TrinityCore
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boss_baron_geddon.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/* ScriptData
19SDName: Boss_Baron_Geddon
20SD%Complete: 100
21SDComment:
22SDCategory: Molten Core
23EndScriptData */
24
25#include "ScriptMgr.h"
26#include "molten_core.h"
27#include "ScriptedCreature.h"
28#include "SpellAuraEffects.h"
29#include "SpellScript.h"
30#include "ObjectMgr.h"
31
33{
35};
36
38{
44};
45
47{
51};
52
54{
56 {
57 }
58
59 void JustEngagedWith(Unit* victim) override
60 {
65 }
66
67 void UpdateAI(uint32 diff) override
68 {
69 if (!UpdateVictim())
70 return;
71
72 events.Update(diff);
73
74 // If we are <2% hp cast Armageddon
75 if (!HealthAbovePct(2))
76 {
80 return;
81 }
82
84 return;
85
86 while (uint32 eventId = events.ExecuteEvent())
87 {
88 switch (eventId)
89 {
90 case EVENT_INFERNO:
93 break;
95 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true, true, -SPELL_IGNITE_MANA))
98 break;
100 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true))
101 DoCast(target, SPELL_LIVING_BOMB);
103 break;
104 default:
105 break;
106 }
107
109 return;
110 }
111
113 }
114};
115
116// 19695 - Inferno
118{
120
121 void OnPeriodic(AuraEffect const* aurEff)
122 {
124 static const int32 damageForTick[8] = { 500, 500, 1000, 1000, 2000, 2000, 3000, 5000 };
127 args.TriggeringAura = aurEff;
128 args.AddSpellMod(SPELLVALUE_BASE_POINT0, damageForTick[aurEff->GetTickNumber() - 1]);
129 GetTarget()->CastSpell(nullptr, SPELL_INFERNO_DMG, args);
130 }
131
132 void Register() override
133 {
135 }
136};
137
139{
142}
int32_t int32
Definition: Define.h:129
uint32_t uint32
Definition: Define.h:133
Spells
Definition: PlayerAI.cpp:32
#define RegisterSpellScript(spell_script)
Definition: ScriptMgr.h:1129
@ EFFECT_0
Definition: SharedDefines.h:31
@ SPELL_AURA_PERIODIC_TRIGGER_SPELL
@ TRIGGERED_FULL_MASK
Will return SPELL_FAILED_DONT_REPORT in CheckCast functions.
Definition: SpellDefines.h:168
@ SPELLVALUE_BASE_POINT0
Definition: SpellDefines.h:132
#define AuraEffectPeriodicFn(F, I, N)
Definition: SpellScript.h:815
@ UNIT_STATE_CASTING
Definition: Unit.h:235
Events
@ EMOTE_SERVICE
@ SPELL_ARMAGEDDON
@ SPELL_INFERNO_DMG
@ SPELL_LIVING_BOMB
@ SPELL_IGNITE_MANA
@ SPELL_INFERNO
void AddSC_boss_baron_geddon()
@ EVENT_INFERNO
@ EVENT_IGNITE_MANA
@ EVENT_LIVING_BOMB
uint32 GetTickNumber() const
void PreventDefaultAction()
HookList< EffectPeriodicHandler > OnEffectPeriodic
Definition: SpellScript.h:814
Unit * GetTarget() const
void JustEngagedWith(Unit *who) override
EventMap events
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:48
bool UpdateVictim()
Definition: CreatureAI.cpp:240
Creature *const me
Definition: CreatureAI.h:81
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 DoMeleeAttackIfReady()
Definition: UnitAI.cpp:62
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition: UnitAI.cpp:104
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:114
Definition: Unit.h:769
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true)
Definition: Unit.cpp:3093
bool HasUnitState(const uint32 f) const
Definition: Unit.h:874
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2831
PrepareAuraScript(spell_baron_geddon_inferno)
void OnPeriodic(AuraEffect const *aurEff)
#define RegisterMoltenCoreCreatureAI(ai_name)
Definition: molten_core.h:84
@ BOSS_BARON_GEDDON
Definition: molten_core.h:35
TriggerCastFlags TriggerFlags
Definition: SpellDefines.h:352
CastSpellExtraArgs & AddSpellMod(SpellValueMod mod, int32 val)
Definition: SpellDefines.h:349
AuraEffect const * TriggeringAura
Definition: SpellDefines.h:354
bool HealthAbovePct(uint32 pct) const
boss_baron_geddon(Creature *creature)
void UpdateAI(uint32 diff) override
void JustEngagedWith(Unit *victim) override