Fixed many bugs with partial resist calculations, targets with higher resist should have a more natural curve when it comes to resisting spells

This commit is contained in:
KimLS 2014-09-08 03:04:22 -07:00
parent a3b54e5cae
commit 579294fbf0

View File

@ -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);
}
}
}