TrinityCore
Loading...
Searching...
No Matches
boss_jindo.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 "InstanceScript.h"
20#include "ObjectAccessor.h"
21#include "ScriptedCreature.h"
22#include "ScriptMgr.h"
23#include "TemporarySummon.h"
24
25enum Say
26{
27 SAY_AGGRO = 1
28};
29
31{
34 SPELL_HEX = 24053,
37 // Healing Ward Spell
38 SPELL_HEAL = 24311,
39 // Shade of Jindo Spell
41 SPELL_INVISIBLE = 24307
42};
43
52
53Position const TeleportLoc = { -11583.7783f, -1249.4278f, 77.5471f, 4.745f };
54
55// Formation of summoned trolls
57{
58 { -11582.2998f, -1247.8599f, 77.6298f, 0.0f },
59 { -11585.0996f, -1248.7600f, 77.6298f, 0.0f },
60 { -11586.5996f, -1250.7199f, 77.6298f, 0.0f },
61 { -11586.4003f, -1253.9200f, 77.6298f, 0.0f },
62 { -11584.2001f, -1252.2099f, 77.6298f, 0.0f },
63 { -11582.5000f, -1250.3199f, 77.6298f, 0.0f },
64 { -11583.2001f, -1254.8299f, 77.6298f, 0.0f },
65 { -11581.5000f, -1252.5400f, 77.6298f, 0.0f },
66 { -11580.2001f, -1250.5999f, 77.6298f, 0.0f },
67 { -11580.5996f, -1254.7900f, 77.6298f, 0.0f }
68};
69
70struct boss_jindo : public BossAI
71{
72 boss_jindo(Creature* creature) : BossAI(creature, DATA_JINDO) { }
73
74 void Reset() override
75 {
76 _Reset();
77 }
78
79 void JustDied(Unit* /*killer*/) override
80 {
81 _JustDied();
82 }
83
94
95 void UpdateAI(uint32 diff) override
96 {
97 if (!UpdateVictim())
98 return;
99
100 events.Update(diff);
101
103 return;
104
105 while (uint32 eventId = events.ExecuteEvent())
106 {
107 switch (eventId)
108 {
112 break;
116 break;
117 case EVENT_HEX:
118 if (Unit* target = me->GetVictim())
119 {
120 DoCast(target, SPELL_HEX, true);
121 if (GetThreat(target))
122 ModifyThreatByPercent(target, -80);
123 }
124 events.ScheduleEvent(EVENT_HEX, 12s, 20s);
125 break;
127 // Casting the delusion curse with a shade so shade will attack the same target with the curse.
128 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100.0f, true))
129 {
130 DoCast(target, SPELL_SHADE_OF_JINDO, true);
132 }
134 break;
135 case EVENT_TELEPORT:
136 // Teleports a random player and spawns 9 Sacrificed Trolls to attack player
137 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100.0f, true))
138 {
140 if (GetThreat(me->GetVictim()))
141 ModifyThreatByPercent(target, -100);
142
143 // Summon a formation of trolls
144 for (uint8 i = 0; i < 10; ++i)
146 sacrificedTroll->AI()->AttackStart(target);
147 }
149 break;
150 default:
151 break;
152 }
153
155 return;
156 }
157
159 }
160};
161
162// Healing Ward
164{
165 npc_healing_ward(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript())
166 {
167 Initialize();
168 creature->SetReactState(REACT_PASSIVE);
169 }
170
172 {
173 _healTimer = 2000;
174 }
175
176 void Reset() override
177 {
178 Initialize();
179 }
180
181 void AttackStart(Unit* /*victim*/) override { }
182
183 void UpdateAI(uint32 diff) override
184 {
185 // Heal_Timer
186 if (_healTimer <= diff)
187 {
189 DoCast(jindo, SPELL_HEAL);
190 _healTimer = 3000;
191 }
192 else
193 _healTimer -= diff;
194 }
195
196private:
199};
200
201// Shade of Jindo
203{
205 {
206 Initialize();
207 }
208
210 {
211 _shadowShockTimer = 1000;
212 }
213
214 void Reset() override
215 {
216 Initialize();
217 DoCast(me, SPELL_INVISIBLE, true);
218 }
219
220 void UpdateAI(uint32 diff) override
221 {
222 if (!UpdateVictim())
223 return;
224
225 // ShadowShock_Timer
226 if (_shadowShockTimer <= diff)
227 {
229 _shadowShockTimer = 2000;
230 }
231 else
232 _shadowShockTimer -= diff;
233
235 }
236
237private:
239};
240
uint8_t uint8
Definition Define.h:135
uint32_t uint32
Definition Define.h:133
@ TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT
Spells
Definition PlayerAI.cpp:32
@ REACT_PASSIVE
@ UNIT_STATE_CASTING
Definition Unit.h:235
Position const Formation[]
@ SPELL_SHADE_OF_JINDO
@ SPELL_BRAIN_WASH_TOTEM
@ SPELL_DELUSIONS_OF_JINDO
@ SPELL_SHADOWSHOCK
@ SPELL_HEAL
@ SPELL_POWERFULL_HEALING_WARD
@ SPELL_HEX
@ SPELL_INVISIBLE
void AddSC_boss_jindo()
@ SAY_AGGRO
Position const TeleportLoc
@ EVENT_DELUSIONS_OF_JINDO
@ EVENT_POWERFULL_HEALING_WARD
@ EVENT_TELEPORT
@ EVENT_BRAIN_WASH_TOTEM
@ EVENT_HEX
void JustEngagedWith(Unit *who) override
EventMap events
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
void SetReactState(ReactStates st)
Definition Creature.h:119
void Update(uint32 time)
Definition EventMap.h:67
EventId ExecuteEvent()
Definition EventMap.cpp:73
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
Creature * GetCreature(uint32 type)
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
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:106
Definition Unit.h:769
Unit * GetVictim() const
Definition Unit.h:859
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
TempSummon * SummonCreature(uint32 entry, Position const &pos, TempSummonType despawnType=TEMPSUMMON_MANUAL_DESPAWN, Milliseconds despawnTime=0s, uint32 vehId=0, uint32 spellId=0, ObjectGuid privateObjectOwner=ObjectGuid::Empty)
Definition Object.cpp:1992
float GetPositionZ() const
Definition Position.h:81
float GetOrientation() const
Definition Position.h:82
float GetPositionX() const
Definition Position.h:79
float GetPositionY() const
Definition Position.h:80
float GetThreat(Unit const *victim, Unit const *who=nullptr)
void DoTeleportPlayer(Unit *unit, float x, float y, float z, float o)
void ModifyThreatByPercent(Unit *victim, int32 pct, Unit *who=nullptr)
void Reset() override
void JustDied(Unit *) override
void JustEngagedWith(Unit *who) override
boss_jindo(Creature *creature)
void UpdateAI(uint32 diff) override
npc_healing_ward(Creature *creature)
InstanceScript * _instance
void AttackStart(Unit *) override
void Reset() override
void UpdateAI(uint32 diff) override
void UpdateAI(uint32 diff) override
npc_shade_of_jindo(Creature *creature)
void Reset() override
@ NPC_SACRIFICED_TROLL
Definition zulgurub.h:59
#define RegisterZulGurubCreatureAI(ai_name)
Definition zulgurub.h:91
@ DATA_JINDO
Definition zulgurub.h:37