aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts/EasternKingdoms/ScarletMonastery
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/scripts/EasternKingdoms/ScarletMonastery')
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_arcanist_doan.cpp128
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_azshir_the_sleepless.cpp98
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_bloodmage_thalnos.cpp124
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp892
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp158
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_high_inquisitor_fairbanks.cpp133
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_houndmaster_loksey.cpp77
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp118
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp359
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_scorn.cpp101
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp157
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/scarlet_monastery.h18
12 files changed, 2363 insertions, 0 deletions
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_arcanist_doan.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_arcanist_doan.cpp
new file mode 100644
index 00000000000..cb6ed1daf22
--- /dev/null
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_arcanist_doan.cpp
@@ -0,0 +1,128 @@
+/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>.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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* ScriptData
+SDName: Boss_Arcanist_Doan
+SD%Complete: 100
+SDComment:
+SDCategory: Scarlet Monastery
+EndScriptData */
+
+#include "ScriptedPch.h"
+
+enum eEnums
+{
+ SAY_AGGRO = -1189019,
+ SAY_SPECIALAE = -1189020,
+
+ SPELL_POLYMORPH = 13323,
+ SPELL_AOESILENCE = 8988,
+ SPELL_ARCANEEXPLOSION = 9433,
+ SPELL_FIREAOE = 9435,
+ SPELL_ARCANEBUBBLE = 9438,
+};
+
+struct boss_arcanist_doanAI : public ScriptedAI
+{
+ boss_arcanist_doanAI(Creature *c) : ScriptedAI(c) {}
+
+ uint32 Polymorph_Timer;
+ uint32 AoESilence_Timer;
+ uint32 ArcaneExplosion_Timer;
+ bool bCanDetonate;
+ bool bShielded;
+
+ void Reset()
+ {
+ Polymorph_Timer = 20000;
+ AoESilence_Timer = 15000;
+ ArcaneExplosion_Timer = 3000;
+ bCanDetonate = false;
+ bShielded = false;
+ }
+
+ void EnterCombat(Unit * /*who*/)
+ {
+ DoScriptText(SAY_AGGRO, me);
+ }
+
+ void UpdateAI(const uint32 diff)
+ {
+ if (!UpdateVictim())
+ return;
+
+ if (bShielded && bCanDetonate)
+ {
+ DoCast(me, SPELL_FIREAOE);
+ bCanDetonate = false;
+ }
+
+ if (me->HasAura(SPELL_ARCANEBUBBLE))
+ return;
+
+ //If we are <50% hp cast Arcane Bubble
+ if (!bShielded && me->GetHealth()*100 / me->GetMaxHealth() <= 50)
+ {
+ //wait if we already casting
+ if (me->IsNonMeleeSpellCasted(false))
+ return;
+
+ DoScriptText(SAY_SPECIALAE, me);
+ DoCast(me, SPELL_ARCANEBUBBLE);
+
+ bCanDetonate = true;
+ bShielded = true;
+ }
+
+ if (Polymorph_Timer <= diff)
+ {
+ if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,1))
+ DoCast(pTarget, SPELL_POLYMORPH);
+
+ Polymorph_Timer = 20000;
+ } else Polymorph_Timer -= diff;
+
+ //AoESilence_Timer
+ if (AoESilence_Timer <= diff)
+ {
+ DoCast(me->getVictim(), SPELL_AOESILENCE);
+ AoESilence_Timer = 15000 + rand()%5000;
+ } else AoESilence_Timer -= diff;
+
+ //ArcaneExplosion_Timer
+ if (ArcaneExplosion_Timer <= diff)
+ {
+ DoCast(me->getVictim(), SPELL_ARCANEEXPLOSION);
+ ArcaneExplosion_Timer = 8000;
+ } else ArcaneExplosion_Timer -= diff;
+
+ DoMeleeAttackIfReady();
+ }
+};
+CreatureAI* GetAI_boss_arcanist_doan(Creature* pCreature)
+{
+ return new boss_arcanist_doanAI (pCreature);
+}
+
+void AddSC_boss_arcanist_doan()
+{
+ Script *newscript;
+ newscript = new Script;
+ newscript->Name = "boss_arcanist_doan";
+ newscript->GetAI = &GetAI_boss_arcanist_doan;
+ newscript->RegisterSelf();
+}
+
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_azshir_the_sleepless.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_azshir_the_sleepless.cpp
new file mode 100644
index 00000000000..6b6efa0f934
--- /dev/null
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_azshir_the_sleepless.cpp
@@ -0,0 +1,98 @@
+/* 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* ScriptData
+SDName: Boss_Azshir_the_Sleepless
+SD%Complete: 80
+SDComment:
+SDCategory: Scarlet Monastery
+EndScriptData */
+
+#include "ScriptedPch.h"
+
+#define SPELL_CALLOFTHEGRAVE 17831
+#define SPELL_TERRIFY 7399
+#define SPELL_SOULSIPHON 7290
+
+struct boss_azshir_the_sleeplessAI : public ScriptedAI
+{
+ boss_azshir_the_sleeplessAI(Creature *c) : ScriptedAI(c) {}
+
+ uint32 SoulSiphon_Timer;
+ uint32 CallOftheGrave_Timer;
+ uint32 Terrify_Timer;
+
+ void Reset()
+ {
+ SoulSiphon_Timer = 1;
+ CallOftheGrave_Timer = 30000;
+ Terrify_Timer = 20000;
+ }
+
+ void EnterCombat(Unit * /*who*/)
+ {
+ }
+
+ void UpdateAI(const uint32 diff)
+ {
+ if (!UpdateVictim())
+ return;
+
+ //If we are <50% hp cast Soul Siphon rank 1
+ if (me->GetHealth()*100 / me->GetMaxHealth() <= 50 && !me->IsNonMeleeSpellCasted(false))
+ {
+ //SoulSiphon_Timer
+ if (SoulSiphon_Timer <= diff)
+ {
+ DoCast(me->getVictim(), SPELL_SOULSIPHON);
+ return;
+
+ //SoulSiphon_Timer = 20000;
+ } else SoulSiphon_Timer -= diff;
+ }
+
+ //CallOfTheGrave_Timer
+ if (CallOftheGrave_Timer <= diff)
+ {
+ DoCast(me->getVictim(), SPELL_CALLOFTHEGRAVE);
+ CallOftheGrave_Timer = 30000;
+ } else CallOftheGrave_Timer -= diff;
+
+ //Terrify_Timer
+ if (Terrify_Timer <= diff)
+ {
+ DoCast(me->getVictim(), SPELL_TERRIFY);
+ Terrify_Timer = 20000;
+ } else Terrify_Timer -= diff;
+
+ DoMeleeAttackIfReady();
+ }
+};
+
+CreatureAI* GetAI_boss_azshir_the_sleepless(Creature* pCreature)
+{
+ return new boss_azshir_the_sleeplessAI (pCreature);
+}
+
+void AddSC_boss_azshir_the_sleepless()
+{
+ Script *newscript;
+ newscript = new Script;
+ newscript->Name = "boss_azshir_the_sleepless";
+ newscript->GetAI = &GetAI_boss_azshir_the_sleepless;
+ newscript->RegisterSelf();
+}
+
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_bloodmage_thalnos.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_bloodmage_thalnos.cpp
new file mode 100644
index 00000000000..f7b6b7cce4b
--- /dev/null
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_bloodmage_thalnos.cpp
@@ -0,0 +1,124 @@
+/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>.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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* ScriptData
+SDName: Boss_Bloodmage_Thalnos
+SD%Complete: 100
+SDComment:
+SDCategory: Scarlet Monastery
+EndScriptData */
+
+#include "ScriptedPch.h"
+
+enum eEnums
+{
+ SAY_AGGRO = -1189016,
+ SAY_HEALTH = -1189017,
+ SAY_KILL = -1189018,
+
+ SPELL_FLAMESHOCK = 8053,
+ SPELL_SHADOWBOLT = 1106,
+ SPELL_FLAMESPIKE = 8814,
+ SPELL_FIRENOVA = 16079,
+};
+
+struct boss_bloodmage_thalnosAI : public ScriptedAI
+{
+ boss_bloodmage_thalnosAI(Creature *c) : ScriptedAI(c) {}
+
+ bool HpYell;
+ uint32 FlameShock_Timer;
+ uint32 ShadowBolt_Timer;
+ uint32 FlameSpike_Timer;
+ uint32 FireNova_Timer;
+
+ void Reset()
+ {
+ HpYell = false;
+ FlameShock_Timer = 10000;
+ ShadowBolt_Timer = 2000;
+ FlameSpike_Timer = 8000;
+ FireNova_Timer = 40000;
+ }
+
+ void EnterCombat(Unit * /*who*/)
+ {
+ DoScriptText(SAY_AGGRO, me);
+ }
+
+ void KilledUnit(Unit* /*Victim*/)
+ {
+ DoScriptText(SAY_KILL, me);
+ }
+
+ void UpdateAI(const uint32 diff)
+ {
+ if (!UpdateVictim())
+ return;
+
+ //If we are <35% hp
+ if (!HpYell && ((me->GetHealth()*100) / me->GetMaxHealth() <= 35))
+ {
+ DoScriptText(SAY_HEALTH, me);
+ HpYell = true;
+ }
+
+ //FlameShock_Timer
+ if (FlameShock_Timer <= diff)
+ {
+ DoCast(me->getVictim(), SPELL_FLAMESHOCK);
+ FlameShock_Timer = 10000 + rand()%5000;
+ } else FlameShock_Timer -= diff;
+
+ //FlameSpike_Timer
+ if (FlameSpike_Timer <= diff)
+ {
+ DoCast(me->getVictim(), SPELL_FLAMESPIKE);
+ FlameSpike_Timer = 30000;
+ } else FlameSpike_Timer -= diff;
+
+ //FireNova_Timer
+ if (FireNova_Timer <= diff)
+ {
+ DoCast(me->getVictim(), SPELL_FIRENOVA);
+ FireNova_Timer = 40000;
+ } else FireNova_Timer -= diff;
+
+ //ShadowBolt_Timer
+ if (ShadowBolt_Timer <= diff)
+ {
+ DoCast(me->getVictim(), SPELL_SHADOWBOLT);
+ ShadowBolt_Timer = 2000;
+ } else ShadowBolt_Timer -= diff;
+
+ DoMeleeAttackIfReady();
+ }
+};
+
+CreatureAI* GetAI_boss_bloodmage_thalnos(Creature* pCreature)
+{
+ return new boss_bloodmage_thalnosAI (pCreature);
+}
+
+void AddSC_boss_bloodmage_thalnos()
+{
+ Script *newscript;
+ newscript = new Script;
+ newscript->Name = "boss_bloodmage_thalnos";
+ newscript->GetAI = &GetAI_boss_bloodmage_thalnos;
+ newscript->RegisterSelf();
+}
+
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp
new file mode 100644
index 00000000000..17bbf0c23c6
--- /dev/null
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp
@@ -0,0 +1,892 @@
+/* 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* ScriptData
+SDName: Boss_Headless_Horseman
+SD%Complete:
+SDComment:
+SDCategory: Scarlet Monastery
+EndScriptData */
+
+#include "ScriptedPch.h"
+#include "SpellMgr.h"
+#include "scarlet_monastery.h"
+
+//this texts are already used by 3975 and 3976
+#define SAY_ENTRANCE -1189001
+#define SAY_REJOINED -1189002
+#define SAY_LOST_HEAD -1189003
+#define SAY_CONFLAGRATION -1189004
+#define SAY_SPROUTING_PUMPKINS -1189005
+#define SAY_PLAYER_DEATH -1189006
+#define SAY_DEATH -1189007
+
+uint32 RandomLaugh[] = {11965, 11975, 11976};
+
+ // Entryes
+#define HH_MOUNTED 23682
+#define HH_UNHORSED 23800
+#define HEAD 23775
+#define PULSING_PUMPKIN 23694
+#define PUMPKIN_FIEND 23545
+#define HELPER 23686
+#define WISP_INVIS 24034
+
+ //Spells
+#define SPELL_CLEAVE 42587
+#define SPELL_CONFLAGRATION 42380 //Phase 2, can't find real spell(Dim Fire?)
+//#define SPELL_CONFL_SPEED 22587 //8% increase speed, value 22587 from SPELL_CONFLAGRATION mains that spell?
+#define SPELL_SUMMON_PUMPKIN 42394
+
+#define SPELL_WHIRLWIND 43116
+#define SPELL_IMMUNE 42556
+#define SPELL_BODY_REGEN 42403
+#define SPELL_CONFUSE 43105
+
+#define SPELL_FLYING_HEAD 42399 //visual flying head
+#define SPELL_HEAD 42413 //visual buff, "head"
+#define SPELL_HEAD_IS_DEAD 42428 //at killing head, Phase 3
+
+#define SPELL_PUMPKIN_AURA 42280
+#define SPELL_PUMPKIN_AURA_GREEN 42294
+#define SPELL_SQUASH_SOUL 42514
+#define SPELL_SPROUTING 42281
+#define SPELL_SPROUT_BODY 42285
+
+ //Effects
+#define SPELL_RHYME_BIG 42909
+//#define SPELL_RHYME_SMALL 42910
+#define SPELL_HEAD_SPEAKS 43129
+#define SPELL_HEAD_LANDS 42400
+#define SPELL_BODY_FLAME 42074
+#define SPELL_HEAD_FLAME 42971
+//#define SPELL_ENRAGE_VISUAL 42438 // he uses this spell?
+#define SPELL_WISP_BLUE 42821
+#define SPELL_WISP_FLIGHT_PORT 42818
+//#define SPELL_WISP_INVIS 42823
+#define SPELL_SMOKE 42355
+#define SPELL_DEATH 42566 //not correct spell
+
+struct Locations
+{
+ float x, y, z;
+};
+
+static Locations FlightPoint[]=
+{
+ {1754.00,1346.00,17.50},
+ {1765.00,1347.00,19.00},
+ {1784.00,1346.80,25.40},
+ {1803.30,1347.60,33.00},
+ {1824.00,1350.00,42.60},
+ {1838.80,1353.20,49.80},
+ {1852.00,1357.60,55.70},
+ {1861.30,1364.00,59.40},
+ {1866.30,1374.80,61.70},
+ {1864.00,1387.30,63.20},
+ {1854.80,1399.40,64.10},
+ {1844.00,1406.90,64.10},
+ {1824.30,1411.40,63.30},
+ {1801.00,1412.30,60.40},
+ {1782.00,1410.10,55.50},
+ {1770.50,1405.20,50.30},
+ {1765.20,1400.70,46.60},
+ {1761.40,1393.40,41.70},
+ {1759.10,1386.70,36.60},
+ {1757.80,1378.20,29.00},
+ {1758.00,1367.00,19.51}
+};
+
+static Locations Spawn[]=
+{
+ {1776.27,1348.74,19.20}, //spawn point for pumpkin shrine mob
+ {1765.28,1347.46,17.55} //spawn point for smoke
+};
+
+static const char* Text[]=
+{
+ "Horseman rise...",
+ "Your time is nigh...",
+ "You felt death once...",
+ "Now, know demise!"
+};
+
+#define EMOTE_LAUGHS "Headless Horseman laughs"
+
+struct mob_wisp_invisAI : public ScriptedAI
+{
+ mob_wisp_invisAI(Creature *c) : ScriptedAI(c)
+ {
+ Creaturetype = delay = spell = spell2 = 0;
+ //that's hack but there are no info about range of this spells in dbc
+ SpellEntry *wisp = GET_SPELL(SPELL_WISP_BLUE);
+ if (wisp)
+ wisp->rangeIndex = 6; //100 yards
+ SpellEntry *port = GET_SPELL(SPELL_WISP_FLIGHT_PORT);
+ if (port)
+ port->rangeIndex = 6;
+ }
+
+ uint32 Creaturetype;
+ uint32 delay;
+ uint32 spell;
+ uint32 spell2;
+ void Reset(){}
+ void EnterCombat(Unit * /*who*/){}
+ void SetType(uint32 _type)
+ {
+ switch(Creaturetype = _type)
+ {
+ case 1:
+ spell = SPELL_PUMPKIN_AURA_GREEN;
+ break;
+ case 2:
+ delay = 15000;
+ spell = SPELL_BODY_FLAME;
+ spell2 = SPELL_DEATH;
+ break;
+ case 3:
+ delay = 15000;
+ spell = SPELL_SMOKE;
+ break;
+ case 4:
+ delay = 7000;
+ spell2 = SPELL_WISP_BLUE;
+ break;
+ }
+ if (spell)
+ DoCast(me, spell);
+ }
+
+ void SpellHit(Unit* /*caster*/, const SpellEntry *spell)
+ {
+ if (spell->Id == SPELL_WISP_FLIGHT_PORT && Creaturetype == 4)
+ me->SetDisplayId(2027);
+ }
+
+ void MoveInLineOfSight(Unit *who)
+ {
+ if (!who || Creaturetype != 1 || !who->isTargetableForAttack())
+ return;
+
+ if (me->IsWithinDist(who, 0.1, false) && !who->HasAura(SPELL_SQUASH_SOUL))
+ DoCast(who, SPELL_SQUASH_SOUL);
+ }
+
+ void UpdateAI(const uint32 diff)
+ {
+ if (delay)
+ {
+ if (delay <= diff)
+ {
+ me->RemoveAurasDueToSpell(SPELL_SMOKE);
+ if (spell2)
+ DoCast(me, spell2);
+ delay = 0;
+ } else delay -= diff;
+ }
+ }
+};
+
+struct mob_headAI : public ScriptedAI
+{
+ mob_headAI(Creature *c) : ScriptedAI(c) {}
+
+ uint64 bodyGUID;
+
+ uint32 Phase;
+ uint32 laugh;
+ uint32 wait;
+
+ bool withbody;
+ bool die;
+
+ void Reset()
+ {
+ Phase = 0;
+ bodyGUID = 0;
+ die = false;
+ withbody = true;
+ wait = 1000;
+ laugh = urand(15000,30000);
+ }
+
+ void EnterCombat(Unit * /*who*/) {}
+ void SaySound(int32 textEntry, Unit *pTarget = 0)
+ {
+ DoScriptText(textEntry, me, pTarget);
+ //DoCast(me, SPELL_HEAD_SPEAKS, true);
+ Creature *speaker = DoSpawnCreature(HELPER,0,0,0,0,TEMPSUMMON_TIMED_DESPAWN,1000);
+ if (speaker)
+ speaker->CastSpell(speaker,SPELL_HEAD_SPEAKS,false);
+ laugh += 3000;
+ }
+
+ void DamageTaken(Unit* /*done_by*/,uint32 &damage)
+ {
+ if (withbody)
+ return;
+
+ switch(Phase)
+ {
+ case 1:
+ if (((me->GetHealth() - damage)*100)/me->GetMaxHealth() < 67)
+ Disappear();
+ break;
+ case 2:
+ if (((me->GetHealth() - damage)*100)/me->GetMaxHealth() < 34)
+ Disappear();
+ break;
+ case 3:
+ if (damage >= me->GetHealth())
+ {
+ die = true;
+ withbody = true;
+ wait = 300;
+ damage = me->GetHealth() - me->GetMaxHealth()/100;
+ me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
+ me->StopMoving();
+ //me->GetMotionMaster()->MoveIdle();
+ DoCast(me, SPELL_HEAD_IS_DEAD);
+ }
+ break;
+ }
+ }
+
+ void SpellHit(Unit *caster, const SpellEntry* spell)
+ {
+ if (!withbody)
+ return;
+
+ if (spell->Id == SPELL_FLYING_HEAD)
+ {
+ if (Phase < 3) ++Phase;
+ else Phase = 3;
+ withbody = false;
+ if (!bodyGUID)
+ bodyGUID = caster->GetGUID();
+ me->RemoveAllAuras();
+ me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
+ DoCast(me, SPELL_HEAD_LANDS, true);
+ DoCast(me, SPELL_HEAD, false);
+ SaySound(SAY_LOST_HEAD);
+ me->GetMotionMaster()->Clear(false);
+ me->GetMotionMaster()->MoveFleeing(caster->getVictim());
+ }
+ }
+ void Disappear();//we must set returned=true(this will prevent from "body calls head" while head flying to body), see function below
+ void UpdateAI(const uint32 diff)
+ {
+ if (!withbody)
+ {
+ if (wait <= diff)
+ {
+ wait = 1000;
+ if (!me->getVictim()) return;
+ me->GetMotionMaster()->Clear(false);
+ me->GetMotionMaster()->MoveFleeing(me->getVictim());
+ } else wait -= diff;
+
+ if (laugh <= diff)
+ {
+ laugh = urand(15000,30000);
+ DoPlaySoundToSet(me, RandomLaugh[urand(0,2)]);
+ //DoCast(me, SPELL_HEAD_SPEAKS, true); //this spell remove buff "head"
+ Creature *speaker = DoSpawnCreature(HELPER,0,0,0,0,TEMPSUMMON_TIMED_DESPAWN,1000);
+ if (speaker)
+ speaker->CastSpell(speaker,SPELL_HEAD_SPEAKS,false);
+ me->MonsterTextEmote(EMOTE_LAUGHS,NULL);
+ } else laugh -= diff;
+ }
+ else
+ {
+ if (die)
+ {
+ if (wait <= diff)
+ {
+ die = false;
+ if (Unit *body = Unit::GetUnit((*me), bodyGUID))
+ body->Kill(body);
+ me->Kill(me);
+ } else wait -= diff;
+ }
+ }
+ }
+};
+
+struct boss_headless_horsemanAI : public ScriptedAI
+{
+ boss_headless_horsemanAI(Creature *c) : ScriptedAI(c)
+ {
+ SpellEntry *confl = GET_SPELL(SPELL_CONFLAGRATION);
+ if (confl)
+ {
+ confl->EffectApplyAuraName[0] = SPELL_AURA_PERIODIC_DAMAGE_PERCENT;
+ confl->EffectBasePoints[0] = 10;
+ //confl->EffectBaseDice[0] = 10;
+ confl->DmgMultiplier[0] = 1;
+ }
+/*
+ if (SpellEntry *confl = GET_SPELL(SPELL_CONFLAGRATION))
+ confl->EffectTriggerSpell[1] = 22587;
+
+ if (SpellEntry *speed = GET_SPELL(22587))
+ {
+ speed->Effect[1] = SPELL_EFFECT_APPLY_AURA;
+ speed->EffectApplyAuraName[1] = SPELL_AURA_MOD_CONFUSE;
+ }
+*/
+ pInstance = c->GetInstanceData();
+ }
+
+ ScriptedInstance *pInstance;
+
+ uint64 headGUID;
+ uint64 PlayerGUID;
+
+ uint32 Phase;
+ uint32 id;
+ uint32 count;
+ uint32 say_timer;
+
+ uint32 conflagrate;
+ uint32 summonadds;
+ uint32 cleave;
+ uint32 regen;
+ uint32 whirlwind;
+ uint32 laugh;
+ uint32 burn;
+
+ bool withhead;
+ bool returned;
+ bool IsFlying;
+ bool wp_reached;
+ bool burned;
+
+ void Reset()
+ {
+ Phase = 1;
+ conflagrate = 15000;
+ summonadds = 15000;
+ laugh = urand(16000,20000);
+ cleave = 2000;
+ regen = 1000;
+ burn = 6000;
+ count = 0;
+ say_timer = 3000;
+
+ withhead = true;
+ returned = true;
+ burned = false;
+ IsFlying = false;
+ DoCast(me, SPELL_HEAD);
+ if (headGUID)
+ {
+ if (Creature* Head = Unit::GetCreature((*me), headGUID))
+ Head->DisappearAndDie();
+
+ headGUID = 0;
+ }
+
+ //if (pInstance)
+ // pInstance->SetData(DATA_HORSEMAN_EVENT, NOT_STARTED);
+ }
+
+ void FlyMode()
+ {
+ me->SetVisibility(VISIBILITY_OFF);
+ me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
+ me->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT | MOVEMENTFLAG_LEVITATING);
+ me->SetSpeed(MOVE_WALK,5.0f,true);
+ wp_reached = false;
+ count = 0;
+ say_timer = 3000;
+ id = 0;
+ Phase = 0;
+ }
+
+ void MovementInform(uint32 type, uint32 i)
+ {
+ if (type != POINT_MOTION_TYPE || !IsFlying || i != id)
+ return;
+
+ wp_reached = true;
+
+ switch (id)
+ {
+ case 0:
+ me->SetVisibility(VISIBILITY_ON);
+ break;
+ case 1:
+ {
+ if (Creature *smoke = me->SummonCreature(HELPER,Spawn[1].x,Spawn[1].y,Spawn[1].z,0,TEMPSUMMON_TIMED_DESPAWN,20000))
+ CAST_AI(mob_wisp_invisAI, smoke->AI())->SetType(3);
+ DoCast(me, SPELL_RHYME_BIG);
+ break;
+ }
+ case 6:
+ if (pInstance)
+ pInstance->SetData(GAMEOBJECT_PUMPKIN_SHRINE, 0); //hide gameobject
+ break;
+ case 19:
+ me->RemoveUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT | MOVEMENTFLAG_LEVITATING);
+ break;
+ case 20:
+ {
+ Phase = 1;
+ IsFlying = false;
+ wp_reached = false;
+ me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
+ SaySound(SAY_ENTRANCE);
+ if (Unit *plr = Unit::GetUnit((*me),PlayerGUID))
+ DoStartMovement(plr);
+ break;
+ }
+ }
+ ++id;
+ }
+
+ void EnterCombat(Unit * /*who*/)
+ {
+ if (pInstance)
+ pInstance->SetData(DATA_HORSEMAN_EVENT, IN_PROGRESS);
+ DoZoneInCombat();
+ }
+ void AttackStart(Unit* who) {ScriptedAI::AttackStart(who);}
+ void MoveInLineOfSight(Unit *who)
+ {
+ if (withhead && Phase != 0)
+ ScriptedAI::MoveInLineOfSight(who);
+ }
+ void KilledUnit(Unit *plr)
+ {
+ if (plr->GetTypeId() == TYPEID_PLAYER)
+ {
+ if (withhead)
+ SaySound(SAY_PLAYER_DEATH);
+ //maybe possible when player dies from conflagration
+ else if (Creature *Head = Unit::GetCreature((*me), headGUID))
+ CAST_AI(mob_headAI, Head->AI())->SaySound(SAY_PLAYER_DEATH);
+ }
+ }
+
+ void SaySound(int32 textEntry, Unit *pTarget = 0)
+ {
+ DoScriptText(textEntry, me, pTarget);
+ laugh += 4000;
+ }
+
+ Player* SelectRandomPlayer(float range = 0.0f, bool checkLoS = true)
+ {
+ Map* pMap = me->GetMap();
+ if (!pMap->IsDungeon()) return NULL;
+
+ Map::PlayerList const &PlayerList = pMap->GetPlayers();
+ Map::PlayerList::const_iterator i;
+ if (PlayerList.isEmpty()) return NULL;
+
+ std::list<Player*> temp;
+ std::list<Player*>::const_iterator j;
+
+ for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
+ if ((me->IsWithinLOSInMap(i->getSource()) || !checkLoS) && me->getVictim() != i->getSource() &&
+ me->IsWithinDistInMap(i->getSource(), range) && i->getSource()->isAlive())
+ temp.push_back(i->getSource());
+
+ if (temp.size())
+ {
+ j = temp.begin();
+ advance(j, rand()%temp.size());
+ return (*j);
+ }
+ return NULL;
+ }
+
+ void SpellHitTarget(Unit* unit, const SpellEntry* spell)
+ {
+ if (spell->Id == SPELL_CONFLAGRATION && unit->HasAura(SPELL_CONFLAGRATION))
+ SaySound(SAY_CONFLAGRATION,unit);
+ }
+
+ void JustDied(Unit* /*killer*/)
+ {
+ me->StopMoving();
+ //me->GetMotionMaster()->MoveIdle();
+ SaySound(SAY_DEATH);
+ if (Creature *flame = DoSpawnCreature(HELPER,0,0,0,0,TEMPSUMMON_TIMED_DESPAWN,60000))
+ flame->CastSpell(flame,SPELL_BODY_FLAME,false);
+ if (Creature *wisp = DoSpawnCreature(WISP_INVIS,0,0,0,0,TEMPSUMMON_TIMED_DESPAWN,60000))
+ CAST_AI(mob_wisp_invisAI, wisp->AI())->SetType(4);
+ if (pInstance)
+ pInstance->SetData(DATA_HORSEMAN_EVENT, DONE);
+ }
+
+ void SpellHit(Unit *caster, const SpellEntry* spell)
+ {
+ if (withhead)
+ return;
+
+ if (spell->Id == SPELL_FLYING_HEAD)
+ {
+ if (Phase < 3)
+ ++Phase;
+ else
+ Phase = 3;
+ withhead = true;
+ me->RemoveAllAuras();
+ me->SetName("Headless Horseman");
+ me->SetHealth(me->GetMaxHealth());
+ SaySound(SAY_REJOINED);
+ DoCast(me, SPELL_HEAD);
+ caster->GetMotionMaster()->Clear(false);
+ caster->GetMotionMaster()->MoveFollow(me,6,urand(0,5));
+ //DoResetThreat();//not sure if need
+ std::list<HostileReference*>::const_iterator itr;
+ for (itr = caster->getThreatManager().getThreatList().begin(); itr != caster->getThreatManager().getThreatList().end(); ++itr)
+ {
+ Unit* pUnit = Unit::GetUnit((*me), (*itr)->getUnitGuid());
+ if (pUnit && pUnit->isAlive() && pUnit != caster)
+ me->AddThreat(pUnit,caster->getThreatManager().getThreat(pUnit));
+ }
+ }
+ }
+
+ void DamageTaken(Unit *done_by, uint32 &damage)
+ {
+ if (damage >= me->GetHealth() && withhead)
+ {
+ withhead = false;
+ returned = false;
+ damage = me->GetHealth() - me->GetMaxHealth()/100;
+ me->RemoveAllAuras();
+ me->SetName("Headless Horseman, Unhorsed");
+
+ if (!headGUID)
+ headGUID = DoSpawnCreature(HEAD,rand()%6,rand()%6,0,0,TEMPSUMMON_DEAD_DESPAWN,0)->GetGUID();
+ Unit* Head = Unit::GetUnit((*me), headGUID);
+ if (Head && Head->isAlive())
+ {
+ Head->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
+ //Head->CastSpell(Head,SPELL_HEAD_INVIS,false);
+ me->InterruptNonMeleeSpells(false);
+ DoCast(me, SPELL_IMMUNE, true);
+ DoCast(me, SPELL_BODY_REGEN, true);
+ DoCast(Head, SPELL_FLYING_HEAD, true);
+ DoCast(me, SPELL_CONFUSE, false); //test
+ done_by->ProcDamageAndSpell(me,PROC_FLAG_KILL,PROC_FLAG_KILLED,PROC_EX_NONE,0);
+ whirlwind = urand(4000,8000);
+ regen = 0;
+ }
+ }
+ }
+
+ void UpdateAI(const uint32 diff)
+ {
+ if (withhead)
+ {
+ switch(Phase)
+ {
+ case 0:
+ {
+ if (!IsFlying)
+ {
+ if (say_timer <= diff)
+ {
+ say_timer = 3000;
+ Player *plr = SelectRandomPlayer(100.0f,false);
+ if (count < 3)
+ {
+ if (plr)
+ plr->Say(Text[count],0);
+ }
+ else
+ {
+ DoCast(me, SPELL_RHYME_BIG);
+ if (plr)
+ {
+ plr->Say(Text[count],0);
+ plr->HandleEmoteCommand(ANIM_EMOTE_SHOUT);
+ }
+ wp_reached = true;
+ IsFlying = true;
+ count = 0;
+ break;
+ }
+ ++count;
+ } else say_timer -= diff;
+ }
+ else
+ {
+ if (wp_reached)
+ {
+ wp_reached = false;
+ me->GetMotionMaster()->Clear(false);
+ me->GetMotionMaster()->MovePoint(id,FlightPoint[id].x,FlightPoint[id].y,FlightPoint[id].z);
+ }
+ }
+ }
+ break;
+ case 1:
+ if (burned)
+ break;
+ if (burn <= diff)
+ {
+ if (Creature *flame = me->SummonCreature(HELPER,Spawn[0].x,Spawn[0].y,Spawn[0].z,0,TEMPSUMMON_TIMED_DESPAWN,17000))
+ CAST_AI(mob_wisp_invisAI, flame->AI())->SetType(2);
+ burned = true;
+ } else burn -= diff;
+ break;
+ case 2:
+ if (conflagrate <= diff)
+ {
+ if (Unit *plr = SelectRandomPlayer(30.0f))
+ DoCast(plr, SPELL_CONFLAGRATION, false);
+ conflagrate = urand(10000,16000);
+ } else conflagrate -= diff;
+ break;
+ case 3:
+ if (summonadds <= diff)
+ {
+ me->InterruptNonMeleeSpells(false);
+ DoCast(me, SPELL_SUMMON_PUMPKIN);
+ SaySound(SAY_SPROUTING_PUMPKINS);
+ summonadds = urand(25000,35000);
+ } else summonadds -= diff;
+ break;
+ }
+
+ if (laugh <= diff)
+ {
+ laugh = urand(11000,22000);
+ me->MonsterTextEmote(EMOTE_LAUGHS,NULL);
+ DoPlaySoundToSet(me, RandomLaugh[rand()%3]);
+ } else laugh -= diff;
+
+ if (UpdateVictim())
+ {
+ DoMeleeAttackIfReady();
+ if (cleave <= diff)
+ {
+ DoCast(me->getVictim(), SPELL_CLEAVE);
+ cleave = urand(2000,6000); //1 cleave per 2.0-6.0sec
+ } else cleave -= diff;
+ }
+ }
+ else
+ {
+ if (regen <= diff)
+ {
+ regen = 1000; //"body calls head"
+ if (me->GetHealth()/me->GetMaxHealth() == 1 && !returned)
+ {
+ if (Phase > 1)
+ --Phase;
+ else
+ Phase = 1;
+ Creature* Head = Unit::GetCreature((*me), headGUID);
+ if (Head && Head->isAlive())
+ {
+ CAST_AI(mob_headAI, Head->AI())->Phase = Phase;
+ CAST_AI(mob_headAI, Head->AI())->Disappear();
+ }
+ return;
+ }
+ }
+ else regen -= diff;
+
+ if (whirlwind <= diff)
+ {
+ whirlwind = urand(4000,8000);
+ if (urand(0,1))
+ {
+ me->RemoveAurasDueToSpell(SPELL_CONFUSE);
+ DoCast(me, SPELL_WHIRLWIND, true);
+ DoCast(me, SPELL_CONFUSE);
+ } else
+ me->RemoveAurasDueToSpell(SPELL_WHIRLWIND);
+ } else whirlwind -= diff;
+ }
+ }
+};
+
+void mob_headAI::Disappear()
+{
+ if (withbody)
+ return;
+ if (bodyGUID)
+ {
+ Creature *body = Unit::GetCreature((*me), bodyGUID);
+ if (body && body->isAlive())
+ {
+ withbody = true;
+ me->RemoveAllAuras();
+ body->RemoveAurasDueToSpell(SPELL_IMMUNE);//hack, SpellHit doesn't calls if body has immune aura
+ DoCast(body, SPELL_FLYING_HEAD);
+ me->SetHealth(me->GetMaxHealth());
+ me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
+ me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
+ me->GetMotionMaster()->MoveIdle();
+ CAST_AI(boss_headless_horsemanAI, body->AI())->returned = true;
+ }
+ }
+}
+
+struct mob_pulsing_pumpkinAI : public ScriptedAI
+{
+ mob_pulsing_pumpkinAI(Creature *c) : ScriptedAI(c) {}
+
+ bool sprouted;
+ uint64 debuffGUID;
+
+ void Reset()
+ {
+ float x, y, z;
+ me->GetPosition(x, y, z); //this visual aura some under ground
+ me->GetMap()->CreatureRelocation(me, x,y,z + 0.35f, 0.0f);
+ Despawn();
+ Creature *debuff = DoSpawnCreature(HELPER,0,0,0,0,TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN,14500);
+ if (debuff)
+ {
+ debuff->SetDisplayId(me->GetDisplayId());
+ debuff->CastSpell(debuff,SPELL_PUMPKIN_AURA_GREEN,false);
+ CAST_AI(mob_wisp_invisAI, debuff->AI())->SetType(1);
+ debuffGUID = debuff->GetGUID();
+ }
+ sprouted = false;
+ DoCast(me, SPELL_PUMPKIN_AURA, true);
+ DoCast(me, SPELL_SPROUTING);
+ me->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_STUNNED);
+ }
+
+ void EnterCombat(Unit * /*who*/){}
+
+ void SpellHit(Unit * /*caster*/, const SpellEntry *spell)
+ {
+ if (spell->Id == SPELL_SPROUTING)
+ {
+ sprouted = true;
+ me->RemoveAllAuras();
+ me->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_STUNNED);
+ DoCast(me, SPELL_SPROUT_BODY, true);
+ me->UpdateEntry(PUMPKIN_FIEND);
+ DoStartMovement(me->getVictim());
+ }
+ }
+
+ void Despawn()
+ {
+ if (!debuffGUID) return;
+ Unit *debuff = Unit::GetUnit((*me),debuffGUID);
+ if (debuff)
+ debuff->SetVisibility(VISIBILITY_OFF);
+ debuffGUID = 0;
+ }
+
+ void JustDied(Unit * /*killer*/) { if (!sprouted) Despawn(); }
+
+ void MoveInLineOfSight(Unit *who)
+ {
+ if (!who || !who->isTargetableForAttack() || !me->IsHostileTo(who) || me->getVictim())
+ return;
+
+ me->AddThreat(who,0.0f);
+ if (sprouted)
+ DoStartMovement(who);
+ }
+
+ void UpdateAI(const uint32 /*diff*/)
+ {
+ if (sprouted && UpdateVictim())
+ DoMeleeAttackIfReady();
+ }
+};
+
+bool GOHello_go_loosely_turned_soil(Player* pPlayer, GameObject* soil)
+{
+ ScriptedInstance* pInstance = pPlayer->GetInstanceData();
+ if (pInstance)
+ {
+ if (pInstance->GetData(DATA_HORSEMAN_EVENT) != NOT_STARTED)
+ return true;
+ pInstance->SetData(DATA_HORSEMAN_EVENT, IN_PROGRESS);
+ }
+/* if (soil->GetGoType() == GAMEOBJECT_TYPE_QUESTGIVER && plr->getLevel() > 64)
+ {
+ plr->PrepareQuestMenu(soil->GetGUID());
+ plr->SendPreparedQuest(soil->GetGUID());
+ }
+ if (plr->GetQuestStatus(11405) == QUEST_STATUS_INCOMPLETE && plr->getLevel() > 64)
+ { */
+ pPlayer->AreaExploredOrEventHappens(11405);
+ if (Creature *horseman = soil->SummonCreature(HH_MOUNTED,FlightPoint[20].x,FlightPoint[20].y,FlightPoint[20].z,0,TEMPSUMMON_MANUAL_DESPAWN,0))
+ {
+ CAST_AI(boss_headless_horsemanAI, horseman->AI())->PlayerGUID = pPlayer->GetGUID();
+ CAST_AI(boss_headless_horsemanAI, horseman->AI())->FlyMode();
+ }
+ //}
+ return true;
+}
+
+CreatureAI* GetAI_mob_head(Creature* pCreature)
+{
+ return new mob_headAI (pCreature);
+}
+
+CreatureAI* GetAI_boss_headless_horseman(Creature* pCreature)
+{
+ return new boss_headless_horsemanAI (pCreature);
+}
+
+CreatureAI* GetAI_mob_pulsing_pumpkin(Creature* pCreature)
+{
+ return new mob_pulsing_pumpkinAI (pCreature);
+}
+
+CreatureAI* GetAI_mob_wisp_invis(Creature* pCreature)
+{
+ return new mob_wisp_invisAI (pCreature);
+}
+
+void AddSC_boss_headless_horseman()
+{
+ Script *newscript;
+
+ newscript = new Script;
+ newscript->Name = "boss_headless_horseman";
+ newscript->GetAI = &GetAI_boss_headless_horseman;
+ newscript->RegisterSelf();
+
+ newscript = new Script;
+ newscript->Name = "mob_head";
+ newscript->GetAI = &GetAI_mob_head;
+ newscript->RegisterSelf();
+
+ newscript = new Script;
+ newscript->Name = "mob_pulsing_pumpkin";
+ newscript->GetAI = &GetAI_mob_pulsing_pumpkin;
+ newscript->RegisterSelf();
+
+ newscript = new Script;
+ newscript->Name = "mob_wisp_invis";
+ newscript->GetAI = &GetAI_mob_wisp_invis;
+ newscript->RegisterSelf();
+
+ newscript = new Script;
+ newscript->Name = "go_loosely_turned_soil";
+ newscript->pGOHello = &GOHello_go_loosely_turned_soil;
+ newscript->RegisterSelf();
+}
+
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp
new file mode 100644
index 00000000000..e0db29aa240
--- /dev/null
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp
@@ -0,0 +1,158 @@
+/* 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* ScriptData
+SDName: Boss_Herod
+SD%Complete: 95
+SDComment: Should in addition spawn Myrmidons in the hallway outside
+SDCategory: Scarlet Monastery
+EndScriptData */
+
+#include "ScriptedPch.h"
+#include "ScriptedEscortAI.h"
+
+#define SAY_AGGRO -1189000
+#define SAY_WHIRLWIND -1189001
+#define SAY_ENRAGE -1189002
+#define SAY_KILL -1189003
+#define EMOTE_ENRAGE -1189004
+
+#define SPELL_RUSHINGCHARGE 8260
+#define SPELL_CLEAVE 15496
+#define SPELL_WHIRLWIND 8989
+#define SPELL_FRENZY 8269
+
+#define ENTRY_SCARLET_TRAINEE 6575
+#define ENTRY_SCARLET_MYRMIDON 4295
+
+struct boss_herodAI : public ScriptedAI
+{
+ boss_herodAI(Creature *c) : ScriptedAI(c) {}
+
+ bool Enrage;
+
+ uint32 Cleave_Timer;
+ uint32 Whirlwind_Timer;
+
+ void Reset()
+ {
+ Enrage = false;
+ Cleave_Timer = 12000;
+ Whirlwind_Timer = 60000;
+ }
+
+ void EnterCombat(Unit * /*who*/)
+ {
+ DoScriptText(SAY_AGGRO, me);
+ DoCast(me, SPELL_RUSHINGCHARGE);
+ }
+
+ void KilledUnit(Unit * /*victim*/)
+ {
+ DoScriptText(SAY_KILL, me);
+ }
+
+ void JustDied(Unit* /*killer*/)
+ {
+ for (uint8 i = 0; i < 20; ++i)
+ me->SummonCreature(ENTRY_SCARLET_TRAINEE, 1939.18, -431.58, 17.09, 6.22, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000);
+ }
+
+ void UpdateAI(const uint32 diff)
+ {
+ if (!UpdateVictim())
+ return;
+
+ //If we are <30% hp goes Enraged
+ if (!Enrage && me->GetHealth()*100 / me->GetMaxHealth() <= 30 && !me->IsNonMeleeSpellCasted(false))
+ {
+ DoScriptText(EMOTE_ENRAGE, me);
+ DoScriptText(SAY_ENRAGE, me);
+ DoCast(me, SPELL_FRENZY);
+ Enrage = true;
+ }
+
+ //Cleave_Timer
+ if (Cleave_Timer <= diff)
+ {
+ DoCast(me->getVictim(), SPELL_CLEAVE);
+ Cleave_Timer = 12000;
+ } else Cleave_Timer -= diff;
+
+ // Whirlwind_Timer
+ if (Whirlwind_Timer <= diff)
+ {
+ DoScriptText(SAY_WHIRLWIND, me);
+ DoCast(me->getVictim(), SPELL_WHIRLWIND);
+ Whirlwind_Timer = 30000;
+ } else Whirlwind_Timer -= diff;
+
+ DoMeleeAttackIfReady();
+ }
+};
+
+CreatureAI* GetAI_boss_herod(Creature* pCreature)
+{
+ return new boss_herodAI(pCreature);
+}
+
+struct mob_scarlet_traineeAI : public npc_escortAI
+{
+ mob_scarlet_traineeAI(Creature *c) : npc_escortAI(c)
+ {
+ Start_Timer = urand(1000,6000);
+ }
+
+ uint32 Start_Timer;
+
+ void Reset() {}
+ void WaypointReached(uint32 /*uiPoint*/) {}
+ void EnterCombat(Unit* /*who*/) {}
+
+ void UpdateAI(const uint32 diff)
+ {
+ if (Start_Timer)
+ {
+ if (Start_Timer <= diff)
+ {
+ Start(true,true);
+ Start_Timer = 0;
+ } else Start_Timer -= diff;
+ }
+
+ npc_escortAI::UpdateAI(diff);
+ }
+};
+
+CreatureAI* GetAI_mob_scarlet_trainee(Creature* pCreature)
+{
+ return new mob_scarlet_traineeAI(pCreature);
+}
+
+void AddSC_boss_herod()
+{
+ Script *newscript;
+ newscript = new Script;
+ newscript->Name = "boss_herod";
+ newscript->GetAI = &GetAI_boss_herod;
+ newscript->RegisterSelf();
+
+ newscript = new Script;
+ newscript->Name = "mob_scarlet_trainee";
+ newscript->GetAI = &GetAI_mob_scarlet_trainee;
+ newscript->RegisterSelf();
+}
+
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_high_inquisitor_fairbanks.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_high_inquisitor_fairbanks.cpp
new file mode 100644
index 00000000000..b9b15f34508
--- /dev/null
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_high_inquisitor_fairbanks.cpp
@@ -0,0 +1,133 @@
+/* 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* ScriptData
+SDName: Boss_High_Inquisitor_Fairbanks
+SD%Complete: 100
+SDComment: TODO: if this guy not involved in some special event, remove (and let ACID script)
+SDCategory: Scarlet Monastery
+EndScriptData */
+
+#include "ScriptedPch.h"
+
+enum eSpells
+{
+ SPELL_CURSEOFBLOOD = 8282,
+ SPELL_DISPELMAGIC = 15090,
+ SPELL_FEAR = 12096,
+ SPELL_HEAL = 12039,
+ SPELL_POWERWORDSHIELD = 11647,
+ SPELL_SLEEP = 8399
+};
+
+struct boss_high_inquisitor_fairbanksAI : public ScriptedAI
+{
+ boss_high_inquisitor_fairbanksAI(Creature *c) : ScriptedAI(c) {}
+
+ uint32 CurseOfBlood_Timer;
+ uint32 DispelMagic_Timer;
+ uint32 Fear_Timer;
+ uint32 Heal_Timer;
+ uint32 Sleep_Timer;
+ uint32 Dispel_Timer;
+ bool PowerWordShield;
+
+ void Reset()
+ {
+ CurseOfBlood_Timer = 10000;
+ DispelMagic_Timer = 30000;
+ Fear_Timer = 40000;
+ Heal_Timer = 30000;
+ Sleep_Timer = 30000;
+ Dispel_Timer = 20000;
+ PowerWordShield = false;
+ }
+
+ void EnterCombat(Unit * /*who*/)
+ {
+ }
+
+ void UpdateAI(const uint32 diff)
+ {
+ if (!UpdateVictim())
+ return;
+
+ //If we are <25% hp cast Heal
+ if (me->GetHealth()*100 / me->GetMaxHealth() <= 25 && !me->IsNonMeleeSpellCasted(false) && Heal_Timer <= diff)
+ {
+ DoCast(me, SPELL_HEAL);
+ Heal_Timer = 30000;
+ } else Heal_Timer -= diff;
+
+ //Fear_Timer
+ if (Fear_Timer <= diff)
+ {
+ if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,1))
+ DoCast(pTarget, SPELL_FEAR);
+
+ Fear_Timer = 40000;
+ } else Fear_Timer -= diff;
+
+ //Sleep_Timer
+ if (Sleep_Timer <= diff)
+ {
+ if (Unit *pTarget = SelectUnit(SELECT_TARGET_TOPAGGRO,0))
+ DoCast(pTarget, SPELL_SLEEP);
+
+ Sleep_Timer = 30000;
+ } else Sleep_Timer -= diff;
+
+ //PowerWordShield_Timer
+ if (!PowerWordShield && me->GetHealth()*100 / me->GetMaxHealth() <= 25)
+ {
+ DoCast(me, SPELL_POWERWORDSHIELD);
+ PowerWordShield = true;
+ }
+
+ //Dispel_Timer
+ if (Dispel_Timer <= diff)
+ {
+ if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0))
+ DoCast(pTarget, SPELL_DISPELMAGIC);
+
+ DispelMagic_Timer = 30000;
+ } else DispelMagic_Timer -= diff;
+
+ //CurseOfBlood_Timer
+ if (CurseOfBlood_Timer <= diff)
+ {
+ DoCast(me->getVictim(), SPELL_CURSEOFBLOOD);
+ CurseOfBlood_Timer = 25000;
+ } else CurseOfBlood_Timer -= diff;
+
+ DoMeleeAttackIfReady();
+ }
+};
+
+CreatureAI* GetAI_boss_high_inquisitor_fairbanks(Creature* pCreature)
+{
+ return new boss_high_inquisitor_fairbanksAI (pCreature);
+}
+
+void AddSC_boss_high_inquisitor_fairbanks()
+{
+ Script *newscript;
+ newscript = new Script;
+ newscript->Name = "boss_high_inquisitor_fairbanks";
+ newscript->GetAI = &GetAI_boss_high_inquisitor_fairbanks;
+ newscript->RegisterSelf();
+}
+
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_houndmaster_loksey.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_houndmaster_loksey.cpp
new file mode 100644
index 00000000000..300e69611cd
--- /dev/null
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_houndmaster_loksey.cpp
@@ -0,0 +1,77 @@
+/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>.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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* ScriptData
+SDName: Boss_Houndmaster_Loksey
+SD%Complete: 100
+SDComment:
+SDCategory: Scarlet Monastery
+EndScriptData */
+
+#include "ScriptedPch.h"
+
+enum eEnums
+{
+ SAY_AGGRO = -1189021,
+ SPELL_SUMMONSCARLETHOUND = 17164,
+ SPELL_BLOODLUST = 6742
+};
+
+struct boss_houndmaster_lokseyAI : public ScriptedAI
+{
+ boss_houndmaster_lokseyAI(Creature *c) : ScriptedAI(c) {}
+
+ uint32 BloodLust_Timer;
+
+ void Reset()
+ {
+ BloodLust_Timer = 20000;
+ }
+
+ void EnterCombat(Unit * /*who*/)
+ {
+ DoScriptText(SAY_AGGRO, me);
+ }
+
+ void UpdateAI(const uint32 diff)
+ {
+ if (!UpdateVictim())
+ return;
+
+ if (BloodLust_Timer <= diff)
+ {
+ DoCast(me, SPELL_BLOODLUST);
+ BloodLust_Timer = 20000;
+ } else BloodLust_Timer -= diff;
+
+ DoMeleeAttackIfReady();
+ }
+};
+
+CreatureAI* GetAI_boss_houndmaster_loksey(Creature* pCreature)
+{
+ return new boss_houndmaster_lokseyAI (pCreature);
+}
+
+void AddSC_boss_houndmaster_loksey()
+{
+ Script *newscript;
+ newscript = new Script;
+ newscript->Name = "boss_houndmaster_loksey";
+ newscript->GetAI = &GetAI_boss_houndmaster_loksey;
+ newscript->RegisterSelf();
+}
+
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp
new file mode 100644
index 00000000000..b4b84fc8059
--- /dev/null
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp
@@ -0,0 +1,118 @@
+/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>.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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* ScriptData
+SDName: Boss_Interrogator_Vishas
+SD%Complete: 100
+SDComment:
+SDCategory: Scarlet Monastery
+EndScriptData */
+
+#include "ScriptedPch.h"
+#include "scarlet_monastery.h"
+
+enum eEnums
+{
+ SAY_AGGRO = -1189011,
+ SAY_HEALTH1 = -1189012,
+ SAY_HEALTH2 = -1189013,
+ SAY_KILL = -1189014,
+ SAY_TRIGGER_VORREL = -1189015,
+
+ SPELL_SHADOWWORDPAIN = 2767,
+};
+
+struct boss_interrogator_vishasAI : public ScriptedAI
+{
+ boss_interrogator_vishasAI(Creature *c) : ScriptedAI(c)
+ {
+ pInstance = me->GetInstanceData();
+ }
+
+ ScriptedInstance* pInstance;
+
+ bool Yell30;
+ bool Yell60;
+ uint32 ShadowWordPain_Timer;
+
+ void Reset()
+ {
+ ShadowWordPain_Timer = 5000;
+ }
+
+ void EnterCombat(Unit * /*who*/)
+ {
+ DoScriptText(SAY_AGGRO, me);
+ }
+
+ void KilledUnit(Unit* /*Victim*/)
+ {
+ DoScriptText(SAY_KILL, me);
+ }
+
+ void JustDied(Unit* /*Killer*/)
+ {
+ if (!pInstance)
+ return;
+
+ //Any other actions to do with vorrel? setStandState?
+ if (Unit *vorrel = Unit::GetUnit(*me,pInstance->GetData64(DATA_VORREL)))
+ DoScriptText(SAY_TRIGGER_VORREL, vorrel);
+ }
+
+ void UpdateAI(const uint32 diff)
+ {
+ if (!UpdateVictim())
+ return;
+
+ //If we are low on hp Do sayings
+ if (!Yell60 && ((me->GetHealth()*100) / me->GetMaxHealth() <= 60))
+ {
+ DoScriptText(SAY_HEALTH1, me);
+ Yell60 = true;
+ }
+
+ if (!Yell30 && ((me->GetHealth()*100) / me->GetMaxHealth() <= 30))
+ {
+ DoScriptText(SAY_HEALTH2, me);
+ Yell30 = true;
+ }
+
+ //ShadowWordPain_Timer
+ if (ShadowWordPain_Timer <= diff)
+ {
+ DoCast(me->getVictim(), SPELL_SHADOWWORDPAIN);
+ ShadowWordPain_Timer = 5000 + rand()%10000;
+ } else ShadowWordPain_Timer -= diff;
+
+ DoMeleeAttackIfReady();
+ }
+};
+
+CreatureAI* GetAI_boss_interrogator_vishas(Creature* pCreature)
+{
+ return new boss_interrogator_vishasAI (pCreature);
+}
+
+void AddSC_boss_interrogator_vishas()
+{
+ Script *newscript;
+ newscript = new Script;
+ newscript->Name = "boss_interrogator_vishas";
+ newscript->GetAI = &GetAI_boss_interrogator_vishas;
+ newscript->RegisterSelf();
+}
+
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp
new file mode 100644
index 00000000000..32b85e214a0
--- /dev/null
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp
@@ -0,0 +1,359 @@
+/* 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* ScriptData
+SDName: Boss_Mograine_And_Whitemane
+SD%Complete: 90
+SDComment:
+SDCategory: Scarlet Monastery
+EndScriptData */
+
+#include "ScriptedPch.h"
+#include "scarlet_monastery.h"
+
+enum eEnums
+{
+ //Mograine says
+ SAY_MO_AGGRO = -1189005,
+ SAY_MO_KILL = -1189006,
+ SAY_MO_RESSURECTED = -1189007,
+
+ //Whitemane says
+ SAY_WH_INTRO = -1189008,
+ SAY_WH_KILL = -1189009,
+ SAY_WH_RESSURECT = -1189010,
+
+ //Mograine Spells
+ SPELL_CRUSADERSTRIKE = 14518,
+ SPELL_HAMMEROFJUSTICE = 5589,
+ SPELL_LAYONHANDS = 9257,
+ SPELL_RETRIBUTIONAURA = 8990,
+
+ //Whitemanes Spells
+ SPELL_DEEPSLEEP = 9256,
+ SPELL_SCARLETRESURRECTION = 9232,
+ SPELL_DOMINATEMIND = 14515,
+ SPELL_HOLYSMITE = 9481,
+ SPELL_HEAL = 12039,
+ SPELL_POWERWORDSHIELD = 22187
+};
+
+struct boss_scarlet_commander_mograineAI : public ScriptedAI
+{
+ boss_scarlet_commander_mograineAI(Creature* pCreature) : ScriptedAI(pCreature)
+ {
+ m_pInstance = pCreature->GetInstanceData();
+ }
+
+ ScriptedInstance* m_pInstance;
+
+ uint32 m_uiCrusaderStrike_Timer;
+ uint32 m_uiHammerOfJustice_Timer;
+
+ bool m_bHasDied;
+ bool m_bHeal;
+ bool m_bFakeDeath;
+
+ void Reset()
+ {
+ m_uiCrusaderStrike_Timer = 10000;
+ m_uiHammerOfJustice_Timer = 10000;
+
+ //Incase wipe during phase that mograine fake death
+ me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
+ me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
+ me->SetStandState(UNIT_STAND_STATE_STAND);
+
+ if (m_pInstance)
+ if (me->isAlive())
+ m_pInstance->SetData(TYPE_MOGRAINE_AND_WHITE_EVENT,NOT_STARTED);
+
+ m_bHasDied = false;
+ m_bHeal = false;
+ m_bFakeDeath = false;
+ }
+
+ void JustReachedHome()
+ {
+ if (m_pInstance)
+ {
+ if (m_pInstance->GetData(TYPE_MOGRAINE_AND_WHITE_EVENT != NOT_STARTED))
+ m_pInstance->SetData(TYPE_MOGRAINE_AND_WHITE_EVENT, FAIL);
+ }
+ }
+
+ void EnterCombat(Unit* /*pWho*/)
+ {
+ DoScriptText(SAY_MO_AGGRO, me);
+ DoCast(me, SPELL_RETRIBUTIONAURA);
+
+ me->CallForHelp(VISIBLE_RANGE);
+ }
+
+ void KilledUnit(Unit* /*pVictim*/)
+ {
+ DoScriptText(SAY_MO_KILL, me);
+ }
+
+ void DamageTaken(Unit* /*pDoneBy*/, uint32 &uiDamage)
+ {
+ if (uiDamage < me->GetHealth() || m_bHasDied || m_bFakeDeath)
+ return;
+
+ if (!m_pInstance)
+ return;
+
+ //On first death, fake death and open door, as well as initiate whitemane if exist
+ if (Unit* Whitemane = Unit::GetUnit((*me), m_pInstance->GetData64(DATA_WHITEMANE)))
+ {
+ m_pInstance->SetData(TYPE_MOGRAINE_AND_WHITE_EVENT, IN_PROGRESS);
+
+ Whitemane->GetMotionMaster()->MovePoint(1,1163.113370,1398.856812,32.527786);
+
+ me->GetMotionMaster()->MovementExpired();
+ me->GetMotionMaster()->MoveIdle();
+
+ me->SetHealth(0);
+
+ if (me->IsNonMeleeSpellCasted(false))
+ me->InterruptNonMeleeSpells(false);
+
+ me->ClearComboPointHolders();
+ me->RemoveAllAuras();
+ me->ClearAllReactives();
+
+ me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
+ me->SetStandState(UNIT_STAND_STATE_DEAD);
+
+ m_bHasDied = true;
+ m_bFakeDeath = true;
+
+ uiDamage = 0;
+ }
+ }
+
+ void SpellHit(Unit* /*pWho*/, const SpellEntry* pSpell)
+ {
+ //When hit with ressurection say text
+ if (pSpell->Id == SPELL_SCARLETRESURRECTION)
+ {
+ DoScriptText(SAY_MO_RESSURECTED, me);
+ m_bFakeDeath = false;
+
+ if (m_pInstance)
+ m_pInstance->SetData(TYPE_MOGRAINE_AND_WHITE_EVENT, SPECIAL);
+ }
+ }
+
+ void UpdateAI(const uint32 uiDiff)
+ {
+ if (!UpdateVictim())
+ return;
+
+ if (m_bHasDied && !m_bHeal && m_pInstance && m_pInstance->GetData(TYPE_MOGRAINE_AND_WHITE_EVENT) == SPECIAL)
+ {
+ //On ressurection, stop fake death and heal whitemane and resume fight
+ if (Unit* Whitemane = Unit::GetUnit((*me), m_pInstance->GetData64(DATA_WHITEMANE)))
+ {
+ me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
+ me->SetStandState(UNIT_STAND_STATE_STAND);
+ DoCast(Whitemane, SPELL_LAYONHANDS);
+
+ m_uiCrusaderStrike_Timer = 10000;
+ m_uiHammerOfJustice_Timer = 10000;
+
+ if (me->getVictim())
+ me->GetMotionMaster()->MoveChase(me->getVictim());
+
+ m_bHeal = true;
+ }
+ }
+
+ //This if-check to make sure mograine does not attack while fake death
+ if (m_bFakeDeath)
+ return;
+
+ //m_uiCrusaderStrike_Timer
+ if (m_uiCrusaderStrike_Timer <= uiDiff)
+ {
+ DoCast(me->getVictim(), SPELL_CRUSADERSTRIKE);
+ m_uiCrusaderStrike_Timer = 10000;
+ } else m_uiCrusaderStrike_Timer -= uiDiff;
+
+ //m_uiHammerOfJustice_Timer
+ if (m_uiHammerOfJustice_Timer <= uiDiff)
+ {
+ DoCast(me->getVictim(), SPELL_HAMMEROFJUSTICE);
+ m_uiHammerOfJustice_Timer = 60000;
+ } else m_uiHammerOfJustice_Timer -= uiDiff;
+
+ DoMeleeAttackIfReady();
+ }
+};
+
+struct boss_high_inquisitor_whitemaneAI : public ScriptedAI
+{
+ boss_high_inquisitor_whitemaneAI(Creature* pCreature) : ScriptedAI(pCreature)
+ {
+ m_pInstance = pCreature->GetInstanceData();
+ }
+
+ ScriptedInstance* m_pInstance;
+
+ uint32 m_uiHeal_Timer;
+ uint32 m_uiPowerWordShield_Timer;
+ uint32 m_uiHolySmite_Timer;
+ uint32 m_uiWait_Timer;
+
+ bool m_bCanResurrectCheck;
+ bool m_bCanResurrect;
+
+ void Reset()
+ {
+ m_uiWait_Timer = 7000;
+ m_uiHeal_Timer = 10000;
+ m_uiPowerWordShield_Timer = 15000;
+ m_uiHolySmite_Timer = 6000;
+
+ m_bCanResurrectCheck = false;
+ m_bCanResurrect = false;
+
+ if (m_pInstance)
+ if (me->isAlive())
+ m_pInstance->SetData(TYPE_MOGRAINE_AND_WHITE_EVENT, NOT_STARTED);
+ }
+
+ void AttackStart(Unit* pWho)
+ {
+ if (m_pInstance && m_pInstance->GetData(TYPE_MOGRAINE_AND_WHITE_EVENT) == NOT_STARTED)
+ return;
+
+ ScriptedAI::AttackStart(pWho);
+ }
+
+ void EnterCombat(Unit* /*pWho*/)
+ {
+ DoScriptText(SAY_WH_INTRO, me);
+ }
+
+ void KilledUnit(Unit* /*pVictim*/)
+ {
+ DoScriptText(SAY_WH_KILL, me);
+ }
+
+ void UpdateAI(const uint32 uiDiff)
+ {
+ if (!UpdateVictim())
+ return;
+
+ if (m_bCanResurrect)
+ {
+ //When casting resuruction make sure to delay so on rez when reinstate battle deepsleep runs out
+ if (m_pInstance && m_uiWait_Timer <= uiDiff)
+ {
+ if (Unit* Mograine = Unit::GetUnit((*me), m_pInstance->GetData64(DATA_MOGRAINE)))
+ {
+ DoCast(Mograine, SPELL_SCARLETRESURRECTION);
+ DoScriptText(SAY_WH_RESSURECT, me);
+ m_bCanResurrect = false;
+ }
+ }
+ else m_uiWait_Timer -= uiDiff;
+ }
+
+ //Cast Deep sleep when health is less than 50%
+ if (!m_bCanResurrectCheck && me->GetHealth()*100 / me->GetMaxHealth() <= 50)
+ {
+ if (me->IsNonMeleeSpellCasted(false))
+ me->InterruptNonMeleeSpells(false);
+
+ DoCast(me->getVictim(), SPELL_DEEPSLEEP);
+ m_bCanResurrectCheck = true;
+ m_bCanResurrect = true;
+ return;
+ }
+
+ //while in "resurrect-mode", don't do anything
+ if (m_bCanResurrect)
+ return;
+
+ //If we are <75% hp cast healing spells at self or Mograine
+ if (m_uiHeal_Timer <= uiDiff)
+ {
+ Creature* pTarget = NULL;
+
+ if (me->GetHealth() <= me->GetMaxHealth()*0.75f)
+ pTarget = me;
+
+ if (m_pInstance)
+ {
+ if (Creature* pMograine = Unit::GetCreature((*me), m_pInstance->GetData64(DATA_MOGRAINE)))
+ {
+ // checking m_bCanResurrectCheck prevents her healing Mograine while he is "faking death"
+ if (m_bCanResurrectCheck && pMograine->isAlive() && pMograine->GetHealth() <= pMograine->GetMaxHealth()*0.75f)
+ pTarget = pMograine;
+ }
+ }
+
+ if (pTarget)
+ DoCast(pTarget, SPELL_HEAL);
+
+ m_uiHeal_Timer = 13000;
+ } else m_uiHeal_Timer -= uiDiff;
+
+ //m_uiPowerWordShield_Timer
+ if (m_uiPowerWordShield_Timer <= uiDiff)
+ {
+ DoCast(me, SPELL_POWERWORDSHIELD);
+ m_uiPowerWordShield_Timer = 15000;
+ } else m_uiPowerWordShield_Timer -= uiDiff;
+
+ //m_uiHolySmite_Timer
+ if (m_uiHolySmite_Timer <= uiDiff)
+ {
+ DoCast(me->getVictim(), SPELL_HOLYSMITE);
+ m_uiHolySmite_Timer = 6000;
+ } else m_uiHolySmite_Timer -= uiDiff;
+
+ DoMeleeAttackIfReady();
+ }
+};
+
+CreatureAI* GetAI_boss_scarlet_commander_mograine(Creature* pCreature)
+{
+ return new boss_scarlet_commander_mograineAI (pCreature);
+}
+
+CreatureAI* GetAI_boss_high_inquisitor_whitemane(Creature* pCreature)
+{
+ return new boss_high_inquisitor_whitemaneAI (pCreature);
+}
+
+void AddSC_boss_mograine_and_whitemane()
+{
+ Script *newscript;
+
+ newscript = new Script;
+ newscript->Name = "boss_scarlet_commander_mograine";
+ newscript->GetAI = &GetAI_boss_scarlet_commander_mograine;
+ newscript->RegisterSelf();
+
+ newscript = new Script;
+ newscript->Name = "boss_high_inquisitor_whitemane";
+ newscript->GetAI = &GetAI_boss_high_inquisitor_whitemane;
+ newscript->RegisterSelf();
+}
+
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_scorn.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_scorn.cpp
new file mode 100644
index 00000000000..5d0a3b3792f
--- /dev/null
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_scorn.cpp
@@ -0,0 +1,101 @@
+/* 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* ScriptData
+SDName: Boss_Scorn
+SD%Complete: 100
+SDComment:
+SDCategory: Scarlet Monastery
+EndScriptData */
+
+#include "ScriptedPch.h"
+
+#define SPELL_LICHSLAP 28873
+#define SPELL_FROSTBOLTVOLLEY 8398
+#define SPELL_MINDFLAY 17313
+#define SPELL_FROSTNOVA 15531
+
+struct boss_scornAI : public ScriptedAI
+{
+ boss_scornAI(Creature *c) : ScriptedAI(c) {}
+
+ uint32 LichSlap_Timer;
+ uint32 FrostboltVolley_Timer;
+ uint32 MindFlay_Timer;
+ uint32 FrostNova_Timer;
+
+ void Reset()
+ {
+ LichSlap_Timer = 45000;
+ FrostboltVolley_Timer = 30000;
+ MindFlay_Timer = 30000;
+ FrostNova_Timer = 30000;
+ }
+
+ void EnterCombat(Unit * /*who*/)
+ {
+ }
+
+ void UpdateAI(const uint32 diff)
+ {
+ if (!UpdateVictim())
+ return;
+
+ //LichSlap_Timer
+ if (LichSlap_Timer <= diff)
+ {
+ DoCast(me->getVictim(), SPELL_LICHSLAP);
+ LichSlap_Timer = 45000;
+ } else LichSlap_Timer -= diff;
+
+ //FrostboltVolley_Timer
+ if (FrostboltVolley_Timer <= diff)
+ {
+ DoCast(me->getVictim(), SPELL_FROSTBOLTVOLLEY);
+ FrostboltVolley_Timer = 20000;
+ } else FrostboltVolley_Timer -= diff;
+
+ //MindFlay_Timer
+ if (MindFlay_Timer <= diff)
+ {
+ DoCast(me->getVictim(), SPELL_MINDFLAY);
+ MindFlay_Timer = 20000;
+ } else MindFlay_Timer -= diff;
+
+ //FrostNova_Timer
+ if (FrostNova_Timer <= diff)
+ {
+ DoCast(me->getVictim(), SPELL_FROSTNOVA);
+ FrostNova_Timer = 15000;
+ } else FrostNova_Timer -= diff;
+
+ DoMeleeAttackIfReady();
+ }
+};
+CreatureAI* GetAI_boss_scorn(Creature* pCreature)
+{
+ return new boss_scornAI (pCreature);
+}
+
+void AddSC_boss_scorn()
+{
+ Script *newscript;
+ newscript = new Script;
+ newscript->Name = "boss_scorn";
+ newscript->GetAI = &GetAI_boss_scorn;
+ newscript->RegisterSelf();
+}
+
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp
new file mode 100644
index 00000000000..33642d4511c
--- /dev/null
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp
@@ -0,0 +1,157 @@
+/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>.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, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+/* ScriptData
+SDName: Instance_Scarlet_Monastery
+SD%Complete: 50
+SDComment:
+SDCategory: Scarlet Monastery
+EndScriptData */
+
+#include "ScriptedPch.h"
+#include "scarlet_monastery.h"
+
+#define ENTRY_PUMPKIN_SHRINE 186267
+#define ENTRY_HORSEMAN 23682
+#define ENTRY_HEAD 23775
+#define ENTRY_PUMPKIN 23694
+
+#define MAX_ENCOUNTER 2
+
+struct instance_scarlet_monastery : public ScriptedInstance
+{
+ instance_scarlet_monastery(Map* pMap) : ScriptedInstance(pMap) {Initialize();};
+
+ uint64 PumpkinShrineGUID;
+ uint64 HorsemanGUID;
+ uint64 HeadGUID;
+ std::set<uint64> HorsemanAdds;
+
+ uint64 MograineGUID;
+ uint64 WhitemaneGUID;
+ uint64 VorrelGUID;
+ uint64 DoorHighInquisitorGUID;
+
+ uint32 m_auiEncounter[MAX_ENCOUNTER];
+
+ void Initialize()
+ {
+ memset(&m_auiEncounter, 0, sizeof(m_auiEncounter));
+
+ PumpkinShrineGUID = 0;
+ HorsemanGUID = 0;
+ HeadGUID = 0;
+ HorsemanAdds.clear();
+
+ MograineGUID = 0;
+ WhitemaneGUID = 0;
+ VorrelGUID = 0;
+ DoorHighInquisitorGUID = 0;
+ }
+
+ void OnGameObjectCreate(GameObject* pGo, bool /*add*/)
+ {
+ switch(pGo->GetEntry())
+ {
+ case ENTRY_PUMPKIN_SHRINE: PumpkinShrineGUID = pGo->GetGUID();break;
+ case 104600: DoorHighInquisitorGUID = pGo->GetGUID(); break;
+ }
+ }
+
+ void OnCreatureCreate(Creature* pCreature, bool /*add*/)
+ {
+ switch(pCreature->GetEntry())
+ {
+ case ENTRY_HORSEMAN: HorsemanGUID = pCreature->GetGUID(); break;
+ case ENTRY_HEAD: HeadGUID = pCreature->GetGUID(); break;
+ case ENTRY_PUMPKIN: HorsemanAdds.insert(pCreature->GetGUID());break;
+ case 3976: MograineGUID = pCreature->GetGUID(); break;
+ case 3977: WhitemaneGUID = pCreature->GetGUID(); break;
+ case 3981: VorrelGUID = pCreature->GetGUID(); break;
+ }
+ }
+
+ void SetData(uint32 type, uint32 data)
+ {
+ switch(type)
+ {
+ case TYPE_MOGRAINE_AND_WHITE_EVENT:
+ if (data == IN_PROGRESS)
+ DoUseDoorOrButton(DoorHighInquisitorGUID);
+ if (data == FAIL)
+ DoUseDoorOrButton(DoorHighInquisitorGUID);
+
+ m_auiEncounter[0] = data;
+ break;
+ case GAMEOBJECT_PUMPKIN_SHRINE:
+ HandleGameObject(PumpkinShrineGUID, false);
+ break;
+ case DATA_HORSEMAN_EVENT:
+ m_auiEncounter[1] = data;
+ if (data == DONE)
+ {
+ for (std::set<uint64>::const_iterator itr = HorsemanAdds.begin(); itr != HorsemanAdds.end(); ++itr)
+ {
+ Creature* add = instance->GetCreature(*itr);
+ if (add && add->isAlive())
+ add->Kill(add);
+ }
+ HorsemanAdds.clear();
+ HandleGameObject(PumpkinShrineGUID, false);
+ }
+ break;
+ }
+ }
+
+ uint64 GetData64(uint32 type)
+ {
+ switch(type)
+ {
+ //case GAMEOBJECT_PUMPKIN_SHRINE: return PumpkinShrineGUID;
+ //case DATA_HORSEMAN: return HorsemanGUID;
+ //case DATA_HEAD: return HeadGUID;
+ case DATA_MOGRAINE: return MograineGUID;
+ case DATA_WHITEMANE: return WhitemaneGUID;
+ case DATA_VORREL: return VorrelGUID;
+ case DATA_DOOR_WHITEMANE: return DoorHighInquisitorGUID;
+ }
+ return 0;
+ }
+
+ uint32 GetData(uint32 type)
+ {
+ if (type == TYPE_MOGRAINE_AND_WHITE_EVENT)
+ return m_auiEncounter[0];
+ if (type == DATA_HORSEMAN_EVENT)
+ return m_auiEncounter[1];
+ return 0;
+ }
+};
+
+InstanceData* GetInstanceData_instance_scarlet_monastery(Map* pMap)
+{
+ return new instance_scarlet_monastery(pMap);
+}
+
+void AddSC_instance_scarlet_monastery()
+{
+ Script *newscript;
+ newscript = new Script;
+ newscript->Name = "instance_scarlet_monastery";
+ newscript->GetInstanceData = &GetInstanceData_instance_scarlet_monastery;
+ newscript->RegisterSelf();
+}
+
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/scarlet_monastery.h b/src/server/scripts/EasternKingdoms/ScarletMonastery/scarlet_monastery.h
new file mode 100644
index 00000000000..2b6399ae3e4
--- /dev/null
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/scarlet_monastery.h
@@ -0,0 +1,18 @@
+/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>.sourceforge.net/>
+ * This program is free software licensed under GPL version 2
+ * Please see the included DOCS/LICENSE.TXT for more information */
+
+#ifndef DEF_SCARLET_M
+#define DEF_SCARLET_M
+
+#define TYPE_MOGRAINE_AND_WHITE_EVENT 1
+#define DATA_MOGRAINE 2
+#define DATA_WHITEMANE 3
+#define DATA_DOOR_WHITEMANE 4
+
+#define DATA_HORSEMAN_EVENT 5
+#define GAMEOBJECT_PUMPKIN_SHRINE 6
+
+#define DATA_VORREL 7
+#endif
+