mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-30 05:43:12 +01:00
Merge pull request #16644 from Treeston/3.3.5-customcharmai
Core/UnitAI: Rework creature-controlled player behavior.
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
#include "pit_of_saron.h"
|
||||
#include "Vehicle.h"
|
||||
#include "Player.h"
|
||||
#include "PlayerAI.h"
|
||||
|
||||
enum Yells
|
||||
{
|
||||
@@ -438,9 +439,10 @@ class spell_tyrannus_overlord_brand : public SpellScriptLoader
|
||||
if (GetTarget()->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
oldAI = GetTarget()->GetAI();
|
||||
oldAIState = GetTarget()->IsAIEnabled;
|
||||
GetTarget()->SetAI(new player_overlord_brandAI(GetTarget()->ToPlayer(), GetCasterGUID()));
|
||||
Player* pTarget = GetTarget()->ToPlayer();
|
||||
oldAI = pTarget->AI();
|
||||
oldAIState = pTarget->IsAIEnabled;
|
||||
GetTarget()->SetAI(static_cast<UnitAI*>(new player_overlord_brandAI(pTarget, GetCasterGUID())));
|
||||
GetTarget()->IsAIEnabled = true;
|
||||
}
|
||||
|
||||
@@ -450,8 +452,8 @@ class spell_tyrannus_overlord_brand : public SpellScriptLoader
|
||||
return;
|
||||
|
||||
GetTarget()->IsAIEnabled = oldAIState;
|
||||
UnitAI* thisAI = GetTarget()->GetAI();
|
||||
GetTarget()->SetAI(oldAI);
|
||||
PlayerAI* thisAI = GetTarget()->ToPlayer()->AI();
|
||||
GetTarget()->SetAI(static_cast<UnitAI*>(oldAI));
|
||||
delete thisAI;
|
||||
}
|
||||
|
||||
@@ -461,7 +463,7 @@ class spell_tyrannus_overlord_brand : public SpellScriptLoader
|
||||
AfterEffectRemove += AuraEffectRemoveFn(spell_tyrannus_overlord_brand_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
|
||||
}
|
||||
|
||||
UnitAI* oldAI;
|
||||
PlayerAI* oldAI;
|
||||
bool oldAIState;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user