All pastes #951711 Raw Edit

Unnamed

public cpp v1 · immutable
·published 2008-03-21 16:38 UTC
rendered paste body
/* 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*//* ScriptDataSDName: Boss_RageWinterchillSD%Complete: 85SDComment:EndScriptData */#include "../../../sc_defines.h"#include "def_hyjal.h"#include "../../../../../../game/TargetedMovementGenerator.h"#include "../../../../../../game/SpellAuras.h"// Yells// Enter#define SAY_AGGRO             "The Legion's final conquest has begun! Once again the subjugation of this world is within our grasp. Let none survive!"#define SOUND_AGGRO           11023// Death & Decay#define SAY_DECAY1            "Crumble and rot!"#define SOUND_DECAY1          11023#define SAY_DECAY2            "Ashes to ashes, dust to dust."#define SOUND_DECAY2          11055// Frost Nova#define SAY_NOVA1             "Succumb to the icy chill... of death."#define SOUND_NOVA1           11024#define SAY_NOVA2             "It will be much colder in your grave."#define SOUND_NOVA2           11058// Slay#define SAY_SLAY1             "All life must perish!"#define SOUND_SLAY1           11025#define SAY_SLAY2             "You world is ours now!"#define SOUND_SLAY2           11056#define SAY_SLAY3             "Victory to the Legion!"#define SOUND_SLAY3           11057// Death#define SAY_DEATH             "You have won this battle, but not... the... war"#define SOUND_DEATH           11026// Rage Winterchill's spells#define SPELL_ICEBOLT            31249 // Single target (random). 4.5 - 5.5k Frost damage, 4 sec stun + 10k damage over 4 seconds.#define SPELL_DEATH_DECAY        39658 // Single target (random). ~2 Shadow (?) AoE damage per second at a random unit#define SPELL_FROST_NOVA         32365 // Self-pointed AoE. Minimal damage, 6 seconds freeze.#define SPELL_FROST_ARMOR        31256 // Self-buff. Adds armor, and chills attackers - DOESNT WORKstruct MANGOS_DLL_DECL boss_rage_winterchillAI : public ScriptedAI{    boss_rage_winterchillAI(Creature *c) : ScriptedAI(c)    {        pInstance = ((ScriptedInstance*)c->GetInstanceData());        SetVariables();    }    ScriptedInstance* pInstance;    // Fight timers    uint32 FrostArmorTimer;    uint32 IceboltTimer;    uint32 FrostNovaTimer;    uint32 DeathDecayTimer;        bool InCombat;        void SetVariables()    {        // Immunities        m_creature->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_DISARM, true);        m_creature->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_POLYMORPH, true);        m_creature->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_INTERRUPT_CAST, true);        m_creature->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_DAZE, true);        m_creature->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_FEAR, true);        m_creature->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_SILENCE, true);        m_creature->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_CHARM, true);        m_creature->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_ROOT, true);                IceboltTimer = 18000;           DeathDecayTimer = 34000;        FrostNovaTimer = 11000;           FrostArmorTimer = 10000;                          InCombat = false;        if(pInstance)            pInstance->SetData("DATA_RAGEWINTERCHILL_EVENT", 0);    }     void Reset()    {        SetVariables();        m_creature->RemoveAllAuras();        m_creature->DeleteThreatList();        m_creature->CombatStop();        DoGoHome();    }        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 JustDied(Unit *victim)    {        if(pInstance)            pInstance->SetData("DATA_RAGEWINTERCHILL_EVENT", 3);		EnterEvadeMode();        DoYell(SAY_DEATH, LANG_UNIVERSAL, NULL);        DoPlaySoundToSet(m_creature,SOUND_DEATH);    }    void AttackStart(Unit *who)    {        if (!who)            return;        if (who->isTargetableForAttack() && who!= m_creature)        {            DoStartMeleeAttack(who); // Only melee when the summoning is done                            if(!InCombat)            {                if(pInstance)                    pInstance->SetData("DATA_RAGEWINTERCHILL", 1);				EnterEvadeMode();                InCombat = true;                DoYell(SAY_AGGRO, LANG_UNIVERSAL, who);                DoPlaySoundToSet(m_creature, SOUND_AGGRO);            }        }    }    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)            {                if(who->HasStealthAura())                    who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH);                                DoStartMeleeAttack(who); // Only melee when the summoning is done                                    if(!InCombat)                {                    if(pInstance)						pInstance->SetData("DATA_RAGEWINTERCHILL_EVENT", 1);					EnterEvadeMode();                    InCombat = true;                    DoYell(SAY_AGGRO, LANG_UNIVERSAL, who);                    DoPlaySoundToSet(m_creature, SOUND_AGGRO);                }            }        }    }    void UpdateAI(const uint32 diff)    {        // Do not do anything unless we got a current target.        if (!m_creature->SelectHostilTarget() || !m_creature->getVictim() )            return;            if(FrostArmorTimer < diff)        {            DoCast(m_creature, SPELL_FROST_ARMOR);            FrostArmorTimer = 45000;                        }else FrostArmorTimer -= diff;        // Frost Nova        if(FrostNovaTimer < diff)        {            DoCast(m_creature->getVictim(), SPELL_FROST_NOVA);                        switch(rand()%2)            {                case 0:                    DoYell(SAY_NOVA1,LANG_UNIVERSAL,NULL);                    DoPlaySoundToSet(m_creature, SOUND_NOVA1);                case 1:                    DoYell(SAY_NOVA2,LANG_UNIVERSAL,NULL);                    DoPlaySoundToSet(m_creature, SOUND_NOVA2);            }                        FrostNovaTimer = 45000;        }else FrostNovaTimer -= diff;        // Icebolt        if(IceboltTimer < diff)        {            DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_ICEBOLT, true);            IceboltTimer = 45000;        }else IceboltTimer -= diff;        // Death&Decay        if(DeathDecayTimer < diff)        {            DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_DEATH_DECAY, true);            switch(rand()%2)            {                case 0:                    DoYell(SAY_DECAY1, LANG_UNIVERSAL, NULL);                    DoPlaySoundToSet(m_creature, SOUND_DECAY1);                case 1:                    DoYell(SAY_DECAY2, LANG_UNIVERSAL, NULL);                    DoPlaySoundToSet(m_creature, SOUND_DECAY2);            }                        DeathDecayTimer = 45000;        }else DeathDecayTimer -= diff;                DoMeleeAttackIfReady(); // And keep pummeling them with our bone fingers.    }};CreatureAI* GetAI_boss_rage_winterchill(Creature *_Creature){    return new boss_rage_winterchillAI (_Creature);}void AddSC_boss_rage_winterchill(){    Script *newscript;    newscript = new Script;    newscript->Name="boss_rage_winterchill";    newscript->GetAI = GetAI_boss_rage_winterchill;    m_scripts[nrscripts++] = newscript;}