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
19SDName: boss_postmaster_malown
20SD%Complete: 50
21SDComment:
22SDCategory: Stratholme
23EndScriptData */
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
32enum Says
33{
34 SAY_KILL = 0
35};
36
38{
44};
45
47{
53};
54
56{
57 public:
58 boss_postmaster_malown() : CreatureScript("boss_postmaster_malown") { }
59
61 {
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
73 }
74
75 void KilledUnit(Unit* /*victim*/) override
76 {
78 }
79
80 void UpdateAI(uint32 diff) override
81 {
82 if (!UpdateVictim())
83 return;
84
85 events.Update(diff);
86
88 return;
89
90 while (uint32 eventId = events.ExecuteEvent())
91 {
92 switch (eventId)
93 {
95 if (rand32() % 100 < 65) //65% chance to cast
98 break;
99 case EVENT_BACKHAND:
100 if (rand32() % 100 < 45) //45% chance to cast
103 break;
105 if (rand32() % 100 < 3) //3% chance to cast
108 break;
110 if (rand32() % 100 < 3) //3% chance to cast
113 break;
115 if (rand32() % 100 < 5) //5% chance to cast
118 break;
119 default:
120 break;
121 }
122
124 return;
125 }
126 }
127 };
128
129 CreatureAI* GetAI(Creature* creature) const override
130 {
131 return GetStratholmeAI<boss_postmaster_malownAI>(creature);
132 }
133};
134
136{
138}
uint32_t uint32
Definition: Define.h:142
Spells
Definition: PlayerAI.cpp:32
uint32 rand32()
Definition: Random.cpp:70
@ UNIT_STATE_CASTING
Definition: Unit.h:270
Says
@ SPELL_WAILINGDEAD
@ SPELL_CURSEOFWEAKNESS
@ SPELL_CALLOFTHEGRAVE
@ SPELL_CURSEOFTONGUES
void AddSC_boss_postmaster_malown()
@ EVENT_CALLOFTHEGRAVE
@ EVENT_WAILINGDEAD
@ EVENT_CURSEOFTONGUES
@ EVENT_CURSEOFWEAKNESS
EventMap events
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:56
bool UpdateVictim()
Definition: CreatureAI.cpp:245
Creature *const me
Definition: CreatureAI.h:61
uint32 ExecuteEvent()
Definition: EventMap.cpp:73
void Update(uint32 time)
Definition: EventMap.h:56
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:36
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.cpp:180
Definition: Unit.h:627
bool HasUnitState(const uint32 f) const
Definition: Unit.h:732
CreatureAI * GetAI(Creature *creature) const override
@ BOSS_POSTMASTER_MALOWN
Definition: stratholme.h:41