diff options
| author | megamage <none@none> | 2009-01-30 18:10:05 -0600 |
|---|---|---|
| committer | megamage <none@none> | 2009-01-30 18:10:05 -0600 |
| commit | 8fee06f041fbfbc7e22eccc03a8f12bd7a649999 (patch) | |
| tree | 9512260148dabb87926131a225831e72980a250d /src/game/CreatureAI.h | |
| parent | 03234a0657eca4836b1015556973629893c76958 (diff) | |
*AI structure update.
--HG--
branch : trunk
Diffstat (limited to 'src/game/CreatureAI.h')
| -rw-r--r-- | src/game/CreatureAI.h | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/src/game/CreatureAI.h b/src/game/CreatureAI.h index 72e911cceaf..5a8126f24d4 100644 --- a/src/game/CreatureAI.h +++ b/src/game/CreatureAI.h @@ -29,6 +29,7 @@ class Unit; class Creature; +class Player; struct SpellEntry; #define TIME_INTERVAL_LOOK 5000 @@ -71,34 +72,41 @@ enum SelectAggroTarget class TRINITY_DLL_SPEC UnitAI { + protected: + Unit *me; public: UnitAI(Unit *u) : me(u) {} + virtual void AttackStart(Unit *); virtual void UpdateAI(const uint32 diff) = 0; +}; + +class TRINITY_DLL_SPEC PlayerAI : public UnitAI +{ protected: - Unit *me; + Player *me; + public: + PlayerAI(Player *p) : UnitAI((Unit*)p), me(p) {} }; -class TRINITY_DLL_SPEC SimpleCharmedAI : public UnitAI +class TRINITY_DLL_SPEC SimpleCharmedAI : public PlayerAI { public: - virtual void UpdateAI(const uint32 diff); + void UpdateAI(const uint32 diff); }; class TRINITY_DLL_SPEC CreatureAI : public UnitAI { protected: Creature *me; + + bool UpdateVictim(); public: - CreatureAI() : UnitAI(NULL), me(NULL) {} CreatureAI(Creature *c) : UnitAI((Unit*)c), me(c) {} - virtual ~CreatureAI(); + virtual ~CreatureAI() {} // Called if IsVisible(Unit *who) is true at each *who move - virtual void MoveInLineOfSight(Unit *) = 0; - - // Called at each attack of m_creature by any victim - virtual void AttackStart(Unit *) = 0; + virtual void MoveInLineOfSight(Unit *); // Called at stopping attack by any attacker virtual void EnterEvadeMode(); @@ -106,12 +114,6 @@ class TRINITY_DLL_SPEC CreatureAI : public UnitAI // Called at any Damage from any attacker (before damage apply) virtual void DamageTaken(Unit *done_by, uint32 & /*damage*/) {} - // Is unit visible for MoveInLineOfSight - virtual bool IsVisible(Unit *) const = 0; - - // Called at World update tick - virtual void UpdateAI(const uint32 diff ) = 0; - // Called when the creature is killed virtual void JustDied(Unit *) {} |
