TrinityCore
Loading...
Searching...
No Matches
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 "ScriptedCreature.h"
20#include "BattlegroundIC.h"
21
29
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
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
116 }
117
118private:
120};
121
@ NPC_KOR_KRON_GUARD
@ NPC_HIGH_COMMANDER_HALFORD_WYRMBANE
@ NPC_SEVEN_TH_LEGION_INFANTRY
uint32_t uint32
Definition Define.h:133
#define RegisterCreatureAI(ai_name)
Definition ScriptMgr.h:1139
@ UNIT_STATE_CASTING
Definition Unit.h:235
void AddSC_boss_ioc_horde_alliance()
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
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
static Unit * ToUnit(Object *o)
Definition Object.h:192
uint32 GetEntry() const
Definition Object.h:81
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:166
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:96
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:106
Definition Unit.h:769
bool IsVehicle() const
Definition Unit.h:887
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3784
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
static void Kill(Unit *attacker, Unit *victim, bool durabilityLoss=true)
Definition Unit.cpp:10930
void GetCreatureListWithEntryInGrid(Container &creatureContainer, uint32 entry, float maxSearchRange=250.0f) const
Definition Object.cpp:3153
float GetDistance(WorldObject const *obj) const
Definition Object.cpp:1123
boss_ioc_horde_alliance(Creature *creature)
void JustEngagedWith(Unit *) override
void SpellHit(WorldObject *caster, SpellInfo const *) override
void UpdateAI(uint32 diff) override