TrinityCore
Loading...
Searching...
No Matches
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
47
48struct boss_toravon : public BossAI
49{
50 boss_toravon(Creature* creature) : BossAI(creature, DATA_TORAVON) { }
51
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
101 }
102};
103
105{
106 npc_frozen_orb_stalker(Creature* creature) : ScriptedAI(creature) { }
107
108 void Reset() override
109 {
111 }
112};
113
115{
116 npc_frozen_orb(Creature* creature) : ScriptedAI(creature) { }
117
118 void IsSummonedBy(WorldObject* /*summoner*/) override
119 {
123
125 {
126 if (toravon->IsInCombat())
127 {
128 toravon->AI()->JustSummoned(me);
130 }
131 else
133 }
134 }
135};
136
137// 46523 - Random Aggro
139{
141
142 bool Load() override
143 {
144 return GetCaster()->GetTypeId() == TYPEID_UNIT;
145 }
146
147 void HandleScript(SpellEffIndex /*effIndex*/)
148 {
149 Creature* caster = GetCaster()->ToCreature();
150
152
153 if (CreatureAI* ai = caster->AI())
154 if (Unit* target = ai->SelectTarget(SelectTargetMethod::Random, 1))
155 caster->GetThreatManager().AddThreat(target, 1000000);
156 }
157
162};
163
uint32_t uint32
Definition Define.h:133
@ TYPEID_UNIT
Definition ObjectGuid.h:38
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
SpellEffIndex
@ EFFECT_0
@ SPELL_EFFECT_DUMMY
@ SPELLVALUE_MAX_TARGETS
#define SpellEffectFn(F, I, N)
@ UNIT_STATE_CASTING
Definition Unit.h:235
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(Creature *creature=nullptr)
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
CreatureAI * AI() const
Definition Creature.h:154
void Update(uint32 time)
Definition EventMap.h:67
void Repeat(Milliseconds time)
Definition EventMap.cpp:63
EventId ExecuteEvent()
Definition EventMap.cpp:73
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
Creature * GetCreature(uint32 type)
static Creature * ToCreature(Object *o)
Definition Object.h:186
TypeID GetTypeId() const
Definition Object.h:93
Unit * GetCaster() const
HookList< EffectHandler > OnEffectHitTarget
void AddThreat(Unit *target, float amount, SpellInfo const *spell=nullptr, bool ignoreModifiers=false, bool ignoreRedirects=false)
== AFFECT MY THREAT LIST ==
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:241
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
ThreatManager & GetThreatManager()
Definition Unit.h:1155
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
InstanceScript * GetInstanceScript() const
Definition Object.cpp:1087
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2832
void HandleScript(SpellEffIndex)
PrepareSpellScript(spell_toravon_random_aggro)
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
npc_frozen_orb_stalker(Creature *creature)
npc_frozen_orb(Creature *creature)
void IsSummonedBy(WorldObject *) override
@ DATA_TORAVON
#define RegisterVaultOfArchavonCreatureAI(ai_name)