TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boss_twinemperorsAI Struct Referenceabstract

Public Member Functions

 boss_twinemperorsAI (Creature *creature)
 
void Initialize ()
 
virtual bool IAmVeklor ()=0
 
virtual void Reset () override=0
 
virtual void CastSpellOnBug (Creature *target)=0
 
void TwinReset ()
 
CreatureGetOtherBoss ()
 
void DamageTaken (Unit *, uint32 &damage) override
 
void JustDied (Unit *) override
 
void KilledUnit (Unit *) override
 
void EnterCombat (Unit *who) override
 
void SpellHit (Unit *caster, const SpellInfo *entry) override
 
void TryHealBrother (uint32 diff)
 
void TeleportToMyBrother ()
 
void SetAfterTeleport ()
 
bool TryActivateAfterTTelep (uint32 diff)
 
void MoveInLineOfSight (Unit *who) override
 
CreatureRespawnNearbyBugsAndGetOne ()
 
void HandleBugs (uint32 diff)
 
void CheckEnrage (uint32 diff)
 
- Public Member Functions inherited from ScriptedAI
 ScriptedAI (Creature *creature)
 
virtual ~ScriptedAI ()
 
void AttackStartNoMove (Unit *target)
 
virtual void UpdateAI (uint32 diff) override
 
void JustSummoned (Creature *) override
 
void SummonedCreatureDespawn (Creature *) override
 
void SpellHitTarget (Unit *, SpellInfo const *) override
 
void OnPossess (bool)
 
void AttackStart (Unit *) override
 
void DoStartMovement (Unit *target, float distance=0.0f, float angle=0.0f)
 
void DoStartNoMovement (Unit *target)
 
void DoStopAttack ()
 
void DoCastSpell (Unit *target, SpellInfo const *spellInfo, bool triggered=false)
 
void DoPlaySoundToSet (WorldObject *source, uint32 soundId)
 
void DoResetThreat ()
 
float DoGetThreat (Unit *unit)
 
void DoModifyThreatPercent (Unit *unit, int32 pct)
 
void DoTeleportTo (float x, float y, float z, uint32 time=0)
 
void DoTeleportTo (float const pos[4])
 
void DoTeleportPlayer (Unit *unit, float x, float y, float z, float o)
 
void DoTeleportAll (float x, float y, float z, float o)
 
UnitDoSelectLowestHpFriendly (float range, uint32 minHPDiff=1)
 
std::list< Creature * > DoFindFriendlyCC (float range)
 
std::list< Creature * > DoFindFriendlyMissingBuff (float range, uint32 spellId)
 
PlayerGetPlayerAtMinimumRange (float minRange)
 
CreatureDoSpawnCreature (uint32 entry, float offsetX, float offsetY, float offsetZ, float angle, uint32 type, uint32 despawntime)
 
bool HealthBelowPct (uint32 pct) const
 
bool HealthAbovePct (uint32 pct) const
 
SpellInfo constSelectSpell (Unit *target, uint32 school, uint32 mechanic, SelectTargetType targets, float rangeMin, float rangeMax, SelectEffect effect)
 
void SetEquipmentSlots (bool loadDefault, int32 mainHand=EQUIP_NO_CHANGE, int32 offHand=EQUIP_NO_CHANGE, int32 ranged=EQUIP_NO_CHANGE)
 
void SetCombatMovement (bool allowMovement)
 
bool IsCombatMovementAllowed () const
 
bool IsHeroic () const
 
Difficulty GetDifficulty () const
 
bool Is25ManRaid () const
 
template<class T >
const T & DUNGEON_MODE (const T &normal5, const T &heroic10) const
 
template<class T >
const T & RAID_MODE (const T &normal10, const T &normal25) const
 
template<class T >
const T & RAID_MODE (const T &normal10, const T &normal25, const T &heroic10, const T &heroic25) const
 
- Public Member Functions inherited from CreatureAI
void Talk (uint8 id, WorldObject const *whisperTarget=nullptr)
 
 CreatureAI (Creature *creature)
 
