TrinityCore
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
39enum Says
40{
49};
50
52{
58};
59
60enum Misc
61{
63};
64
66{
69};
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
83 void JustEngagedWith(Unit* who) override
84 {
88
94 }
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 }
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
222 void Register() override
223 {
225 }
226};
227
229{
233}
int32_t int32
Definition: Define.h:138
uint32_t uint32
Definition: Define.h:142
std::chrono::seconds Seconds
Seconds shorthand typedef.
Definition: Duration.h:32
@ TYPEID_PLAYER
Definition: ObjectGuid.h:41
Spells
Definition: PlayerAI.cpp:32
bool roll_chance_i(int chance)
Definition: Random.h:59
#define RegisterSpellScript(spell_script)
Definition: ScriptMgr.h:1369
@ EFFECT_0
Definition: SharedDefines.h:30
@ SPELL_AURA_PERIODIC_DUMMY
@ TRIGGERED_FULL_MASK
Used when doing CastSpell with triggered == true.
Definition: SpellDefines.h:266
#define AuraEffectPeriodicFn(F, I, N)
Definition: SpellScript.h:2046
EvadeReason
Definition: UnitAICommon.h:30
@ UNIT_STATE_CASTING
Definition: Unit.h:270
Says
@ 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
Definition: SpellScript.h:2045
Unit * GetUnitOwner() const
void JustEngagedWith(Unit *who) override
void _DespawnAtEvade(Seconds delayToRespawn=30s, Creature *who=nullptr)
EventMap events
void _JustDied()
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:56
bool UpdateVictim()
Definition: CreatureAI.cpp:245
Creature *const me
Definition: CreatureAI.h:61
uint32 ExecuteEvent()
Definition: EventMap.cpp:73
void Update(uint32 time)
Definition: EventMap.h:56
void Repeat(Milliseconds time)
Definition: EventMap.cpp:63
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:36
bool IsInPhase(uint8 phase) const
Definition: EventMap.h:217
void CancelEvent(uint32 eventId)
Definition: EventMap.cpp:131
void SetPhase(uint8 phase)
Definition: EventMap.cpp:28
static Creature * ToCreature(Object *o)
Definition: Object.h:219
TypeID GetTypeId() const
Definition: Object.h:173
uint32 const Id
Definition: SpellInfo.h:325
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Definition: SpellScript.h:162
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.h:159
SpellCastResult DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.h:161
Definition: Unit.h:627
float GetHealthPct() const
Definition: Unit.h:784
bool HasUnitState(const uint32 f) const
Definition: Unit.h:732
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3831
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
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(int32 val)
Definition: SpellDefines.h:475
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