Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
boss_high_botanist_freywinn.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_High_Botanist_Freywinn
8SD%Complete: 90
9SDComment: some strange visual related to tree form(if aura lost before normal duration end). possible make summon&transform -process smoother(transform after delay)
10SDCategory: Tempest Keep, The Botanica
11EndScriptData */
12
13#include "ScriptMgr.h"
14#include "ScriptedCreature.h"
15#include "the_botanica.h"
16
26
37
39{
40 NPC_FRAYER = 19953
41};
42
44{
45 public:
46 boss_high_botanist_freywinn() : CreatureScript("boss_high_botanist_freywinn") { }
47
49 {
51
52 std::list<uint64> Adds_List;
53
59
61 {
62 Adds_List.clear();
63
65 TreeForm_Timer = 30000;
66 MoveCheck_Timer = 1000;
67 DeadAddsCount = 0;
68 MoveFree = true;
69 }
70
71 void EnterCombat(Unit* /*who*/) OVERRIDE
72 {
74 }
75
77 {
78 if (summoned->GetEntry() == NPC_FRAYER)
79 Adds_List.push_back(summoned->GetGUID());
80 }
81
83 {
84 switch (rand()%4)
85 {
86 case 0: DoCast(me, SPELL_PLANT_WHITE); break;
87 case 1: DoCast(me, SPELL_PLANT_GREEN); break;
88 case 2: DoCast(me, SPELL_PLANT_BLUE); break;
89 case 3: DoCast(me, SPELL_PLANT_RED); break;
90 }
91 }
92
93 void KilledUnit(Unit* /*victim*/) OVERRIDE
94 {
96 }
97
98 void JustDied(Unit* /*killer*/) OVERRIDE
99 {
101 }
102
104 {
105 if (!UpdateVictim())
106 return;
107
108 if (TreeForm_Timer <= diff)
109 {
110 Talk(SAY_TREE);
111
112 if (me->IsNonMeleeSpellCasted(false))
113 me->InterruptNonMeleeSpells(true);
114
115 me->RemoveAllAuras();
116
119 DoCast(me, SPELL_TREE_FORM, true);
120
121 me->GetMotionMaster()->MoveIdle();
122 MoveFree = false;
123
124 TreeForm_Timer = 75000;
125 }
126 else
127 TreeForm_Timer -= diff;
128
129 if (!MoveFree)
130 {
131 if (MoveCheck_Timer <= diff)
132 {
133 if (!Adds_List.empty())
134 {
135 for (std::list<uint64>::iterator itr = Adds_List.begin(); itr != Adds_List.end(); ++itr)
136 {
137 if (Unit* temp = Unit::GetUnit(*me, *itr))
138 {
139 if (!temp->IsAlive())
140 {
141 Adds_List.erase(itr);
143 break;
144 }
145 }
146 }
147 }
148
149 if (DeadAddsCount < 3 && TreeForm_Timer-30000 <= diff)
150 DeadAddsCount = 3;
151
152 if (DeadAddsCount >= 3)
153 {
154 Adds_List.clear();
155 DeadAddsCount = 0;
156
157 me->InterruptNonMeleeSpells(true);
158 me->RemoveAllAuras();
159 me->GetMotionMaster()->MoveChase(me->GetVictim());
160 MoveFree = true;
161 }
162 MoveCheck_Timer = 500;
163 }
164 else
165 MoveCheck_Timer -= diff;
166
167 return;
168 }
169
170 /*if (me->HasAura(SPELL_TREE_FORM, 0) || me->HasAura(SPELL_TRANQUILITY, 0))
171 return;*/
172
173 //one random seedling every 5 secs, but not in tree form
174 if (SummonSeedling_Timer <= diff)
175 {
178 }
179 else
180 SummonSeedling_Timer -= diff;
181
183 }
184 };
185
187 {
188 return new boss_high_botanist_freywinnAI(creature);
189 }
190};
191
196
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
Creatures
#define SAY_DEATH
#define SAY_AGGRO
#define SAY_KILL
void AddSC_boss_high_botanist_freywinn()
@ SPELL_TRANQUILITY
Definition chapter5.cpp:194
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 DoCast(uint32 spellId)
Definition UnitAI.cpp:110
Definition Unit.h:1367
static Unit * GetUnit(WorldObject &object, uint64 guid)
Definition Unit.cpp:4895
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Creature * me
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
@ DATA_HIGH_BOTANIST_FREYWINN