From 2f14664340ba486a226a0c48d285e7141a16b62f Mon Sep 17 00:00:00 2001 From: treeston Date: Fri, 19 Feb 2016 19:14:56 +0100 Subject: Core/UnitAI: Rework creature-controlled player behavior. - Removed hacked control mechanism, use proper PlayerAI instead - Port old hacky code to new SimpleCharmedPlayerAI class - Make adjustments to aforementioned code to fix bugs: - Properly clean up movement after charm ends - Only try to attack a target if charmer is engaged in combat --- src/server/scripts/Spells/spell_dk.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/server/scripts/Spells') diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index 3cea620559a..f1ad785c13d 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -22,7 +22,7 @@ */ #include "Player.h" -#include "UnitAI.h" +#include "PlayerAI.h" #include "ScriptMgr.h" #include "SpellScript.h" #include "SpellAuraEffects.h" @@ -1909,9 +1909,9 @@ public: if (!player || player->GetGhoulResurrectGhoulGUID().IsEmpty()) return; - oldAI = player->GetAI(); + oldAI = player->AI(); oldAIState = player->IsAIEnabled; - player->SetAI(new player_ghoulAI(player, player->GetGhoulResurrectGhoulGUID())); + player->SetAI(static_cast(new player_ghoulAI(player, player->GetGhoulResurrectGhoulGUID()))); player->IsAIEnabled = true; } @@ -1922,8 +1922,8 @@ public: return; player->IsAIEnabled = oldAIState; - UnitAI* thisAI = player->GetAI(); - player->SetAI(oldAI); + PlayerAI* thisAI = player->AI(); + player->SetAI(static_cast(oldAI)); delete thisAI; // Dismiss ghoul if necessary @@ -1943,7 +1943,7 @@ public: AfterEffectRemove += AuraEffectRemoveFn(spell_dk_raise_ally_AuraScript::OnRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); } - UnitAI* oldAI; + PlayerAI* oldAI; bool oldAIState; }; -- cgit v1.2.3