TrinityCore
boss_baroness_anastari.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 "InstanceScript.h"
19#include "ObjectAccessor.h"
20#include "Player.h"
21#include "ScriptMgr.h"
22#include "ScriptedCreature.h"
23#include "stratholme.h"
24
26{
30 SPELL_POSSESS = 17244, // the charm on player
31 SPELL_POSSESSED = 17246, // the damage debuff on player
32 SPELL_POSSESS_INV = 17250 // baroness becomes invisible while possessing a target
33};
34
36{
42};
43
45{
47
49
50 void Reset() override
51 {
52 _Reset();
53
55
59
60 events.Reset();
61 }
62
63 void JustEngagedWith(Unit* /*who*/) override
64 {
69 }
70
71 void UpdateAI(uint32 diff) override
72 {
73 if (!UpdateVictim())
74 return;
75
76 events.Update(diff);
77
79 return;
80
81 while (uint32 eventId = events.ExecuteEvent())
82 {
83 switch (eventId)
84 {
87 events.Repeat(4s);
88 break;
91 events.Repeat(18s);
92 break;
95 events.Repeat(13s);
96 break;
98 if (Unit* possessTarget = SelectTarget(SelectTargetMethod::Random, 1, 0, true, false))
99 {
100 DoCast(possessTarget, SPELL_POSSESS, true);
101 DoCast(possessTarget, SPELL_POSSESSED, true);
103 _possessedTargetGuid = possessTarget->GetGUID();
105 }
106 else
107 events.Repeat(20s, 30s);
108 break;
111 {
112 if (!possessedTarget->HasAura(SPELL_POSSESSED) || possessedTarget->HealthBelowPct(50))
113 {
114 possessedTarget->RemoveAurasDueToSpell(SPELL_POSSESS);
115 possessedTarget->RemoveAurasDueToSpell(SPELL_POSSESSED);
120 }
121 else
122 events.Repeat(1s);
123 }
124 break;
125 }
126
128 return;
129 }
130 }
131};
132
134{
136}
uint32_t uint32
Definition: Define.h:142
Spells
Definition: PlayerAI.cpp:32
@ UNIT_STATE_CASTING
Definition: Unit.h:270
void AddSC_boss_baroness_anastari()
@ SPELL_BANSHEEWAIL
@ SPELL_POSSESS_INV
@ SPELL_BANSHEECURSE
BaronessAnastariEvents
@ EVENT_SPELL_BANSHEECURSE
@ EVENT_SPELL_POSSESS
@ EVENT_SPELL_SILENCE
@ EVENT_SPELL_BANSHEEWAIL
@ EVENT_CHECK_POSSESSED
InstanceScript *const instance
EventMap events
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
void CancelEvent(uint32 eventId)
Definition: EventMap.cpp:131
void Reset()
Definition: EventMap.cpp:21
void DoRemoveAurasDueToSpellOnPlayers(uint32 spell, bool includePets=false, bool includeControlled=false)
void Clear()
Definition: ObjectGuid.h:286
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
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3831
TC_GAME_API Player * GetPlayer(Map const *, ObjectGuid const &guid)
@ BOSS_BARONESS_ANASTARI
Definition: stratholme.h:35
#define RegisterStratholmeCreatureAI(ai_name)
Definition: stratholme.h:133
void UpdateAI(uint32 diff) override
boss_baroness_anastari(Creature *creature)
void JustEngagedWith(Unit *) override