From 9aa0f7c6959840b4ed90f1d2a3bc7dbcf63fa9aa Mon Sep 17 00:00:00 2001 From: nytmyr <53322305+nytmyr@users.noreply.github.com> Date: Sat, 15 Feb 2025 15:03:23 -0600 Subject: [PATCH] [Spells] Add all types to checks for max_targets_allowed rule for AEs (#4682) - Added all TargetedAE types to IsTargetableAESpell - Added IsTargetableAESpell to IsAnyAESpell and changed order for earlier escapes - IsPBAESpell now checks all PBAE types - The rule Spells, TargetedAOEMaxTargets will now check all Targeted AE types - The rule Spells, PointBlankAOEMaxTargets will now check all remaining types that can be a PBAE and not only Nuke PBAEs --- common/spdat.cpp | 37 +++++++++++++++++++++++-------------- zone/effects.cpp | 2 +- 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/common/spdat.cpp b/common/spdat.cpp index 5bfce95e6..e7706dbff 100644 --- a/common/spdat.cpp +++ b/common/spdat.cpp @@ -93,7 +93,14 @@ bool IsTargetableAESpell(uint16 spell_id) return false; } - return spells[spell_id].target_type == ST_AETarget; + return ( + spells[spell_id].target_type == ST_AETarget || + spells[spell_id].target_type == ST_TargetAETap || + spells[spell_id].target_type == ST_AETargetHateList || + spells[spell_id].target_type == ST_TargetAENoPlayersPets || + spells[spell_id].target_type == ST_UndeadAE || + spells[spell_id].target_type == ST_SummonedAE + ); } bool IsSacrificeSpell(uint16 spell_id) @@ -675,17 +682,19 @@ bool IsAnyNukeOrStunSpell(uint16 spell_id) { } bool IsAnyAESpell(uint16 spell_id) { - return ( - IsValidSpell(spell_id) && - ( - IsAEDurationSpell(spell_id) || - IsAESpell(spell_id) || - IsAERainNukeSpell(spell_id) || - IsAERainSpell(spell_id) || - IsPBAESpell(spell_id) || - IsPBAENukeSpell(spell_id) - ) - ); + if (!IsValidSpell(spell_id)) { + return false; + } + + return ( + IsTargetableAESpell(spell_id) || + IsAESpell(spell_id) || + IsPBAESpell(spell_id) || + IsAEDurationSpell(spell_id) || + IsAERainNukeSpell(spell_id) || + IsAERainSpell(spell_id) || + IsPBAENukeSpell(spell_id) + ); } bool IsAESpell(uint16 spell_id) @@ -740,8 +749,8 @@ bool IsPBAESpell(uint16 spell_id) if ( spell.aoe_range > 0 && - spell.target_type == ST_AECaster - ) { + !IsTargetRequiredForSpell(spell_id) + ) { return true; } diff --git a/zone/effects.cpp b/zone/effects.cpp index 2b6472446..7f0b1eb93 100644 --- a/zone/effects.cpp +++ b/zone/effects.cpp @@ -1110,7 +1110,7 @@ void EntityList::AESpell( ) { max_targets_allowed = RuleI(Spells, TargetedAOEMaxTargets); } else if ( - IsPBAENukeSpell(spell_id) && + IsPBAESpell(spell_id) && IsDetrimentalSpell && !is_npc ) {