virtual ~CreatureAI ()
 
void MoveInLineOfSight_Safe (Unit *who)
 == Reactions At ================================= More...
 
void TriggerAlert (Unit const *who) const
 
virtual bool CanRespawn ()
 
virtual void EnterEvadeMode (EvadeReason why=EVADE_REASON_OTHER)
 
virtual void IsSummonedBy (Unit *)
 
virtual void SummonedCreatureDies (Creature *, Unit *)
 
virtual void AttackedBy (Unit *)
 
virtual bool IsEscorted () const
 
virtual void JustRespawned ()
 
virtual void MovementInform (uint32, uint32)
 
void OnCharmed (bool apply) override
 
virtual void JustReachedHome ()
 
void DoZoneInCombat (Creature *creature=NULL, float maxRangeToNearestTarget=50.0f)
 
virtual void ReceiveEmote (Player *, uint32)
 
virtual void OwnerAttackedBy (Unit *)
 
virtual void OwnerAttacked (Unit *)
 
virtual void CorpseRemoved (uint32 &)
 == Triggered Actions Requested ================== More...
 
virtual void PassengerBoarded (Unit *, int8, bool)
 == Fields ======================================= More...
 
virtual void OnSpellClick (Unit *, bool &)
 
virtual bool CanSeeAlways (WorldObject const *)
 
int32 VisualizeBoundary (uint32 duration, Unit *owner=nullptr, bool fill=false) const
 
virtual bool CheckInRoom ()
 
CreatureBoundary constGetBoundary () const
 
- Public Member Functions inherited from UnitAI
 UnitAI (Unit *unit)
 
virtual ~UnitAI ()
 
virtual bool CanAIAttack (Unit const *) const
 
virtual void InitializeAI ()
 
virtual void DoAction (int32)
 
virtual uint32 GetData (uint32) const
 
virtual void SetData (uint32, uint32)
 
virtual void SetGUID (ObjectGuid, int32=0)
 
virtual ObjectGuid GetGUID (int32=0) const
 
UnitSelectTarget (SelectAggroTarget targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, int32 aura=0)
 
template<class PREDICATE >
UnitSelectTarget (SelectAggroTarget targetType, uint32 position, PREDICATE const &predicate)
 
void SelectTargetList (std::list< Unit * > &targetList, uint32 num, SelectAggroTarget targetType, float dist=0.0f, bool playerOnly=false, int32 aura=0)
 
template<class PREDICATE >
void SelectTargetList (std::list< Unit * > &targetList, PREDICATE const &predicate, uint32 maxTargets, SelectAggroTarget targetType)
 
virtual void DamageDealt (Unit *, uint32 &, DamageEffectType)
 
virtual void HealReceived (Unit *, uint32 &)
 
virtual void HealDone (Unit *, uint32 &)
 
virtual void SpellInterrupted (uint32, uint32)
 
void AttackStartCaster (Unit *victim, float dist)
 
void DoCast (uint32 spellId)
 
void DoCast (Unit *victim, uint32 spellId, bool triggered=false)
 
void DoCastVictim (uint32 spellId, bool triggered=false)
 
void DoCastAOE (uint32 spellId, bool triggered=false)
 
void DoMeleeAttackIfReady ()
 
bool DoSpellAttackIfReady (uint32 spellId)
 
virtual void sGossipHello (Player *)
 
virtual void sGossipSelect (Player *, uint32, uint32)
 
virtual void sGossipSelectCode (Player *, uint32, uint32, char const *)
 
virtual void sQuestAccept (Player *, Quest const *)
 
virtual void sQuestSelect (Player *, Quest const *)
 
virtual void sQuestReward (Player *, Quest const *, uint32)
 
virtual bool sOnDummyEffect (Unit *, uint32, SpellEffIndex)
 
virtual void sOnGameEvent (bool, uint16)
 

Public Attributes

InstanceScriptinstance
 
uint32 Heal_Timer
 
