TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boss_freya::boss_freyaAI Struct Reference

Public Member Functions

 boss_freyaAI (Creature *creature)
 
void Initialize ()
 
void Reset () override
 
void KilledUnit (Unit *who) override
 
void DamageTaken (Unit *who, uint32 &damage) override
 
void EnterCombat (Unit *who) override
 
uint32 GetData (uint32 type) const override
 
void UpdateAI (uint32 diff) override
 
void LasherDead (uint32 type)
 
int GetWaveId ()
 
void SpawnWave ()
 
void JustDied (Unit *) override
 
void JustSummoned (Creature *summoned) override
 
void SummonedCreatureDies (Creature *summoned, Unit *who) override
 
- Public Member Functions inherited from BossAI
 BossAI (Creature *creature, uint32 bossId)
 
virtual ~BossAI ()
 
void SummonedCreatureDespawn (Creature *summon) override
 
virtual void ExecuteEvent (uint32)
 
virtual void ScheduleTasks ()
 
void JustReachedHome () override
 
bool CanAIAttack (Unit const *target) const override
 
- Public Member Functions inherited from ScriptedAI
 ScriptedAI (Creature *creature)
 
virtual ~ScriptedAI ()
 
void AttackStartNoMove (Unit *target)
 
void SpellHit (Unit *, SpellInfo const *) 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 AttackedBy (Unit *)
 
virtual bool IsEscorted () const
 
virtual void JustRespawned ()
 
virtual void MovementInform (uint32, uint32)
 
void OnCharmed (bool apply) override
 
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 void InitializeAI ()
 
virtual void DoAction (int32)
 
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

ObjectGuid ElementalGUID [3][2]
 
uint32 deforestation [6][2]
 
uint32 elementalTimer [2]
 
uint32 diffTimer
 
uint8 trioWaveCount
 
uint8 trioWaveController
 
uint8 waveCount
 
uint8 elderCount
 
uint8 attunedToNature
 
bool checkElementalAlive [2]
 
bool trioDefeated [2]
 
bool random [3]
 
- Public Attributes inherited from BossAI
InstanceScript *const instance
 
- 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 BossAI
void _Reset ()
 
void _EnterCombat ()
 
void _JustDied ()
 
void _JustReachedHome ()
 
void _DespawnAtEvade ()
 
void TeleportCheaters ()
 
- 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)
 
virtual void MoveInLineOfSight (Unit *)
 
bool _EnterEvadeMode (EvadeReason why=EVADE_REASON_OTHER)
 
- Protected Attributes inherited from BossAI
EventMap events
 
SummonList summons
 
TaskScheduler scheduler
 
- Protected Attributes inherited from CreatureAI
Creature *const me
 
CreatureBoundary const_boundary
 
- Protected Attributes inherited from UnitAI
Unit *const me
 

Constructor & Destructor Documentation

boss_freya::boss_freyaAI::boss_freyaAI ( Creature creature)
inline
268  : BossAI(creature, BOSS_FREYA)
269  {
270  Initialize();
271  memset(elementalTimer, 0, sizeof(elementalTimer));
272  diffTimer = 0;
273  attunedToNature = 0;
274  }
Definition: ulduar.h:41
void Initialize()
Definition: boss_freya.cpp:276
uint8 attunedToNature
Definition: boss_freya.cpp:307
uint32 diffTimer
Definition: boss_freya.cpp:302
uint32 elementalTimer[2]
Definition: boss_freya.cpp:301
BossAI(Creature *creature, uint32 bossId)
Definition: ScriptedCreature.cpp:444

+ Here is the call graph for this function:

Member Function Documentation

void boss_freya::boss_freyaAI::DamageTaken ( Unit who,
uint32 damage 
)
inlineoverridevirtual

Reimplemented from ScriptedAI.

326  {
327  if (damage >= me->GetHealth())
328  {
329  damage = 0;
330  JustDied(who);
331  }
332  }
Creature *const me
Definition: CreatureAI.h:71
void JustDied(Unit *) override
Definition: boss_freya.cpp:590
uint32 GetHealth() const
Definition: Unit.h:1426

