diff options
author | megamage <none@none> | 2009-08-28 11:26:20 -0500 |
---|---|---|
committer | megamage <none@none> | 2009-08-28 11:26:20 -0500 |
commit | ab5f515f21d1f9e735e8b2c91a64f2dd02512ed5 (patch) | |
tree | bc50ecf26bc74e872d11d21e6e17c86618462e64 /src/game/CreatureAIImpl.h | |
parent | 9d28323a55aaca70135c598baaaa340a16cf4540 (diff) |
*Update flame levi script. Allow player to shoot down pyrite container and refill the demolishers.
*Other script-related fixes.
--HG--
branch : trunk
Diffstat (limited to 'src/game/CreatureAIImpl.h')
-rw-r--r-- | src/game/CreatureAIImpl.h | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/src/game/CreatureAIImpl.h b/src/game/CreatureAIImpl.h index bcedd108d44..ef3ea285b1f 100644 --- a/src/game/CreatureAIImpl.h +++ b/src/game/CreatureAIImpl.h @@ -20,6 +20,8 @@ #include "Common.h" #include "Platform/Define.h" +#include "Creature.h" +#include "CreatureAI.h" #define HEROIC(n,h) (HeroicMode ? h : n) @@ -257,5 +259,76 @@ struct AISpellInfoType TRINITY_DLL_SPEC AISpellInfoType * GetAISpellInfo(uint32 i); + +inline void CreatureAI::SetGazeOn(Unit *target) +{ + if(me->canAttack(target)) + { + AttackStart(target); + me->SetReactState(REACT_PASSIVE); + } +} + +inline bool CreatureAI::UpdateVictimWithGaze() +{ + if(!me->isInCombat()) + return false; + + if(me->HasReactState(REACT_PASSIVE)) + { + if(me->getVictim()) + return true; + else + me->SetReactState(REACT_AGGRESSIVE); + } + + if(Unit *victim = me->SelectVictim()) + AttackStart(victim); + return me->getVictim(); +} + +inline bool CreatureAI::UpdateVictim() +{ + if(!me->isInCombat()) + return false; + if(Unit *victim = me->SelectVictim()) + AttackStart(victim); + return me->getVictim(); +} + +inline bool CreatureAI::_EnterEvadeMode() +{ + if(me->IsInEvadeMode() || !me->isAlive()) + return false; + + me->RemoveAllAuras(); + me->DeleteThreatList(); + me->CombatStop(true); + me->LoadCreaturesAddon(); + me->SetLootRecipient(NULL); + me->ResetPlayerDamageReq(); + + return true; +} + +inline Creature *CreatureAI::DoSummon(uint32 uiEntry, const Position fPos, uint32 uiDespawntime, TempSummonType uiType) +{ + return me->SummonCreature(uiEntry, fPos[0], fPos[1], fPos[2], fPos[3], uiType, uiDespawntime); +} + +inline Creature *CreatureAI::DoSummon(uint32 uiEntry, WorldObject* pGo, float fRadius, uint32 uiDespawntime, TempSummonType uiType) +{ + float fX, fY, fZ; + pGo->GetGroundPointAroundUnit(fX, fY, fZ, fRadius * rand_norm(), rand_norm()*2*M_PI); + return me->SummonCreature(uiEntry, fX, fY, fZ, me->GetOrientation(), uiType, uiDespawntime); +} + +inline Creature *CreatureAI::DoSummonFlyer(uint32 uiEntry, WorldObject *obj, float _fZ, float fRadius, uint32 uiDespawntime, TempSummonType uiType) +{ + float fX, fY, fZ; + obj->GetGroundPointAroundUnit(fX, fY, fZ, fRadius * rand_norm(), rand_norm()*2*M_PI); + return me->SummonCreature(uiEntry, fX, fY, fZ + _fZ, me->GetOrientation(), uiType, uiDespawntime); +} + #endif |