uint32 Teleport_Timer
 
bool AfterTeleport
 
uint32 AfterTeleportTimer
 
bool DontYellWhenDead
 
uint32 Abuse_Bug_Timer
 
uint32 BugsTimer
 
bool tspellcast
 
uint32 EnrageTimer
 
- Public Attributes inherited from ScriptedAI
bool IsFleeing
 

Additional Inherited Members

- Public Types inherited from CreatureAI
enum  EvadeReason { EVADE_REASON_NO_HOSTILES, EVADE_REASON_BOUNDARY, EVADE_REASON_SEQUENCE_BREAK, EVADE_REASON_OTHER }
 
- Static Public Member Functions inherited from UnitAI
static void FillAISpellInfo ()
 
- Static Public Attributes inherited from UnitAI
static AISpellInfoTypeAISpellInfo
 
- Protected Member Functions inherited from CreatureAI
bool UpdateVictim ()
 
bool UpdateVictimWithGaze ()
 
void SetGazeOn (Unit *target)
 
CreatureDoSummon (uint32 entry, Position const &pos, uint32 despawnTime=30000, TempSummonType summonType=TEMPSUMMON_CORPSE_TIMED_DESPAWN)
 
CreatureDoSummon (uint32 entry, WorldObject *obj, float radius=5.0f, uint32 despawnTime=30000, TempSummonType summonType=TEMPSUMMON_CORPSE_TIMED_DESPAWN)
 
CreatureDoSummonFlyer (uint32 entry, WorldObject *obj, float flightZ, float radius=5.0f, uint32 despawnTime=30000, TempSummonType summonType=TEMPSUMMON_CORPSE_TIMED_DESPAWN)
 
bool CheckBoundary (Position const *who=nullptr) const
 
void SetBoundary (CreatureBoundary const *boundary)
 
bool _EnterEvadeMode (EvadeReason why=EVADE_REASON_OTHER)
 
- Protected Attributes inherited from CreatureAI
Creature *const me
 
CreatureBoundary const_boundary
 
- Protected Attributes inherited from UnitAI
Unit *const me
 

Constructor & Destructor Documentation

boss_twinemperorsAI::boss_twinemperorsAI ( Creature creature)
inline
70  : ScriptedAI(creature)
71  {
72  Initialize();
73  instance = creature->GetInstanceScript();
74  }
ScriptedAI(Creature *creature)
Definition: ScriptedCreature.cpp:100
void Initialize()
Definition: boss_twinemperors.cpp:76
InstanceScript * GetInstanceScript()
Definition: Object.cpp:1540
InstanceScript * instance
Definition: boss_twinemperors.cpp:90

+ Here is the call graph for this function:

Member Function Documentation

virtual void boss_twinemperorsAI::CastSpellOnBug ( Creature target)
pure virtual

Implemented in boss_veklor::boss_veklorAI, and boss_veknilash::boss_veknilashAI.

+ Here is the caller graph for this function:

void boss_twinemperorsAI::CheckEnrage ( uint32  diff)
inline
379  {
380  if (EnrageTimer <= diff)
381  {
382  if (!me->IsNonMeleeSpellCast(true))
383  {
385  EnrageTimer = 60*60000;
386  } else EnrageTimer = 0;
387  } else EnrageTimer-=diff;
388  }
bool IsNonMeleeSpellCast(bool withDelayed, bool skipChanneled=false, bool skipAutorepeat=false, bool isAutoshoot=false, bool skipInstant=true) const
Definition: Unit.cpp:2886
Creature *const me
Definition: CreatureAI.h:71
void DoCast(uint32 spellId)
Definition: UnitAI.cpp:101
uint32 EnrageTimer
Definition: boss_twinemperors.cpp:99
Definition: boss_twinemperors.cpp:40

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void boss_twinemperorsAI::DamageTaken ( Unit ,
uint32 damage 
)
inlineoverridevirtual

Reimplemented from ScriptedAI.

