fix(Scripts/Spells): Mind Control should put both caster and target in combat. (#9301)

Fixes #8938
This commit is contained in:
UltraNix
2021-11-29 16:09:39 +01:00
committed by GitHub
parent 15e4f9697a
commit 0b551a055c
3 changed files with 34 additions and 1 deletions

View File

@@ -0,0 +1,5 @@
INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1637699382534407800');
DELETE FROM `spell_script_names` WHERE `spell_id`=605;
INSERT INTO `spell_script_names` VALUES
(605,'spell_pri_mind_control');

View File

@@ -12988,7 +12988,7 @@ void Unit::SetInCombatState(bool PvP, Unit* enemy, uint32 duration)
if (controlled->GetTypeId() == TYPEID_UNIT && controlled->ToCreature()->HasReactState(REACT_PASSIVE))
continue;
controlled->SetInCombatState(PvP, enemy);
controlled->SetInCombatState(PvP, enemy, duration);
}
#ifdef ELUNA
if (Player* player = this->ToPlayer())

View File

@@ -807,6 +807,33 @@ class spell_pri_vampiric_touch : public AuraScript
}
};
// 605 - Mind Control
class spell_pri_mind_control : public SpellScript
{
PrepareSpellScript(spell_pri_mind_control);
void OnHit()
{
if (Aura const* aura = GetHitAura())
{
if (Unit* caster = GetCaster())
{
if (Unit* target = GetHitUnit())
{
uint32 duration = static_cast<uint32>(aura->GetMaxDuration());
caster->SetInCombatWith(target, duration);
target->SetInCombatWith(caster, duration);
}
}
}
}
void Register() override
{
AfterHit += SpellHitFn(spell_pri_mind_control::OnHit);
}
};
void AddSC_priest_spell_scripts()
{
RegisterSpellScript(spell_pri_shadowfiend_scaling);
@@ -828,4 +855,5 @@ void AddSC_priest_spell_scripts()
RegisterSpellScript(spell_pri_renew);
RegisterSpellScript(spell_pri_shadow_word_death);
RegisterSpellScript(spell_pri_vampiric_touch);
RegisterSpellScript(spell_pri_mind_control);
}