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/* Timers requires update */
19
20#include "ScriptMgr.h"
21#include "ScriptedCreature.h"
22#include "SpellInfo.h"
23#include "steam_vault.h"
24
32
41
48
49// 17797 - Hydromancer Thespia
51{
53
63
64 void OnSpellCast(SpellInfo const* spell) override
65 {
66 if (spell->Id == SPELL_LIGHTNING_CLOUD)
67 if (roll_chance_i(50))
69 }
70
71 void KilledUnit(Unit* who) override
72 {
73 if (who->GetTypeId() == TYPEID_PLAYER)
75 }
76
77 void JustDied(Unit* /*killer*/) override
78 {
80 _JustDied();
81 }
82
83 void ExecuteEvent(uint32 eventId) override
84 {
85 switch (eventId)
86 {
88 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 30.0f, true))
90 events.Repeat(15s, 25s);
91 break;
93 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 40.0f, true))
94 DoCast(target, SPELL_LUNG_BURST);
95 events.Repeat(7s, 12s);
96 break;
98 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 35.0f, true))
100 events.Repeat(10s, 15s);
101 break;
102 default:
103 break;
104 }
105 }
106};
107
108// 17917 - Coilfang Water Elemental
110{
112
113 void Reset() override
114 {
116 }
117
118 void JustEngagedWith(Unit* /*who*/) override
119 {
120 _scheduler.Schedule(4s, 12s, [this](TaskContext task)
121 {
123 task.Repeat(8s, 15s);
124 });
125 }
126
127 void UpdateAI(uint32 diff) override
128 {
129 if (!UpdateVictim())
130 return;
131
132 _scheduler.Update(diff);
133
135 }
136
137private:
139};
140
uint32_t uint32
Definition Define.h:133
@ TYPEID_PLAYER
Definition ObjectGuid.h:39
bool roll_chance_i(int chance)
Definition Random.h:59
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:63
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
TypeID GetTypeId() const
Definition Object.h:93
uint32 Id
Definition SpellInfo.h:289
TaskContext & Repeat(std::chrono::duration< _Rep, _Period > const &duration)
TaskScheduler & CancelAll()
TaskScheduler & Schedule(std::chrono::duration< _Rep, _Period > const &time, task_handler_t const &task)
TaskScheduler & Update(success_t const &callback=EmptyCallback)
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
@ DATA_HYDROMANCER_THESPIA
Definition steam_vault.h:30
#define RegisterSteamVaultCreatureAI(ai_name)
Definition steam_vault.h:70
void ExecuteEvent(uint32 eventId) override
boss_hydromancer_thespia(Creature *creature)
void KilledUnit(Unit *who) override
void OnSpellCast(SpellInfo const *spell) override
void JustEngagedWith(Unit *who) override
void UpdateAI(uint32 diff) override