diff options
| author | Treeston <treeston.mmoc@gmail.com> | 2018-08-23 14:33:28 +0200 |
|---|---|---|
| committer | Treeston <treeston.mmoc@gmail.com> | 2018-08-23 16:34:42 +0200 |
| commit | 042f5515e4f3e52b0d2e23d9b9e147041849ce12 (patch) | |
| tree | e9bd421089edfd6098a96300393d086875f9a054 /src/server/scripts/Spells | |
| parent | 0e4a49b0a4c86eb4a2d0d128e24bc8aaabb47e31 (diff) | |
Core/AI: Clean up charm AI handling, we now have two unique_ptr instead of a crapton of booleans
Diffstat (limited to 'src/server/scripts/Spells')
| -rw-r--r-- | src/server/scripts/Spells/spell_dk.cpp | 10 | ||||
| -rw-r--r-- | src/server/scripts/Spells/spell_generic.cpp | 2 | ||||
| -rw-r--r-- | src/server/scripts/Spells/spell_quest.cpp | 4 |
3 files changed, 4 insertions, 12 deletions
diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index 9d79f6d2398..5dbad258d65 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -2914,20 +2914,14 @@ public: if (ghoulGuid.IsEmpty()) return; - oldAI = player->AI(); - oldAIState = player->IsAIEnabled; player->SetAI(new player_ghoulAI(player, ghoulGuid)); - player->IsAIEnabled = true; } void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { Player* player = GetTarget()->ToPlayer(); - player->IsAIEnabled = oldAIState; - PlayerAI* thisAI = player->AI(); - player->SetAI(oldAI); - delete thisAI; + player->SetAI(nullptr); // Dismiss ghoul if necessary if (Creature* ghoul = ObjectAccessor::GetCreature(*player, ghoulGuid)) @@ -2946,8 +2940,6 @@ public: } ObjectGuid ghoulGuid; - PlayerAI* oldAI = nullptr; - bool oldAIState = false; }; AuraScript* GetAuraScript() const override diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 2ff9d51dc8b..543a566df62 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -1647,7 +1647,7 @@ class spell_ethereal_pet_aura : public AuraScript GetUnitOwner()->GetAllMinionsByEntry(minionList, NPC_ETHEREAL_SOUL_TRADER); for (Creature* minion : minionList) { - if (minion->IsAIEnabled) + if (minion->IsAIEnabled()) { minion->AI()->Talk(SAY_STEAL_ESSENCE); minion->CastSpell(eventInfo.GetProcTarget(), SPELL_STEAL_ESSENCE_VISUAL); diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp index 63d084e589b..09c5238bc51 100644 --- a/src/server/scripts/Spells/spell_quest.cpp +++ b/src/server/scripts/Spells/spell_quest.cpp @@ -54,8 +54,8 @@ class spell_generic_quest_update_entry_SpellScript : public SpellScript if (!creatureTarget->IsPet() && creatureTarget->GetEntry() == _originalEntry) { creatureTarget->UpdateEntry(_newEntry); - if (_shouldAttack && creatureTarget->IsAIEnabled) - creatureTarget->AI()->AttackStart(GetCaster()); + if (_shouldAttack) + creatureTarget->EngageWithTarget(GetCaster()); if (_despawnTime) creatureTarget->DespawnOrUnsummon(_despawnTime); |
