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/*
19 * Timers requires to be revisited
20 */
21
22#include "ScriptMgr.h"
23#include "ScriptedCreature.h"
24#include "SpellInfo.h"
25#include "steam_vault.h"
26
34
43
50
51// 17797 - Hydromancer Thespia
53{
55
66
67 void OnSpellCast(SpellInfo const* spellInfo) override
68 {
69 if (spellInfo->Id == SPELL_LIGHTNING_CLOUD)
70 if (roll_chance(50))
72 }
73
74 void KilledUnit(Unit* /*who*/) override
75 {
77 }
78
79 void JustDied(Unit* /*killer*/) override
80 {
81 _JustDied();
83 }
84
85 void ExecuteEvent(uint32 eventId) override
86 {
87 switch (eventId)
88 {
90 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 30.0f))
92 events.Repeat(20s, 35s);
93 break;
95 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 40.0f))
96 DoCast(target, SPELL_LUNG_BURST);
97 events.Repeat(20s, 30s);
98 break;
100 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 35.0f))
102 events.Repeat(25s, 40s);
103 break;
104 default:
105 break;
106 }
107 }
108};
109
110// 17917 - Coilfang Water Elemental
112{
114
115 void Reset() override
116 {
118 }
119
120 void JustEngagedWith(Unit* /*who*/) override
121 {
122 _scheduler.Schedule(4s, 12s, [this](TaskContext& task)
123 {
125 task.Repeat(8s, 15s);
126 });
127 }
128
129 void UpdateAI(uint32 diff) override
130 {
131 if (!UpdateVictim())
132 return;
133
134 _scheduler.Update(diff);
135 }
136
137private:
139};
140
uint32_t uint32
Definition Define.h:154
bool roll_chance(float chance, PseudoRandomDistributionState &state)
Definition Random.cpp:131
void AddSC_boss_hydromancer_thespia()
@ SPELL_WATER_BOLT_VOLLEY
void JustEngagedWith(Unit *who) override
EventMap events
bool UpdateVictim()
void Repeat(Milliseconds time)
Definition EventMap.cpp:67
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:40
uint32 const Id
Definition SpellInfo.h:328
TaskContext & Repeat(TaskScheduler::duration_t duration)
TaskScheduler & CancelAll()
TaskScheduler & Schedule(duration_t time, task_handler_t task)
TaskScheduler & Update()
Update the scheduler to the current time.
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:160
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:71
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:81
Definition Unit.h:647
@ DATA_HYDROMANCER_THESPIA
Definition steam_vault.h:30
#define RegisterSteamVaultCreatureAI(ai_name)
Definition steam_vault.h:61
ScriptedAI(Creature *creature, uint32 scriptId=0) noexcept
void ExecuteEvent(uint32 eventId) override
boss_hydromancer_thespia(Creature *creature)
void OnSpellCast(SpellInfo const *spellInfo) override
void JustEngagedWith(Unit *who) override
void UpdateAI(uint32 diff) override