TrinityCore
boss_ichoron.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 "InstanceScript.h"
20#include "MotionMaster.h"
21#include "ScriptedCreature.h"
22#include "SpellAuras.h"
23#include "SpellScript.h"
24#include "violet_hold.h"
25
27{
32 SPELL_FRENZY = 54312,
33 SPELL_BURST = 54379,
36 SPELL_SHRINK = 54297,
37
45
46 SPELL_MERGE = 54269,
47 SPELL_SPLASH = 59516
48};
49
51{
60};
61
63{
67};
68
69enum Misc
70{
72};
73
74struct boss_ichoron : public BossAI
75{
76 boss_ichoron(Creature* creature) : BossAI(creature, DATA_ICHORON)
77 {
78 Initialize();
79
82 }
83
85 {
86 _isFrenzy = false;
87 _dehydration = true;
88 }
89
90 void Reset() override
91 {
92 Initialize();
94
96 }
97
98 void JustEngagedWith(Unit* who) override
99 {
102 }
103
104 void JustReachedHome() override
105 {
108 }
109
110 void DoAction(int32 actionId) override
111 {
112 switch (actionId)
113 {
115 if (!me->IsAlive())
116 break;
117
119 _dehydration = false;
120 break;
122 {
125
127 DoCastAOE(SPELL_BURST, true);
128 DoCast(me, SPELL_DRAINED, true);
129
130 uint32 damage = me->CountPctFromMaxHealth(30);
131 me->LowerPlayerDamageReq(damage);
132 me->ModifyHealth(-std::min<int32>(damage, me->GetHealth() - 1));
133
135 break;
136 }
137 case ACTION_DRAINED:
138 if (HealthAbovePct(30))
139 {
142 }
143 break;
144 default:
145 break;
146 }
147 }
148
149 uint32 GetData(uint32 type) const override
150 {
151 if (type == DATA_DEHYDRATION)
152 return _dehydration ? 1 : 0;
153 return 0;
154 }
155
156 void KilledUnit(Unit* victim) override
157 {
158 if (victim->GetTypeId() == TYPEID_PLAYER)
159 Talk(SAY_SLAY);
160 }
161
162 void JustDied(Unit* /*killer*/) override
163 {
165 _JustDied();
166 }
167
168 void JustSummoned(Creature* summon) override
169 {
170 summons.Summon(summon);
171
172 if (summon->GetEntry() == NPC_ICHOR_GLOBULE)
174 }
175
176 void SummonedCreatureDespawn(Creature* summon) override
177 {
179
180 if (summons.empty())
182 }
183
184 void UpdateAI(uint32 diff) override
185 {
186 if (!UpdateVictim())
187 return;
188
190 {
192 DoCast(me, SPELL_FRENZY, true);
193 _isFrenzy = true;
194 }
195
196 scheduler.Update(diff);
197 }
198
199 void ScheduleTasks() override
200 {
201 scheduler.Async([this]
202 {
205 });
206
207 scheduler.Schedule(Seconds(10), Seconds(15), [this](TaskContext task)
208 {
210 task.Repeat(Seconds(10), Seconds(15));
211 });
212
213 scheduler.Schedule(Seconds(6), Seconds(9), [this](TaskContext task)
214 {
215 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 50.0f))
216 DoCast(target, SPELL_WATER_BLAST);
217 task.Repeat(Seconds(6), Seconds(9));
218 });
219 }
220
221private:
224};
225
227{
229 {
230 _instance = creature->GetInstanceScript();
231 creature->SetReactState(REACT_PASSIVE);
232 }
233
234 void SpellHit(WorldObject* caster, SpellInfo const* spellInfo) override
235 {
236 Unit* unitCaster = caster->ToUnit();
237 if (!unitCaster)
238 return;
239
240 if (spellInfo->Id == SPELL_WATER_GLOBULE_VISUAL)
241 {
243 me->SetUninteractible(false);
244 me->GetMotionMaster()->MoveFollow(unitCaster, 0.0f, 0.0f);
245 }
246 }
247
248 void MovementInform(uint32 type, uint32 id) override
249 {
250 if (type != FOLLOW_MOTION_TYPE)
251 return;
252
254 return;
255
257 me->DespawnOrUnsummon(1ms);
258 }
259
260 // on retail spell casted on a creature's death are not casted after death but keeping mob at 1 health, casting it and then letting the mob die.
261 // this feature should be still implemented
262 void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
263 {
265 return;
266
267 if (damage >= me->GetHealth())
268 {
269 _splashTriggered = true;
271 }
272 }
273
274 void UpdateAI(uint32 /*diff*/) override { }
275
276private:
279};
280
281// 59820 - Drained
283{
284 bool Load() override
285 {
287 }
288
289 void HandleApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
290 {
293 }
294
295 void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
296 {
299
300 if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE)
301 if (UnitAI* ai = GetTarget()->GetAI())
302 ai->DoAction(ACTION_DRAINED);
303 }
304
305 void Register() override
306 {
309 }
310};
311
312// 54269 - Merge
314{
315 bool Validate(SpellInfo const* /*spellInfo*/) override
316 {
318 }
319
320 void HandleScript(SpellEffIndex /*effIndex*/)
321 {
322 if (Creature* target = GetHitCreature())
323 {
324 if (Aura* aura = target->GetAura(SPELL_SHRINK))
325 aura->ModStackAmount(-1);
326
327 target->AI()->DoAction(ACTION_WATER_GLOBULE_HIT);
328 }
329 }
330
331 void Register() override
332 {
334 }
335};
336
337// 54306 - Protective Bubble
339{
340 bool Load() override
341 {
343 }
344
345 void HandleShatter(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
346 {
347 //if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_ENEMY_SPELL)
348 if (GetAura()->GetCharges() <= 1)
349 if (UnitAI* targetAI = GetTarget()->GetAI())
350 targetAI->DoAction(ACTION_PROTECTIVE_BUBBLE_SHATTERED);
351 }
352
353 void Register() override
354 {
356 }
357};
358
359// 54259 - Splatter
361{
362 bool Validate(SpellInfo const* /*spellInfo*/) override
363 {
364 return ValidateSpellInfo(
365 {
372 });
373 }
374
375 void PeriodicTick(AuraEffect const* /*aurEff*/)
376 {
379 }
380
381 void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
382 {
383 if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE)
384 if (Aura* aura = GetTarget()->GetAura(SPELL_SHRINK))
385 aura->ModStackAmount(10);
386 }
387
388 void Register() override
389 {
392 }
393};
394
396{
397 public:
398 achievement_dehydration() : AchievementCriteriaScript("achievement_dehydration") { }
399
400 bool OnCheck(Player* /*player*/, Unit* target) override
401 {
402 if (!target)
403 return false;
404
405 if (Creature* Ichoron = target->ToCreature())
406 if (Ichoron->AI()->GetData(DATA_DEHYDRATION))
407 return true;
408
409 return false;
410 }
411};
412
414{
422}
Actions
First const & RAND(First const &first, Second const &second, Rest const &... rest)
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
@ FOLLOW_MOTION_TYPE
@ TYPEID_PLAYER
Definition: ObjectGuid.h:41
Spells
Definition: PlayerAI.cpp:32
#define RegisterSpellScript(spell_script)
Definition: ScriptMgr.h:1369
SpellEffIndex
Definition: SharedDefines.h:29
@ EFFECT_0
Definition: SharedDefines.h:30
@ SPELL_EFFECT_SCRIPT_EFFECT
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL
@ AURA_REMOVE_BY_EXPIRE
@ SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN
@ SPELL_AURA_PERIODIC_DUMMY
@ SPELL_AURA_MOD_STUN
#define SpellEffectFn(F, I, N)
Definition: SpellScript.h:842
#define AuraEffectPeriodicFn(F, I, N)
Definition: SpellScript.h:2046
#define AuraEffectApplyFn(F, I, N, M)
Definition: SpellScript.h:2029
#define AuraEffectRemoveFn(F, I, N, M)
Definition: SpellScript.h:2040
@ UNIT_FLAG2_FEIGN_DEATH
Definition: UnitDefines.h:194
@ REACT_PASSIVE
Definition: UnitDefines.h:506
DamageEffectType
Definition: UnitDefines.h:131
@ UNIT_STATE_IGNORE_PATHFINDING
Definition: Unit.h:283
@ ACTION_WATER_GLOBULE_HIT
@ ACTION_PROTECTIVE_BUBBLE_SHATTERED
@ ACTION_DRAINED
@ DATA_DEHYDRATION
@ SAY_DEATH
@ SAY_AGGRO
@ SAY_BUBBLE
@ SAY_SLAY
@ SAY_SPAWN
@ SAY_SHATTER
@ SAY_ENRAGE
@ EMOTE_SHATTER
void AddSC_boss_ichoron()
@ SPELL_SHRINK
@ SPELL_SPLATTER
@ SPELL_WATER_GLOBULE_SUMMON_3
@ SPELL_THREAT_PROC
@ SPELL_WATER_GLOBULE_SUMMON_4
@ SPELL_MERGE
@ SPELL_WATER_GLOBULE_SUMMON_2
@ SPELL_WATER_GLOBULE_SUMMON_1
@ SPELL_WATER_BOLT_VOLLEY
@ SPELL_WATER_GLOBULE_SUMMON_5
@ SPELL_WATER_GLOBULE_VISUAL
@ SPELL_WATER_GLOBULE_TRANSFORM
@ SPELL_FRENZY
@ SPELL_WATER_BLAST
@ SPELL_SPLASH
@ SPELL_PROTECTIVE_BUBBLE
@ SPELL_BURST
@ SPELL_DRAINED
Yells
void PreventDefaultAction()
AuraApplication const * GetTargetApplication() const
HookList< EffectApplyHandler > AfterEffectRemove
Definition: SpellScript.h:2039
HookList< EffectPeriodicHandler > OnEffectPeriodic
Definition: SpellScript.h:2045
WorldObject * GetOwner() const
HookList< EffectApplyHandler > AfterEffectApply
Definition: SpellScript.h:2028
Aura * GetAura() const
Unit * GetTarget() const
uint8 GetCharges() const
InstanceScript *const instance
void JustEngagedWith(Unit *who) override
TaskScheduler scheduler
void JustReachedHome() override
SummonList summons
void SummonedCreatureDespawn(Creature *summon) override
void Reset() override
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
void SetReactState(ReactStates st)
Definition: Creature.h:160
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
Definition: Creature.cpp:2415
void LowerPlayerDamageReq(uint64 unDamage)
Definition: Creature.cpp:1680
ObjectGuid GetObjectGuid(uint32 type) const
void MoveFollow(Unit *target, float dist, ChaseAngle angle, Optional< Milliseconds > duration={}, MovementSlot slot=MOTION_SLOT_ACTIVE)
LowType GetCounter() const
Definition: ObjectGuid.h:293
static ObjectGuid const Empty
Definition: ObjectGuid.h:274
static Creature * ToCreature(Object *o)
Definition: Object.h:219
static Unit * ToUnit(Object *o)
Definition: Object.h:225
TypeID GetTypeId() const
Definition: Object.h:173
uint32 GetEntry() const
Definition: Object.h:161
uint32 const Id
Definition: SpellInfo.h:325
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Definition: SpellScript.h:162
Creature * GetHitCreature() const
HookList< EffectHandler > OnEffectHitTarget
Definition: SpellScript.h:840
bool empty() const
void Summon(Creature const *summon)
TaskScheduler & DelayAll(std::chrono::duration< Rep, Period > duration)
Delays all tasks with the given duration.
TaskScheduler & Schedule(std::chrono::duration< Rep, Period > time, task_handler_t task)
TaskScheduler & Async(std::function< void()> callable)
TaskScheduler & Update(success_t const &callback=nullptr)
Definition: UnitAI.h:50
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 DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.h:161
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:89
Definition: Unit.h:627
int64 ModifyHealth(int64 val)
Definition: Unit.cpp:8182
MotionMaster * GetMotionMaster()
Definition: Unit.h:1652
void SetUnitFlag2(UnitFlags2 flags)
Definition: Unit.h:838
bool IsAlive() const
Definition: Unit.h:1164
void SetUninteractible(bool apply)
Definition: Unit.cpp:8147
void AddUnitState(uint32 f)
Definition: Unit.h:731
uint64 GetHealth() const
Definition: Unit.h:776
void RemoveUnitFlag2(UnitFlags2 flags)
Definition: Unit.h:839
uint64 CountPctFromMaxHealth(int32 pct) const
Definition: Unit.h:785
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition: Unit.cpp:4664
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3831
InstanceScript * GetInstanceScript() const
Definition: Object.cpp:1042
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
virtual void SetData(uint32, uint32)
Definition: ZoneScript.h:92
bool OnCheck(Player *, Unit *target) override
void HandleRemove(AuraEffect const *, AuraEffectHandleModes)
bool Load() override
void Register() override
void HandleApply(AuraEffect const *, AuraEffectHandleModes)
void HandleScript(SpellEffIndex)
bool Validate(SpellInfo const *) override
void Register() override
void HandleShatter(AuraEffect const *, AuraEffectHandleModes)
void PeriodicTick(AuraEffect const *)
void Register() override
bool Validate(SpellInfo const *) override
void HandleRemove(AuraEffect const *, AuraEffectHandleModes)
bool HealthAbovePct(uint32 pct) const
bool HealthBelowPct(uint32 pct) const
void JustSummoned(Creature *summon) override
void KilledUnit(Unit *victim) override
void SummonedCreatureDespawn(Creature *summon) override
void DoAction(int32 actionId) override
uint32 GetData(uint32 type) const override
void Initialize()
boss_ichoron(Creature *creature)
void UpdateAI(uint32 diff) override
void Reset() override
void JustReachedHome() override
void JustEngagedWith(Unit *who) override
void ScheduleTasks() override
void JustDied(Unit *) override
void MovementInform(uint32 type, uint32 id) override
InstanceScript * _instance
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
npc_ichor_globule(Creature *creature)
void UpdateAI(uint32) override
void SpellHit(WorldObject *caster, SpellInfo const *spellInfo) override
@ DATA_ICHORON
Definition: violet_hold.h:56
@ DATA_HANDLE_CELLS
Definition: violet_hold.h:87
#define RegisterVioletHoldCreatureAI(ai_name)
Definition: violet_hold.h:164
@ NPC_DUMMY_ICHORON
Definition: violet_hold.h:111
@ NPC_ICHOR_GLOBULE
Definition: violet_hold.h:100
@ NPC_ICHORON
Definition: violet_hold.h:99