[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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 10 deletions

View File

@ -432,8 +432,10 @@ RULE_BOOL(Spells, AlwaysSendTargetsBuffs, false, "Ignore Leadership Alternate Ab
RULE_BOOL(Spells, FlatItemExtraSpellAmt, false, "Allow SpellDmg stat to affect all spells, regardless of cast time/cooldown/etc") RULE_BOOL(Spells, FlatItemExtraSpellAmt, false, "Allow SpellDmg stat to affect all spells, regardless of cast time/cooldown/etc")
RULE_BOOL(Spells, IgnoreSpellDmgLvlRestriction, false, "Ignore the 5 level spread on applying SpellDmg") RULE_BOOL(Spells, IgnoreSpellDmgLvlRestriction, false, "Ignore the 5 level spread on applying SpellDmg")
RULE_BOOL(Spells, ItemExtraSpellAmtCalcAsPercent, false, "Apply the Item stats Spell Dmg and Heal Amount as Percentage-based modifiers instead of flat additions") RULE_BOOL(Spells, ItemExtraSpellAmtCalcAsPercent, false, "Apply the Item stats Spell Dmg and Heal Amount as Percentage-based modifiers instead of flat additions")
RULE_REAL(Spells, BreakFeignDeathWhenCastOn, 2.0, "Percentage that fd will break when you resist a spell") RULE_REAL(Spells, BreakFeignDeathWhenCastOn, 2.0, "Percentage that Feign Death will break when you resist a spell")
RULE_REAL(Spells, BreakSneakWhenCastOn, 2.0, "Percentage that sneak will break when you resist a spell") RULE_REAL(Spells, BreakSneakWhenCastOn, 2.0, "Percentage that Sneak will break when you resist a spell")
RULE_BOOL(Spells, EnableResistSoftCap, false, "Enabled resist softcap and can be adjusted by rule, SpellResistSoftCap")
RULE_INT(Spells, SpellResistSoftCap, 255, "Softcap for spell resists.")
RULE_BOOL(Spells, AllowItemTGB, false, "Target group buff (/tgb) doesn't work with items on live, custom servers want it though") RULE_BOOL(Spells, AllowItemTGB, false, "Target group buff (/tgb) doesn't work with items on live, custom servers want it though")
RULE_BOOL(Spells, NPCInnateProcOverride, true, "NPC innate procs override the target type to single target") RULE_BOOL(Spells, NPCInnateProcOverride, true, "NPC innate procs override the target type to single target")
RULE_BOOL(Spells, OldRainTargets, false, "Use old incorrectly implemented maximum targets for rains") RULE_BOOL(Spells, OldRainTargets, false, "Use old incorrectly implemented maximum targets for rains")

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 //Add our level, resist and -spell resist modifier to our roll chance
resist_chance += level_mod; resist_chance += level_mod;
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 += resist_modifier;
resist_chance += target_resist; resist_chance += target_resist;
}
//Do our min and max resist checks. //Do our min and max resist checks.
if(resist_chance > spells[spell_id].max_resist && spells[spell_id].max_resist != 0) 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 //Finally our roll
int roll = zone->random.Int(0, 200); int roll = zone->random.Int(0, RuleB(Spells, EnableResistSoftCap) ? RuleI(Spells, SpellResistSoftCap) : 200);
if(roll > resist_chance)
{ if(roll > resist_chance) {
return 100; return 100;
} } else {
else
{
//This is confusing but it's basically right //This is confusing but it's basically right
//It skews partial resists up over 100 more often than not //It skews partial resists up over 100 more often than not
if(!IsPartialResistableSpell(spell_id)) if(!IsPartialResistableSpell(spell_id))