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 "gundrak.h"
20#include "ScriptedCreature.h"
21#include "SpellInfo.h"
22#include "SpellScript.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(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 }
180
181private:
183};
184
186{
187 public:
188 achievement_less_rabi() : AchievementCriteriaScript("achievement_less_rabi") { }
189
190 bool OnCheck(Player* /*player*/, Unit* target) override
191 {
192 if (!target)
193 return false;
194
195 if (Creature* Moorabi = target->ToCreature())
196 if (Moorabi->AI()->GetData(DATA_LESS_RABI))
197 return true;
198
199 return false;
200 }
201};
202
203// 55163 - Mojo Frenzy
205{
206 bool Validate(SpellInfo const* /*spell*/) override
207 {
209 }
210
211 void HandlePeriodic(AuraEffect const* /*aurEff*/)
212 {
214
215 Unit* owner = GetUnitOwner();
216 int32 castSpeedBonus = (100.0f - owner->GetHealthPct()) * 4; // between 0% and 400% cast speed bonus
218 args.AddSpellBP0(castSpeedBonus);
219 owner->CastSpell(owner, SPELL_MOJO_FRENZY_CAST_SPEED, args);
220 }
221
226};
227
int32_t int32
Definition Define.h:150
uint32_t uint32
Definition Define.h:154
std::chrono::seconds Seconds
Seconds shorthand typedef.
Definition Duration.h:28
@ TYPEID_PLAYER
Definition ObjectGuid.h:44
Spells
Definition PlayerAI.cpp:32
bool roll_chance(T chance)
Definition Random.h:55
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
@ EFFECT_0
@ SPELL_AURA_PERIODIC_DUMMY
@ TRIGGERED_FULL_MASK
Used when doing CastSpell with triggered == true.
#define AuraEffectPeriodicFn(F, I, N)
EvadeReason
@ UNIT_STATE_CASTING
Definition Unit.h:276
@ 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
TypeID GetTypeId() const
Definition BaseEntity.h:166
void JustEngagedWith(Unit *who) override
void _DespawnAtEvade(Seconds delayToRespawn=30s, Creature *who=nullptr)
EventMap events
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:63
uint32 ExecuteEvent()
Definition EventMap.cpp:77
void Update(uint32 time)
Definition EventMap.h:61
void Repeat(Milliseconds time)
Definition EventMap.cpp:67
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition EventMap.cpp:40
bool IsInPhase(uint8 phase) const
Definition EventMap.h:222
void CancelEvent(uint32 eventId)
Definition EventMap.cpp:135
void SetPhase(uint8 phase)
Definition EventMap.cpp:32
Creature * ToCreature()
Definition Object.h:121
uint32 const Id
Definition SpellInfo.h:328
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:160
SpellCastResult DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:162
Definition Unit.h:635
float GetHealthPct() const
Definition Unit.h:796
bool HasUnitState(const uint32 f) const
Definition Unit.h:743
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3974
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2217
bool OnCheck(Player *, Unit *target) override
void HandlePeriodic(AuraEffect const *)
bool Validate(SpellInfo const *) override
#define RegisterGundrakCreatureAI(ai_name)
Definition gundrak.h:99
@ DATA_MOORABI
Definition gundrak.h:33
CastSpellExtraArgs & AddSpellBP0(SpellEffectValue 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