mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 17:05:44 +01:00
Merge pull request #16644 from Treeston/3.3.5-customcharmai
Core/UnitAI: Rework creature-controlled player behavior.
This commit is contained in:
@@ -73,6 +73,7 @@ include_directories(
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Addons
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/AI
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/AI/CoreAI
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/AI/PlayerAI
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/AI/ScriptedAI
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/AI/SmartScripts
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/AuctionHouse
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
@@ -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<UnitAI*>(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<UnitAI*>(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;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user