Public feed #892486

akilzon

public text v1 · immutable
Raw Edit
·published 2008-02-05 14:00 UTC
rendered paste body
/* 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_Akilzon
SD%Complete: 75
SDComment: Missing timer for Call Lightning and Sound ID's
SQLUpdate: 
#Temporary fix for Soaring Eagles
update `creature_template` set `entry`='24858',`modelid_A`='22255',`modelid_A2`='0',`modelid_H`='22255',`modelid_H2`='0',`name`='Soaring Eagle',`subname`='',`minlevel`='70',`maxlevel`='70',`minhealth`='6800',`maxhealth`='6800',`minmana`='5000',`maxmana`='5000',`armor`='0',`faction_A`='168',`faction_H`='168',`npcflag`='0',`speed`='1',`rank`='0',`mindmg`='0',`maxdmg`='0',`dmgschool`='0',`attackpower`='0',`baseattacktime`='0',`rangeattacktime`='0',`flags`='0',`dynamicflags`='0',`family`='0',`trainer_type`='0',`trainer_spell`='0',`class`='0',`race`='0',`minrangedmg`='0',`maxrangedmg`='0',`rangedattackpower`='0',`type`='1',`civilian`='0',`flag1`='72',`lootid`='0',`pickpocketloot`='0',`skinloot`='0',`resistance1`='0',`resistance2`='0',`resistance3`='0',`resistance4`='0',`resistance5`='0',`resistance6`='0',`spell1`='0',`spell2`='0',`spell3`='0',`spell4`='0',`mingold`='0',`maxgold`='0',`AIName`='',`MovementType`='0',`InhabitType`='3',`RacialLeader`='0',`RegenHealth`='1',`equipment_id`='0',`ScriptName`='mob_soaring_eagle' where `entry`='24858';
update `creature_template` set `ScriptName` = 'boss_akilzon' where entry = 23574;
EndScriptData */
 
#include "../../sc_defines.h"
#include "../../creature/simple_ai.h"
 
#define SPELL_STATIC_DISRUPTION 44008
#define SPELL_CALL_LIGHTING		43661 //Missing timer
#define SPELL_GUST_OF_WIND		43621
#define SPELL_ELECTRICAL_STORM	43648
 
#define SAY_ONAGGRO		"Your death gonna be quick, strangers. You shoulda never have come to this place..."
#define SAY_ONSUMMON	"Feed, me bruddahs!"
#define SAY_ONDEATH		"You can't... kill... me spirit!"
#define SAY_RANDOM1		"I be da predator! You da prey..." //currently user in OnEnrage
#define SAY_RANDOM2		"Stop your cryin'!" //currently used in OnKill
#define SAY_RANDOM3		"Ya got nothin'!" //currently used in OnKill
 
#define MOB_SOARING_EAGLE 24858
 
struct MANGOS_DLL_DECL boss_akilzonAI : public ScriptedAI
{
	bool InCombat;
	uint32 StaticDisruption_Timer, GustOfWind_Timer, CallLighting_Timer, ElectricalStorm_Timer, SummonEagles_Timer, Enrage_Timer;
	ScriptedInstance* pInstance;
 
    boss_akilzonAI(Creature *c) : ScriptedAI(c) 
	{
		pInstance = (c->GetInstanceData()) ? ((ScriptedInstance*)c->GetInstanceData()) : NULL;
 
		EnterEvadeMode();
	}
 
