diff --git a/common/ruletypes.h b/common/ruletypes.h index 77d9d4dfb..09c3798f4 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -477,6 +477,7 @@ RULE_BOOL(Spells, EvacClearAggroInSameZone, false, "Enable to clear aggro on cli RULE_BOOL(Spells, CharmAggroOverLevel, false, "Enabling this rule will cause Charm casts over level to show resisted and cause aggro. Early EQ style.") RULE_BOOL(Spells, RequireMnemonicRetention, true, "Enabling will require spell slots 9-12 to have the appropriate Mnemonic Retention AA learned.") RULE_BOOL(Spells, EvacClearCharmPet, false, "Enable to have evac in zone clear charm from charm pets and detach buffs.") +RULE_BOOL(Spells, ManaTapsRequireNPCMana, false, "Enabling will require target to have mana to tap. Default off as many npc's are caster class with 0 mana and need fixed.") RULE_CATEGORY_END() RULE_CATEGORY(Combat) diff --git a/zone/spells.cpp b/zone/spells.cpp index 1a6d4d875..9e5630c01 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -220,6 +220,23 @@ 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 + ) + ) + ) { + InterruptSpell(TARGET_NO_MANA, 0x121, spell_id); + return false; + } + } + //Casting a spell from an item click will also stop bard pulse. if (HasActiveSong() && (IsBardSong(spell_id) || slot == CastingSlot::Item)) { LogSpells("Casting a new song while singing a song. Killing old song [{}]", bardsong); @@ -2481,14 +2498,6 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, CastingSlot slot, in return false; } - // check to see if target is a caster mob before performing a mana tap - if(spell_target && IsManaTapSpell(spell_id)) { - if(spell_target->GetCasterClass() == 'N') { - MessageString(Chat::Red, TARGET_NO_MANA); - return false; - } - } - //range check our target, if we have one and it is not us float range = spells[spell_id].range + GetRangeDistTargetSizeMod(spell_target); if(IsClient() && CastToClient()->TGB() && IsTGBCompatibleSpell(spell_id) && IsGroupSpell(spell_id))