TrinityCore
ulduar.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 "Spell.h"
21#include "SpellAuraEffects.h"
22#include "SpellScript.h"
23
24// 61906 - Random Aggro Periodic (5 sec)
26{
27 void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
28 {
29 Unit* target = GetTarget();
31 if (!target->IsAIEnabled())
32 return;
33
34 if (Unit* victim = target->GetAI()->SelectTarget(SelectTargetMethod::Random, 0, 100.0f, true, false))
35 {
36 target->GetThreatManager().AddThreat(victim, 3000000.0f, nullptr, true, true);
37 target->GetAI()->AttackStart(victim);
38 }
39 }
40
41 void Register() override
42 {
44 }
45};
46
47// 64014 - Expedition Base Camp Teleport
48// 64025 - Halls of Invention Teleport
49// 64028 - Colossal Forge Teleport
50// 64029 - Shattered Walkway Teleport
51// 64030 - Antechamber Teleport
52// 64032 - Formation Grounds Teleport
53// 65042 - Prison of Yogg-Saron Teleport
55{
57 {
58 if (GetExplTargetUnit()->GetTypeId() != TYPEID_PLAYER)
60
61 if (GetExplTargetUnit()->IsInCombat())
62 {
65 }
66
67 return SPELL_CAST_OK;
68 }
69
70 void Register() override
71 {
73 }
74};
75
77{
80}
@ TYPEID_PLAYER
Definition: ObjectGuid.h:41
#define RegisterSpellScript(spell_script)
Definition: ScriptMgr.h:1369
@ EFFECT_0
Definition: SharedDefines.h:30
SpellCastResult
@ SPELL_FAILED_AFFECTING_COMBAT
@ SPELL_FAILED_DONT_REPORT
@ SPELL_CAST_OK
@ SPELL_AURA_PERIODIC_DUMMY
#define SpellCheckCastFn(F)
Definition: SpellScript.h:830
#define AuraEffectPeriodicFn(F, I, N)
Definition: SpellScript.h:2046
HookList< EffectPeriodicHandler > OnEffectPeriodic
Definition: SpellScript.h:2045
Unit * GetTarget() const
HookList< CheckCastHandler > OnCheckCast
Definition: SpellScript.h:829
Spell * GetSpell() const
Definition: SpellScript.h:987
Unit * GetExplTargetUnit() const
SpellInfo const * GetSpellInfo() const
static void SendCastResult(Player *caster, SpellInfo const *spellInfo, SpellCastVisual spellVisual, ObjectGuid cast_count, SpellCastResult result, SpellCustomErrors customError=SPELL_CUSTOM_ERROR_NONE, int32 *param1=nullptr, int32 *param2=nullptr)
Definition: Spell.cpp:4643
void AddThreat(Unit *target, float amount, SpellInfo const *spell=nullptr, bool ignoreModifiers=false, bool ignoreRedirects=false)
== AFFECT MY THREAT LIST ==
virtual void AttackStart(Unit *victim)
Definition: UnitAI.cpp:29
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition: UnitAI.cpp:79
Definition: Unit.h:627
ThreatManager & GetThreatManager()
Definition: Unit.h:1063
UnitAI * GetAI() const
Definition: Unit.h:660
bool IsAIEnabled() const
Definition: Unit.h:658
void HandleEffectPeriodic(AuraEffect const *)
Definition: ulduar.cpp:27
void Register() override
Definition: ulduar.cpp:70
SpellCastResult CheckRequirement()
Definition: ulduar.cpp:56
void AddSC_ulduar()
Definition: ulduar.cpp:76