Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
boss_warp_splinter.cpp
Go to the documentation of this file.
1/*
2* This file is part of Project SkyFire https://www.projectskyfire.org.
3* See LICENSE.md file for Copyright information
4*/
5
6/* ScriptData
7SDName: Boss_Warp_Splinter
8SD%Complete: 80
9SDComment: Includes Sapling (need some better control with these).
10SDCategory: Tempest Keep, The Botanica
11EndScriptData */
12
13#include "ScriptMgr.h"
14#include "ScriptedCreature.h"
15#include "the_botanica.h"
16
17enum Says
18{
23};
24
26{
27 WAR_STOMP = 34716,
28 SUMMON_TREANTS = 34727, // DBC: 34727, 34731, 34733, 34734, 34736, 34739, 34741 (with Ancestral Life spell 34742) // won't work (guardian summon)
32};
33
34enum Misc
35{
37};
38
39float treant_pos[6][3] =
40{
41 {24.301233f, 427.221100f, -27.060635f},
42 {16.795492f, 359.678802f, -27.355425f},
43 {53.493484f, 345.381470f, -26.196192f},
44 {61.867096f, 439.362732f, -25.921030f},
45 {109.861877f, 423.201630f, -27.356019f},
46 {106.780159f, 355.582581f, -27.593357f}
47};
48
49/*#####
50# npc_treant (Sapling)
51#####*/
53{
54 public:
55 npc_warp_splinter_treant() : CreatureScript("npc_warp_splinter_treant") { }
56
58 {
60 {
61 WarpGuid = 0;
62 }
63
66
68 {
69 check_Timer = 0;
70 }
71
72 void EnterCombat(Unit* /*who*/) OVERRIDE { }
73
74 void MoveInLineOfSight(Unit* /*who*/) OVERRIDE { }
75
76
78 {
79 if (!UpdateVictim())
80 {
81 if (WarpGuid && check_Timer <= diff)
82 {
83 if (Unit* Warp = Unit::GetUnit(*me, WarpGuid))
84 {
85 if (me->IsWithinMeleeRange(Warp, 2.5f))
86 {
87 int32 CurrentHP_Treant = (int32)me->GetHealth();
88 Warp->CastCustomSpell(Warp, SPELL_HEAL_FATHER, &CurrentHP_Treant, 0, 0, true, 0, 0, me->GetGUID());
89 me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
90 return;
91 }
92 me->GetMotionMaster()->MoveFollow(Warp, 0, 0);
93 }
94 check_Timer = 1000;
95 }
96 else
97 check_Timer -= diff;
98 return;
99 }
100
101 if (me->GetVictim()->GetGUID() != WarpGuid)
103 }
104 };
106 {
107 return new npc_warp_splinter_treantAI(creature);
108 }
109};
110
111/*#####
112# boss_warp_splinter
113#####*/
115{
116 public:
117 boss_warp_splinter() : CreatureScript("boss_warp_splinter") { }
118
120 {
122 {
123 Treant_Spawn_Pos_X = creature->GetPositionX();
124 Treant_Spawn_Pos_Y = creature->GetPositionY();
125 }
126
130
133
135 {
136 War_Stomp_Timer = std::rand() % 40000 + 25000;
137 Summon_Treants_Timer = 45000;
138 Arcane_Volley_Timer = std::rand() % 20000 + 8000;
139
140 me->SetSpeed(MOVE_RUN, 0.7f, true);
141 }
142
143 void EnterCombat(Unit* /*who*/) OVERRIDE
144 {
146 }
147
148 void KilledUnit(Unit* /*victim*/) OVERRIDE
149 {
150 Talk(SAY_SLAY);
151 }
152
153 void JustDied(Unit* /*killer*/) OVERRIDE
154 {
156 }
157
159 {
160 for (uint8 i = 0; i < 6; ++i)
161 {
162 float angle = (M_PI / 3) * i;
163
164 float X = Treant_Spawn_Pos_X + 50.0f * std::cos(angle);
165 float Y = Treant_Spawn_Pos_Y + 50.0f * std::sin(angle);
166 float O = - me->GetAngle(X, Y);
167
168 if (Creature* pTreant = me->SummonCreature(CREATURE_TREANT, treant_pos[i][0], treant_pos[i][1], treant_pos[i][2], O, TempSummonType::TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 25000))
169 CAST_AI(npc_warp_splinter_treant::npc_warp_splinter_treantAI, pTreant->AI())->WarpGuid = me->GetGUID();
170 }
172 }
173
175 {
176 if (!UpdateVictim())
177 return;
178
179 //Check for War Stomp
180 if (War_Stomp_Timer <= diff)
181 {
183 War_Stomp_Timer = std::rand() % 40000 + 25000;
184 }
185 else
186 War_Stomp_Timer -= diff;
187
188 //Check for Arcane Volley
189 if (Arcane_Volley_Timer <= diff)
190 {
192 Arcane_Volley_Timer = std::rand() % 35000 + 20000;
193 }
194 else
195 Arcane_Volley_Timer -= diff;
196
197 //Check for Summon Treants
198 if (Summon_Treants_Timer <= diff)
199 {
201 Summon_Treants_Timer = 45000;
202 }
203 else
204 Summon_Treants_Timer -= diff;
205
207 }
208 };
209
211 {
212 return new boss_warp_splinterAI(creature);
213 }
214};
215
221
#define M_PI
Definition Common.h:192
std::int32_t int32
Definition Define.h:73
std::uint8_t uint8
Definition Define.h:79
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
std::uint64_t uint64
Definition Define.h:76
@ TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN
Definition Object.h:69
#define CAST_AI(a, b)
@ SPELL_SCHOOL_MASK_NORMAL
@ MOVE_RUN
Definition Unit.h:556
@ DIRECT_DAMAGE
Definition Unit.h:614
@ SAY_SLAY
#define SAY_DEATH
#define SAY_AGGRO
void AddSC_boss_warp_splinter()
float treant_pos[6][3]
@ CREATURE_TREANT
@ ARCANE_VOLLEY
@ SUMMON_TREANTS
@ SPELL_HEAL_FATHER
@ ARCANE_VOLLEY_H
BossAI(Creature *creature, uint32 bossId)
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
bool UpdateVictim()
CreatureScript(const char *name)
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:28
void DoCastVictim(uint32 spellId, bool triggered=false)
Definition UnitAI.cpp:168
Definition Unit.h:1367
static Unit * GetUnit(WorldObject &object, uint64 guid)
Definition Unit.cpp:4895
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
float GetPositionX() const
Definition Object.h:328
float GetPositionY() const
Definition Object.h:329
Creature * me
ScriptedAI(Creature *creature)
const T & DUNGEON_MODE(const T &normal5, const T &heroic5) const
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
@ DATA_WARP_SPLINTER