117  {
118  Unit* pOtherBoss = GetOtherBoss();
119  if (pOtherBoss)
120  {
121  float dPercent = ((float)damage) / ((float)me->GetMaxHealth());
122  int odmg = (int)(dPercent * ((float)pOtherBoss->GetMaxHealth()));
123  int ohealth = pOtherBoss->GetHealth()-odmg;
124  pOtherBoss->SetHealth(ohealth > 0 ? ohealth : 0);
125  if (ohealth <= 0)
126  {
127  pOtherBoss->setDeathState(JUST_DIED);
129  }
130  }
131  }
uint32 GetMaxHealth() const
Definition: Unit.h:1427
Definition: Unit.h:542
void SetFlag(uint16 index, uint32 newFlag)
Definition: Object.cpp:1199
Creature *const me
Definition: CreatureAI.h:71
Definition: SharedDefines.h:4201
virtual void setDeathState(DeathState s)
Definition: Unit.cpp:10593
Creature * GetOtherBoss()
Definition: boss_twinemperors.cpp:111
Definition: UpdateFields.h:30
void SetHealth(uint32 val)
Definition: Unit.cpp:11537
uint32 GetHealth() const
Definition: Unit.h:1426
Definition: Unit.h:1305

+ Here is the call graph for this function:

void boss_twinemperorsAI::EnterCombat ( Unit who)
inlineoverridevirtual
Todo:
we should activate the other boss location so he can start attackning even if nobody

Reimplemented from ScriptedAI.

153  {
154  DoZoneInCombat();
155  Creature* pOtherBoss = GetOtherBoss();
156  if (pOtherBoss)
157  {
159  // is near I dont know how to do that
160  if (!pOtherBoss->IsInCombat())
161  {
162  ScriptedAI* otherAI = ENSURE_AI(ScriptedAI, pOtherBoss->AI());
164  otherAI->AttackStart(who);
165  otherAI->DoZoneInCombat();
166  }
167  }
168  }
Definition: boss_twinemperors.cpp:50
void DoZoneInCombat(Creature *creature=NULL, float maxRangeToNearestTarget=50.0f)
Definition: CreatureAI.cpp:47
bool IsInCombat() const
Definition: Unit.h:1584
Definition: boss_twinemperors.cpp:54
Definition: Creature.h:467
void DoPlaySoundToSet(WorldObject *source, uint32 soundId)
Definition: ScriptedCreature.cpp:163
Creature *const me
Definition: CreatureAI.h:71
#define ENSURE_AI(a, b)
Definition: ScriptedCreature.h:29
virtual bool IAmVeklor()=0
Definition: ScriptedCreature.h:142
CreatureAI * AI() const
Definition: Creature.h:525
void AttackStart(Unit *) override
Definition: ScriptedCreature.cpp:117
Creature * GetOtherBoss()
Definition: boss_twinemperors.cpp:111

+ Here is the call graph for this function:

Creature* boss_twinemperorsAI::GetOtherBoss ( )
inline
112  {
114  }
InstanceScript * instance
Definition: boss_twinemperors.cpp:90
Definition: temple_of_ahnqiraj.h:31
Creature *const me
Definition: CreatureAI.h:71
virtual ObjectGuid GetGuidData(uint32 type) const override
Definition: InstanceScript.cpp:93
Definition: temple_of_ahnqiraj.h:34
virtual bool IAmVeklor()=0
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
Definition: ObjectAccessor.cpp:174

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void boss_twinemperorsAI::HandleBugs ( uint32  diff)
inline
349  {
350  if (BugsTimer < diff || Abuse_Bug_Timer <= diff)
351  {
353  if (Abuse_Bug_Timer <= diff)
354  {
355  if (c)
356  {
357  CastSpellOnBug(c);
358  Abuse_Bug_Timer = urand(10000, 17000);
359  }
360  else
361  {
362  Abuse_Bug_Timer = 1000;
363  }
364  }
365  else
366  {
367  Abuse_Bug_Timer -= diff;
368  }
369  BugsTimer = 2000;
370  }
371  else
372  {
373  BugsTimer -= diff;
374  Abuse_Bug_Timer -= diff;
375  }
376  }
uint32 Abuse_Bug_Timer
Definition: boss_twinemperors.cpp:97
Definition: Creature.h:467
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:45
virtual void CastSpellOnBug(Creature *target)=0
uint32 BugsTimer
Definition: boss_twinemperors.cpp:97
Creature * RespawnNearbyBugsAndGetOne()
Definition: boss_twinemperors.cpp:316

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

