TrinityCore
Loading...
Searching...
No Matches
boss_warlord_kalithresh.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/* ScriptData
19SDName: Boss_Warlord_Kalithres
20SD%Complete: 65
21SDComment: Contains workarounds regarding warlord's rage spells not acting as expected. Both scripts here require review and fine tuning.
22SDCategory: Coilfang Resevoir, The Steamvault
23EndScriptData */
24
25#include "ScriptMgr.h"
26#include "InstanceScript.h"
27#include "ScriptedCreature.h"
28#include "SpellInfo.h"
29#include "steam_vault.h"
30
46
48{
49public:
50 npc_naga_distiller() : CreatureScript("npc_naga_distiller") { }
51
52 CreatureAI* GetAI(Creature* creature) const override
53 {
54 return GetSteamVaultAI<npc_naga_distillerAI>(creature);
55 }
56
58 {
60 {
61 instance = creature->GetInstanceScript();
62 }
63
65
66 void Reset() override
67 {
68 me->SetUninteractible(true);
70
71 //hack, due to really weird spell behaviour :(
73 {
74 me->SetUninteractible(false);
76 }
77 }
78
79 void JustEngagedWith(Unit* /*who*/) override { }
80
90
91 void DamageTaken(Unit* /*done_by*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
92 {
93 if (me->GetHealth() <= damage)
95 }
96 };
97
98};
99
101{
102public:
103 boss_warlord_kalithresh() : CreatureScript("boss_warlord_kalithresh") { }
104
105 CreatureAI* GetAI(Creature* creature) const override
106 {
107 return GetSteamVaultAI<boss_warlord_kalithreshAI>(creature);
108 }
109
111 {
113 {
114 Initialize();
115 instance = creature->GetInstanceScript();
116 }
117
119 {
120 Reflection_Timer = 10000;
121 Impale_Timer = 7000 + rand32() % 7000;
122 Rage_Timer = 45000;
123 CanRage = false;
124 }
125
127
132
133 void Reset() override
134 {
135 Initialize();
136
138 }
139
140 void JustEngagedWith(Unit* /*who*/) override
141 {
143
145 }
146
147 void KilledUnit(Unit* /*victim*/) override
148 {
149 Talk(SAY_SLAY);
150 }
151
152 void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
153 {
154 //hack :(
155 if (spellInfo->Id == SPELL_WARLORDS_RAGE_PROC)
158 }
159
160 void JustDied(Unit* /*killer*/) override
161 {
163
165 }
166
167 void UpdateAI(uint32 diff) override
168 {
169 if (!UpdateVictim())
170 return;
171
172 if (Rage_Timer <= diff)
173 {
174 if (Creature* distiller = me->FindNearestCreature(17954, 100.0f))
175 {
178 ENSURE_AI(npc_naga_distiller::npc_naga_distillerAI, distiller->AI())->StartRageGen(me);
179 }
180 Rage_Timer = 3000 + rand32() % 15000;
181 } else Rage_Timer -= diff;
182
183 //Reflection_Timer
184 if (Reflection_Timer <= diff)
185 {
187 Reflection_Timer = 15000 + rand32() % 10000;
188 } else Reflection_Timer -= diff;
189
190 //Impale_Timer
191 if (Impale_Timer <= diff)
192 {
194 DoCast(target, SPELL_IMPALE);
195
196 Impale_Timer = 7500 + rand32() % 5000;
197 } else Impale_Timer -= diff;
198 }
199 };
200};
201
uint32_t uint32
Definition Define.h:154
@ IN_PROGRESS
@ DONE
@ NOT_STARTED
uint32 rand32()
Definition Random.cpp:70
#define ENSURE_AI(a, b)
Definition UnitAI.h:30
DamageEffectType
@ UNIT_FLAG_NON_ATTACKABLE
void AddSC_boss_warlord_kalithresh()
@ SPELL_WARLORDS_RAGE_NAGA
@ SPELL_WARLORDS_RAGE_PROC
@ SPELL_SPELL_REFLECTION
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:63
virtual bool SetBossState(uint32 id, EncounterState state)
uint32 const Id
Definition SpellInfo.h:328
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:79
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:89
Definition Unit.h:635
void SetUninteractible(bool apply)
Definition Unit.cpp:8564
uint64 GetHealth() const
Definition Unit.h:788
void SetUnitFlag(UnitFlags flags)
Definition Unit.h:846
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3974
void RemoveUnitFlag(UnitFlags flags)
Definition Unit.h:847
InstanceScript * GetInstanceScript() const
Definition Object.cpp:396
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition Object.cpp:1517
virtual uint32 GetData(uint32) const
Definition ZoneScript.h:99
virtual void SetData(uint32, uint32)
Definition ZoneScript.h:100
CreatureAI * GetAI(Creature *creature) const override
CreatureAI * GetAI(Creature *creature) const override
@ DATA_DISTILLER
Definition steam_vault.h:35
@ DATA_WARLORD_KALITHRESH
Definition steam_vault.h:32
void SpellHit(WorldObject *, SpellInfo const *spellInfo) override
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override