TrinityCore
Loading...
Searching...
No Matches
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/*
19 * Combat timers requires to be revisited
20 */
21
22#include "ScriptMgr.h"
23#include "hyjal.h"
24#include "MotionMaster.h"
25#include "ScriptedCreature.h"
26#include "SpellInfo.h"
27
36
45
54
55// 17767 - Rage Winterchill
57{
59
65
76
77 void OnSpellCast(SpellInfo const* spellInfo) override
78 {
79 switch (spellInfo->Id)
80 {
82 if (roll_chance_i(30))
84 break;
86 if (roll_chance_i(30))
88 break;
89 default:
90 break;
91 }
92 }
93
94 void WaypointPathEnded(uint32 /*waypointId*/, uint32 pathId) override
95 {
96 switch (pathId)
97 {
102 break;
103 default:
104 break;
105 }
106 }
107
108 // Do not reset SetActive, we want boss to be active all the time
109 void JustReachedHome() override { }
110
111 void KilledUnit(Unit* victim) override
112 {
113 if (victim->GetTypeId() == TYPEID_PLAYER)
114 Talk(SAY_SLAY);
115 }
116
117 void JustDied(Unit* /*killer*/) override
118 {
119 _JustDied();
121 }
122
123 void UpdateAI(uint32 diff) override
124 {
125 if (!UpdateVictim())
126 return;
127
128 events.Update(diff);
129
131 return;
132
133 while (uint32 eventId = events.ExecuteEvent())
134 {
135 switch (eventId)
136 {
137 case EVENT_ICEBOLT:
138 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 40.0f, true))
139 DoCast(target, SPELL_ICEBOLT);
140 events.Repeat(6s, 8s);
141 break;
142 case EVENT_FROST_NOVA:
143 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 45.0f))
144 DoCast(target, SPELL_FROST_NOVA);
145 events.Repeat(30s, 45s);
146 break;
149 events.Repeat(40s, 60s);
150 break;
152 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 40.0f))
154 events.Repeat(35s, 50s);
155 break;
156 case EVENT_BERSERK:
158 break;
159 default:
160 break;
161 }
162
164 return;
165 }
166
168 }
169};
170
First const & RAND(First const &first, Second const &second, Rest const &... rest)
uint32_t uint32
Definition Define.h:133
@ TYPEID_PLAYER
Definition ObjectGuid.h:39
bool roll_chance_i(int chance)
Definition Random.h:59
@ UNIT_STATE_CASTING
Definition Unit.h:235
void AddSC_boss_rage_winterchill()
@ EVENT_FROST_ARMOR
@ EVENT_DEATH_AND_DECAY
@ SPELL_DEATH_AND_DECAY
@ SPELL_FROST_ARMOR
void JustEngagedWith(Unit *who) override
EventMap events
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
void Update(uint32 time)
Definition EventMap.h:67
void Repeat(Milliseconds time)
Definition EventMap.cpp:63
EventId ExecuteEvent()
Definition EventMap.cpp:73
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
void MovePath(uint32 pathId, bool repeatable)
TypeID GetTypeId() const
Definition Object.h:93
uint32 Id
Definition SpellInfo.h:289
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:241
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:96
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:106
Definition Unit.h:769
MotionMaster * GetMotionMaster()
Definition Unit.h:1667
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
@ PATH_ALLY_BASE_2
Definition hyjal.h:104
@ PATH_ALLY_INITIAL_1
Definition hyjal.h:99
@ PATH_ALLY_INITIAL_2
Definition hyjal.h:100
@ PATH_ALLY_BASE_3
Definition hyjal.h:105
@ PATH_ALLY_BASE_1
Definition hyjal.h:103
@ PATH_ALLY_INITIAL_3
Definition hyjal.h:101
@ DATA_RAGEWINTERCHILL
Definition hyjal.h:30
#define RegisterHyjalCreatureAI(ai_name)
Definition hyjal.h:126
void UpdateAI(uint32 diff) override
boss_rage_winterchill(Creature *creature)
void KilledUnit(Unit *victim) override
void WaypointPathEnded(uint32, uint32 pathId) override
void JustDied(Unit *) override
void OnSpellCast(SpellInfo const *spellInfo) override
void JustEngagedWith(Unit *who) override