[Bug Fix] Cleanup NPC Mana Tap Logic (#4134)

* [Bug Fix] Cleanup NPC Mana Tap Logic

Mana Tap rule logic was invalid - Cleaned up and simplified, either we care about npc mana or we dont.

* Updated for bypass all rule

* Change so melee targets get blocked even with requiremana rule off

---------

Co-authored-by: Trust <fryguy503@gmail.com>
This commit is contained in:
Paul Coene
2024-03-01 22:48:50 -05:00
committed by GitHub
parent 69c42510ca
commit 0c582cc4f9
2 changed files with 6 additions and 11 deletions
+5 -11
View File
@@ -221,18 +221,12 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, CastingSlot slot,
BuffFadeByEffect(SE_NegateIfCombat);
}
// check to see if target is a caster mob before performing a mana tap
if(GetTarget() && IsManaTapSpell(spell_id)) {
if (
GetTarget()->GetCasterClass() == 'N' &&
(
!RuleB(Spells, ManaTapsRequireNPCMana) ||
(
RuleB(Spells, ManaTapsRequireNPCMana) &&
GetTarget()->GetMana() == 0
)
)
) {
// If melee, block if ManaTapsOnAnyClass rule is false
// if caster, block if ManaTapsRequireNPCMana and no mana
bool melee_block = !RuleB(Spells, ManaTapsOnAnyClass);
bool caster_block = (GetTarget()->GetCasterClass() != 'N' && RuleB(Spells, ManaTapsRequireNPCMana) && GetTarget()->GetMana() == 0);
if (melee_block || caster_block) {
InterruptSpell(TARGET_NO_MANA, 0x121, spell_id);
return false;
}