TrinityCore
Loading...
Searching...
No Matches
boss_huhuran.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/*
19 * Timers requires to be revisited
20 */
21
22#include "ScriptMgr.h"
23#include "ScriptedCreature.h"
24#include "SpellAuraEffects.h"
25#include "SpellScript.h"
26#include "temple_of_ahnqiraj.h"
27
33
44
53
54// 15509 - Princess Huhuran
55struct boss_huhuran : public BossAI
56{
57 boss_huhuran(Creature* creature) : BossAI(creature, DATA_HUHURAN), _berserkTriggered(false) { }
58
59 void Reset() override
60 {
61 _Reset();
62 _berserkTriggered = false;
63 }
64
74
75 void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
76 {
77 if (!_berserkTriggered && me->HealthBelowPctDamaged(30, damage))
78 {
79 _berserkTriggered = true;
82 }
83 }
84
85 void OnSpellCast(SpellInfo const* spell) override
86 {
87 switch (spell->Id)
88 {
89 case SPELL_ENRAGE:
91 break;
92 case SPELL_BERSERK:
94 break;
95 default:
96 break;
97 }
98 }
99
100 void UpdateAI(uint32 diff) override
101 {
102 if (!UpdateVictim())
103 return;
104
105 events.Update(diff);
106
108 return;
109
110 while (uint32 eventId = events.ExecuteEvent())
111 {
112 switch (eventId)
113 {
114 case EVENT_ACID_SPIT:
116 events.Repeat(10s, 15s);
117 break;
119 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100.0f, true))
121 events.Repeat(10s, 25s);
122 break;
125 events.Repeat(25s, 35s);
126 break;
127 case EVENT_ENRAGE:
129 events.Repeat(10s, 20s);
130 break;
131 case EVENT_BERSERK:
133 break;
134 default:
135 break;
136 }
137
139 return;
140 }
141
143 }
144
145private:
147};
148
149// 26180 - Wyvern Sting
151{
153
154 bool Validate(SpellInfo const* /*spellInfo*/) override
155 {
157 }
158
159 void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
160 {
162
163 if (Unit* caster = GetCaster())
164 {
165 int32 damage = removeMode == AURA_REMOVE_BY_ENEMY_SPELL ? 3000 : 500;
167 args.AddSpellBP0(damage);
168 caster->CastSpell(GetTarget(), SPELL_WYVERN_STING_DAMAGE, args);
169 }
170 }
171
176};
177
int32_t int32
Definition Define.h:129
uint32_t uint32
Definition Define.h:133
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
@ EFFECT_0
AuraRemoveMode
@ AURA_REMOVE_BY_ENEMY_SPELL
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL
@ SPELL_AURA_MOD_STUN
@ TRIGGERED_FULL_MASK
Will return SPELL_FAILED_DONT_REPORT in CheckCast functions.
#define AuraEffectRemoveFn(F, I, N, M)
@ UNIT_STATE_CASTING
Definition Unit.h:235
DamageEffectType
Definition Unit.h:352
void AddSC_boss_huhuran()
HuhuranTexts
@ EMOTE_ENRAGE
@ EMOTE_BERSERK
HuhuranSpells
@ SPELL_ENRAGE
@ SPELL_NOXIOUS_POISON
@ SPELL_BERSERK
@ SPELL_ACID_SPIT
@ SPELL_WYVERN_STING
@ SPELL_WYVERN_STING_DAMAGE
HuhuranEvents
@ EVENT_WYVERN_STING
@ EVENT_ENRAGE
@ EVENT_NOXIOUS_POISON
@ EVENT_ACID_SPIT
@ EVENT_BERSERK
AuraRemoveMode GetRemoveMode() const
Definition SpellAuras.h:80
AuraApplication const * GetTargetApplication() const
HookList< EffectApplyHandler > AfterEffectRemove
Unit * GetCaster() const
Unit * GetTarget() const
void JustEngagedWith(Unit *who) override
EventMap events
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
void Update(uint32 time)
Definition EventMap.h:67
void Repeat(Milliseconds time)
Definition EventMap.cpp:63
EventId ExecuteEvent()
Definition EventMap.cpp:73
void CancelEvent(EventId eventId)
Definition EventMap.cpp:151
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
uint32 Id
Definition SpellInfo.h:289
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:241
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
bool HealthBelowPctDamaged(int32 pct, uint32 damage) const
Definition Unit.h:918
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
PrepareAuraScript(spell_huhuran_wyvern_sting)
bool Validate(SpellInfo const *) override
void AfterRemove(AuraEffect const *, AuraEffectHandleModes)
CastSpellExtraArgs & AddSpellBP0(int32 val)
void JustEngagedWith(Unit *who) override
void OnSpellCast(SpellInfo const *spell) override
void UpdateAI(uint32 diff) override
void Reset() override
boss_huhuran(Creature *creature)
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
#define RegisterAQ40CreatureAI(ai_name)
@ DATA_HUHURAN