TrinityCore
boss_toravon.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 "InstanceScript.h"
20#include "ScriptedCreature.h"
21#include "SpellScript.h"
22#include "vault_of_archavon.h"
23
25{
26 // Toravon
31
32 // Frozen Orb
36
37 // Frozen Orb Stalker
39};
40
42{
46};
47
48struct boss_toravon : public BossAI
49{
50 boss_toravon(Creature* creature) : BossAI(creature, DATA_TORAVON) { }
51
52 void JustEngagedWith(Unit* who) override
53 {
55
59
61 }
62
63 void UpdateAI(uint32 diff) override
64 {
65 if (!UpdateVictim())
66 return;
67
68 events.Update(diff);
69
71 return;
72
73 while (uint32 eventId = events.ExecuteEvent())
74 {
75 switch (eventId)
76 {
78 {
80 events.Repeat(32s);
81 break;
82 }
83 case EVENT_WHITEOUT:
85 events.Repeat(38s);
86 break;
90 events.Repeat(38s);
91 break;
92 default:
93 break;
94 }
95
97 return;
98 }
99 }
100};
101
103{
104 npc_frozen_orb_stalker(Creature* creature) : ScriptedAI(creature) { }
105
106 void Reset() override
107 {
109 }
110};
111
113{
114 npc_frozen_orb(Creature* creature) : ScriptedAI(creature) { }
115
116 void IsSummonedBy(WorldObject* /*summoner*/) override
117 {
121
123 {
124 if (toravon->IsInCombat())
125 {
126 toravon->AI()->JustSummoned(me);
128 }
129 else
131 }
132 }
133};
134
135// 46523 - Random Aggro
137{
138 bool Load() override
139 {
140 return GetCaster()->GetTypeId() == TYPEID_UNIT;
141 }
142
143 void HandleScript(SpellEffIndex /*effIndex*/)
144 {
145 Creature* caster = GetCaster()->ToCreature();
146
148
149 if (CreatureAI* ai = caster->AI())
150 if (Unit* target = ai->SelectTarget(SelectTargetMethod::Random, 1))
151 caster->GetThreatManager().AddThreat(target, 1000000);
152 }
153
154 void Register() override
155 {
157 }
158};
159
161{
166}
uint32_t uint32
Definition: Define.h:142
@ TYPEID_UNIT
Definition: ObjectGuid.h:40
#define RegisterSpellScript(spell_script)
Definition: ScriptMgr.h:1369
SpellEffIndex
Definition: SharedDefines.h:29
@ EFFECT_0
Definition: SharedDefines.h:30
@ SPELL_EFFECT_DUMMY
@ SPELLVALUE_MAX_TARGETS
Definition: SpellDefines.h:230
#define SpellEffectFn(F, I, N)
Definition: SpellScript.h:842
@ UNIT_STATE_CASTING
Definition: Unit.h:270
ToravonEvents
@ EVENT_FROZEN_ORB
@ EVENT_WHITEOUT
@ EVENT_FREEZING_GROUND
ToravonSpells
@ FROZEN_ORB_STALKER_AURA
@ SPELL_FROZEN_MALLET
@ SPELL_RANDOM_AGGRO
@ SPELL_WHITEOUT
@ SPELL_FROZEN_ORB
@ SPELL_FROZEN_ORB_DMG
@ SPELL_FREEZING_GROUND
@ SPELL_FROZEN_ORB_AURA
void AddSC_boss_toravon()
void JustEngagedWith(Unit *who) override
EventMap events
void DoZoneInCombat()
Definition: CreatureAI.h:161
bool UpdateVictim()
Definition: CreatureAI.cpp:245
Creature *const me
Definition: CreatureAI.h:61
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
Definition: Creature.cpp:2415
CreatureAI * AI() const
Definition: Creature.h:214
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
Creature * GetCreature(uint32 type)
static Creature * ToCreature(Object *o)
Definition: Object.h:219
TypeID GetTypeId() const
Definition: Object.h:173
Unit * GetCaster() const
HookList< EffectHandler > OnEffectHitTarget
Definition: SpellScript.h:840
void AddThreat(Unit *target, float amount, SpellInfo const *spell=nullptr, bool ignoreModifiers=false, bool ignoreRedirects=false)
== AFFECT MY THREAT LIST ==
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.h:159
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
ThreatManager & GetThreatManager()
Definition: Unit.h:1063
bool HasUnitState(const uint32 f) const
Definition: Unit.h:732
InstanceScript * GetInstanceScript() const
Definition: Object.cpp:1042
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
void HandleScript(SpellEffIndex)
T const & RAID_MODE(T const &normal10, T const &normal25) const
boss_toravon(Creature *creature)
void UpdateAI(uint32 diff) override
void JustEngagedWith(Unit *who) override
void Reset() override
npc_frozen_orb_stalker(Creature *creature)
npc_frozen_orb(Creature *creature)
void IsSummonedBy(WorldObject *) override
@ DATA_TORAVON
#define RegisterVaultOfArchavonCreatureAI(ai_name)