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 }
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
158};
159
uint32_t uint32
Definition Define.h:154
@ TYPEID_UNIT
Definition ObjectGuid.h:43
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
SpellEffIndex
@ EFFECT_0
@ SPELL_EFFECT_DUMMY
@ SPELLVALUE_MAX_TARGETS
#define SpellEffectFn(F, I, N)
@ UNIT_STATE_CASTING
Definition Unit.h:276
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()
TypeID GetTypeId() const
Definition BaseEntity.h:166
void JustEngagedWith(Unit *who) override
EventMap events
void DoZoneInCombat()
Definition CreatureAI.h:169
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:63
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
CreatureAI * AI() const
Definition Creature.h:228
uint32 ExecuteEvent()
Definition EventMap.cpp:77
void Update(uint32 time)
Definition EventMap.h:61
void Repeat(Milliseconds time)
Definition EventMap.cpp:67
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition EventMap.cpp:40
Creature * GetCreature(uint32 type)
Creature * ToCreature()
Definition Object.h:121
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 ==
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:160
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:635
ThreatManager & GetThreatManager()
Definition Unit.h:1078
bool HasUnitState(const uint32 f) const
Definition Unit.h:743
InstanceScript * GetInstanceScript() const
Definition Object.cpp:396
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2217
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
npc_frozen_orb_stalker(Creature *creature)
npc_frozen_orb(Creature *creature)
void IsSummonedBy(WorldObject *) override
@ DATA_TORAVON
#define RegisterVaultOfArchavonCreatureAI(ai_name)