mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-22 05:06:24 +00:00
fix(Core/Spells): Drop combat on Mind Control cancel. (#10201)
Fixes #9980
This commit is contained in:
@@ -1613,6 +1613,7 @@ public:
|
||||
void ClearInCombat();
|
||||
void ClearInPetCombat();
|
||||
[[nodiscard]] uint32 GetCombatTimer() const { return m_CombatTimer; }
|
||||
void SetCombatTimer(uint32 timer) { m_CombatTimer = timer; }
|
||||
|
||||
[[nodiscard]] bool HasAuraTypeWithFamilyFlags(AuraType auraType, uint32 familyName, uint32 familyFlags) const;
|
||||
[[nodiscard]] bool virtual HasSpell(uint32 /*spellID*/) const { return false; }
|
||||
|
||||
@@ -808,29 +808,39 @@ class spell_pri_vampiric_touch : public AuraScript
|
||||
};
|
||||
|
||||
// 605 - Mind Control
|
||||
class spell_pri_mind_control : public SpellScript
|
||||
class spell_pri_mind_control : public AuraScript
|
||||
{
|
||||
PrepareSpellScript(spell_pri_mind_control);
|
||||
PrepareAuraScript(spell_pri_mind_control);
|
||||
|
||||
void OnHit()
|
||||
void HandleApplyEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (Aura const* aura = GetHitAura())
|
||||
if (Unit* caster = GetCaster())
|
||||
{
|
||||
if (Unit* caster = GetCaster())
|
||||
if (Unit* target = GetTarget())
|
||||
{
|
||||
if (Unit* target = GetHitUnit())
|
||||
{
|
||||
uint32 duration = static_cast<uint32>(aura->GetMaxDuration());
|
||||
caster->SetInCombatWith(target, duration);
|
||||
target->SetInCombatWith(caster, duration);
|
||||
}
|
||||
uint32 duration = static_cast<uint32>(GetDuration());
|
||||
caster->SetInCombatWith(target, duration);
|
||||
target->SetInCombatWith(caster, duration);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void HandleRemoveEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (Unit* caster = GetCaster())
|
||||
{
|
||||
if (Unit* target = GetTarget())
|
||||
{
|
||||
caster->SetCombatTimer(0);
|
||||
target->SetCombatTimer(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
AfterHit += SpellHitFn(spell_pri_mind_control::OnHit);
|
||||
AfterEffectApply += AuraEffectApplyFn(spell_pri_mind_control::HandleApplyEffect, EFFECT_0, SPELL_AURA_MOD_POSSESS, AURA_EFFECT_HANDLE_REAL);
|
||||
AfterEffectRemove += AuraEffectRemoveFn(spell_pri_mind_control::HandleRemoveEffect, EFFECT_0, SPELL_AURA_MOD_POSSESS, AURA_EFFECT_HANDLE_REAL);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user