Public feed #726754

Hyjal - Kaz'Rogal by Palmik

public cpp v1 · immutable
Raw Edit
·published 2007-10-05 14:02 UTC
rendered paste body
/**|||||||||||||||||||||||||*||                     ||*||  UNDER DEVELOPMENT  ||*||---------------------||*||   HYJAL KAZ'ROGAL   ||*||                     ||*|||||||||||||||||||||||||*/#include "../../sc_defines.h"#define SPELL_CLEAVE          0#define SPELL_MARK            31447 //If the target have no mana he will "bum" him via 31463 spell, but I think it would be better do that via the dummy effect in MaNGOS core.#define SPELL_STOMP           38911#define SPELL_DISPELL         0#define SOUND_ENTER           11015#define SOUND_MARK1           11016#define SOUND_MARK2           11052#define SOUND_SLAY1           11017#define SOUND_SLAY2           11053#define SOUND_SLAY3           11054#define SOUND_JUSTDIED        11018#define SAY_ENTER             "Cry for mercy! Your meaningless lives will soon be forfeit."#define SAY_MARK1             "Your death will be a painful one."#define SAY_MARK2             "You... are marked."#define SAY_SLAY1             "Shaza-Kiel!"#define SAY_SLAY2             "You are nothing!"#define SAY_SLAY3             "Miserable nuisance!"#define SAY_JUSTDIED          ""struct MANGOS_DLL_DECL boss_kazrogalAI : public ScriptedAI{	boss_kazrogalAI(Creature *c) : ScriptedAI(c) {EnterEvadeMode();} 	bool InCombat;    uint32 Mark_Timer;    uint32 Stomp_Timer;    uint32 Cleave_Timer;     	void EnterEvadeMode()	{		InCombat = false;         		m_creature->RemoveAllAuras();		m_creature->DeleteThreatList();		m_creature->CombatStop();		DoGoHome();        Mark_Timer = 180000;        Stomp_Timer = 20000;        Cleave_Timer = 5000 + rand()15000;                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_INTERRUPTED, true);        m_creature->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_DAZED, true);        m_creature->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_FEAR, true);        m_creature->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_CHARM, true);        m_creature->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_ROOT, true);        m_creature->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_FREEZE, true);        m_creature->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_SILENCE, true);        m_creature->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_STUNDED, true);        m_creature->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_CONFUSED, true);        m_creature->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_SLEEP, true);        m_creature->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_BANISH, true);	} 	void AttackStart(Unit *who)	{		if (!who)			return; 		if (who->isTargetableForAttack() && who!= m_creature)		{			//Begin melee attack if we are within range			if (!m_creature->IsWithinDistInMap(who, ATTACK_DISTANCE))			DoStartMeleeAttack(who); 			InCombat = true;		}	}    void KilledUnit(Unit* victim)    {        switch(rand()%3)        {            case 0:                DoYell(SAY_SLAY1,LANG_UNIVERSAL,NULL);                DoPlaySoundToSet(m_creature,SOUND_SLAY1);            break;            case 1:                DoYell(SAY_SLAY2,LANG_UNIVERSAL,NULL);                DoPlaySoundToSet(m_creature,SOUND_SLAY2);            break;            case 2:                DoYell(SAY_SLAY3,LANG_UNIVERSAL,NULL);                DoPlaySoundToSet(m_creature,SOUND_SLAY3);            break;        }    }    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 if we are within range                if (!m_creature->IsWithinDistInMap(who, ATTACK_DISTANCE))                    DoStartMeleeAttack(who);                if (!m_creature->IsWithinDistInMap(who, ATTACK_DISTANCE))                {                    IsSelfRooted = true;                }                 InCombat = true;                if (who->GetTypeId() == TYPEID_PLAYER)                {                    DoYell(SAY_ENTER,LANG_UNIVERSAL,NULL);                    DoPlaySoundToSet(m_creature,SOUND_ENTER);                }            }        }    } 	void UpdateAI(const uint32 diff)		{			//Return since we have no target		if (!m_creature->SelectHostilTarget())			return;			//Check if we have a current target		if( m_creature->getVictim() && m_creature->isAlive()) 				//If we are within range melee the target			if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE))				{					//Make sure our attack is ready and we aren't currently casting				if( m_creature->isAttackReady() && !m_creature->IsNonMeleeSpellCasted(false))				{                    //Kaz'Rogal's Mark                    if (Mark_Timer < diff)                    {                        int Markcount = 0;                        Markcount++                        DoCast(m_creature,SPELL_MARK);                        if (Markcount == 7)                            Mark_Timer = 10000;                        else                            Mark_Timer = 45000 - (Markcount * 5000);                    }else Mark_Timer -= diff;                                        //War Stomp (He cast if every 15, 20 or 25 sec)                     if (Stomp_Timer < diff)                    {                        DoCast(m_creature,SPELL_STOMP);                        int Stomp_cast = rand()%3;                        switch (Stomp_cast)                        {                            case 0:                                Stomp_Timer = 15000;                            break;                            case 1:                                Stomp_Timer = 25000;                            break;                            case 2:                                Stomp_Timer = 20000;                            break;                        }                    }else Stomp_Timer -= diff;                    //Cleave (I am not sure with this timer, but he cast cleave every 5-20 sec... I could not find any rule in this.)                     if (Cleave_Timer < diff)                    {                        DoCast(m_creature->GetVictim(),SPELL_STOMP);                        Cleave_Timer = 5000 + rand()15000;                    }else Stomp_Timer -= diff;				}			} 			DoMeleeAttackIfReady(); 	}}; CreatureAI* GetAI_boss_kazrogal(Creature *_Creature){	return new boss_kazrogalAI (_Creature);} }void AddSC_mount_hyjal(){    Script *newscript;    newscript = new Script;    newscript->Name="boss_kazrogal";    newscript->GetAI = GetAI_boss_kazrogal;    m_scripts[nrscripts++] = newscript;}