/* Copyright (C) 2006 - 2008 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 Pathaleon the Calculator
SD%Complete:
+SDComment:
EndScriptData */
#include "../../../sc_defines.h"
#include "../../../../../../game/Unit.h"
// Spells to be casted
#define SPELL_MANA_TAP 36021
#define SPELL_DOMINATION 36866
#define SPELL_SILENCE 30225
#define SUMMON_NETHER_WRAITH 35285
#define NETHER_WRAITH 21062
define SPELL_ARCANE_MISSILES 39414
#define SAY_SUMMON_NETHER_WRAITH "Time to supplement my work force."
#define SOUND_SUMMON_NETHER_WRAITH 11196
#define SAY_SPELL_DOMINATION_1 "I'm looking for a team player..."
#define SOUND_SPELL_DOMINATION_1 11197
#define SAY_SPELL_DOMINATION_2 "You work for me now!"
#define SOUND_SPELL_DOMINATION_2 11198
// On Aggro
#define SAY_AGGRO "We are on a strict timetable. You will not interfere!"
#define SOUND_SAY_AGGRO 11193
//On Kill Unit
#define SAY_SLAY "Looks like you lose."
#define SOUND_SLAY 11195
// On Death
#define SAY_DEATH "The project will... continue."
#define SOUND_DEATH 11200
// On low health
#define SAY_LOW_HEALT "A minor inconvenience"
#define SOUND_LOW_HEALT 11194
struct MANGOS_DLL_DECL boss_pathaleon_the_calculatorAI : public ScriptedAI
{
boss_pathaleon_the_calculatorAI(Creature *c) : ScriptedAI(c) {EnterEvadeMode();}
uint32 mana_tap_Timer;
uint32 domination_Timer;
uint32 silence_Timer;
uint32 summon_nether_wraith_Timer;
bool InCombat;
void EnterEvadeMode()
{
m_creature->RemoveAllAuras();
m_creature->DeleteThreatList();
m_creature->CombatStop();
DoGoHome();
mana_tap_Timer = 20000;
domination_Timer = 15000;
silence_Timer = 9000;
summon_nether_wraith_Timer = 30000;
InCombat = false;
}
void AttackStart(Unit *who)
{
if (!who)
return;
if (who->isTargetableForAttack() && who!= m_creature)
{
//Begin melee attack if we are within range
DoStartMeleeAttack(who);
InCombat = true;
}
}
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 (!InCombat)
{
DoYell(SAY_AGGRO, LANG_UNIVERSAL, NULL);
DoPlaySoundToSet(m_creature,SOUND_SAY_AGGRO);
InCombat = true;
}
DoStartMeleeAttack(who);
}
}
}
// On Killed Unit
void KilledUnit(Unit* victim)
{
DoYell(SAY_SLAY, LANG_UNIVERSAL, NULL);
DoPlaySoundToSet(m_creature,SOUND_SLAY);
}
// On Death
void JustDied(Unit* Killer)
{
DoYell(SAY_DEATH, LANG_UNIVERSAL, NULL);
DoPlaySoundToSet(m_creature, SOUND_DEATH);
}
// On low healt
void LowHealth(Unit* Killer)
{
DoYell(SAY_LOW_HEALT, LANG_UNIVERSAL, NULL);
DoPlaySoundToSet(m_creature, SOUND_LOW_HEALT);
}
void UpdateAI(const uint32 diff)
//Return since we have no target
{
if (!m_creature->SelectHostilTarget() || !m_creature->getVictim() )
return;
//Check for Mana Tap
if(mana_tap_Timer < diff)
{
//time to cast
DoCast(m_creature->getVictim(),SPELL_MANA_TAP);
//Cast again on time
mana_tap_Timer = 20000;
}else mana_tap_Timer -= diff;
//Check for Domination
if(domination_Timer < diff)
{
//time to cast
DoCast(m_creature->getVictim(),SPELL_DOMINATION);
{
if (rand()%2)
return;
switch (rand()%2)
{
case 0:
DoYell(SAY_SPELL_DOMINATION_1, LANG_UNIVERSAL, NULL);
DoPlaySoundToSet(m_creature,SOUND_SPELL_DOMINATION_1);
break;
case 1:
DoYell(SAY_SPELL_DOMINATION_2, LANG_UNIVERSAL, NULL);
DoPlaySoundToSet(m_creature,SOUND_SPELL_DOMINATION_2);
break;
}
}
//Cast again on time
domination_Timer = 15000;
}else domination_Timer -= diff;
//Check for Silence
if(silence_Timer < diff)
{
//time to cast
DoCast(m_creature->getVictim(),SPELL_SILENCE);
//Cast again on time
silence_Timer = 9000;
}else silence_Timer -= diff;
//Check for Summon Nether Wraith
if(summon_nether_wraith_Timer < diff)
{
int i;
Creature* Summoned = NULL;
Unit* target = NULL;
for(i=1;i<=3;i++)
{
Summoned = DoSpawnCreature(NETHER_WRAITH, 0, 0, 0, 0, TEMPSUMMON_CORPSE_DESPAWN, 300000);
target = SelectUnit(SELECT_TARGET_RANDOM, 0);
if(Summoned && target)
{
Summoned->AI()->AttackStart(target);
}
target = NULL;
Summoned = NULL;
};
DoYell(SAY_SUMMON_NETHER_WRAITH, LANG_UNIVERSAL, NULL);
DoPlaySoundToSet(m_creature,SOUND_SUMMON_NETHER_WRAITH);
//Cast again on time
summon_nether_wraith_Timer = 30000;
}else summon_nether_wraith_Timer -= diff;
DoMeleeAttackIfReady();
}
};
CreatureAI* GetAI_boss_pathaleon_the_calculator(Creature *_Creature)
{
return new boss_pathaleon_the_calculatorAI (_Creature);
}
struct MANGOS_DLL_DECL mob_nether_wraithAI : public ScriptedAI
{
mob_nether_wraithAI(Creature *c) : ScriptedAI(c) {EnterEvadeMode();}
uint32 missiles_Timer;
bool InCombat;
void EnterEvadeMode()
{
m_creature->RemoveAllAuras();
m_creature->DeleteThreatList();
m_creature->CombatStop();
DoGoHome();
missiles_Timer = 9000;
InCombat = false;
}
void AttackStart(Unit *who)
{
if (!who)
return;
if (who->isTargetableForAttack() && who!= m_creature)
{
//Begin melee attack if we are within range
DoStartMeleeAttack(who);
InCombat = true;
}
}
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 (!InCombat)
DoStartMeleeAttack(who);
}
}
}
void UpdateAI(const uint32 diff)
{
//Return since we have no target
if (!m_creature->SelectHostilTarget() || !m_creature->getVictim() )
return;
//Check for Arcane Missiles
if(missiles_Timer < diff)
{
//time to cast
DoCast(m_creature->getVictim(),SPELL_ARCANE_MISSILES);
//Cast again on time
missiles_Timer = 9000;
}else missiles_Timer -= diff;
DoMeleeAttackIfReady();
}
};
CreatureAI* GetAI_mob_nether_wraith(Creature *_Creature)
{
return new mob_nether_wraithAI (_Creature);
}
void AddSC_boss_pathaleon_the_calculator()
{
Script *newscript;
newscript = new Script;
newscript->Name="boss_pathaleon_the_calculator";
newscript->GetAI = GetAI_boss_pathaleon_the_calculator;
m_scripts[nrscripts++] = newscript;
newscript = new Script;
newscript->Name="mob_nether_wraith";
newscript->GetAI = GetAI_mob_nether_wraith;
m_scripts[nrscripts++] = newscript;
}