virtual bool boss_twinemperorsAI::IAmVeklor ( )
pure virtual

Implemented in boss_veklor::boss_veklorAI, and boss_veknilash::boss_veknilashAI.

+ Here is the caller graph for this function:

void boss_twinemperorsAI::Initialize ( void  )
inline
77  {
78  Heal_Timer = 0; // first heal immediately when they get close together
80  AfterTeleport = false;
81  tspellcast = false;
83  Abuse_Bug_Timer = urand(10000, 17000);
84  BugsTimer = 2000;
85 
86  DontYellWhenDead = false;
87  EnrageTimer = 15 * 60000;
88  }
uint32 Heal_Timer
Definition: boss_twinemperors.cpp:92
uint32 AfterTeleportTimer
Definition: boss_twinemperors.cpp:95
uint32 Abuse_Bug_Timer
Definition: boss_twinemperors.cpp:97
bool DontYellWhenDead
Definition: boss_twinemperors.cpp:96
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:45
uint32 BugsTimer
Definition: boss_twinemperors.cpp:97
uint32 EnrageTimer
Definition: boss_twinemperors.cpp:99
bool AfterTeleport
Definition: boss_twinemperors.cpp:94
Definition: boss_twinemperors.cpp:63
uint32 Teleport_Timer
Definition: boss_twinemperors.cpp:93
bool tspellcast
Definition: boss_twinemperors.cpp:98

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void boss_twinemperorsAI::JustDied ( Unit )
inlineoverridevirtual

Reimplemented from ScriptedAI.

134  {
135  Creature* pOtherBoss = GetOtherBoss();
136  if (pOtherBoss)
137  {
138  pOtherBoss->SetHealth(0);
139  pOtherBoss->setDeathState(JUST_DIED);
141  ENSURE_AI(boss_twinemperorsAI, pOtherBoss->AI())->DontYellWhenDead = true;
142  }
143  if (!DontYellWhenDead) // I hope AI is not threaded
145  }
Definition: Unit.h:542
bool DontYellWhenDead
Definition: boss_twinemperors.cpp:96
Definition: Creature.h:467
Definition: boss_twinemperors.cpp:53
void SetFlag(uint16 index, uint32 newFlag)
Definition: Object.cpp:1199
void DoPlaySoundToSet(WorldObject *source, uint32 soundId)
Definition: ScriptedCreature.cpp:163
Creature *const me
Definition: CreatureAI.h:71
#define ENSURE_AI(a, b)
Definition: ScriptedCreature.h:29
void setDeathState(DeathState s) override
Definition: Creature.cpp:1624
virtual bool IAmVeklor()=0
CreatureAI * AI() const
Definition: Creature.h:525
Definition: boss_twinemperors.cpp:52
Definition: SharedDefines.h:4201
Creature * GetOtherBoss()
Definition: boss_twinemperors.cpp:111
Definition: UpdateFields.h:30
void SetHealth(uint32 val)
Definition: Unit.cpp:11537
Definition: boss_twinemperors.cpp:68

+ Here is the call graph for this function:

void boss_twinemperorsAI::KilledUnit ( Unit )
inlineoverridevirtual

Reimplemented from ScriptedAI.

148  {
150  }
Definition: boss_twinemperors.cpp:55
Definition: boss_twinemperors.cpp:51
void DoPlaySoundToSet(WorldObject *source, uint32 soundId)
Definition: ScriptedCreature.cpp:163
Creature *const me
Definition: CreatureAI.h:71
virtual bool IAmVeklor()=0

