From 579294fbf0ef375e5eb84d746bd01228aff34459 Mon Sep 17 00:00:00 2001 From: KimLS Date: Mon, 8 Sep 2014 03:04:22 -0700 Subject: [PATCH] Fixed many bugs with partial resist calculations, targets with higher resist should have a more natural curve when it comes to resisting spells --- zone/spells.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/zone/spells.cpp b/zone/spells.cpp index 357fafbd4..b54b0b66c 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -4501,13 +4501,12 @@ float Mob::ResistSpell(uint8 resist_type, uint16 spell_id, Mob *caster, bool use } else { - resist_chance -= roll; if(resist_chance < 1) { resist_chance = 1; } - int partial_modifier = ((150 * (roll - resist_chance)) / resist_chance); + int partial_modifier = ((150 * (resist_chance - roll)) / resist_chance); if(IsNPC()) { @@ -4535,17 +4534,16 @@ float Mob::ResistSpell(uint8 resist_type, uint16 spell_id, Mob *caster, bool use } } - if(partial_modifier < 0) + if(partial_modifier <= 0) + { + return 100; + } + else if(partial_modifier >= 100) { return 0; } - if(partial_modifier > 100) - { - return 100; - } - - return partial_modifier; + return (100.0f - partial_modifier); } } }