TrinityCore
Loading...
Searching...
No Matches
boss_moorabi.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 "SpellInfo.h"
21#include "SpellScript.h"
22#include "gundrak.h"
23
25{
32 SPELL_QUAKE = 55101,
36 SPELL_TRANSFORMATION = 55098 // Periodic, The caster transforms into a powerful mammoth, increasing Physical damage done by 25% and granting immunity to Stun effects.
37};
38
50
59
60enum Misc
61{
63};
64
70
71struct boss_moorabi : public BossAI
72{
73 boss_moorabi(Creature* creature) : BossAI(creature, DATA_MOORABI), _transformed(false) { }
74
75 void Reset() override
76 {
77 _Reset();
78 _transformed = false;
81 }
82
95
96 void EnterEvadeMode(EvadeReason /*why*/) override
97 {
99 }
100
101 void JustSummoned(Creature* /*summon*/) override {}
102
103 uint32 GetData(uint32 type) const override
104 {
105 if (type == DATA_LESS_RABI)
106 return _transformed ? 0 : 1;
107 return 0;
108 }
109
110 void KilledUnit(Unit* victim) override
111 {
112 if (victim->GetTypeId() == TYPEID_PLAYER)
113 Talk(SAY_SLAY);
114 }
115
116 void JustDied(Unit* /*killer*/) override
117 {
118 _JustDied();
121 }
122
123 void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
124 {
125 if (spellInfo->Id == SPELL_TRANSFORMATION)
126 {
127 _transformed = true;
131 }
132 }
133
134 void UpdateAI(uint32 diff) override
135 {
137 return;
138
139 events.Update(diff);
141 return;
142
143 while (uint32 eventId = events.ExecuteEvent())
144 {
145 switch (eventId)
146 {
148 if (roll_chance_i(50))
151 events.Repeat(Seconds(10));
152 break;
155 events.Repeat(Seconds(10));
156 break;
160 break;
166 events.Repeat(Seconds(10));
167 break;
168 case EVENT_PHANTOM:
170 events.Repeat(Seconds(20), Seconds(25));
171 break;
172 default:
173 break;
174 }
175
177 return;
178 }
179
181 }
182
183private:
185};
186
188{
189 public:
190 achievement_less_rabi() : AchievementCriteriaScript("achievement_less_rabi") { }
191
192 bool OnCheck(Player* /*player*/, Unit* target) override
193 {
194 if (!target)
195 return false;
196
197 if (Creature* Moorabi = target->ToCreature())
198 if (Moorabi->AI()->GetData(DATA_LESS_RABI))
199 return true;
200
201 return false;
202 }
203};
204
205// 55163 - Mojo Frenzy
207{
209
210 bool Validate(SpellInfo const* /*spell*/) override
211 {
213 }
214
215 void HandlePeriodic(AuraEffect const* /*aurEff*/)
216 {
218
219 Unit* owner = GetUnitOwner();
220 int32 castSpeedBonus = (100.0f - owner->GetHealthPct()) * 4; // between 0% and 400% cast speed bonus
222 args.AddSpellBP0(castSpeedBonus);
223 owner->CastSpell(owner, SPELL_MOJO_FRENZY_CAST_SPEED, args);
224 }
225
230};
231
int32_t int32
Definition Define.h:129
uint32_t uint32
Definition Define.h:133
std::chrono::seconds Seconds
Seconds shorthand typedef.
Definition Duration.h:27
@ TYPEID_PLAYER
Definition ObjectGuid.h:39
Spells
Definition PlayerAI.cpp:32
bool roll_chance_i(int chance)
Definition Random.h:59
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
@ EFFECT_0
@ SPELL_AURA_PERIODIC_DUMMY
@ TRIGGERED_FULL_MASK
Will return SPELL_FAILED_DONT_REPORT in CheckCast functions.
#define AuraEffectPeriodicFn(F, I, N)
@ UNIT_STATE_CASTING
Definition Unit.h:235
@ EMOTE_BEGIN_TRANSFORM
@ SAY_DEATH
@ SAY_QUAKE
@ SAY_AGGRO
@ SAY_TRANSFORM
@ SAY_SLAY
@ EMOTE_TRANSFORMED
@ EMOTE_ACTIVATE_ALTAR
@ DATA_LESS_RABI
@ SPELL_DETERMINED_STAB
@ SPELL_DETERMINED_GORE
@ SPELL_MOJO_FRENZY
@ SPELL_QUAKE
@ SPELL_NUMBING_ROAR
@ SPELL_NUMBING_SHOUT
@ SPELL_SUMMON_PHANTOM
@ SPELL_GROUND_TREMOR
@ SPELL_MOJO_FRENZY_CAST_SPEED
@ SPELL_TRANSFORMATION
@ SPELL_SUMMON_PHANTOM_TRANSFORM
@ PHASE_INTRO
@ PHASE_COMBAT
@ EVENT_TRANFORMATION
@ EVENT_GROUND_TREMOR
@ EVENT_PHANTOM
@ EVENT_DETERMINED_STAB
@ EVENT_NUMBLING_SHOUT
void AddSC_boss_moorabi()
void PreventDefaultAction()
HookList< EffectPeriodicHandler > OnEffectPeriodic
Unit * GetUnitOwner() const
void JustEngagedWith(Unit *who) override
void _DespawnAtEvade(Seconds delayToRespawn=30s, Creature *who=nullptr)
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
bool IsInPhase(PhaseIndex phase) const
Definition EventMap.h:236
void CancelEvent(EventId eventId)
Definition EventMap.cpp:151
void SetPhase(PhaseIndex phase)
Definition EventMap.cpp:28
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
static Creature * ToCreature(Object *o)
Definition Object.h:186
TypeID GetTypeId() const
Definition Object.h:93
uint32 Id
Definition SpellInfo.h:289
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:241
SpellCastResult DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:243
Definition Unit.h:769
float GetHealthPct() const
Definition Unit.h:921
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3784
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2832
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
bool OnCheck(Player *, Unit *target) override
PrepareAuraScript(spell_moorabi_mojo_frenzy)
void HandlePeriodic(AuraEffect const *)
bool Validate(SpellInfo const *) override
#define RegisterGundrakCreatureAI(ai_name)
Definition gundrak.h:101
@ DATA_MOORABI
Definition gundrak.h:33
CastSpellExtraArgs & AddSpellBP0(int32 val)
void JustEngagedWith(Unit *who) override
void JustDied(Unit *) override
boss_moorabi(Creature *creature)
void JustSummoned(Creature *) override
void UpdateAI(uint32 diff) override
uint32 GetData(uint32 type) const override
void Reset() override
void EnterEvadeMode(EvadeReason) override
void SpellHit(WorldObject *, SpellInfo const *spellInfo) override
void KilledUnit(Unit *victim) override