    void EnterEvadeMode()
    {
		InCombat = false;
 
		if (pInstance)
			pInstance->SetData("AkilzonIsDead", 0);
 
		StaticDisruption_Timer = (10+rand()%10)*1000; //10 to 20 seconds (bosskillers)
		GustOfWind_Timer = (20+rand()%10)*1000; //20 to 30 seconds(bosskillers)
		CallLighting_Timer = 30*1000; //totaly random timer. can't find any info on this
		ElectricalStorm_Timer = 60*1000; //60 seconds(bosskillers)
		SummonEagles_Timer = ElectricalStorm_Timer + (9 + rand()%4) * 1000; //a few seconds after each storm(bosskillers)
		Enrage_Timer = 10*60*1000; //10 minutes till enrage(bosskillers)
 
        m_creature->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_DISARM, true);
        m_creature->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_POLYMORPH, true);
        m_creature->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_INTERRUPT, true);
        m_creature->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_INTERRUPT_CAST, true);
        m_creature->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_SILENCE, true);       
        m_creature->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_CONFUSED, true);
        m_creature->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_CHARM , true);
        m_creature->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_FEAR , true);
        m_creature->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_ROOT, true);
        m_creature->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_STUN, true);
        m_creature->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_FREEZE, true);
        m_creature->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_HORROR, true);
        m_creature->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_DAZE, true);
        m_creature->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_SLEEP, true);
        m_creature->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_BANISH, true);
        m_creature->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_SNARE, true);
 
		m_creature->RemoveAllAuras();
		m_creature->DeleteThreatList();
		m_creature->CombatStop();
		DoGoHome();
	}
 
	void AttackStart(Unit *who)
	{
        if (!who)
            return;
 
        if (who->isTargetableForAttack() && who!= m_creature)
        {
			//Begin melee attack if we are within range
			DoStartMeleeAttack(who);
 
			if (!InCombat) {
				DoYell(SAY_ONAGGRO,LANG_UNIVERSAL,NULL);
				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(who->HasStealthAura())
                    who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH);
 
                //Begin melee attack
                DoStartMeleeAttack(who);
 
				if (!InCombat) {
					DoYell(SAY_ONAGGRO,LANG_UNIVERSAL,NULL);
					InCombat = true;
				}
            }
        }
	}
 
	void JustDied(Unit* Killer)
	{
		DoYell(SAY_ONDEATH,LANG_UNIVERSAL,NULL);
 
		if (pInstance)
			pInstance->SetData("AkilzonIsDead", 1);
	}
 
    void KilledUnit(Unit* victim)
	{
		if (rand()%2 == 0) {
			DoYell(SAY_RANDOM2, LANG_UNIVERSAL, NULL);
		} else {
			DoYell(SAY_RANDOM3, LANG_UNIVERSAL, NULL);
		}
	}
 
	void UpdateAI(const uint32 diff)
	{
        //Return since we have no target
        if (!m_creature->SelectHostilTarget() || !m_creature->getVictim())
            return;
 
		Unit* target = NULL;
 
		if (StaticDisruption_Timer < diff) {
			target = SelectUnit(SELECT_TARGET_RANDOM, 0);
 
			DoCast(target, SPELL_STATIC_DISRUPTION);
			StaticDisruption_Timer = (10+rand()%10)*1000; //10 to 20 seconds (bosskillers)
		}else StaticDisruption_Timer -= diff;
 
		if (GustOfWind_Timer < diff) {
			target = SelectUnit(SELECT_TARGET_RANDOM, 1);
 
			DoCast(target, SPELL_GUST_OF_WIND);
			GustOfWind_Timer = (20+rand()%10)*1000; //20 to 30 seconds(bosskillers)
		} else GustOfWind_Timer -= diff;
 
		if (CallLighting_Timer < diff) {
			DoCast(m_creature->getVictim(), SPELL_CALL_LIGHTING);
			CallLighting_Timer = 25*1000; //totaly random timer. can't find any info on this
		} else CallLighting_Timer -= diff;
 
		if (ElectricalStorm_Timer < diff) {
			target = SelectUnit(SELECT_TARGET_RANDOM, 0);
 
			DoCast(target, SPELL_ELECTRICAL_STORM);
			ElectricalStorm_Timer = 60*1000; //60 seconds(bosskillers)
		} else ElectricalStorm_Timer -= diff;
 
		if (SummonEagles_Timer < diff) {
			int summonedEagles = 6 + rand()%3;
			float off_x, off_y, off_z;
 
			DoYell(SAY_ONSUMMON, LANG_UNIVERSAL, NULL);
 
			for (int i = 0; i < summonedEagles; i++) {
				target = SelectUnit(SELECT_TARGET_RANDOM, 1);
				off_x = m_creature->GetPositionX();
				off_y = m_creature->GetPositionY();
				off_z = m_creature->GetPositionZ() + 0.5;
 
				m_creature->SummonCreature(MOB_SOARING_EAGLE, off_x, off_y, off_z, 9, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, ElectricalStorm_Timer);
			}
 
			SummonEagles_Timer = ElectricalStorm_Timer + (9 + rand()%4) * 1000; //a few seconds after each storm(bosskillers)
		} else SummonEagles_Timer -= diff;
 
		if (Enrage_Timer < diff) {
			const CreatureInfo *cinfo = m_creature->GetCreatureInfo();
 
			DoYell(SAY_RANDOM1, LANG_UNIVERSAL, NULL);
 
			m_creature->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 500)));
			m_creature->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 500)));
			m_creature->UpdateDamagePhysical(BASE_ATTACK);
		} else Enrage_Timer -= diff;
 
		DoMeleeAttackIfReady();
	}
};
 
//Soaring Eagle
CreatureAI* GetAI_mob_soaring_eagle(Creature *_Creature)
{
    SimpleAI* ai = new SimpleAI (_Creature);
 
    ai->m_creature->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_POLYMORPH, true);
 
    ai->Spell[0].Enabled = true;
    ai->Spell[0].Spell_Id = 44732;           //Eagle Swoop
    ai->Spell[0].Cooldown = 5000;
    ai->Spell[0].CooldownRandomAddition = 1000;
    ai->Spell[0].First_Cast = 5000;
    ai->Spell[0].Cast_Target_Type = CAST_HOSTILE_RANDOM;
 
    ai->EnterEvadeMode();
 
    return ai;
}
 
CreatureAI* GetAI_boss_akilzon(Creature *_Creature)
{
    return new boss_akilzonAI (_Creature);
}
 
void AddSC_boss_akilzon()
{
    Script *newscript = NULL;
 
    newscript = new Script;
    newscript->Name="boss_akilzon";
    newscript->GetAI = GetAI_boss_akilzon;
    m_scripts[nrscripts++] = newscript;
 
    newscript = new Script;
    newscript->Name="mob_soaring_eagle";
    newscript->GetAI = GetAI_mob_soaring_eagle;
    m_scripts[nrscripts++] = newscript;
}