TrinityCore
Loading...
Searching...
No Matches
boss_hydromancer_thespia.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 "ScriptedCreature.h"
20#include "steam_vault.h"
21
23{
28};
29
36
43
45{
46 public:
47 boss_hydromancer_thespia() : CreatureScript("boss_hydromancer_thespia") { }
48
49 struct boss_thespiaAI : public BossAI
50 {
52
53 void Reset() override
54 {
55 _Reset();
56 }
57
58 void JustDied(Unit* /*killer*/) override
59 {
61 _JustDied();
62 }
63
64 void KilledUnit(Unit* who) override
65 {
66 if (who->GetTypeId() == TYPEID_PLAYER)
68 }
69
79
80 void ExecuteEvent(uint32 eventId) override
81 {
82 switch (eventId)
83 {
85 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 30.0f, true))
87 // cast twice in Heroic mode
88 if (IsHeroic())
89 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 30.0f, true))
91
93 break;
95 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 40.0f, true))
96 DoCast(target, SPELL_LUNG_BURST);
98 break;
100 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 35.0f, true))
102 // cast twice in Heroic mode
103 if (IsHeroic())
104 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 35.0f, true))
106
108 break;
109 default:
110 break;
111 }
112 }
113 };
114
115 CreatureAI* GetAI(Creature* creature) const override
116 {
117 return GetSteamVaultAI<boss_thespiaAI>(creature);
118 }
119};
120
126
128{
129 public:
130 npc_coilfang_waterelemental() : CreatureScript("npc_coilfang_waterelemental") { }
131
133 {
135
136 void Reset() override
137 {
138 _events.Reset();
139 }
140
141 void JustEngagedWith(Unit* /*who*/) override
142 {
144 }
145
146 void UpdateAI(uint32 diff) override
147 {
148 if (!UpdateVictim())
149 return;
150
151 _events.Update(diff);
152
154 return;
155
156 while (uint32 eventId = _events.ExecuteEvent())
157 {
158 switch (eventId)
159 {
163 break;
164 default:
165 break;
166 }
167 }
168 }
169
170 private:
172 };
173
174 CreatureAI* GetAI(Creature* creature) const override
175 {
176 return GetSteamVaultAI<npc_coilfang_waterelementalAI>(creature);
177 }
178};
179
uint32_t uint32
Definition Define.h:154
@ TYPEID_PLAYER
Definition ObjectGuid.h:44
Spells
Definition PlayerAI.cpp:32
@ UNIT_STATE_CASTING
Definition Unit.h:276
void AddSC_boss_hydromancer_thespia()
Yells
TypeID GetTypeId() const
Definition BaseEntity.h:166
void JustEngagedWith(Unit *who) override
EventMap events
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:63
uint32 ExecuteEvent()
Definition EventMap.cpp:77
void Update(uint32 time)
Definition EventMap.h:61
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition EventMap.cpp:40
void Reset()
Definition EventMap.cpp:25
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:635
bool HasUnitState(const uint32 f) const
Definition Unit.h:743
CreatureAI * GetAI(Creature *creature) const override
CreatureAI * GetAI(Creature *creature) const override
@ DATA_HYDROMANCER_THESPIA
Definition steam_vault.h:30
bool IsHeroic() const