Merge branch 'master' of github.com:TrinityCore/TrinityCore into mmaps

Conflicts:
	src/server/game/Movement/Spline/MoveSplineInit.h
This commit is contained in:
Vincent_Michael committed 2013-01-02 14:12:48 +01:00
commit b873156c3c
52 files changed
+1886 -1018

No files matched your search

@@ -35,10 +35,13 @@ Script Data End */
#include "eye_of_eternity.h"
#include "ScriptedEscortAI.h"
#include "Player.h"
#include "Vehicle.h"
#include "CombatAI.h"
#include "CreatureTextMgr.h"
enum Achievements
{
ACHIEV_TIMED_START_EVENT = 20387,
ACHIEV_TIMED_START_EVENT = 20387,
};
enum Events
@@ -132,25 +135,36 @@ enum MalygosEvents
#define TEN_MINUTES 600000
enum MalygosSays
enum Texts
{
SAY_AGGRO_P_ONE,
SAY_KILLED_PLAYER_P_ONE,
SAY_END_P_ONE,
SAY_AGGRO_P_TWO,
SAY_ANTI_MAGIC_SHELL, // not sure when execute it
SAY_MAGIC_BLAST, // not sure when execute it
SAY_KILLED_PLAYER_P_TWO,
SAY_END_P_TWO,
SAY_INTRO_P_THREE,
SAY_AGGRO_P_THREE,
SAY_SURGE_POWER, // not sure when execute it
SAY_BUFF_SPARK,
SAY_KILLED_PLAYER_P_THREE,
SAY_SPELL_CASTING_P_THREE,
SAY_DEATH
// Malygos
SAY_AGGRO_P_ONE = 0,
SAY_KILLED_PLAYER_P_ONE = 1,
SAY_END_P_ONE = 2,
SAY_AGGRO_P_TWO = 3,
SAY_ANTI_MAGIC_SHELL = 4, // not sure when execute it
SAY_MAGIC_BLAST = 5, // not sure when execute it
SAY_KILLED_PLAYER_P_TWO = 6,
SAY_END_P_TWO = 7,
SAY_INTRO_P_THREE = 8,
SAY_AGGRO_P_THREE = 9,
SAY_SURGE_POWER = 10, // not sure when execute it
SAY_BUFF_SPARK = 11,
SAY_KILLED_PLAYER_P_THREE = 12,
SAY_SPELL_CASTING_P_THREE = 13,
SAY_DEATH,
// Alexstrasza
SAY_ONE = 0,
SAY_TWO = 1,
SAY_THREE = 2,
SAY_FOUR = 3,
// Power Sparks
EMOTE_POWER_SPARK_SUMMONED = 0
};
#define MAX_HOVER_DISK_WAYPOINTS 18
// Sniffed data (x, y,z)
@@ -178,7 +192,7 @@ const Position HoverDiskWaypoints[MAX_HOVER_DISK_WAYPOINTS] =
#define GROUND_Z 268
// Source: Sniffs (x, y,z)
// Source: Sniffs (x,y,z)
#define MALYGOS_MAX_WAYPOINTS 16
const Position MalygosPhaseTwoWaypoints[MALYGOS_MAX_WAYPOINTS] =
{
@@ -316,6 +330,7 @@ public:
// The rest is handled in the AI of the vehicle.
target->CastSpell(target, SPELL_SUMMOM_RED_DRAGON, true);
me->Attack(target, false);
}
}
@@ -748,13 +763,18 @@ public:
_instance = creature->GetInstanceScript();
}
void Reset()
void SpellHit(Unit* /*caster*/, const SpellInfo* spell)
{
_summonTimer = urand(5, 7)*IN_MILLISECONDS;
if (spell->Id == SPELL_PORTAL_OPENED)
{
DoCast(me, SPELL_SUMMON_POWER_PARK, true);
}
}
void UpdateAI(uint32 const diff)
void UpdateAI(uint32 const /*diff*/)
{
// When duration of oppened riff visual ends,
// closed one should be cast
if (!me->HasAura(SPELL_PORTAL_VISUAL_CLOSED) &&
!me->HasAura(SPELL_PORTAL_OPENED))
DoCast(me, SPELL_PORTAL_VISUAL_CLOSED, true);
@@ -770,16 +790,6 @@ public:
}
}
}
if (!me->HasAura(SPELL_PORTAL_OPENED))
return;
if (_summonTimer <= diff)
{
DoCast(SPELL_SUMMON_POWER_PARK);
_summonTimer = urand(5, 7)*IN_MILLISECONDS;
} else
_summonTimer -= diff;
}
void JustSummoned(Creature* summon)
@@ -811,6 +821,8 @@ public:
_instance = creature->GetInstanceScript();
MoveToMalygos();
// Talk range was not enough for this encounter
sCreatureTextMgr->SendChat(me, EMOTE_POWER_SPARK_SUMMONED, 0, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_MAP);
}
void EnterEvadeMode()
@@ -853,14 +865,9 @@ public:
}
}
void DamageTaken(Unit* /*done_by*/, uint32& damage)
void JustDied(Unit* /*killer*/)
{
if (damage > me->GetMaxHealth())
{
damage = 0;
DoCast(me, SPELL_POWER_SPARK_DEATH, true);
me->DespawnOrUnsummon(1000);
}
me->CastSpell(me, SPELL_POWER_SPARK_DEATH, true); // not supposed to hide the fact it's there by not selectable
}
private:
@@ -903,8 +910,7 @@ public:
else
{
// Error found: This is not called if the passenger is a player
if (unit->GetTypeId() == TYPEID_UNIT)
if (unit->GetTypeId() == TYPEID_UNIT || unit->GetTypeId() == TYPEID_PLAYER)
{
// This will only be called if the passenger dies
if (_instance)
@@ -1012,7 +1018,7 @@ public:
};
};
// SmartAI does not work correctly for this (vehicles)
// SmartAI does not work correctly for vehicles
class npc_wyrmrest_skytalon : public CreatureScript
{
public:
@@ -1023,14 +1029,13 @@ public:
return new npc_wyrmrest_skytalonAI (creature);
}
struct npc_wyrmrest_skytalonAI : public NullCreatureAI
struct npc_wyrmrest_skytalonAI : public VehicleAI
{
npc_wyrmrest_skytalonAI(Creature* creature) : NullCreatureAI(creature)
{
_instance = creature->GetInstanceScript();
npc_wyrmrest_skytalonAI(Creature* creature) : VehicleAI(creature) { }
_timer = 1000;
_entered = false;
void IsSummonedBy(Unit* summoner)
{
summoner->CastSpell(me, SPELL_RIDE_RED_DRAGON, true);
}
void PassengerBoarded(Unit* /*unit*/, int8 /*seat*/, bool apply)
@@ -1038,54 +1043,9 @@ public:
if (!apply)
me->DespawnOrUnsummon();
}
// we can't call this in reset function, it fails.
void MakePlayerEnter()
{
if (!_instance)
return;
if (Unit* summoner = me->ToTempSummon()->GetSummoner())
{
if (Creature* malygos = Unit::GetCreature(*me, _instance->GetData64(DATA_MALYGOS)))
{
summoner->CastSpell(me, SPELL_RIDE_RED_DRAGON, true);
float victimThreat = malygos->getThreatManager().getThreat(summoner);
malygos->getThreatManager().resetAllAggro();
malygos->AI()->AttackStart(me);
malygos->AddThreat(me, victimThreat);
}
}
}
void UpdateAI(const uint32 diff)
{
if (!_entered)
{
if (_timer <= diff)
{
MakePlayerEnter();
_entered = true;
} else
_timer -= diff;
}
}
private:
InstanceScript* _instance;
uint32 _timer;
bool _entered;
};
};
enum AlexstraszaYells
{
SAY_ONE,
SAY_TWO,
SAY_THREE,
SAY_FOUR
};
class npc_alexstrasza_eoe : public CreatureScript
{
public:
@@ -59,6 +59,10 @@ set(scripts_STAT_SRCS
Outland/TempestKeep/Eye/boss_alar.cpp
Outland/TempestKeep/Eye/boss_kaelthas.cpp
Outland/TempestKeep/Eye/the_eye.cpp
Outland/TempestKeep/botanica/the_botanica.h
Outland/TempestKeep/botanica/instance_the_botanica.cpp
Outland/TempestKeep/botanica/boss_commander_sarannis.cpp
Outland/TempestKeep/botanica/thorngrin_the_tender.cpp
Outland/TempestKeep/botanica/boss_high_botanist_freywinn.cpp
Outland/TempestKeep/botanica/boss_warp_splinter.cpp
Outland/TempestKeep/botanica/boss_laj.cpp
@@ -0,0 +1,186 @@
/*
* Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "the_botanica.h"
#include "SpellScript.h"
enum Says
{
SAY_AGGRO = 0,
SAY_KILL = 1,
SAY_ARCANE_RESONANCE = 2,
SAY_ARCANE_DEVASTATION = 3,
EMOTE_SUMMON = 4,
SAY_SUMMON = 5,
SAY_DEATH = 6
};
enum Spells
{
SPELL_ARCANE_RESONANCE = 34794,
SPELL_ARCANE_DEVASTATION = 34799,
SPELL_SUMMON_REINFORCEMENTS = 34803
};
enum
{
EVENT_ARCANE_RESONANCE = 1,
EVENT_ARCANE_DEVASTATION = 2
};
class boss_commander_sarannis : public CreatureScript
{
public: boss_commander_sarannis() : CreatureScript("boss_commander_sarannis") { }
struct boss_commander_sarannisAI : public BossAI
{
boss_commander_sarannisAI(Creature* creature) : BossAI(creature, DATA_COMMANDER_SARANNIS) { }
void Reset()
{
_Reset();
_phase = true;
}
void EnterCombat(Unit* /*who*/)
{
_EnterCombat();
Talk(SAY_AGGRO);
events.ScheduleEvent(EVENT_ARCANE_RESONANCE, 42700);
events.ScheduleEvent(EVENT_ARCANE_DEVASTATION, 15200);
}
void KilledUnit(Unit* /*victim*/)
{
Talk(SAY_KILL);
}
void JustDied(Unit* /*killer*/)
{
_JustDied();
Talk(SAY_DEATH);
}
void DamageTaken(Unit* /*killer*/, uint32 &damage)
{
if (me->HealthBelowPctDamaged(50, damage) && _phase)
{
_phase = false;
Talk(EMOTE_SUMMON);
Talk(SAY_SUMMON);
DoCast(me, SPELL_SUMMON_REINFORCEMENTS);
}
}
void JustSummoned(Creature* summon)
{
BossAI::JustSummoned(summon);
}
void UpdateAI(uint32 const diff)
{
if (!UpdateVictim())
return;
events.Update(diff);
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
while (uint32 eventId = events.ExecuteEvent())
{
switch (eventId)
{
case EVENT_ARCANE_RESONANCE:
Talk(SAY_ARCANE_RESONANCE);
DoCastVictim(SPELL_ARCANE_RESONANCE, true);
events.ScheduleEvent(EVENT_ARCANE_RESONANCE, 42700);
break;
case EVENT_ARCANE_DEVASTATION:
Talk(SAY_ARCANE_DEVASTATION);
DoCastVictim(SPELL_ARCANE_DEVASTATION, true);
events.ScheduleEvent(EVENT_ARCANE_DEVASTATION, urand(11000, 19200));
break;
default:
break;
}
}
DoMeleeAttackIfReady();
}
private:
bool _phase;
};
CreatureAI* GetAI(Creature* creature) const
{
return new boss_commander_sarannisAI(creature);
}
};
Position const PosSummonReinforcements[4] =
{
{ 160.4483f, 287.6435f, -3.887904f, 2.3841f },
{ 153.4406f, 289.9929f, -4.736916f, 2.3841f },
{ 154.4137f, 292.8956f, -4.683603f, 2.3841f },
{ 157.1544f, 294.2599f, -4.726504f, 2.3841f }
};
enum Creatures
{
NPC_SUMMONED_BLOODWARDER_MENDER = 20083,
NPC_SUMMONED_BLOODWARDER_RESERVIST = 20078
};
class spell_commander_sarannis_summon_reinforcements : public SpellScriptLoader
{
public:
spell_commander_sarannis_summon_reinforcements() : SpellScriptLoader("spell_commander_sarannis_summon_reinforcements") { }
class spell_commander_sarannis_summon_reinforcements_SpellScript : public SpellScript
{
PrepareSpellScript(spell_commander_sarannis_summon_reinforcements_SpellScript);
void HandleCast(SpellEffIndex /*effIndex*/)
{
GetCaster()->SummonCreature(NPC_SUMMONED_BLOODWARDER_MENDER, PosSummonReinforcements[0], TEMPSUMMON_CORPSE_DESPAWN);
GetCaster()->SummonCreature(NPC_SUMMONED_BLOODWARDER_RESERVIST, PosSummonReinforcements[1], TEMPSUMMON_CORPSE_DESPAWN);
GetCaster()->SummonCreature(NPC_SUMMONED_BLOODWARDER_RESERVIST, PosSummonReinforcements[2], TEMPSUMMON_CORPSE_DESPAWN);
if (GetCaster()->GetMap()->IsHeroic())
GetCaster()->SummonCreature(NPC_SUMMONED_BLOODWARDER_RESERVIST, PosSummonReinforcements[3], TEMPSUMMON_CORPSE_DESPAWN);
}
void Register()
{
OnEffectHitTarget += SpellEffectFn(spell_commander_sarannis_summon_reinforcements_SpellScript::HandleCast, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const
{
return new spell_commander_sarannis_summon_reinforcements_SpellScript();
}
};
void AddSC_boss_commander_sarannis()
{
new boss_commander_sarannis();
new spell_commander_sarannis_summon_reinforcements();
}
@@ -25,6 +25,7 @@ EndScriptData */
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "the_botanica.h"
enum eSays
{
@@ -33,7 +34,7 @@ enum eSays
SAY_TREE = 2,
SAY_SUMMON = 3,
SAY_DEATH = 4,
SAY_OOC_RANDOM = 5,
SAY_OOC_RANDOM = 5
};
enum eSpells
@@ -44,7 +45,7 @@ enum eSpells
SPELL_PLANT_WHITE = 34759,
SPELL_PLANT_GREEN = 34761,
SPELL_PLANT_BLUE = 34762,
SPELL_PLANT_RED = 34763,
SPELL_PLANT_RED = 34763
};
#define ENTRY_FRAYER 19953
@@ -58,9 +59,9 @@ class boss_high_botanist_freywinn : public CreatureScript
{
}
struct boss_high_botanist_freywinnAI : public ScriptedAI
struct boss_high_botanist_freywinnAI : public BossAI
{
boss_high_botanist_freywinnAI(Creature* creature) : ScriptedAI(creature) {}
boss_high_botanist_freywinnAI(Creature* creature) : BossAI(creature, DATA_HIGH_BOTANIST_FREYWINN) { }
std::list<uint64> Adds_List;
@@ -25,6 +25,7 @@ EndScriptData */
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "the_botanica.h"
enum eSpells
{
@@ -38,7 +39,7 @@ enum eSpells
SPELL_SUMMON_LASHER_3 = 34686,
SPELL_SUMMON_FLAYER_4 = 34687,
SPELL_SUMMON_LASHER_4 = 34688,
SPELL_SUMMON_FLAYER_3 = 34690,
SPELL_SUMMON_FLAYER_3 = 34690
};
enum eOthers
{
@@ -47,7 +48,7 @@ enum eOthers
MODEL_ARCANE = 14213,
MODEL_FIRE = 13110,
MODEL_FROST = 14112,
MODEL_NATURE = 14214,
MODEL_NATURE = 14214
};
class boss_laj : public CreatureScript
@@ -59,9 +60,9 @@ class boss_laj : public CreatureScript
{
}
struct boss_lajAI : public ScriptedAI
struct boss_lajAI : public BossAI
{
boss_lajAI(Creature* creature) : ScriptedAI(creature) {}
boss_lajAI(Creature* creature) : BossAI(creature, DATA_LAJ) { }
bool CanSummon;
uint32 Teleport_Timer;
@@ -25,6 +25,7 @@ EndScriptData */
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "the_botanica.h"
enum eSays
{
@@ -40,13 +41,13 @@ enum eSpells
SUMMON_TREANTS = 34727, // DBC: 34727, 34731, 34733, 34734, 34736, 34739, 34741 (with Ancestral Life spell 34742) // won't work (guardian summon)
ARCANE_VOLLEY = 36705,
ARCANE_VOLLEY_H = 39133,
SPELL_HEAL_FATHER = 6262,
SPELL_HEAL_FATHER = 6262
};
enum eOthers
{
CREATURE_TREANT = 19949,
TREANT_SPAWN_DIST = 50, //50 yards from Warp Splinter's spawn point
TREANT_SPAWN_DIST = 50 //50 yards from Warp Splinter's spawn point
};
float treant_pos[6][3] =
@@ -134,9 +135,9 @@ class boss_warp_splinter : public CreatureScript
: CreatureScript("boss_warp_splinter")
{
}
struct boss_warp_splinterAI : public ScriptedAI
struct boss_warp_splinterAI : public BossAI
{
boss_warp_splinterAI(Creature* creature) : ScriptedAI(creature)
boss_warp_splinterAI(Creature* creature) : BossAI(creature, DATA_WARP_SPLINTER)
{
Treant_Spawn_Pos_X = creature->GetPositionX();
Treant_Spawn_Pos_Y = creature->GetPositionY();
@@ -0,0 +1,164 @@
/*
* Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ScriptMgr.h"
#include "InstanceScript.h"
#include "the_botanica.h"
class instance_the_botanica : public InstanceMapScript
{
public:
instance_the_botanica() : InstanceMapScript("instance_the_botanica", 553) { }
struct instance_the_botanica_InstanceMapScript : public InstanceScript
{
instance_the_botanica_InstanceMapScript(Map* map) : InstanceScript(map)
{
CommanderSarannisGUID = 0;
HighBotanistFreywinnGUID = 0;
ThorngrinTheTenderGUID = 0;
LajGUID = 0;
WarpSplinterGUID = 0;
}
void OnCreatureCreate(Creature* creature)
{
switch (creature->GetEntry())
{
case NPC_COMMANDER_SARANNIS:
CommanderSarannisGUID = creature->GetGUID();
break;
case NPC_HIGH_BOTANIST_FREYWINN:
HighBotanistFreywinnGUID = creature->GetGUID();
break;
case NPC_THORNGRIN_THE_TENDER:
ThorngrinTheTenderGUID = creature->GetGUID();
break;
case NPC_LAJ:
LajGUID = creature->GetGUID();
break;
case NPC_WARP_SPLINTER:
WarpSplinterGUID = creature->GetGUID();
break;
default:
break;
}
}
uint64 GetData64(uint32 type) const
{
switch (type)
{
case DATA_COMMANDER_SARANNIS:
return CommanderSarannisGUID;
case DATA_HIGH_BOTANIST_FREYWINN:
return HighBotanistFreywinnGUID;
case DATA_THORNGRIN_THE_TENDER:
return ThorngrinTheTenderGUID;
case DATA_LAJ:
return LajGUID;
case DATA_WARP_SPLINTER:
return WarpSplinterGUID;
default:
break;
}
return 0;
}
bool SetBossState(uint32 type, EncounterState state)
{
if (!InstanceScript::SetBossState(type, state))
return false;
switch (type)
{
case DATA_COMMANDER_SARANNIS:
case DATA_HIGH_BOTANIST_FREYWINN:
case DATA_THORNGRIN_THE_TENDER:
case DATA_LAJ:
case DATA_WARP_SPLINTER:
break;
default:
break;
}
return true;
}
std::string GetSaveData()
{
OUT_SAVE_INST_DATA;
std::ostringstream saveStream;
saveStream << "B O " << GetBossSaveData();
OUT_SAVE_INST_DATA_COMPLETE;
return saveStream.str();
}
void Load(char const* str)
{
if (!str)
{
OUT_LOAD_INST_DATA_FAIL;
return;
}
OUT_LOAD_INST_DATA(str);
char dataHead1, dataHead2;
std::istringstream loadStream(str);
loadStream >> dataHead1 >> dataHead2;
if (dataHead1 == 'B' && dataHead2 == 'O')
{
for (uint8 i = 0; i < EncounterCount; ++i)
{
uint32 tmpState;
loadStream >> tmpState;
if (tmpState == IN_PROGRESS || tmpState > SPECIAL)
tmpState = NOT_STARTED;
SetBossState(i, EncounterState(tmpState));
}
}
else
OUT_LOAD_INST_DATA_FAIL;
OUT_LOAD_INST_DATA_COMPLETE;
}
protected:
uint64 CommanderSarannisGUID;
uint64 HighBotanistFreywinnGUID;
uint64 ThorngrinTheTenderGUID;
uint64 LajGUID;
uint64 WarpSplinterGUID;
};
InstanceScript* GetInstanceScript(InstanceMap* map) const
{
return new instance_the_botanica_InstanceMapScript(map);
}
};
void AddSC_instance_the_botanica()
{
new instance_the_botanica;
}
@@ -0,0 +1,42 @@
/*
* Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef DEF_THE_BOTANICA_H
#define DEF_THE_BOTANICA_H
uint32 const EncounterCount = 5;
enum DataTypes
{
DATA_COMMANDER_SARANNIS = 0,
DATA_HIGH_BOTANIST_FREYWINN = 1,
DATA_THORNGRIN_THE_TENDER = 2,
DATA_LAJ = 3,
DATA_WARP_SPLINTER = 4
};
enum CreatureIds
{
NPC_COMMANDER_SARANNIS = 17976,
NPC_HIGH_BOTANIST_FREYWINN = 17975,
NPC_THORNGRIN_THE_TENDER = 17978,
NPC_LAJ = 17980,
NPC_WARP_SPLINTER = 17977
};
#endif
@@ -0,0 +1,152 @@
/*
* Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "the_botanica.h"
enum Says
{
SAY_AGGRO = 0,
SAY_20_PERCENT_HP = 1,
SAY_KILL = 2,
SAY_CAST_SACRIFICE = 3,
SAY_50_PERCENT_HP = 4,
SAY_CAST_HELLFIRE = 5,
SAY_DEATH = 6,
EMOTE_ENRAGE = 7
};
enum Spells
{
SPELL_SACRIFICE = 34661,
SPELL_HELLFIRE_NORMAL = 34659,
SPELL_HELLFIRE_HEROIC = 39131,
SPELL_ENRAGE = 34670
};
enum Events
{
EVENT_SACRIFICE = 1,
EVENT_HELLFIRE = 2,
EVENT_ENRAGE = 3
};
class boss_thorngrin_the_tender : public CreatureScript
{
public: boss_thorngrin_the_tender() : CreatureScript("thorngrin_the_tender") { }
struct boss_thorngrin_the_tenderAI : public BossAI
{
boss_thorngrin_the_tenderAI(Creature* creature) : BossAI(creature, DATA_THORNGRIN_THE_TENDER) { }
void Reset()
{
_Reset();
_phase1 = true;
_phase2 = true;
}
void EnterCombat(Unit* /*who*/)
{
_EnterCombat();
Talk(SAY_AGGRO);
events.ScheduleEvent(EVENT_SACRIFICE, 5700);
events.ScheduleEvent(EVENT_HELLFIRE, IsHeroic() ? urand(17400, 19300) : 18000);
events.ScheduleEvent(EVENT_ENRAGE, 12000);
}
void KilledUnit(Unit* /*victim*/)
{
Talk(SAY_KILL);
}
void JustDied(Unit* /*killer*/)
{
_JustDied();
Talk(SAY_DEATH);
}
void DamageTaken(Unit* /*killer*/, uint32 &damage)
{
if (me->HealthBelowPctDamaged(50, damage) && _phase1)
{
_phase1 = false;
Talk(SAY_50_PERCENT_HP);
}
if (me->HealthBelowPctDamaged(20, damage) && _phase2)
{
_phase2 = false;
Talk(SAY_20_PERCENT_HP);
}
}
void UpdateAI(uint32 const diff)
{
if (!UpdateVictim())
return;
events.Update(diff);
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
while (uint32 eventId = events.ExecuteEvent())
{
switch (eventId)
{
case EVENT_SACRIFICE:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 0.0f, true))
{
Talk(SAY_CAST_SACRIFICE);
DoCast(target, SPELL_SACRIFICE, true);
}
events.ScheduleEvent(EVENT_SACRIFICE, 29400);
break;
case EVENT_HELLFIRE:
Talk(SAY_CAST_HELLFIRE);
DoCastVictim(DUNGEON_MODE(SPELL_HELLFIRE_NORMAL, SPELL_HELLFIRE_HEROIC), true);
events.ScheduleEvent(EVENT_HELLFIRE, IsHeroic() ? urand(17400, 19300) : 18000);
break;
case EVENT_ENRAGE:
Talk(EMOTE_ENRAGE);
DoCast(me, SPELL_ENRAGE);
events.ScheduleEvent(EVENT_ENRAGE, 33000);
break;
default:
break;
}
}
DoMeleeAttackIfReady();
}
private:
bool _phase1;
bool _phase2;
};
CreatureAI* GetAI(Creature* creature) const
{
return new boss_thorngrin_the_tenderAI(creature);
}
};
void AddSC_boss_thorngrin_the_tender()
{
new boss_thorngrin_the_tender();
}