TrinityCore
Loading...
Searching...
No Matches
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
30
38
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(50))
60 }
61
62 void JustDied(Unit* /*killer*/) override
63 {
65 _JustDied();
66 }
67
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
uint32_t uint32
Definition Define.h:154
std::chrono::seconds Seconds
Seconds shorthand typedef.
Definition Duration.h:28
Spells
Definition PlayerAI.cpp:32
bool roll_chance(T chance)
Definition Random.h:55
@ UNIT_STATE_CASTING
Definition Unit.h:276
void AddSC_boss_maiden_of_virtue()
Yells
void JustEngagedWith(Unit *who) override
EventMap events
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:63
uint32 ExecuteEvent()
Definition EventMap.cpp:77
void Update(uint32 time)
Definition EventMap.h:61
void Repeat(Milliseconds time)
Definition EventMap.cpp:67
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition EventMap.cpp:40
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:160
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:635
bool HasUnitState(const uint32 f) const
Definition Unit.h:743
CreatureAI * GetAI(Creature *creature) const override
@ DATA_MAIDEN_OF_VIRTUE
Definition karazhan.h:32