TrinityCore
boss_maiden_of_virtue.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#include "ScriptMgr.h"
19#include "karazhan.h"
20#include "ScriptedCreature.h"
21
23{
28 SPELL_BERSERK = 26662
29};
30
32{
36 SAY_DEATH = 3
37};
38
40{
44 EVENT_ENRAGE = 4
45};
46
48{
49public:
50 boss_maiden_of_virtue() : CreatureScript("boss_maiden_of_virtue") { }
51
53 {
55
56 void KilledUnit(Unit* /*Victim*/) override
57 {
58 if (roll_chance_i(50))
60 }
61
62 void JustDied(Unit* /*killer*/) override
63 {
65 _JustDied();
66 }
67
68 void JustEngagedWith(Unit* who) override
69 {
72
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 {
98 break;
99 case EVENT_HOLYFIRE:
100 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 50, true))
101 DoCast(target, SPELL_HOLYFIRE);
102 events.Repeat(Seconds(8), Seconds(19));
103 break;
104 case EVENT_HOLYWRATH:
105 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 80, true))
106 DoCast(target, SPELL_HOLYWRATH);
107 events.Repeat(Seconds(15), Seconds(25));
108 break;
109 case EVENT_ENRAGE:
111 break;
112 default:
113 break;
114 }
115
117 return;
118 }
119 }
120 };
121
122 CreatureAI* GetAI(Creature* creature) const override
123 {
124 return GetKarazhanAI<boss_maiden_of_virtueAI>(creature);
125 }
126};
127
129{
131}
uint32_t uint32
Definition: Define.h:142
std::chrono::seconds Seconds
Seconds shorthand typedef.
Definition: Duration.h:32
Spells
Definition: PlayerAI.cpp:32
bool roll_chance_i(int chance)
Definition: Random.h:59
@ UNIT_STATE_CASTING
Definition: Unit.h:270
@ SAY_REPENTANCE
@ SPELL_HOLYGROUND
@ SPELL_REPENTANCE
@ SPELL_HOLYWRATH
@ SPELL_HOLYFIRE
void AddSC_boss_maiden_of_virtue()
@ EVENT_HOLYFIRE
@ EVENT_REPENTANCE
@ EVENT_HOLYWRATH
Yells
void JustEngagedWith(Unit *who) override
EventMap events
void _JustDied()
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 Repeat(Milliseconds time)
Definition: EventMap.cpp:63
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:36
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.h:159
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.cpp:180
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition: UnitAI.cpp:79
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:89
Definition: Unit.h:627
bool HasUnitState(const uint32 f) const
Definition: Unit.h:732
CreatureAI * GetAI(Creature *creature) const override
@ DATA_MAIDEN_OF_VIRTUE
Definition: karazhan.h:32