+ Here is the call graph for this function:

void boss_freya::boss_freyaAI::EnterCombat ( Unit who)
inlineoverridevirtual

Why?

Reimplemented from BossAI.

335  {
336  _EnterCombat();
337  DoZoneInCombat();
338  Creature* Elder[3];
339  for (uint8 n = 0; n < 3; ++n)
340  {
342  if (Elder[n] && Elder[n]->IsAlive())
343  {
344  me->AddAura(SPELL_DRAINED_OF_POWER, Elder[n]);
345  Elder[n]->CastSpell(me, SPELL_IRONBRANCH_ESSENCE, true);
346  Elder[n]->RemoveLootMode(LOOT_MODE_DEFAULT);
347  Elder[n]->AI()->AttackStart(who);
348  Elder[n]->AddThreat(who, 250.0f);
349  Elder[n]->SetInCombatWith(who);
350  ++elderCount;
351  }
352  }
353 
354  if (Elder[0] && Elder[0]->IsAlive())
355  {
356  Elder[0]->CastSpell(me, SPELL_BRIGHTLEAF_ESSENCE, true);
358  }
359 
360  if (Elder[1] && Elder[1]->IsAlive())
361  {
362  Elder[1]->CastSpell(me, SPELL_STONEBARK_ESSENCE, true);
364  }
365 
366  if (Elder[2] && Elder[2]->IsAlive())
367  {
368  Elder[2]->CastSpell(me, SPELL_IRONBRANCH_ESSENCE, true);
370  }
371 
372  if (elderCount == 0)
373  Talk(SAY_AGGRO);
374  else
376 
378 
382  events.ScheduleEvent(EVENT_SUNBEAM, urand(5000, 15000));
383  }
void AddThreat(Unit *victim, float fThreat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *threatSpell=NULL)
Definition: Unit.cpp:10691
void _EnterCombat()
Definition: ScriptedCreature.cpp:480
Definition: boss_freya.cpp:186
Definition: boss_freya.cpp:188
void DoZoneInCombat(Creature *creature=NULL, float maxRangeToNearestTarget=50.0f)
Definition: CreatureAI.cpp:47
Aura * AddAura(uint32 spellId, Unit *target)
Definition: Unit.cpp:14463
Definition: boss_freya.cpp:61
Definition: boss_freya.cpp:52
Definition: Creature.h:467
Definition: boss_freya.cpp:187
Definition: SharedDefines.h:69
void RemoveLootMode(uint16 lootMode)
Definition: Creature.h:596
Creature *const me
Definition: CreatureAI.h:71
uint8 elderCount
Definition: boss_freya.cpp:306
virtual ObjectGuid GetGuidData(uint32 type) const override
Definition: InstanceScript.cpp:93
Definition: boss_freya.cpp:59
Definition: boss_freya.cpp:30
Definition: ulduar.h:46
Definition: boss_freya.cpp:31
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:45
CreatureAI * AI() const
Definition: Creature.h:525
Definition: boss_freya.cpp:60
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:42
void ScheduleEvent(uint32 eventId, Milliseconds const &time, uint32 group=0, uint8 phase=0)
Definition: EventMap.h:123
Definition: boss_freya.cpp:185
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
Definition: ObjectAccessor.cpp:174
Definition: boss_freya.cpp:182
Definition: boss_freya.cpp:181
uint8_t uint8
Definition: Define.h:152
EventMap events
Definition: ScriptedCreature.h:371
Definition: Unit.h:164
Definition: boss_freya.cpp:58
Definition: boss_freya.cpp:184
void CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:869
virtual void AttackStart(Unit *)
Definition: UnitAI.cpp:29
void CastCustomSpell(Unit *victim, uint32 spellId, int32 const *bp0, int32 const *bp1, int32 const *bp2, bool triggered, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:920
void SetInCombatWith(Unit *enemy)
Definition: Unit.cpp:9840
InstanceScript *const instance
Definition: ScriptedCreature.h:340

+ Here is the call graph for this function:

uint32 boss_freya::boss_freyaAI::GetData ( uint32  type) const
inlineoverridevirtual

Reimplemented from UnitAI.

386  {
387  switch (type)
388  {
390  return attunedToNature;
391  case DATA_KNOCK_ON_WOOD:
392  return elderCount;
393  }
394 
395  return 0;
396  }
uint8 attunedToNature
Definition: boss_freya.cpp:307
Definition: boss_freya.cpp:210
uint8 elderCount
Definition: boss_freya.cpp:306
Definition: boss_freya.cpp:211
int boss_freya::boss_freyaAI::GetWaveId ( )
inline
553  {
554  if (random[0] && random[1] && random[2])
555  for (uint8 n = 0; n < 3; ++n)
556  random[n] = false;
557 
558  uint8 randomId = urand(0, 2);
559 
560  while (random[randomId])
561  randomId = urand(0, 2);
562 
563  random[randomId] = true;
564  return randomId;
565  }
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:45
bool random[3]
Definition: boss_freya.cpp:311
uint8_t uint8
Definition: Define.h:152

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void boss_freya::boss_freyaAI::Initialize ( void  )
inline
277  {
278  trioWaveCount = 0;
279  trioWaveController = 0;
280  waveCount = 0;
281  elderCount = 0;
282 
283  for (uint8 i = 0; i < 3; ++i)
284  for (uint8 n = 0; n < 2; ++n)
285  ElementalGUID[i][n].Clear();
286  for (uint8 i = 0; i < 6; ++i)
287  for (uint8 n = 0; n < 2; ++n)
288  deforestation[i][n] = 0;
289  for (uint8 n = 0; n < 2; ++n)
290  {
291  checkElementalAlive[n] = true;
292  trioDefeated[n] = false;
293  }
294  for (uint8 n = 0; n < 3; ++n)
295  random[n] = false;
296  }
uint8 waveCount
Definition: boss_freya.cpp:305
ObjectGuid ElementalGUID[3][2]
Definition: boss_freya.cpp:298
uint32 deforestation[6][2]
Definition: boss_freya.cpp:300
bool checkElementalAlive[2]
Definition: boss_freya.cpp:309
uint8 elderCount
Definition: boss_freya.cpp:306
bool trioDefeated[2]
Definition: boss_freya.cpp:310
uint8 trioWaveController
Definition: boss_freya.cpp:304
uint8 trioWaveCount
Definition: boss_freya.cpp:303
bool random[3]
Definition: boss_freya.cpp:311
uint8_t uint8
Definition: Define.h:152

+ Here is the caller graph for this function:

void boss_freya::boss_freyaAI::JustDied ( Unit )
inlineoverridevirtual

Freya's chest is dynamically spawned on death by different spells.

Reimplemented from BossAI.

591  {
593  const uint32 summonSpell[2][4] =
594  {
595  /* 0Elder, 1Elder, 2Elder, 3Elder */
596  /* 10N */ {62950, 62952, 62953, 62954},
597  /* 25N */ {62955, 62956, 62957, 62958}
598  };
599 
600  me->CastSpell((Unit*)NULL, summonSpell[me->GetMap()->GetDifficultyID() - DIFFICULTY_10_N][elderCount], true);
601 
602  Talk(SAY_DEATH);
604  _JustDied();
605  me->RemoveAllAuras();
606  me->AttackStop();
607  me->setFaction(35);
608  me->DeleteThreatList();
609  me->CombatStop(true);
610  me->DespawnOrUnsummon(7500);
612 
613  for (uint8 n = 0; n < 3; ++n)
614  {
616  if (Elder && Elder->IsAlive())
617  {
618  Elder->RemoveAllAuras();
619  Elder->AttackStop();
620  Elder->CombatStop(true);
621  Elder->DeleteThreatList();
623  }
624  }
625  }
bool AttackStop()
Definition: Unit.cpp:7337
void DespawnOrUnsummon(uint32 msTimeToDespawn=0)
Definition: Creature.cpp:1774
void RemoveAllAuras()
Definition: Unit.cpp:3920
Definition: DBCEnums.h:407
Map * GetMap() const
Definition: Object.h:543
Definition: Unit.h:1129
Difficulty GetDifficultyID() const
Definition: Map.h:390
arena_t NULL
Definition: jemalloc_internal.h:624
void _JustDied()
Definition: ScriptedCreature.cpp:471
Definition: Creature.h:467
Definition: boss_freya.cpp:33
void setFaction(uint32 faction)
Definition: Unit.h:1467
Creature *const me
Definition: CreatureAI.h:71
uint8 elderCount
Definition: boss_freya.cpp:306
virtual ObjectGuid GetGuidData(uint32 type) const override
Definition: InstanceScript.cpp:93
Definition: ulduar.h:46
bool IsAlive() const
Definition: Unit.h:1692
uint32_t uint32
Definition: Define.h:150
virtual void DoAction(int32)
Definition: UnitAI.h:138
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:42
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
Definition: ObjectAccessor.cpp:174
UnitAI * GetAI()
Definition: Unit.h:1331
Definition: boss_freya.cpp:175
void DeleteThreatList()
Definition: Unit.cpp:10700
Definition: boss_freya.cpp:90
uint8_t uint8
Definition: Define.h:152
void CombatStop(bool includingCast=false)
Definition: Unit.cpp:7371
Definition: Unit.h:1305
void SetReactState(ReactStates st)
Definition: Creature.h:502
void CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:869
InstanceScript *const instance
Definition: ScriptedCreature.h:340

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void boss_freya::boss_freyaAI::JustSummoned ( Creature summoned)
inlineoverridevirtual

Reimplemented from BossAI.

628  {
629  switch (summoned->GetEntry())
630  {
631  case NPC_SNAPLASHER:
633  case NPC_STORM_LASHER:
635  summons.Summon(summoned);
637  if (trioWaveController > 2)
638  trioWaveController = 0;
639  break;
642  default:
643  summons.Summon(summoned);
644  break;
645  }
646 
647  // Need to have it there, or summoned units would do nothing untill attacked
648  if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 250.0f, true))
649  {
650  summoned->AI()->AttackStart(target);
651  summoned->AddThreat(target, 250.0f);
652  DoZoneInCombat(summoned);
653  }
654  }
void AddThreat(Unit *victim, float fThreat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *threatSpell=NULL)
Definition: Unit.cpp:10691
Definition: boss_freya.cpp:157
void DoZoneInCombat(Creature *creature=NULL, float maxRangeToNearestTarget=50.0f)
Definition: CreatureAI.cpp:47
void Summon(Creature const *summon)
Definition: ScriptedCreature.h:92
Definition: boss_freya.cpp:161
ObjectGuid ElementalGUID[3][2]
Definition: boss_freya.cpp:298
Definition: boss_freya.cpp:158
Definition: boss_freya.cpp:160
Definition: UnitAI.h:35
uint8 trioWaveController
Definition: boss_freya.cpp:304
CreatureAI * AI() const
Definition: Creature.h:525
Unit * SelectTarget(SelectAggroTarget targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, int32 aura=0)
Definition: UnitAI.cpp:91
uint8 trioWaveCount
Definition: boss_freya.cpp:303
SummonList summons
Definition: ScriptedCreature.h:372
ObjectGuid const & GetGUID() const
Definition: Object.h:105
uint32 GetEntry() const
Definition: Object.h:107
Definition: Unit.h:1305
virtual void AttackStart(Unit *)
Definition: UnitAI.cpp:29
Definition: boss_freya.cpp:159

