aboutsummaryrefslogtreecommitdiff
path: root/src/bindings/scripts
diff options
context:
space:
mode:
authormegamage <none@none>2008-11-24 17:15:41 -0600
committermegamage <none@none>2008-11-24 17:15:41 -0600
commitf7e5b2ba69605b23ef918e53922839888983cacf (patch)
treecce8bfc7d12750f919f83509af16b16867be0626 /src/bindings/scripts
parent7312c5034e9e98dcf935c21ced806278514fe862 (diff)
*Implement simple charmed AI for players charmed by creatures.
--HG-- branch : trunk
Diffstat (limited to 'src/bindings/scripts')
-rw-r--r--src/bindings/scripts/include/sc_creature.cpp17
-rw-r--r--src/bindings/scripts/scripts/creature/mob_event_ai.cpp19
2 files changed, 13 insertions, 23 deletions
diff --git a/src/bindings/scripts/include/sc_creature.cpp b/src/bindings/scripts/include/sc_creature.cpp
index b3fd3723466..a74b59c872c 100644
--- a/src/bindings/scripts/include/sc_creature.cpp
+++ b/src/bindings/scripts/include/sc_creature.cpp
@@ -141,17 +141,24 @@ void ScriptedAI::UpdateAI(const uint32 diff)
void ScriptedAI::EnterEvadeMode()
{
- m_creature->InterruptNonMeleeSpells(true);
+ //m_creature->InterruptNonMeleeSpells(true);
m_creature->RemoveAllAuras();
m_creature->DeleteThreatList();
m_creature->CombatStop();
m_creature->LoadCreaturesAddon();
-
- if (m_creature->isAlive())
- m_creature->GetMotionMaster()->MoveTargetedHome();
-
m_creature->SetLootRecipient(NULL);
+ if(m_creature->isAlive())
+ {
+ if(Unit* owner = m_creature->GetOwner())
+ {
+ if(owner->isAlive())
+ m_creature->GetMotionMaster()->MoveFollow(owner,PET_FOLLOW_DIST,PET_FOLLOW_ANGLE);
+ }
+ else
+ m_creature->GetMotionMaster()->MoveTargetedHome();
+ }
+
InCombat = false;
Reset();
}
diff --git a/src/bindings/scripts/scripts/creature/mob_event_ai.cpp b/src/bindings/scripts/scripts/creature/mob_event_ai.cpp
index 657a1f41b5b..7d8b11d21af 100644
--- a/src/bindings/scripts/scripts/creature/mob_event_ai.cpp
+++ b/src/bindings/scripts/scripts/creature/mob_event_ai.cpp
@@ -1033,26 +1033,9 @@ struct TRINITY_DLL_DECL Mob_EventAI : public ScriptedAI
void EnterEvadeMode()
{
- m_creature->RemoveAllAuras();
- m_creature->DeleteThreatList();
- m_creature->CombatStop();
- m_creature->LoadCreaturesAddon();
- if( m_creature->isAlive() )
- {
- if (Unit* owner = m_creature->GetOwner())
- {
- if (owner->isAlive())
- m_creature->GetMotionMaster()->MoveFollow(owner,PET_FOLLOW_DIST,PET_FOLLOW_ANGLE);
- }
- else
- m_creature->GetMotionMaster()->MoveTargetedHome();
- }
+ ScriptedAI::EnterEvadeMode();
- m_creature->SetLootRecipient(NULL);
-
- InCombat = false;
IsFleeing = false;
- Reset();
//Handle Evade events
for (std::list<EventHolder>::iterator i = EventList.begin(); i != EventList.end(); ++i)