+ Here is the call graph for this function:

void boss_twinemperorsAI::MoveInLineOfSight ( Unit who)
inlineoverridevirtual

Reimplemented from CreatureAI.

298  {
299  if (!who || me->GetVictim())
300  return;
301 
302  if (me->CanCreatureAttack(who))
303  {
304  float attackRadius = me->GetAttackDistance(who);
305  if (attackRadius < PULL_RANGE)
306  attackRadius = PULL_RANGE;
307  if (me->IsWithinDistInMap(who, attackRadius) && me->GetDistanceZ(who) <= /*CREATURE_Z_ATTACK_RANGE*/7 /*there are stairs*/)
308  {
309  //if (who->HasStealthAura())
310  // who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH);
311  AttackStart(who);
312  }
313  }
314  }
float GetDistanceZ(WorldObject const *obj) const
Definition: Object.cpp:1546
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true) const
Definition: Object.cpp:1663
Creature *const me
Definition: CreatureAI.h:71
float GetAttackDistance(Unit const *player) const
Definition: Creature.cpp:1586
Unit * GetVictim() const
Definition: Unit.h:1379
Definition: boss_twinemperors.cpp:60
void AttackStart(Unit *) override
Definition: ScriptedCreature.cpp:117
bool CanCreatureAttack(Unit const *victim, bool force=true) const
Definition: Creature.cpp:2170

+ Here is the call graph for this function:

virtual void boss_twinemperorsAI::Reset ( )
overridepure virtual
Creature* boss_twinemperorsAI::RespawnNearbyBugsAndGetOne ( )
inline
317  {
318  std::list<Creature*> lUnitList;
319  me->GetCreatureListWithEntryInGrid(lUnitList, 15316, 150.0f);
320  me->GetCreatureListWithEntryInGrid(lUnitList, 15317, 150.0f);
321 
322  if (lUnitList.empty())
323  return NULL;
324 
325  Creature* nearb = NULL;
326 
327  for (std::list<Creature*>::const_iterator iter = lUnitList.begin(); iter != lUnitList.end(); ++iter)
328  {
329  Creature* c = *iter;
330  if (c)
331  {
332  if (c->isDead())
333  {
334  c->Respawn();
335  c->setFaction(7);
336  c->RemoveAllAuras();
337  }
339  {
340  if (!nearb || (rand32() % 4) == 0)
341  nearb = c;
342  }
343  }
344  }
345  return nearb;
346  }
void RemoveAllAuras()
Definition: Unit.cpp:3920
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: Creature.h:467
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true) const
Definition: Object.cpp:1663
void GetCreatureListWithEntryInGrid(std::list< Creature * > &lList, uint32 uiEntry, float fMaxSearchRange) const
Definition: Object.cpp:2483
void setFaction(uint32 faction)
Definition: Unit.h:1467
Definition: boss_twinemperors.cpp:61
Creature *const me
Definition: CreatureAI.h:71
void Respawn(bool force=false)
Definition: Creature.cpp:1697
bool isDead() const
Definition: Unit.h:1694
uint32 rand32()
Definition: Random.cpp:64

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void boss_twinemperorsAI::SetAfterTeleport ( )
inline
239  {
240  me->InterruptNonMeleeSpells(false);
241  DoStopAttack();
242  DoResetThreat();
245  AfterTeleport = true;
246  AfterTeleportTimer = 2000;
247  tspellcast = false;
248  }
uint32 AfterTeleportTimer
Definition: boss_twinemperors.cpp:95
void AddUnitState(uint32 f)
Definition: Unit.h:1394
void DoStopAttack()
Definition: ScriptedCreature.cpp:148
Creature *const me
Definition: CreatureAI.h:71
Definition: Unit.h:553
void DoCast(uint32 spellId)
Definition: UnitAI.cpp:101
Definition: boss_twinemperors.cpp:37
void DoResetThreat()
Definition: ScriptedCreature.cpp:248
bool AfterTeleport
Definition: boss_twinemperors.cpp:94
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true)
Definition: Unit.cpp:2916
bool tspellcast
Definition: boss_twinemperors.cpp:98

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void boss_twinemperorsAI::SpellHit ( Unit caster,
const SpellInfo entry 
)
inlineoverridevirtual

