Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
boss_thorngrin_the_tender.cpp
Go to the documentation of this file.
1/*
2* This file is part of Project SkyFire https://www.projectskyfire.org.
3* See LICENSE.md file for Copyright information
4*/
5
6#include "ScriptMgr.h"
7#include "ScriptedCreature.h"
8#include "the_botanica.h"
9
21
29
36
38{
39public:
40 boss_thorngrin_the_tender() : CreatureScript("thorngrin_the_tender") { }
41
43 {
45
47 {
48 _Reset();
49 _phase1 = true;
50 _phase2 = true;
51 }
52
53 void EnterCombat(Unit* /*who*/) OVERRIDE
54 {
57 events.ScheduleEvent(EVENT_SACRIFICE, 5700);
58 events.ScheduleEvent(EVENT_HELLFIRE, IsHeroic() ? std::rand() % 19300 + 17400 : 18000);
59 events.ScheduleEvent(EVENT_ENRAGE, 12000);
60 }
61
62 void KilledUnit(Unit* /*victim*/) OVERRIDE
63 {
65 }
66
67 void JustDied(Unit* /*killer*/) OVERRIDE
68 {
69 _JustDied();
71 }
72
73 void DamageTaken(Unit* /*killer*/, uint32& damage) OVERRIDE
74 {
75 if (me->HealthBelowPctDamaged(50, damage) && _phase1)
76 {
77 _phase1 = false;
79 }
80 if (me->HealthBelowPctDamaged(20, damage) && _phase2)
81 {
82 _phase2 = false;
84 }
85 }
86
88 {
89 if (!UpdateVictim())
90 return;
91
92 events.Update(diff);
93
94 if (me->HasUnitState(UNIT_STATE_CASTING))
95 return;
96
97 while (uint32 eventId = events.ExecuteEvent())
98 {
99 switch (eventId)
100 {
101 case EVENT_SACRIFICE:
102 if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 0.0f, true))
103 {
105 DoCast(target, SPELL_SACRIFICE, true);
106 }
107 events.ScheduleEvent(EVENT_SACRIFICE, 29400);
108 break;
109 case EVENT_HELLFIRE:
112 events.ScheduleEvent(EVENT_HELLFIRE, IsHeroic() ? std::rand() % 19300 + 17400 : 18000);
113 break;
114 case EVENT_ENRAGE:
117 events.ScheduleEvent(EVENT_ENRAGE, 33000);
118 break;
119 default:
120 break;
121 }
122 }
123
125 }
126
127 private:
130 };
131
133 {
134 return new boss_thorngrin_the_tenderAI(creature);
135 }
136};
137
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
@ UNIT_STATE_CASTING
Definition Unit.h:527
@ SELECT_TARGET_RANDOM
Definition UnitAI.h:23
@ SPELL_ENRAGE
@ EVENT_ENRAGE
#define SAY_DEATH
#define SAY_AGGRO
#define SAY_KILL
@ EMOTE_ENRAGE
void AddSC_boss_thorngrin_the_tender()
EventMap events
BossAI(Creature *creature, uint32 bossId)
void _EnterCombat()
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
bool UpdateVictim()
CreatureScript(const char *name)
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:28
void DoCast(uint32 spellId)
Definition UnitAI.cpp:110
Unit * SelectTarget(SelectAggroTarget targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, int32 aura=0)
Definition UnitAI.cpp:66
void DoCastVictim(uint32 spellId, bool triggered=false)
Definition UnitAI.cpp:168
Definition Unit.h:1367
CreatureAI * GetAI(Creature *creature) const OVERRIDE
bool IsHeroic() const
Creature * me
const T & DUNGEON_MODE(const T &normal5, const T &heroic5) const
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
@ DATA_THORNGRIN_THE_TENDER