TrinityCore
boss_postmaster_malown.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
/* ScriptData
19
SDName: boss_postmaster_malown
20
SD%Complete: 50
21
SDComment:
22
SDCategory: Stratholme
23
EndScriptData */
24
25
#include "
ScriptMgr.h
"
26
#include "
ScriptedCreature.h
"
27
#include "
stratholme.h
"
28
29
//Spell ID to summon this guy is 24627 "Summon Postmaster Malown"
30
//He should be spawned along with three other elites once the third postbox has been opened
31
32
enum
Says
33
{
34
SAY_KILL
= 0
35
};
36
37
enum
Spells
38
{
39
SPELL_WAILINGDEAD
= 7713,
40
SPELL_BACKHAND
= 6253,
41
SPELL_CURSEOFWEAKNESS
= 8552,
42
SPELL_CURSEOFTONGUES
= 12889,
43
SPELL_CALLOFTHEGRAVE
= 17831
44
};
45
46
enum
Events
47
{
48
EVENT_WAILINGDEAD
= 1,
49
EVENT_BACKHAND
= 2,
50
EVENT_CURSEOFWEAKNESS
= 3,
51
EVENT_CURSEOFTONGUES
= 4,
52
EVENT_CALLOFTHEGRAVE
= 5
53
};
54
55
class
boss_postmaster_malown
:
public
CreatureScript
56
{
57
public
:
58
boss_postmaster_malown
() :
CreatureScript
(
"boss_postmaster_malown"
) { }
59
60
struct
boss_postmaster_malownAI
:
public
BossAI
61
{
62
boss_postmaster_malownAI
(
Creature
* creature) :
BossAI
(creature,
BOSS_POSTMASTER_MALOWN
) { }
63
64
void
Reset
()
override
{ }
65
66
void
JustEngagedWith
(
Unit
*
/*who*/
)
override
67
{
68
events
.
ScheduleEvent
(
EVENT_WAILINGDEAD
, 19s);
// lasts 6 sec
69
events
.
ScheduleEvent
(
EVENT_BACKHAND
, 8s);
// 2 sec stun
70
events
.
ScheduleEvent
(
EVENT_CURSEOFWEAKNESS
, 20s);
// lasts 2 mins
71
events
.
ScheduleEvent
(
EVENT_CURSEOFTONGUES
, 22s);
72
events
.
ScheduleEvent
(
EVENT_CALLOFTHEGRAVE
, 25s);
73
}
74
75
void
KilledUnit
(
Unit
*
/*victim*/
)
override
76
{
77
Talk
(
SAY_KILL
);
78
}
79
80
void
UpdateAI
(
uint32
diff)
override
81
{
82
if
(!
UpdateVictim
())
83
return
;
84
85
events
.
Update
(diff);
86
87
if
(
me
->
HasUnitState
(
UNIT_STATE_CASTING
))
88
return
;
89
90
while
(
uint32
eventId =
events
.
ExecuteEvent
())
91
{
92
switch
(eventId)
93
{
94
case
EVENT_WAILINGDEAD
:
95
if
(
rand32
() % 100 < 65)
//65% chance to cast
96
DoCastVictim
(
SPELL_WAILINGDEAD
,
true
);
97
events
.
ScheduleEvent
(
EVENT_WAILINGDEAD
, 19s);
98
break
;
99
case
EVENT_BACKHAND
:
100
if
(
rand32
() % 100 < 45)
//45% chance to cast
101
DoCastVictim
(
SPELL_BACKHAND
,
true
);
102
events
.
ScheduleEvent
(
EVENT_WAILINGDEAD
, 8s);
103
break
;
104
case
EVENT_CURSEOFWEAKNESS
:
105
if
(
rand32
() % 100 < 3)
//3% chance to cast
106
DoCastVictim
(
SPELL_CURSEOFWEAKNESS
,
true
);
107
events
.
ScheduleEvent
(
EVENT_WAILINGDEAD
, 20s);
108
break
;
109
case
EVENT_CURSEOFTONGUES
:
110
if
(
rand32
() % 100 < 3)
//3% chance to cast
111
DoCastVictim
(
SPELL_CURSEOFTONGUES
,
true
);
112
events
.
ScheduleEvent
(
EVENT_WAILINGDEAD
, 22s);
113
break
;
114
case
EVENT_CALLOFTHEGRAVE
:
115
if
(
rand32
() % 100 < 5)
//5% chance to cast
116
DoCastVictim
(
SPELL_CALLOFTHEGRAVE
,
true
);
117
events
.
ScheduleEvent
(
EVENT_WAILINGDEAD
, 25s);
118
break
;
119
default
:
120
break
;
121
}
122
123
if
(
me
->
HasUnitState
(
UNIT_STATE_CASTING
))
124
return
;
125
}
126
}
127
};
128
129
CreatureAI
*
GetAI
(
Creature
* creature)
const override
130
{
131
return
GetStratholmeAI<boss_postmaster_malownAI>(creature);
132
}
133
};
134
135
void
AddSC_boss_postmaster_malown
()
136
{
137
new
boss_postmaster_malown
();
138
}
uint32
uint32_t uint32
Definition:
Define.h:142
Spells
Spells
Definition:
PlayerAI.cpp:32
rand32
uint32 rand32()
Definition:
Random.cpp:70
ScriptMgr.h
ScriptedCreature.h
UNIT_STATE_CASTING
@ UNIT_STATE_CASTING
Definition:
Unit.h:270
Events
Events
Definition:
boss_garothi_worldbreaker.cpp:101
Says
Says
Definition:
boss_halycon.cpp:29
SAY_KILL
@ SAY_KILL
Definition:
boss_postmaster_malown.cpp:34
SPELL_WAILINGDEAD
@ SPELL_WAILINGDEAD
Definition:
boss_postmaster_malown.cpp:39
SPELL_CURSEOFWEAKNESS
@ SPELL_CURSEOFWEAKNESS
Definition:
boss_postmaster_malown.cpp:41
SPELL_CALLOFTHEGRAVE
@ SPELL_CALLOFTHEGRAVE
Definition:
boss_postmaster_malown.cpp:43
SPELL_CURSEOFTONGUES
@ SPELL_CURSEOFTONGUES
Definition:
boss_postmaster_malown.cpp:42
SPELL_BACKHAND
@ SPELL_BACKHAND
Definition:
boss_postmaster_malown.cpp:40
AddSC_boss_postmaster_malown
void AddSC_boss_postmaster_malown()
Definition:
boss_postmaster_malown.cpp:135
EVENT_BACKHAND
@ EVENT_BACKHAND
Definition:
boss_postmaster_malown.cpp:49
EVENT_CALLOFTHEGRAVE
@ EVENT_CALLOFTHEGRAVE
Definition:
boss_postmaster_malown.cpp:52
EVENT_WAILINGDEAD
@ EVENT_WAILINGDEAD
Definition:
boss_postmaster_malown.cpp:48
EVENT_CURSEOFTONGUES
@ EVENT_CURSEOFTONGUES
Definition:
boss_postmaster_malown.cpp:51
EVENT_CURSEOFWEAKNESS
@ EVENT_CURSEOFWEAKNESS
Definition:
boss_postmaster_malown.cpp:50
BossAI
Definition:
ScriptedCreature.h:312
BossAI::events
EventMap events
Definition:
ScriptedCreature.h:350
CreatureAI
Definition:
CreatureAI.h:59
CreatureAI::Talk
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition:
CreatureAI.cpp:56
CreatureAI::UpdateVictim
bool UpdateVictim()
Definition:
CreatureAI.cpp:245
CreatureAI::me
Creature *const me
Definition:
CreatureAI.h:61
CreatureScript
Definition:
ScriptMgr.h:430
Creature
Definition:
Creature.h:70
EventMap::ExecuteEvent
uint32 ExecuteEvent()
Definition:
EventMap.cpp:73
EventMap::Update
void Update(uint32 time)
Definition:
EventMap.h:56
EventMap::ScheduleEvent
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition:
EventMap.cpp:36
UnitAI::DoCastVictim
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition:
UnitAI.cpp:180
Unit
Definition:
Unit.h:627
Unit::HasUnitState
bool HasUnitState(const uint32 f) const
Definition:
Unit.h:732
boss_postmaster_malown
Definition:
boss_postmaster_malown.cpp:56
boss_postmaster_malown::boss_postmaster_malown
boss_postmaster_malown()
Definition:
boss_postmaster_malown.cpp:58
boss_postmaster_malown::GetAI
CreatureAI * GetAI(Creature *creature) const override
Definition:
boss_postmaster_malown.cpp:129
stratholme.h
BOSS_POSTMASTER_MALOWN
@ BOSS_POSTMASTER_MALOWN
Definition:
stratholme.h:41
boss_postmaster_malown::boss_postmaster_malownAI
Definition:
boss_postmaster_malown.cpp:61
boss_postmaster_malown::boss_postmaster_malownAI::UpdateAI
void UpdateAI(uint32 diff) override
Definition:
boss_postmaster_malown.cpp:80
boss_postmaster_malown::boss_postmaster_malownAI::Reset
void Reset() override
Definition:
boss_postmaster_malown.cpp:64
boss_postmaster_malown::boss_postmaster_malownAI::JustEngagedWith
void JustEngagedWith(Unit *) override
Definition:
boss_postmaster_malown.cpp:66
boss_postmaster_malown::boss_postmaster_malownAI::KilledUnit
void KilledUnit(Unit *) override
Definition:
boss_postmaster_malown.cpp:75
boss_postmaster_malown::boss_postmaster_malownAI::boss_postmaster_malownAI
boss_postmaster_malownAI(Creature *creature)
Definition:
boss_postmaster_malown.cpp:62
server
scripts
EasternKingdoms
Stratholme
boss_postmaster_malown.cpp
Generated on Thu Mar 14 2024 23:39:27 for TrinityCore by
1.9.4