[Rule] Ensure mana taps only effect NPC's that have mana. (#3907)

* [Rule] Ensure mana taps only effect NPC's that have mana.

* Requested Changes

* fail at the beginning of a cast.

* Fixes
This commit is contained in:
Fryguy
2024-01-08 06:23:54 -05:00
committed by GitHub
parent ce73f6bfe1
commit e5db19965f
2 changed files with 18 additions and 8 deletions
+17 -8
View File
@@ -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))