Reimplemented from ScriptedAI.

171  {
172  if (caster == me)
173  return;
174 
175  Creature* pOtherBoss = GetOtherBoss();
176  if (entry->Id != SPELL_HEAL_BROTHER || !pOtherBoss)
177  return;
178 
179  // add health so we keep same percentage for both brothers
180  uint32 mytotal = me->GetMaxHealth(), histotal = pOtherBoss->GetMaxHealth();
181  float mult = ((float)mytotal) / ((float)histotal);
182  if (mult < 1)
183  mult = 1.0f/mult;
184  #define HEAL_BROTHER_AMOUNT 30000.0f
185  uint32 largerAmount = (uint32)((HEAL_BROTHER_AMOUNT * mult) - HEAL_BROTHER_AMOUNT);
186 
187  if (mytotal > histotal)
188  {
189  uint32 h = me->GetHealth()+largerAmount;
190  me->SetHealth(std::min(mytotal, h));
191  }
192  else
193  {
194  uint32 h = pOtherBoss->GetHealth()+largerAmount;
195  pOtherBoss->SetHealth(std::min(histotal, h));
196  }
197  }
uint32 Id
Definition: SpellInfo.h:329
uint32 GetMaxHealth() const
Definition: Unit.h:1427
Definition: Creature.h:467
#define HEAL_BROTHER_AMOUNT
Creature *const me
Definition: CreatureAI.h:71
T min(const T &x, const T &y)
Definition: g3dmath.h:305
uint32_t uint32
Definition: Define.h:150
Definition: boss_twinemperors.cpp:35
Creature * GetOtherBoss()
Definition: boss_twinemperors.cpp:111
uint32_t uint32
Definition: g3dmath.h:168
void SetHealth(uint32 val)
Definition: Unit.cpp:11537
uint32 GetHealth() const
Definition: Unit.h:1426

+ Here is the call graph for this function:

