TrinityCore
Loading...
Searching...
No Matches
boss_azuregos.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 "ObjectAccessor.h"
20#include "Player.h"
21#include "ScriptedCreature.h"
22#include "SpellScript.h"
23
28
30{
35 SPELL_CHILL = 21098,
38 SPELL_CLEAVE = 8255, // Perhaps not right ID
39 SPELL_ENRAGE = 23537
40};
41
53
55{
56 boss_azuregos(Creature* creature) : WorldBossAI(creature)
57 {
58 _enraged = false;
59 }
60
61 void Reset() override
62 {
63 _Reset();
64 }
65
79
80 void KilledUnit(Unit* who) override
81 {
82 if (who->GetTypeId() == TYPEID_PLAYER)
83 who->CastSpell(who, SPELL_MARK_OF_FROST, true);
84 }
85
86 void UpdateAI(uint32 diff) override
87 {
88 if (!UpdateVictim())
89 return;
90
91 events.Update(diff);
92
94 return;
95
96 while (uint32 eventId = events.ExecuteEvent())
97 {
98 switch (eventId)
99 {
100 case EVENT_MANA_STORM:
101 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 60.0f, true))
102 DoCast(target, SPELL_MANA_STORM);
103 events.ScheduleEvent(EVENT_MANA_STORM, 7500ms, 12500ms);
104 break;
105 case EVENT_CHILL:
108 break;
109 case EVENT_BREATH:
112 break;
113 case EVENT_TELEPORT:
114 {
116 for (auto const& pair : me->GetCombatManager().GetPvECombatRefs())
117 if (Player* player = pair.second->GetOther(me)->ToPlayer())
118 DoTeleportPlayer(player, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+3, player->GetOrientation());
119
122 break;
123 }
124 case EVENT_REFLECT:
127 break;
128 case EVENT_CLEAVE:
131 break;
132 default:
133 break;
134 }
135
137 return;
138 }
139
140 if (HealthBelowPct(26) && !_enraged)
141 {
143 _enraged = true;
144 }
145
147 }
148
149private:
151};
152
154{
155 public:
157
158 bool operator()(WorldObject* object) const
159 {
160 if (Unit* unit = object->ToUnit())
161 return !(unit->HasAura(SPELL_MARK_OF_FROST) && !unit->HasAura(SPELL_AURA_OF_FROST));
162 return true;
163 }
164};
165
166// 23183 - Mark of Frost - Triggered spell
193
uint32_t uint32
Definition Define.h:133
@ TYPEID_PLAYER
Definition ObjectGuid.h:39
#define RegisterCreatureAI(ai_name)
Definition ScriptMgr.h:1139
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
SpellEffIndex
@ EFFECT_0
@ SPELL_EFFECT_APPLY_AURA
@ TARGET_UNIT_SRC_AREA_ENEMY
#define SpellEffectFn(F, I, N)
#define SpellObjectAreaTargetSelectFn(F, I, N)
@ UNIT_STATE_CASTING
Definition Unit.h:235
AzuregosSpells
@ SPELL_MARK_OF_FROST_AURA
@ SPELL_CLEAVE
@ SPELL_FROST_BREATH
@ SPELL_ENRAGE
@ SPELL_MARK_OF_FROST
@ SPELL_REFLECT
@ SPELL_MANA_STORM
@ SPELL_CHILL
@ SPELL_AURA_OF_FROST
void AddSC_boss_azuregos()
AzuregosEvents
@ EVENT_REFLECT
@ EVENT_ENRAGE
@ EVENT_CHILL
@ EVENT_TELEPORT
@ EVENT_MARK_OF_FROST
@ EVENT_MANA_STORM
@ EVENT_BREATH
@ EVENT_CLEAVE
AzuregosTexts
@ SAY_TELEPORT
std::unordered_map< ObjectGuid, CombatReference * > const & GetPvECombatRefs() const
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
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
bool operator()(WorldObject *object) const
static Unit * ToUnit(Object *o)
Definition Object.h:192
TypeID GetTypeId() const
Definition Object.h:93
static Player * ToPlayer(Object *o)
Definition Object.h:180
void PreventHitDefaultEffect(SpellEffIndex effIndex)
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:166
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
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
CombatManager & GetCombatManager()
Definition Unit.h:1130
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2832
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
void HandleEffect(SpellEffIndex effIndex)
bool Validate(SpellInfo const *) override
void FilterTargets(std::list< WorldObject * > &targets)
PrepareSpellScript(spell_mark_of_frost)
void Register() override
float GetPositionZ() const
Definition Position.h:81
float GetPositionX() const
Definition Position.h:79
float GetPositionY() const
Definition Position.h:80
void DoTeleportPlayer(Unit *unit, float x, float y, float z, float o)
bool HealthBelowPct(uint32 pct) const
void ResetThreatList(Unit *who=nullptr)
void UpdateAI(uint32 diff) override
void JustEngagedWith(Unit *) override
void Reset() override
boss_azuregos(Creature *creature)
void KilledUnit(Unit *who) override