TrinityCore
boss_ioc_horde_alliance.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 "BattlegroundIC.h"
20#include "ScriptedCreature.h"
21
23{
27 SPELL_RAGE = 66776
28};
29
31{
36};
37
39{
40 boss_ioc_horde_alliance(Creature* creature) : ScriptedAI(creature) { }
41
42 void Reset() override
43 {
44 _events.Reset();
45
46 uint32 _npcGuard;
49 else
50 _npcGuard = NPC_KOR_KRON_GUARD;
51
52 std::list<Creature*> guardsList;
53 me->GetCreatureListWithEntryInGrid(guardsList, _npcGuard, 100.0f);
54 for (std::list<Creature*>::const_iterator itr = guardsList.begin(); itr != guardsList.end(); ++itr)
55 (*itr)->Respawn();
56 };
57
58 void JustEngagedWith(Unit* /*who*/) override
59 {
64 }
65
66 void SpellHit(WorldObject* caster, SpellInfo const* /*spellInfo*/) override
67 {
68 Unit* unitCaster = caster->ToUnit();
69 if (!unitCaster)
70 return;
71
72 if (unitCaster->IsVehicle())
73 Unit::Kill(me, unitCaster);
74 }
75
76 void UpdateAI(uint32 diff) override
77 {
78 if (!UpdateVictim())
79 return;
80
81 _events.Update(diff);
82
84 return;
85
86 while (uint32 eventId = _events.ExecuteEvent())
87 {
88 switch (eventId)
89 {
93 break;
98 break;
102 break;
104 if (me->GetDistance(me->GetHomePosition()) > 25.0f)
106 else
109 break;
110 default:
111 break;
112 }
113 }
114 }
115
116private:
118};
119
121{
123}
@ NPC_KOR_KRON_GUARD
@ NPC_HIGH_COMMANDER_HALFORD_WYRMBANE
@ NPC_SEVEN_TH_LEGION_INFANTRY
uint32_t uint32
Definition: Define.h:142
#define RegisterCreatureAI(ai_name)
Definition: ScriptMgr.h:1380
@ UNIT_STATE_CASTING
Definition: Unit.h:270
@ EVENT_BRUTAL_STRIKE
@ EVENT_DAGGER_THROW
@ EVENT_CRUSHING_LEAP
void AddSC_boss_ioc_horde_alliance()
@ SPELL_DAGGER_THROW
@ SPELL_BRUTAL_STRIKE
@ SPELL_CRUSHING_LEAP
bool UpdateVictim()
Definition: CreatureAI.cpp:245
Creature *const me
Definition: CreatureAI.h:61
void GetHomePosition(float &x, float &y, float &z, float &ori) const
Definition: Creature.h:373
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
void Reset()
Definition: EventMap.cpp:21
static Unit * ToUnit(Object *o)
Definition: Object.h:225
uint32 GetEntry() const
Definition: Object.h:161
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 IsVehicle() const
Definition: Unit.h:743
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
static void Kill(Unit *attacker, Unit *victim, bool durabilityLoss=true, bool skipSettingDeathState=false)
Definition: Unit.cpp:10591
void GetCreatureListWithEntryInGrid(Container &creatureContainer, uint32 entry, float maxSearchRange=250.0f) const
Definition: Object.cpp:3312
float GetDistance(WorldObject const *obj) const
Definition: Object.cpp:1078
boss_ioc_horde_alliance(Creature *creature)
void JustEngagedWith(Unit *) override
void SpellHit(WorldObject *caster, SpellInfo const *) override
void UpdateAI(uint32 diff) override