+ Here is the call graph for this function:

void boss_freya::boss_freyaAI::KilledUnit ( Unit who)
inlineoverridevirtual

Reimplemented from ScriptedAI.

320  {
321  if (who->GetTypeId() == TYPEID_PLAYER)
322  Talk(SAY_SLAY);
323  }
Definition: boss_freya.cpp:32
TypeID GetTypeId() const
Definition: Object.h:113
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:42
Definition: ObjectGuid.h:33

+ Here is the call graph for this function:

void boss_freya::boss_freyaAI::LasherDead ( uint32  type)
inline
522  {
523  uint8 n = 0;
524 
525  // Handling received data
526  for (uint8 i = 0; i < 5; ++i) // We have created "instances" for keeping informations about last 6 death lashers - needed because of respawning
527  {
528  deforestation[i][0] = deforestation[(i + 1)][0]; // Time
529  deforestation[i][1] = deforestation[(i + 1)][1]; // Type
530  }
531  deforestation[5][0] = diffTimer;
532  deforestation[5][1] = type;
533 
534  // Check for achievement completion
535  if (deforestation[0][1]) // Check for proper functionality of binary masks (overflow would not be problem)
536  {
537  for (uint8 i = 0; i < 6; ++i) // Count binary mask
538  {
539  n += deforestation[i][1];
540  }
541  if ((deforestation[5][0] - deforestation[0][0]) < 10000) // Time check
542  {
543  if (n == 14 && instance) // Binary mask check - verification of lasher types
544  {
546  }
547  }
548  }
549  }
void DoCastSpellOnPlayers(uint32 spell)
Definition: InstanceScript.cpp:558
uint32 diffTimer
Definition: boss_freya.cpp:302
uint32 deforestation[6][2]
Definition: boss_freya.cpp:300
uint8_t uint8
Definition: Define.h:152
Definition: boss_freya.cpp:89
InstanceScript *const instance
Definition: ScriptedCreature.h:340

