From ac214f71d4043a99296141089bba4ad1c922929a Mon Sep 17 00:00:00 2001 From: catapultam-habeo <97849758+catapultam-habeo@users.noreply.github.com> Date: Sun, 6 Mar 2022 16:40:21 -0800 Subject: [PATCH] [Bots] Apply Spells:IgnoreSpellDmgLvlRestriction to bots (#2024) * Correct bot spell damage and healing pathways to account for rule Spell:IgnoreSpellDmgLvlRestriction * Corrected to be more consistent in regard to the 'spells[spell_id].no_heal_damage_item_mod' modifier. This modifier doesn't seem to actually exist on any content, and bots didn't use it to begin with. This restriction is present on players - do we want it on bots also? --- zone/bot.cpp | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/zone/bot.cpp b/zone/bot.cpp index e0e5d99ab..c07ecb8b2 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -6734,8 +6734,8 @@ int32 Bot::GetActSpellDamage(uint16 spell_id, int32 value, Mob* target) { value -= GetBotFocusEffect(focusFcDamageAmt, spell_id); value -= GetBotFocusEffect(focusFcDamageAmt2, spell_id); - - if(itembonuses.SpellDmg && spells[spell_id].classes[(GetClass() % 17) - 1] >= GetLevel() - 5) + + if ((RuleB(Spells, IgnoreSpellDmgLvlRestriction) || spells[spell_id].classes[(GetClass() % 17) - 1] >= GetLevel() - 5) && itembonuses.SpellDmg) value += (GetExtraSpellAmt(spell_id, itembonuses.SpellDmg, value) * ratio / 100); entity_list.MessageClose(this, false, 100, Chat::SpellCrit, "%s delivers a critical blast! (%d)", GetName(), -value); @@ -6756,7 +6756,8 @@ int32 Bot::GetActSpellDamage(uint16 spell_id, int32 value, Mob* target) { value -= GetBotFocusEffect(focusFcDamageAmtCrit, spell_id); value -= GetBotFocusEffect(focusFcDamageAmt, spell_id); value -= GetBotFocusEffect(focusFcDamageAmt2, spell_id); - if(itembonuses.SpellDmg && spells[spell_id].classes[(GetClass() % 17) - 1] >= GetLevel() - 5) + + if ((RuleB(Spells, IgnoreSpellDmgLvlRestriction) || spells[spell_id].classes[(GetClass() % 17) - 1] >= GetLevel() - 5) && itembonuses.SpellDmg) value += GetExtraSpellAmt(spell_id, itembonuses.SpellDmg, value); return value; @@ -6788,16 +6789,31 @@ int32 Bot::GetActSpellHealing(uint16 spell_id, int32 value, Mob* target) { value += (GetBotFocusEffect(focusFcHealAmtCrit, spell_id) * modifier); value += GetBotFocusEffect(focusFcHealAmt, spell_id); value += target->GetFocusIncoming(focusFcHealAmtIncoming, SE_FcHealAmtIncoming, this, spell_id); - - if(itembonuses.HealAmt && spells[spell_id].classes[(GetClass() % 17) - 1] >= GetLevel() - 5) + + //Using IgnoreSpellDmgLvlRestriction + if ((RuleB(Spells, IgnoreSpellDmgLvlRestriction) || spells[spell_id].classes[(GetClass() % 17) - 1] >= GetLevel() - 5) && itembonuses.HealAmt) value += (GetExtraSpellAmt(spell_id, itembonuses.HealAmt, value) * modifier); - value += (value * target->GetHealRate() / 100); if (Critical) entity_list.MessageClose(this, false, 100, Chat::SpellCrit, "%s performs an exceptional heal! (%d)", GetName(), value); return value; - } else { + } else { + int32 extra_heal = 0; + //Using IgnoreSpellDmgLvlRestriction to also allow healing to scale + if (RuleB(Spells, HOTsScaleWithHealAmt)) { + if ((RuleB(Spells, IgnoreSpellDmgLvlRestriction) || spells[spell_id].classes[(GetClass() % 17) - 1] >= GetLevel() - 5) && itembonuses.HealAmt) + extra_heal += GetExtraSpellAmt(spell_id, itembonuses.HealAmt, value); + } + + if (extra_heal) { + int duration = CalcBuffDuration(this, target, spell_id); + if (duration > 0) { + extra_heal /= duration; + value += extra_heal; + } + } + chance = (itembonuses.CriticalHealOverTime + spellbonuses.CriticalHealOverTime + aabonuses.CriticalHealOverTime); chance += target->GetFocusIncoming(focusFcHealPctCritIncoming, SE_FcHealPctCritIncoming, this, spell_id); if (spellbonuses.CriticalRegenDecay)