void boss_twinemperorsAI::TeleportToMyBrother ( )
inline
216  {
218 
219  if (IAmVeklor())
220  return; // mechanics handled by veknilash so they teleport exactly at the same time and to correct coordinates
221 
222  Creature* pOtherBoss = GetOtherBoss();
223  if (pOtherBoss)
224  {
225  //me->MonsterYell("Teleporting ...", LANG_UNIVERSAL, 0);
226  Position thisPos;
227  thisPos.Relocate(me);
228  Position otherPos;
229  otherPos.Relocate(pOtherBoss);
230  pOtherBoss->SetPosition(thisPos);
231  me->SetPosition(otherPos);
232 
235  }
236  }
Definition: Creature.h:467
void SetPosition(float x, float y, float z, float o)
Definition: Creature.cpp:2537
Creature *const me
Definition: CreatureAI.h:71
#define ENSURE_AI(a, b)
Definition: ScriptedCreature.h:29
void Relocate(float x, float y)
Definition: Position.h:67
virtual bool IAmVeklor()=0
CreatureAI * AI() const
Definition: Creature.h:525
Creature * GetOtherBoss()
Definition: boss_twinemperors.cpp:111
Definition: boss_twinemperors.cpp:63
uint32 Teleport_Timer
Definition: boss_twinemperors.cpp:93
Definition: Position.h:27
Definition: boss_twinemperors.cpp:68
void SetAfterTeleport()
Definition: boss_twinemperors.cpp:238

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool boss_twinemperorsAI::TryActivateAfterTTelep ( uint32  diff)
inline
251  {
252  if (AfterTeleport)
253  {
254  if (!tspellcast)
255  {
259  }
260 
261  tspellcast = true;
262 
263  if (AfterTeleportTimer <= diff)
264  {
265  AfterTeleport = false;
267  if (Unit* nearu = me->SelectNearestTarget(100))
268  {
269  //DoYell(nearu->GetName(), LANG_UNIVERSAL, 0);
270  AttackStart(nearu);
271  me->AddThreat(nearu, 10000);
272  }
273  return true;
274  }
275  else
276  {
277  AfterTeleportTimer -= diff;
278  // update important timers which would otherwise get skipped
279  if (EnrageTimer > diff)
280  EnrageTimer -= diff;
281  else
282  EnrageTimer = 0;
283  if (Teleport_Timer > diff)
284  Teleport_Timer -= diff;
285  else
286  Teleport_Timer = 0;
287  return false;
288  }
289  }
290  else
291  {
292  return true;
293  }
294  }
void AddThreat(Unit *victim, float fThreat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *threatSpell=NULL)
Definition: Unit.cpp:10691
uint32 AfterTeleportTimer
Definition: boss_twinemperors.cpp:95
void AddUnitState(uint32 f)
Definition: Unit.h:1394
Unit * SelectNearestTarget(float dist=0, bool playerOnly=false) const
Definition: Creature.cpp:1944
void ClearUnitState(uint32 f)
Definition: Unit.h:1396
Creature *const me
Definition: CreatureAI.h:71
Definition: Unit.h:553
Definition: boss_twinemperors.cpp:36
void DoCast(uint32 spellId)
Definition: UnitAI.cpp:101
uint32 EnrageTimer
Definition: boss_twinemperors.cpp:99
bool AfterTeleport
Definition: boss_twinemperors.cpp:94
void AttackStart(Unit *) override
Definition: ScriptedCreature.cpp:117
uint32 Teleport_Timer
Definition: boss_twinemperors.cpp:93
Definition: Unit.h:1305
bool tspellcast
Definition: boss_twinemperors.cpp:98

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void boss_twinemperorsAI::TryHealBrother ( uint32  diff)
inline
200  {
201  if (IAmVeklor()) // this spell heals caster and the other brother so let VN cast it
202  return;
203 
204  if (Heal_Timer <= diff)
205  {
206  Unit* pOtherBoss = GetOtherBoss();
207  if (pOtherBoss && pOtherBoss->IsWithinDist(me, 60))
208  {
209  DoCast(pOtherBoss, SPELL_HEAL_BROTHER);
210  Heal_Timer = 1000;
211  }
212  } else Heal_Timer -= diff;
213  }
uint32 Heal_Timer
Definition: boss_twinemperors.cpp:92
bool IsWithinDist(WorldObject const *obj, float dist2compare, bool is3D=true) const
Definition: Object.cpp:1658
Creature *const me
Definition: CreatureAI.h:71
virtual bool IAmVeklor()=0
void DoCast(uint32 spellId)
Definition: UnitAI.cpp:101
Definition: boss_twinemperors.cpp:35
Creature * GetOtherBoss()
Definition: boss_twinemperors.cpp:111
Definition: Unit.h:1305

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void boss_twinemperorsAI::TwinReset ( )
inline
106  {
107  Initialize();
109  }
void Initialize()
Definition: boss_twinemperors.cpp:76
void ClearUnitState(uint32 f)
Definition: Unit.h:1396
Creature *const me
Definition: CreatureAI.h:71
Definition: Unit.h:553

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

uint32 boss_twinemperorsAI::Abuse_Bug_Timer
bool boss_twinemperorsAI::AfterTeleport
uint32 boss_twinemperorsAI::AfterTeleportTimer
uint32 boss_twinemperorsAI::BugsTimer
bool boss_twinemperorsAI::DontYellWhenDead
uint32 boss_twinemperorsAI::EnrageTimer
uint32 boss_twinemperorsAI::Heal_Timer
InstanceScript* boss_twinemperorsAI::instance
uint32 boss_twinemperorsAI::Teleport_Timer
bool boss_twinemperorsAI::tspellcast

The documentation for this struct was generated from the following file: