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
27
enum
ThespiaTexts
28
{
29
SAY_CLOUD
= 0,
30
SAY_AGGRO
= 1,
31
SAY_SLAY
= 2,
32
SAY_DEATH
= 3
33
};
34
35
enum
ThespiaSpells
36
{
37
SPELL_LIGHTNING_CLOUD
= 25033,
38
SPELL_LUNG_BURST
= 31481,
39
SPELL_ENVELOPING_WINDS
= 31718,
40
41
SPELL_WATER_BOLT_VOLLEY
= 34449
42
};
43
44
enum
ThespiaEvents
45
{
46
EVENT_LIGHTNING_CLOUD
= 1,
47
EVENT_LUNG_BURST
,
48
EVENT_ENVELOPING_WINDS
49
};
50
51
// 17797 - Hydromancer Thespia
52
struct
boss_hydromancer_thespia
:
public
BossAI
53
{
54
boss_hydromancer_thespia
(
Creature
* creature) :
BossAI
(creature,
DATA_HYDROMANCER_THESPIA
) { }
55
56
void
JustEngagedWith
(
Unit
* who)
override
57
{
58
BossAI::JustEngagedWith
(who);
59
60
Talk
(
SAY_AGGRO
);
61
62
events
.
ScheduleEvent
(
EVENT_LIGHTNING_CLOUD
, 5s, 15s);
63
events
.
ScheduleEvent
(
EVENT_LUNG_BURST
, 10s, 20s);
64
events
.
ScheduleEvent
(
EVENT_ENVELOPING_WINDS
, 10s, 20s);
65
}
66
67
void
OnSpellCast
(
SpellInfo
const
* spellInfo)
override
68
{
69
if
(spellInfo->
Id
==
SPELL_LIGHTNING_CLOUD
)
70
if
(
roll_chance
(50))
71
Talk
(
SAY_CLOUD
);
72
}
73
74
void
KilledUnit
(
Unit
*
/*who*/
)
override
75
{
76
Talk
(
SAY_SLAY
);
77
}
78
79
void
JustDied
(
Unit
*
/*killer*/
)
override
80
{
81
_JustDied
();
82
Talk
(
SAY_DEATH
);
83
}
84
85
void
ExecuteEvent
(
uint32
eventId)
override
86
{
87
switch
(eventId)
88
{
89
case
EVENT_LIGHTNING_CLOUD
:
90
if
(
Unit
* target =
SelectTarget
(
SelectTargetMethod::Random
, 0, 30.0f))
91
DoCast
(target,
SPELL_LIGHTNING_CLOUD
);
92
events
.
Repeat
(20s, 35s);
93
break
;
94
case
EVENT_LUNG_BURST
:
95
if
(
Unit
* target =
SelectTarget
(
SelectTargetMethod::Random
, 0, 40.0f))
96
DoCast
(target,
SPELL_LUNG_BURST
);
97
events
.
Repeat
(20s, 30s);
98
break
;
99
case
EVENT_ENVELOPING_WINDS
:
100
if
(
Unit
* target =
SelectTarget
(
SelectTargetMethod::Random
, 0, 35.0f))
101
DoCast
(target,
SPELL_ENVELOPING_WINDS
);
102
events
.
Repeat
(25s, 40s);
103
break
;
104
default
:
105
break
;
106
}
107
}
108
};
109
110
// 17917 - Coilfang Water Elemental
111
struct
npc_coilfang_waterelemental
:
public
ScriptedAI
112
{
113
using
ScriptedAI::ScriptedAI
;
114
115
void
Reset
()
override
116
{
117
_scheduler
.
CancelAll
();
118
}
119
120
void
JustEngagedWith
(
Unit
*
/*who*/
)
override
121
{
122
_scheduler
.
Schedule
(4s, 12s, [
this
](
TaskContext
& task)
123
{
124
DoCastSelf
(
SPELL_WATER_BOLT_VOLLEY
);
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
137
private
:
138
TaskScheduler
_scheduler
;
139
};
140
141
void
AddSC_boss_hydromancer_thespia
()
142
{
143
RegisterSteamVaultCreatureAI
(
boss_hydromancer_thespia
);
144
RegisterSteamVaultCreatureAI
(
npc_coilfang_waterelemental
);
145
}
uint32
uint32_t uint32
Definition
Define.h:154
roll_chance
bool roll_chance(float chance, PseudoRandomDistributionState &state)
Definition
Random.cpp:131
ScriptMgr.h
ScriptedCreature.h
SpellInfo.h
SelectTargetMethod::Random
@ Random
Talk
Talk
Definition
boss_hadronox.cpp:130
AddSC_boss_hydromancer_thespia
void AddSC_boss_hydromancer_thespia()
Definition
boss_hydromancer_thespia.cpp:141
ThespiaEvents
ThespiaEvents
Definition
boss_hydromancer_thespia.cpp:45
EVENT_LUNG_BURST
@ EVENT_LUNG_BURST
Definition
boss_hydromancer_thespia.cpp:47
EVENT_ENVELOPING_WINDS
@ EVENT_ENVELOPING_WINDS
Definition
boss_hydromancer_thespia.cpp:48
EVENT_LIGHTNING_CLOUD
@ EVENT_LIGHTNING_CLOUD
Definition
boss_hydromancer_thespia.cpp:46
ThespiaTexts
ThespiaTexts
Definition
boss_hydromancer_thespia.cpp:28
SAY_DEATH
@ SAY_DEATH
Definition
boss_hydromancer_thespia.cpp:32
SAY_CLOUD
@ SAY_CLOUD
Definition
boss_hydromancer_thespia.cpp:29
SAY_AGGRO
@ SAY_AGGRO
Definition
boss_hydromancer_thespia.cpp:30
SAY_SLAY
@ SAY_SLAY
Definition
boss_hydromancer_thespia.cpp:31
ThespiaSpells
ThespiaSpells
Definition
boss_hydromancer_thespia.cpp:36
SPELL_LUNG_BURST
@ SPELL_LUNG_BURST
Definition
boss_hydromancer_thespia.cpp:38
SPELL_WATER_BOLT_VOLLEY
@ SPELL_WATER_BOLT_VOLLEY
Definition
boss_hydromancer_thespia.cpp:41
SPELL_ENVELOPING_WINDS
@ SPELL_ENVELOPING_WINDS
Definition
boss_hydromancer_thespia.cpp:39
SPELL_LIGHTNING_CLOUD
@ SPELL_LIGHTNING_CLOUD
Definition
boss_hydromancer_thespia.cpp:37
BossAI
Definition
ScriptedCreature.h:313
BossAI::JustEngagedWith
void JustEngagedWith(Unit *who) override
Definition
ScriptedCreature.h:334
BossAI::events
EventMap events
Definition
ScriptedCreature.h:351
BossAI::_JustDied
void _JustDied()
Definition
ScriptedCreature.cpp:570
CreatureAI::UpdateVictim
bool UpdateVictim()
Definition
CreatureAI.cpp:244
Creature
Definition
Creature.h:82
EventMap::Repeat
void Repeat(Milliseconds time)
Definition
EventMap.cpp:67
EventMap::ScheduleEvent
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition
EventMap.cpp:40
SpellInfo
Definition
SpellInfo.h:324
SpellInfo::Id
uint32 const Id
Definition
SpellInfo.h:328
TaskContext
Definition
TaskScheduler.h:370
TaskContext::Repeat
TaskContext & Repeat(TaskScheduler::duration_t duration)
Definition
TaskScheduler.cpp:319
TaskScheduler
Definition
TaskScheduler.h:49
TaskScheduler::CancelAll
TaskScheduler & CancelAll()
Definition
TaskScheduler.cpp:86
TaskScheduler::Schedule
TaskScheduler & Schedule(duration_t time, task_handler_t task)
Definition
TaskScheduler.h:265
TaskScheduler::Update
TaskScheduler & Update()
Update the scheduler to the current time.
Definition
TaskScheduler.cpp:38
UnitAI::DoCastSelf
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition
UnitAI.h:160
UnitAI::SelectTarget
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition
UnitAI.cpp:71
UnitAI::DoCast
SpellCastResult DoCast(uint32 spellId)
Definition
UnitAI.cpp:81
Unit
Definition
Unit.h:647
steam_vault.h
DATA_HYDROMANCER_THESPIA
@ DATA_HYDROMANCER_THESPIA
Definition
steam_vault.h:30
RegisterSteamVaultCreatureAI
#define RegisterSteamVaultCreatureAI(ai_name)
Definition
steam_vault.h:61
ScriptedAI
Definition
ScriptedCreature.h:135
ScriptedAI::ScriptedAI
ScriptedAI(Creature *creature, uint32 scriptId=0) noexcept
Definition
ScriptedCreature.cpp:126
boss_hydromancer_thespia
Definition
boss_hydromancer_thespia.cpp:53
boss_hydromancer_thespia::ExecuteEvent
void ExecuteEvent(uint32 eventId) override
Definition
boss_hydromancer_thespia.cpp:85
boss_hydromancer_thespia::KilledUnit
void KilledUnit(Unit *) override
Definition
boss_hydromancer_thespia.cpp:74
boss_hydromancer_thespia::boss_hydromancer_thespia
boss_hydromancer_thespia(Creature *creature)
Definition
boss_hydromancer_thespia.cpp:54
boss_hydromancer_thespia::OnSpellCast
void OnSpellCast(SpellInfo const *spellInfo) override
Definition
boss_hydromancer_thespia.cpp:67
boss_hydromancer_thespia::JustDied
void JustDied(Unit *) override
Definition
boss_hydromancer_thespia.cpp:79
boss_hydromancer_thespia::JustEngagedWith
void JustEngagedWith(Unit *who) override
Definition
boss_hydromancer_thespia.cpp:56
npc_coilfang_waterelemental
Definition
boss_hydromancer_thespia.cpp:112
npc_coilfang_waterelemental::UpdateAI
void UpdateAI(uint32 diff) override
Definition
boss_hydromancer_thespia.cpp:129
npc_coilfang_waterelemental::JustEngagedWith
void JustEngagedWith(Unit *) override
Definition
boss_hydromancer_thespia.cpp:120
npc_coilfang_waterelemental::Reset
void Reset() override
Definition
boss_hydromancer_thespia.cpp:115
npc_coilfang_waterelemental::_scheduler
TaskScheduler _scheduler
Definition
boss_hydromancer_thespia.cpp:138
server
scripts
Outland
CoilfangReservoir
SteamVault
boss_hydromancer_thespia.cpp
Generated by
1.9.8