/* Copyright (C) 2006,2007 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_Moroes
SD%Complete: 0
SDComment: Place Holder
EndScriptData */
//This is still under development
#include "../../sc_defines.h"
#define SAY_AGGRO "Hum. Des visiteurs imprévus. Il va faloir se préparer."
#define SOUND_AGGRO 9211
#define SAY_SPECIAL1 "Bon, où en étais-je ? Ah oui"
#define SOUND_SPECIAL1 9215
#define SAY_SPECIAL2 "Vous avez sonné ?"
#define SOUND_SPECIAL2 9316
#define SAY_KILL1 "Un invité de plus au dinner ce soir"
#define SOUND_KILL1 9214
#define SAY_KILL2 "Je n'ai ... Jamais assez de temps"
#define SOUND_KILL2 9314
#define SAY_KILL3 "Je suis parti, ça fait désordre"
#define SOUND_KILL3 9315
#define SAY_DEATH "Comme je suis maladroit c'est terrible..."
#define SOUND_DEATH 9213
#define SPELL_VANISH 31619
#define SPELL_GARROTE 29433
#define SPELL_BLIND 34694
#define SPELL_GOUGE 36862
#define SPELL_ENRAGE 19953 //to much dmg?
//Add spells, not enough information
struct MANGOS_DLL_DECL boss_MoroesAI : public ScriptedAI
{
boss_MoroesAI(Creature *c) : ScriptedAI(c)
{
data = (c->GetInstanceData()) ? ((ScriptedInstance*)c->GetInstanceData()) : NULL;
EnterEvadeMode();
}
ScriptedInstance* data;
bool InCombat;
uint32 Vanish_Timer;
uint32 Garrote_Timer;
uint32 Blind_Timer;
uint32 Gouge_Timer;
uint32 Enrage_Timer;
bool IsVanish;
bool IsEnraged;
void EnterEvadeMode()
{
InCombat = false;
Vanish_Timer = 30000;
Garrote_Timer = 34000;
Blind_Timer = 10000;
Gouge_Timer = 20000;
IsVanish = false;
IsEnraged = false;
m_creature->RemoveAllAuras();
m_creature->DeleteThreatList();
m_creature->CombatStop();
DoGoHome();
if(data)
data->SetData("moroes_encounter", 0); //not started, you just failed it nubs :D
}
void KilledUnit(Unit *victim)
{
switch(rand()%3)
{
case 0:
DoYell(SAY_KILL1, LANG_UNIVERSAL, NULL);
DoPlaySoundToSet(victim, SOUND_KILL1);
break;
case 1:
DoYell(SAY_KILL2, LANG_UNIVERSAL, NULL);
DoPlaySoundToSet(victim, SOUND_KILL2);
break;
case 2:
DoYell(SAY_KILL3, LANG_UNIVERSAL, NULL);
DoPlaySoundToSet(victim, SOUND_KILL3);
break;
}
}
void JustDied(Unit *victim)
{
if(data)
data->SetData("moroes_encounter", 2); //Completed
DoYell(SAY_DEATH, LANG_UNIVERSAL, NULL);
DoPlaySoundToSet(m_creature, SOUND_DEATH);
}
void AttackStart(Unit *who)
{
if(!who && who != m_creature)
return;
if (who->isTargetableForAttack() && who!= m_creature)
{
//Begin melee attack if we are within range
DoStartMeleeAttack(who);
//Say our dialog and mark the encounter as in progress
if (!InCombat)
{
DoYell(SAY_AGGRO, LANG_UNIVERSAL, NULL);
DoPlaySoundToSet(m_creature, SOUND_AGGRO);
InCombat = true;
if(data)
data->SetData("moroes_encounter", 1); //In progress
}
}
}
void MoveInLineOfSight(Unit *who)
{
if (!who || m_creature->getVictim())
return;
if (who->isTargetableForAttack() && who->isInAccessablePlaceFor(m_creature) && m_creature->IsHostileTo(who))
{
float attackRadius = m_creature->GetAttackDistance(who);
if (m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->GetDistanceZ(who) <= CREATURE_Z_ATTACK_RANGE && m_creature->IsWithinLOSInMap(who))
{
if(who->HasStealthAura())
who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH);
if (!InCombat)
{
DoYell(SAY_AGGRO, LANG_UNIVERSAL, NULL);
DoPlaySoundToSet(m_creature, SOUND_AGGRO);
InCombat = true;
}
DoStartMeleeAttack(who);
}
}
}
void UpdateAI(const uint32 diff)
{
//Return since we have no target
if (!m_creature->SelectHostilTarget() || !m_creature->getVictim() )
return;
if(!IsVanish)
DoMeleeAttackIfReady();
if (Gouge_Timer < diff && !IsVanish)
{
DoCast(m_creature->getVictim(),SPELL_GOUGE);
Gouge_Timer = 10000;
}else Gouge_Timer -= diff;
if (Blind_Timer < diff && !IsVanish)
{
Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 0);
DoCast(target,SPELL_BLIND);
switch(rand()%2)
{
case 0:
DoYell(SAY_SPECIAL1, LANG_UNIVERSAL, NULL);
DoPlaySoundToSet(target, SOUND_SPECIAL1);
break;
case 1:
DoYell(SAY_SPECIAL2, LANG_UNIVERSAL, NULL);
DoPlaySoundToSet(target, SOUND_SPECIAL2);
break;
}
target = NULL;
Blind_Timer = 20000;
}else Blind_Timer -= diff;
if (Vanish_Timer < diff && !IsVanish)
{
Vanish();
Vanish_Timer = 30000;
}else Vanish_Timer -= diff;
if(m_creature->GetAura(SPELL_VANISH,1) && IsVanish)
{
DoCast(m_creature->getVictim(),SPELL_GARROTE);
}else
{
IsVanish = false;
}
if( (m_creature->GetHealth()*100) / m_creature->GetMaxHealth() <= 30 && !IsEnraged)
{
IsEnraged = true;
DoCast(m_creature, SPELL_ENRAGE);
}
}
void Vanish()
{
Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 0);
m_creature->CastSpell(m_creature, SPELL_VANISH, true);
m_creature->RemoveAllAuras();
m_creature->DeleteThreatList();
m_creature->AddThreat(target,10.0f);
IsVanish = true;
target = NULL;
}
};
CreatureAI* GetAI_boss_Moroes(Creature *_Creature)
{
return new boss_MoroesAI (_Creature);
}
void AddSC_boss_Moroes()
{
Script *newscript;
newscript = new Script;
newscript->Name="boss_moroes";
newscript->GetAI = GetAI_boss_Moroes;
m_scripts[nrscripts++] = newscript;
}