[Rules] Resist Softcap rules (#3863)

* [Rules] Resist Softcap rules

This rule will allow you to adjust the Resist softcap to help tune resists as you need.

* Fix naming

* Cleanup
This commit is contained in:
Fryguy
2024-01-07 04:46:14 -05:00
committed by GitHub
parent 20e9a8b2d2
commit 2c971fb2de
2 changed files with 24 additions and 10 deletions
+20 -8
View File
@@ -5187,8 +5187,22 @@ float Mob::ResistSpell(uint8 resist_type, uint16 spell_id, Mob *caster, bool use
//Add our level, resist and -spell resist modifier to our roll chance
resist_chance += level_mod;
resist_chance += resist_modifier;
resist_chance += target_resist;
if (RuleB(Spells, EnableResistSoftCap)) {
int soft_cap_level_modifier;
if (GetLevel() > 60) {
soft_cap_level_modifier = (GetLevel() - 60) * 10;
}
if ((target_resist + resist_modifier) > (RuleI(Spells, SpellResistSoftCap) + soft_cap_level_modifier)) {
resist_chance += RuleI(Spells, SpellResistSoftCap) + soft_cap_level_modifier;
} else {
resist_chance += target_resist + resist_modifier;
}
} else {
resist_chance += resist_modifier;
resist_chance += target_resist;
}
//Do our min and max resist checks.
if(resist_chance > spells[spell_id].max_resist && spells[spell_id].max_resist != 0)
@@ -5221,13 +5235,11 @@ float Mob::ResistSpell(uint8 resist_type, uint16 spell_id, Mob *caster, bool use
}
//Finally our roll
int roll = zone->random.Int(0, 200);
if(roll > resist_chance)
{
int roll = zone->random.Int(0, RuleB(Spells, EnableResistSoftCap) ? RuleI(Spells, SpellResistSoftCap) : 200);
if(roll > resist_chance) {
return 100;
}
else
{
} else {
//This is confusing but it's basically right
//It skews partial resists up over 100 more often than not
if(!IsPartialResistableSpell(spell_id))