+ Here is the call graph for this function:

void boss_freya::boss_freyaAI::Reset ( )
inlineoverridevirtual

Reimplemented from BossAI.

314  {
315  _Reset();
316  Initialize();
317  }
void Initialize()
Definition: boss_freya.cpp:276
void _Reset()
Definition: ScriptedCreature.cpp:457

+ Here is the call graph for this function:

void boss_freya::boss_freyaAI::SpawnWave ( )
inline
568  {
569  switch (GetWaveId())
570  {
571  case 0:
573  for (uint8 n = 0; n < 10; ++n)
575  break;
576  case 1:
579  trioWaveCount++;
580  break;
581  case 2:
584  break;
585  }
587  waveCount++;
588  }
Definition: boss_freya.cpp:95
Definition: boss_freya.cpp:35
Definition: boss_freya.cpp:39
uint8 waveCount
Definition: boss_freya.cpp:305
int GetWaveId()
Definition: boss_freya.cpp:552
Definition: boss_freya.cpp:93
Definition: boss_freya.cpp:94
Definition: boss_freya.cpp:37
void DoCast(uint32 spellId)
Definition: UnitAI.cpp:101
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:42
uint8 trioWaveCount
Definition: boss_freya.cpp:303
Definition: boss_freya.cpp:36
uint8_t uint8
Definition: Define.h:152

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void boss_freya::boss_freyaAI::SummonedCreatureDies ( Creature summoned,
Unit who 
)
inlineoverridevirtual

