All pastes #943950 Raw Edit

Archimonde by Seline

public cpp v1 · immutable
·published 2008-03-15 18:52 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*/#include "../../../sc_defines.h"#include "def_hyjal.h"#include "../../../../../../game/TargetedMovementGenerator.h"#include "../../../../../../game/SpellAuras.h"#define SPELL_DENOUEMENT_WISP      32124 // Wisps use this#define SPELL_PROTECTION_OF_ELUNE  38528#define SPELL_DRAIN_WORLD_TREE      39140#define SPELL_DRAIN_WORLD_TREE_2    39141#define SPELL_FINGER_OF_DEATH       31984#define SPELL_HAND_OF_DEATH         35354#define SPELL_AIR_BURST             32014#define SPELL_GRIP_OF_THE_LEGION    31972#define SPELL_DOOMFIRE_SPAWN        32045#define SPELL_DOOMFIRE_VISUAL       31945#define SPELL_DOOMFIRE_DAMAGE       31969#define SPELL_SOUL_CHARGE_YELLOW    32045#define SPELL_SOUL_CHARGE_GREEN     32051#define SPELL_SOUL_CHARGE_RED       32052#define SPELL_UNLEASH_SOUL_YELLOW   32054#define SPELL_UNLEASH_SOUL_GREEN    32057#define SPELL_UNLEASH_SOUL_RED      32053#define SPELL_FEAR                  41150#define SAY_AGGRO           "Your resistance is insignificant!"#define SOUND_AGGRO         10987#define SAY_DOOMFIRE1       "This world will burn!"#define SOUND_DOOMFIRE1     10990#define SAY_DOOMFIRE2       "Manach sheek-thrish!"#define SOUND_DOOMFIRE2     11041#define SAY_AIR_BURST       "A-kreesh!"#define SOUND_AIR_BURST     10989#define SAY_AIR_BURST2       "Away vermin!"#define SOUND_AIR_BURST2     11043#define SAY_SLAY1           "All creation will be devoured!"#define SOUND_SLAY1         11044#define SAY_SLAY2           "Your soul will languish for eternity."#define SOUND_SLAY2         10991#define SAY_SLAY3           "I am the coming of the end!"#define SOUND_SLAY3         11045#define SAY_UNK1           "You are mine now."#define SOUND_UNK1          10988#define SAY_UNK2            "Bow to my will."#define SOUND_UNK2          11042#define SAY_ENRAGE          "At last it is here. Mourn and lament the passing of all you have ever known and all that would have been! Akmin-kurai!"#define SOUND_ENRAGE        10993#define SAY_DEATH           "No, it cannot be! Nooo!"#define SOUND_DEATH         10992struct MANGOS_DLL_DECL boss_archimondeAI : public ScriptedAI{    boss_archimondeAI(Creature* c) : ScriptedAI(c)    {        Reset();    }    uint32 FearTimer;    uint32 AirBurstTimer;    uint32 GripOfTheLegionTimer;    uint32 DoomfireTimer;    uint32 SoulChargeTimer;    uint32 MeleeRangeCheckTimer;    uint32 HandOfDeathTimer;    bool InCombat;    bool SoulCharged;    bool BelowTenPercent;    bool HasProtected;    void Reset()    {        FearTimer = 40000;        AirBurstTimer = 30000;        GripOfTheLegionTimer = 5000 + rand()%20000;        DoomfireTimer = 20000;        SoulChargeTimer = 15000 + rand()%105000;        MeleeRangeCheckTimer = 15000;        HandOfDeathTimer = 2000;        InCombat = false;        SoulCharged = false;        BelowTenPercent = false;        HasProtected = false;    }    void EnterEvadeMode()    {        Reset();    }    void AttackStart(Unit* who)    {        if (!who)            return;        if (who->isTargetableForAttack() && who!= m_creature)        {            DoStartMeleeAttack(who);            if (!InCombat)            {                DoYell(SAY_AGGRO, LANG_UNIVERSAL, NULL);                DoPlaySoundToSet(m_creature, SOUND_AGGRO);                InCombat = true;            }        }    }    void MoveInLineOfSight(Unit* who)    {        if (!who)            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);                DoStartMeleeAttack(who);            }        }    }    void JustDied(Unit* killer)    {        DoYell(SAY_DEATH, LANG_UNIVERSAL, NULL);        DoPlaySoundToSet(m_creature, SOUND_DEATH);    }    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_SLAY3);                break;            case 2:                DoYell(SAY_SLAY3, LANG_UNIVERSAL, NULL);                DoPlaySoundToSet(m_creature, SOUND_SLAY3);                break;        }        GainSoulCharge(victim->getClass());    }    void GainSoulCharge(uint8 Class)    {        DoTextEmote("would receive a soul charge here. NYI.", NULL);    }    void UpdateAI(const uint32 diff)    {        if(!m_creature->getVictim() || !m_creature->SelectHostilTarget())            return;        if(((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 10) && !BelowTenPercent)            BelowTenPercent = true;        if(BelowTenPercent)        {            if(!HasProtected)            {                DoCast(m_creature->getVictim(), SPELL_PROTECTION_OF_ELUNE);                HasProtected = true;            }            if(HandOfDeathTimer < diff)            {                DoCast(m_creature->getVictim(), SPELL_HAND_OF_DEATH);                HandOfDeathTimer = 2000;            }else HandOfDeathTimer -= diff;            return; // Don't do anything after this point.        }        if(GripOfTheLegionTimer < diff)        {            DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_GRIP_OF_THE_LEGION);            GripOfTheLegionTimer = 5000 + rand()%20000;        }else GripOfTheLegionTimer -= diff;        if(AirBurstTimer < diff)        {            DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_AIR_BURST);            AirBurstTimer = 25000 + rand()%15000;        }else AirBurstTimer -= diff;        if(FearTimer < diff)        {            DoCast(m_creature->getVictim(), SPELL_FEAR);            FearTimer = 40000;        }else FearTimer -= diff;        if(DoomfireTimer < diff)        {            DoTextEmote("would summon a doomfire here", NULL);            DoomfireTimer = 30000;        }else DoomfireTimer -= diff;        if(MeleeRangeCheckTimer < diff)        {            DoTextEmote("would check if everyone is out of melee range here", NULL);            MeleeRangeCheckTimer = 5000;        }else MeleeRangeCheckTimer -= diff;        DoMeleeAttackIfReady();    }};CreatureAI* GetAI_boss_archimondeAI(Creature* _Creature){    return new boss_archimondeAI(_Creature);}void AddSC_boss_archimonde(){    Script *newscript;    newscript = new Script;    newscript->GetAI = GetAI_boss_archimondeAI;    newscript->Name = "boss_archimonde";    m_scripts[nrscripts++] = newscript;}