TrinityCore
boss_rage_winterchill.cpp
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#include "ScriptMgr.h"
19#include "hyjal.h"
20#include "hyjal_trash.h"
21#include "InstanceScript.h"
22#include "ObjectAccessor.h"
23
25{
29 SPELL_ICEBOLT = 31249
30};
31
33{
38 SAY_ONAGGRO = 4
39};
40
41static constexpr uint32 PATH_ESCORT_RAGE_WINTERCHILL = 142138;
42
44{
45public:
46 boss_rage_winterchill() : CreatureScript("boss_rage_winterchill") { }
47
48 CreatureAI* GetAI(Creature* creature) const override
49 {
50 return GetHyjalAI<boss_rage_winterchillAI>(creature);
51 }
52
54 {
56 {
57 Initialize();
58 instance = creature->GetInstanceScript();
59 go = false;
60 }
61
63 {
64 damageTaken = 0;
65 FrostArmorTimer = 37000;
66 DecayTimer = 45000;
67 NovaTimer = 15000;
68 IceboltTimer = 10000;
69 }
70
75 bool go;
76
77 void Reset() override
78 {
79 Initialize();
80
81 if (IsEvent)
83 }
84
85 void JustEngagedWith(Unit* /*who*/) override
86 {
87 if (IsEvent)
90 }
91
92 void KilledUnit(Unit* /*victim*/) override
93 {
95 }
96
97 void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
98 {
99 if (waypointId == 7 && instance)
100 {
102 if (target && target->IsAlive())
103 AddThreat(target, 0.0f);
104 }
105 }
106
107 void JustDied(Unit* killer) override
108 {
110 if (IsEvent)
113 }
114
115 void UpdateAI(uint32 diff) override
116 {
117 if (IsEvent)
118 {
119 //Must update EscortAI
120 EscortAI::UpdateAI(diff);
121 if (!go)
122 {
123 go = true;
125 Start(false);
126 SetDespawnAtEnd(false);
127 }
128 }
129
130 //Return since we have no target
131 if (!UpdateVictim())
132 return;
133
134 if (FrostArmorTimer <= diff)
135 {
137 FrostArmorTimer = 40000 + rand32() % 20000;
138 } else FrostArmorTimer -= diff;
139 if (DecayTimer <= diff)
140 {
142 DecayTimer = 60000 + rand32() % 20000;
144 } else DecayTimer -= diff;
145 if (NovaTimer <= diff)
146 {
148 NovaTimer = 30000 + rand32() % 15000;
149 Talk(SAY_NOVA);
150 } else NovaTimer -= diff;
151 if (IceboltTimer <= diff)
152 {
154 IceboltTimer = 11000 + rand32() % 20000;
155 } else IceboltTimer -= diff;
156 }
157 };
158};
159
161{
163}
Texts
uint32_t uint32
Definition: Define.h:142
@ IN_PROGRESS
@ DONE
@ NOT_STARTED
Spells
Definition: PlayerAI.cpp:32
uint32 rand32()
Definition: Random.cpp:70
void AddSC_boss_rage_winterchill()
@ SPELL_DEATH_AND_DECAY
@ SPELL_FROST_ARMOR
@ SPELL_FROST_NOVA
static constexpr uint32 PATH_ESCORT_RAGE_WINTERCHILL
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:56
bool UpdateVictim()
Definition: CreatureAI.cpp:245
Creature *const me
Definition: CreatureAI.h:61
virtual bool SetBossState(uint32 id, EncounterState state)
virtual ObjectGuid GetGuidData(uint32 type) const override
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.cpp:180
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition: UnitAI.cpp:79
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:89
Definition: Unit.h:627
bool IsAlive() const
Definition: Unit.h:1164
InstanceScript * GetInstanceScript() const
Definition: Object.cpp:1042
CreatureAI * GetAI(Creature *creature) const override
@ DATA_RAGEWINTERCHILL
Definition: hyjal.h:30
@ DATA_JAINAPROUDMOORE
Definition: hyjal.h:36
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
void Start(bool isActiveAttacker=true, ObjectGuid playerGUID=ObjectGuid::Empty, Quest const *quest=nullptr, bool instantRespawn=false, bool canLoopPath=false)
void SetDespawnAtEnd(bool despawn)
void LoadPath(uint32 pathId)
void UpdateAI(uint32 diff) override
void AddThreat(Unit *victim, float amount, Unit *who=nullptr)
void WaypointReached(uint32 waypointId, uint32) override
void JustDied(Unit *) override
uint32 damageTaken
Definition: hyjal_trash.h:43
InstanceScript * instance
Definition: hyjal_trash.h:34