Reimplemented from CreatureAI.

657  {
658  switch (summoned->GetEntry())
659  {
661  summoned->CastSpell(me, SPELL_REMOVE_2STACK, true);
662  summoned->CastSpell(who, SPELL_DETONATE, true);
663  summoned->DespawnOrUnsummon(5000);
664  summons.Despawn(summoned);
665  break;
667  summoned->CastSpell(me, SPELL_REMOVE_25STACK, true);
668  summoned->DespawnOrUnsummon(5000);
669  summons.Despawn(summoned);
670  break;
671  }
672  }
void DespawnOrUnsummon(uint32 msTimeToDespawn=0)
Definition: Creature.cpp:1774
Definition: boss_freya.cpp:86
Definition: boss_freya.cpp:157
Definition: boss_freya.cpp:158
void Despawn(Creature const *summon)
Definition: ScriptedCreature.h:93
Creature *const me
Definition: CreatureAI.h:71
SummonList summons
Definition: ScriptedCreature.h:372
Definition: boss_freya.cpp:84
uint32 GetEntry() const
Definition: Object.h:107
void CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:869
Definition: boss_freya.cpp:98

+ Here is the call graph for this function:

void boss_freya::boss_freyaAI::UpdateAI ( uint32  diff)
inlineoverridevirtual

