TrinityCore
Loading...
Searching...
No Matches
alterac_valley.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 "ScriptedCreature.h"
20
38
50
60
66
79
81{
83 {
84 Initialize();
85 }
86
88 {
89 _hasAura = false;
90 }
91
104
105 void JustAppeared() override
106 {
107 Reset();
108 }
109
110 void UpdateAI(uint32 diff) override
111 {
112 // I have a feeling this isn't blizzlike, but owell, I'm only passing by and cleaning up.
113 if (!_hasAura)
114 {
115 for (uint8 i = 0; i < MAX_SPELL_PAIRS; ++i)
116 if (_auraPairs[i].npcEntry == me->GetEntry())
117 DoCast(me, _auraPairs[i].spellId);
118
119 _hasAura = true;
120 }
121
122 if (!UpdateVictim())
123 return;
124
125 events.Update(diff);
126
128 return;
129
130 while (uint32 eventId = events.ExecuteEvent())
131 {
132 switch (eventId)
133 {
137 break;
138 case EVENT_CLEAVE:
141 break;
145 break;
146 case EVENT_WHIRLWIND:
149 break;
150 case EVENT_ENRAGE:
153 break;
155 {
156 Position const& _homePosition = me->GetHomePosition();
157 if (me->GetDistance2d(_homePosition.GetPositionX(), _homePosition.GetPositionY()) > 50.0f)
158 {
160 return;
161 }
163 break;
164 }
165 }
167 return;
168 }
169
171 }
172
173private:
176};
177
uint8_t uint8
Definition Define.h:135
uint32_t uint32
Definition Define.h:133
Spells
Definition PlayerAI.cpp:32
#define RegisterCreatureAI(ai_name)
Definition ScriptMgr.h:1139
@ EVENT_CHARGE
@ UNIT_STATE_CASTING
Definition Unit.h:235
Creatures
@ NPC_EAST_FROSTWOLF_WARMASTER
@ NPC_TOWER_POINT_WARMASTER
@ NPC_ICEWING_MARSHAL
@ NPC_ICEBLOOD_WARMASTER
@ NPC_SOUTH_MARSHAL
@ NPC_NORTH_MARSHAL
@ NPC_WEST_FROSTWOLF_WARMASTER
@ NPC_STONEHEARTH_MARSHAL
void AddSC_alterac_valley()
@ SPELL_CLEAVE
@ SPELL_WEST_FROSTWOLF_WARMASTER
@ SPELL_ENRAGE
@ SPELL_CHARGE
@ SPELL_TOWER_POINT_WARMASTER
@ SPELL_ICEWING_MARSHAL
@ SPELL_STONEHEARTH_MARSHAL
@ SPELL_NORTH_MARSHAL
@ SPELL_DEMORALIZING_SHOUT
@ SPELL_SOUTH_MARSHAL
@ SPELL_ICEBLOOD_WARMASTER
@ SPELL_EAST_FROSTWOLF_WARMASTER
@ SPELL_WHIRLWIND
SpellPair const _auraPairs[MAX_SPELL_PAIRS]
uint8 const MAX_SPELL_PAIRS
@ EVENT_ENRAGE
@ EVENT_WHIRLWIND
@ EVENT_CHECK_RESET
@ EVENT_DEMORALIZING_SHOUT
@ EVENT_CLEAVE
@ EVENT_CHARGE_TARGET
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
virtual void EnterEvadeMode(EvadeReason why=EVADE_REASON_OTHER)
void GetHomePosition(float &x, float &y, float &z, float &ori) const
Definition Creature.h:295
void Update(uint32 time)
Definition EventMap.h:67
EventId ExecuteEvent()
Definition EventMap.cpp:73
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
void Reset()
Definition EventMap.cpp:21
uint32 GetEntry() const
Definition Object.h:81
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:166
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:106
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
float GetDistance2d(WorldObject const *obj) const
Definition Object.cpp:1141
float GetPositionX() const
Definition Position.h:79
float GetPositionY() const
Definition Position.h:80
void UpdateAI(uint32 diff) override
npc_av_marshal_or_warmaster(Creature *creature)