TrinityCore
Loading...
Searching...
No Matches
boss_marli.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 "zulgurub.h"
19#include "GameObject.h"
20#include "GameObjectAI.h"
21#include "InstanceScript.h"
22#include "Object.h"
23#include "ScriptedCreature.h"
24#include "ScriptMgr.h"
25#include "SpellInfo.h"
26#include "SpellScript.h"
27#include "TemporarySummon.h"
28
36
38{
39 SPELL_CHARGE = 22911,
40 SPELL_ASPECT_OF_MARLI = 24686, // A stun spell
46 // The Spider Spell
47 SPELL_LEVELUP = 24312 // Not right Spell.
48};
49
51{
53 EVENT_POISON_VOLLEY = 2, // Phase All
54 EVENT_HATCH_SPIDER_EGG = 3, // Phase All
55 EVENT_CHARGE_PLAYER = 4, // Phase 3
56 EVENT_ASPECT_OF_MARLI = 5, // Phase 2
57 EVENT_TRANSFORM = 6, // Phase 2
58 EVENT_TRANSFORM_BACK = 7 // Phase 3
59};
60
62{
65 PHASE_THREE = 3
66};
67
68enum Misc
69{
70 NPC_SPIDER = 15041,
72};
73
74// AWFUL HACK WARNING
75// To whoever reads this: Zul'Gurub needs your love
76// Need to do this calculation to increase/decrease Mar'li's damage by 35% (probably some aura missing)
77// This is only to compile the scripts after the aura calculation revamp
78float const DamageIncrease = 35.0f;
79float const DamageDecrease = 100.f / (1.f + DamageIncrease / 100.f) - 100.f;
80
81struct boss_marli : public BossAI
82{
83 boss_marli(Creature* creature) : BossAI(creature, DATA_MARLI) { }
84
85 void Reset() override
86 {
89
90 std::list<GameObject*> eggs;
92 for (GameObject* egg : eggs)
93 {
94 egg->Respawn();
95 egg->UpdateObjectVisibility(true);
96 }
97
99 _Reset();
100 }
101
102 void JustDied(Unit* /*killer*/) override
103 {
104 _JustDied();
106 }
107
114
115 void JustSummoned(Creature* creature) override
116 {
117 creature->AI()->AttackStart(SelectTarget(SelectTargetMethod::Random, 0, 0.f, true));
118 summons.Summon(creature);
119 }
120
121 void UpdateAI(uint32 diff) override
122 {
123 if (!UpdateVictim())
124 return;
125
126 events.Update(diff);
127
129 return;
130
131 while (uint32 eventId = events.ExecuteEvent())
132 {
133 switch (eventId)
134 {
144 break;
148 break;
152 break;
156 break;
157 case EVENT_TRANSFORM:
158 {
160 DoCast(me, SPELL_SPIDER_FORM); // SPELL_AURA_TRANSFORM
161 /*
162 CreatureTemplate const* cinfo = me->GetCreatureTemplate();
163 me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 35)));
164 me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 35)));
165 me->UpdateDamagePhysical(BASE_ATTACK);
166 */
169 if (GetThreat(me->GetVictim()))
175 break;
176 }
178 {
179 Unit* target = nullptr;
180 int i = 0;
181 while (i++ < 3) // max 3 tries to get a random target with power_mana
182 {
183 target = SelectTarget(SelectTargetMethod::Random, 1, 100, true); // not aggro leader
184 if (target && target->GetPowerType() == POWER_MANA)
185 break;
186 }
187 if (target)
188 {
189 DoCast(target, SPELL_CHARGE);
190 AttackStart(target);
191 }
193 break;
194 }
196 {
198 /*
199 CreatureTemplate const* cinfo = me->GetCreatureTemplate();
200 me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 1)));
201 me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 1)));
202 me->UpdateDamagePhysical(BASE_ATTACK);
203 */
211 break;
212 }
213 default:
214 break;
215 }
216
218 return;
219 }
220
222 }
223};
224
226{
227 gob_spider_egg(GameObject* gob) : GameObjectAI(gob), _instance(gob->GetInstanceScript()) { }
228
229 void JustSummoned(Creature* creature) override
230 {
232 marli->AI()->JustSummoned(creature);
233
235 }
236private:
238};
239
240// Spawn of Marli
242{
244 {
245 Initialize();
246 }
247
249 {
250 _levelUpTimer = 3000;
251 }
252
253 void Reset() override
254 {
255 Initialize();
256 }
257
258 void UpdateAI(uint32 diff) override
259 {
260 if (!UpdateVictim())
261 return;
262
263 if (_levelUpTimer <= diff)
264 {
266 _levelUpTimer = 3000;
267 }
268 else
269 _levelUpTimer -= diff;
270
272 }
273
274private:
276};
277
278// 24083 - Hatch Eggs
294
uint32_t uint32
Definition Define.h:133
Spells
Definition PlayerAI.cpp:32
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
@ EFFECT_0
@ TARGET_GAMEOBJECT_DEST_AREA
@ POWER_MANA
#define SpellObjectAreaTargetSelectFn(F, I, N)
@ UNIT_MOD_DAMAGE_MAINHAND
Definition Unit.h:180
@ UNIT_STATE_CASTING
Definition Unit.h:235
@ TOTAL_PCT
Definition Unit.h:146
@ SAY_DEATH
@ SAY_AGGRO
@ SAY_TRANSFORM
@ SAY_SPIDER_SPAWN
@ NPC_SPIDER
@ GOB_SPIDER_EGG
@ SPELL_ENVOLWINGWEB
@ SPELL_ASPECT_OF_MARLI
@ SPELL_HATCH_SPIDER_EGG
@ SPELL_CHARGE
@ SPELL_LEVELUP
@ SPELL_SPIDER_FORM
@ SPELL_HATCH_EGGS
@ SPELL_POISON_VOLLEY
@ PHASE_ONE
@ PHASE_THREE
@ PHASE_TWO
float const DamageIncrease
float const DamageDecrease
void AddSC_boss_marli()
@ EVENT_POISON_VOLLEY
@ EVENT_HATCH_SPIDER_EGG
@ EVENT_TRANSFORM_BACK
@ EVENT_CHARGE_PLAYER
@ EVENT_ASPECT_OF_MARLI
@ EVENT_TRANSFORM
@ EVENT_SPAWN_START_SPIDERS
void JustEngagedWith(Unit *who) override
SummonList summons
EventMap events
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
CreatureAI * AI() const
Definition Creature.h:154
void Update(uint32 time)
Definition EventMap.h:67
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
GameObject *const me
void SetRespawnCompatibilityMode(bool mode=true)
Definition GameObject.h:270
Creature * GetCreature(uint32 type)
Unit * GetCaster() const
SpellInfo const * GetSpellInfo() const
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
void Summon(Creature const *summon)
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
virtual void AttackStart(Unit *)
Definition UnitAI.cpp:30
SpellCastResult DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:243
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:106
Definition Unit.h:769
void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3638
void ApplyStatPctModifier(UnitMods unitMod, UnitModifierPctType modifierType, float amount)
Definition Unit.cpp:9042
Powers GetPowerType() const
Definition Unit.h:931
Unit * GetVictim() const
Definition Unit.h:859
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
void GetGameObjectListWithEntryInGrid(Container &gameObjectContainer, uint32 entry, float maxSearchRange=250.0f) const
Definition Object.cpp:3133
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2832
PrepareSpellScript(spell_hatch_spiders)
void HandleObjectAreaTargetSelect(std::list< WorldObject * > &targets)
void Register() override
void AttackStart(Unit *) override
float GetThreat(Unit const *victim, Unit const *who=nullptr)
void ModifyThreatByPercent(Unit *victim, int32 pct, Unit *who=nullptr)
void UpdateAI(uint32 diff) override
boss_marli(Creature *creature)
void JustDied(Unit *) override
void JustEngagedWith(Unit *who) override
void JustSummoned(Creature *creature) override
void Reset() override
void JustSummoned(Creature *creature) override
InstanceScript *const _instance
gob_spider_egg(GameObject *gob)
void UpdateAI(uint32 diff) override
npc_spawn_of_marli(Creature *creature)
void Reset() override
#define RegisterZulGurubCreatureAI(ai_name)
Definition zulgurub.h:91
#define RegisterZulGurubGameObjectAI(ai_name)
Definition zulgurub.h:92
@ DATA_MARLI
Definition zulgurub.h:32