Reimplemented from BossAI.

399  {
400  if (!UpdateVictim())
401  return;
402 
403  events.Update(diff);
404 
406  return;
407 
408  while (uint32 eventId = events.ExecuteEvent())
409  {
410  switch (eventId)
411  {
412  case EVENT_ENRAGE:
413  Talk(SAY_BERSERK);
415  break;
416  case EVENT_SUNBEAM:
417  if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true))
418  DoCast(target, SPELL_SUNBEAM);
419  events.ScheduleEvent(EVENT_SUNBEAM, urand(10000, 15000));
420  break;
421  case EVENT_NATURE_BOMB:
424  break;
426  if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true))
427  DoCast(target, SPELL_FREYA_UNSTABLE_SUNBEAM, true);
429  break;
430  case EVENT_WAVE:
431  SpawnWave();
432  if (waveCount <= 6) // If set to 6 The Bombs appear during the Final Add wave
434  else
436  break;
437  case EVENT_EONAR_GIFT:
440  events.ScheduleEvent(EVENT_EONAR_GIFT, urand(40000, 50000));
441  break;
444  if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true, -SPELL_ROOTS_FREYA))
445  target->CastSpell(target, SPELL_ROOTS_FREYA, true); // This must be cast by Target self
447  break;
448  case EVENT_GROUND_TREMOR:
452  break;
453  }
454  }
455 
458 
459  // For achievement check
460  if (Aura* aura = me->GetAura(SPELL_ATTUNED_TO_NATURE))
461  attunedToNature = aura->GetStackAmount();
462  else
463  attunedToNature = 0;
464 
465  diffTimer += diff; // For getting time difference for Deforestation achievement
466 
467  // Elementals must be killed within 12 seconds of each other, or they will all revive and heal
468  Creature* Elemental[3][2];
469  for (uint8 i = 0; i < 2; ++i)
470  {
471  if (checkElementalAlive[i])
472  elementalTimer[i] = 0;
473  else
474  {
475  elementalTimer[i] += diff;
476  for (uint8 k = 0; k < 3; ++k)
477  Elemental[k][i] = ObjectAccessor::GetCreature(*me, ElementalGUID[k][i]);
478  if (elementalTimer[i] > 12000)
479  {
480  if (!trioDefeated[i]) // Do *NOT* merge this bool with bool few lines below!
481  {
482  if (Elemental[0][i] && Elemental[1][i] && Elemental[2][i])
483  {
484  for (uint8 n = 0; n < 3; ++n)
485  {
486  if (Elemental[n][i]->IsAlive())
487  Elemental[n][i]->SetHealth(Elemental[n][i]->GetMaxHealth());
488  else
489  Elemental[n][i]->Respawn();
490  }
491  }
492  }
493  checkElementalAlive[i] = true;
494  }
495  else
496  {
497  if (!trioDefeated[i])
498  {
499  if (Elemental[0][i] && Elemental[1][i] && Elemental[2][i])
500  {
501  if (Elemental[0][i]->isDead() && Elemental[1][i]->isDead() && Elemental[2][i]->isDead())
502  {
503  for (uint8 n = 0; n < 3; ++n)
504  {
505  summons.Despawn(Elemental[n][i]);
506  Elemental[n][i]->DespawnOrUnsummon(5000);
507  trioDefeated[i] = true;
508  Elemental[n][i]->CastSpell(me, SPELL_REMOVE_10STACK, true);
509  }
510  }
511  }
512  }
513  }
514  }
515  }
516 
518  }
void DespawnOrUnsummon(uint32 msTimeToDespawn=0)
Definition: Creature.cpp:1774
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition: Unit.cpp:4240
void SpawnWave()
Definition: boss_freya.cpp:567
void DoCastAOE(uint32 spellId, bool triggered=false)
Definition: UnitAI.cpp:167
bool UpdateVictim()
Definition: CreatureAI.cpp:233
Definition: boss_freya.cpp:186
Definition: boss_freya.cpp:85
Definition: boss_freya.cpp:188
Definition: boss_freya.cpp:55
Definition: Unit.h:565
Aura * GetAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition: Unit.cpp:4151
uint8 attunedToNature
Definition: boss_freya.cpp:307
Definition: boss_freya.cpp:52
Definition: Creature.h:467
uint32 diffTimer
Definition: boss_freya.cpp:302
Definition: boss_freya.cpp:187
uint8 waveCount
Definition: boss_freya.cpp:305
ObjectGuid ElementalGUID[3][2]
Definition: boss_freya.cpp:298
Definition: boss_freya.cpp:53
void Despawn(Creature const *summon)
Definition: ScriptedCreature.h:93
Creature *const me
Definition: CreatureAI.h:71
bool checkElementalAlive[2]
Definition: boss_freya.cpp:309
uint32 elementalTimer[2]
Definition: boss_freya.cpp:301
bool trioDefeated[2]
Definition: boss_freya.cpp:310
Definition: boss_freya.cpp:38
Definition: UnitAI.h:35
Definition: boss_freya.cpp:54
Definition: boss_freya.cpp:135
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:45
Unit * SelectTarget(SelectAggroTarget targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, int32 aura=0)
Definition: UnitAI.cpp:91
uint32_t uint32
Definition: Define.h:150
void DoCast(uint32 spellId)
Definition: UnitAI.cpp:101
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:42
void ScheduleEvent(uint32 eventId, Milliseconds const &time, uint32 group=0, uint8 phase=0)
Definition: EventMap.h:123
Definition: boss_freya.cpp:185
SummonList summons
Definition: ScriptedCreature.h:372
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
Definition: ObjectAccessor.cpp:174
void Update(uint32 time)
Definition: EventMap.h:54
Definition: boss_freya.cpp:182
Definition: boss_freya.cpp:56
Definition: boss_freya.cpp:62
void Respawn(bool force=false)
Definition: Creature.cpp:1697
Definition: boss_freya.cpp:208
Definition: boss_freya.cpp:181
uint32 ExecuteEvent()
Definition: EventMap.cpp:46
void DoMeleeAttackIfReady()
Definition: UnitAI.cpp:49
bool HasUnitState(const uint32 f) const
Definition: Unit.h:1395
Definition: boss_freya.cpp:41
uint8_t uint8
Definition: Define.h:152
EventMap events
Definition: ScriptedCreature.h:371
Definition: boss_freya.cpp:40
Definition: boss_freya.cpp:34
Definition: boss_freya.cpp:183
void SetHealth(uint32 val)
Definition: Unit.cpp:11537
Definition: boss_freya.cpp:184
Definition: SpellAuras.h:116
Definition: Unit.h:1305
void CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:869
Definition: boss_freya.cpp:142
Definition: boss_freya.cpp:57

+ Here is the call graph for this function:

Member Data Documentation

uint8 boss_freya::boss_freyaAI::attunedToNature
bool boss_freya::boss_freyaAI::checkElementalAlive[2]
uint32 boss_freya::boss_freyaAI::deforestation[6][2]
uint32 boss_freya::boss_freyaAI::diffTimer
uint8 boss_freya::boss_freyaAI::elderCount
ObjectGuid boss_freya::boss_freyaAI::ElementalGUID[3][2]
uint32 boss_freya::boss_freyaAI::elementalTimer[2]
bool boss_freya::boss_freyaAI::random[3]
bool boss_freya::boss_freyaAI::trioDefeated[2]
uint8 boss_freya::boss_freyaAI::trioWaveController
uint8 boss_freya::boss_freyaAI::trioWaveCount
uint8 boss_freya::boss_freyaAI::waveCount

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