All pastes #955124 Raw Edit

an.sxsdsdsada

public cpp v1 · immutable
#955124 ·published 2008-03-24 11:22 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 "../scripts/sc_defines.h"#include "../scripts/creature/simple_ai.h"#include "../../../game/Player.h"#include "../../../game/Spell.h"#include "../../../game/SpellAuras.h"#include "../../../shared/Database/DBCStores.h"#include "../../../game/ObjectAccessor.h" #define SPELL_CARRION_SWARM       31306 // HOWL_OF_AZGALOR#define SPELL_VAMPIRIC_AURA       38196  //Rain OF Fire#define SPELL_SLEEP               31548 // Unqjshs Flames#define SPELL_CLEAVE              40505 #define INFERNO                   17818 //DOOMGUARD// #define SPELL_INFERNO             31299 // WarStomp#define NPC_INFERNO               17818 //Criple#define SPELL_IMMOLATION          7     //Trash #define SAY_ENTER "Hello I R DREADLORD!"#define SOUND_ENTER 10977                   #define SAY_SLEEP "I cast sleep, seriously."#define SOUND_SLEEP 10978                   #define SAY_INFERNO "I summon big fat infernal from teh sky."#define SOUND_INFERNO 10980                           // Slay#define SAY_SLAY "Die"#define SOUND_SLAY 10981  // Death#define SAY_DEATH "I died :("#define SOUND_DEATH 10982  class CustomAura:public Aura{public:	CustomAura(SpellEntry const* spellproto, uint32 eff, int32 *currentBasePoints, Unit *target, Unit *caster = NULL, Item* castItem = NULL):Aura(spellproto, eff, currentBasePoints, target,caster, castItem)	{};}; struct MANGOS_DLL_DECL boss_anetheronAI : public ScriptedAI{    boss_anetheronAI(Creature *c) : ScriptedAI(c)    {        pInstance = (c->GetInstanceData()) ? ((ScriptedInstance*)c->GetInstanceData()) : NULL;        Reset();    }     ScriptedInstance *pInstance;     uint32 CarrionSwarmTimer;    uint32 VampiricAuraTimer;    uint32 SleepTimer;    uint32 InfernoTimer;     bool InCombat;    uint64 DoomVictim_Guid;     void Reset()    {        CarrionSwarmTimer = 10000;           VampiricAuraTimer = 1000;        SleepTimer = 60000;           InfernoTimer = 30000;         InCombat = false;         m_creature->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_SILENCE, true);        m_creature->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_DISARM, true);        m_creature->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_CONFUSED, true);        m_creature->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_SNARE, true);        m_creature->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_FREEZE, true);        m_creature->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_INTERRUPT_CAST, true);         //m_creature->RemoveAllAuras();        //m_creature->DeleteThreatList();        //m_creature->CombatStop();        //DoGoHome();        DoomVictim_Guid=0;         //    }     void JustDied(Unit* Killer)    {           DoYell(SAY_SLEEP,LANG_UNIVERSAL,NULL);           DoPlaySoundToSet(m_creature, SOUND_SLEEP);    }     void KilledUnit(Unit *victim)    {       if((victim!=NULL)&&(DoomVictim_Guid!=0))        if(victim->GetGUID()==DoomVictim_Guid)		{            //summon Inferno         Unit* currentUnit1=Unit::GetUnit((*m_creature),INFERNOVictim_Guid);         m_creature->SummonCreature(INFERNO, currentUnit1->GetPositionX(), currentUnit1->GetPositionY(), currentUnit1->GetPositionZ(), 2.2540, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 60000);         INFERNOVictim_Guid=0;		}         if(InCombat)        {          if(victim->GetTypeId() == TYPEID_PLAYER)          {              switch(rand()%3)              {              case 0:                  DoYell(SAY_DEATH,LANG_UNIVERSAL,NULL);                  DoPlaySoundToSet(m_creature, SOUND_DEATH);              default:                  break;              }          }        }      }     void AttackStart(Unit *who)    {        if (!who)            return;         if (who->isTargetableForAttack() && who != m_creature)        {            //Begin attack            DoStartMeleeAttack(who);             if (!InCombat)            {                DoYell(SAY_ENTER,LANG_UNIVERSAL,NULL);                InCombat = true;                DoPlaySoundToSet(m_creature, SOUND_ENTER);                //            }        }    }     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 attack                DoStartMeleeAttack(who);                 if (!InCombat)                {                    DoYell(SAY_AGGRO,LANG_UNIVERSAL,NULL);                    InCombat = true;                    DoPlaySoundToSet(m_creature, SOUND_AGGRO);                    //                }            }        }    }     void UpdateAI(const uint32 diff)    {        Unit* target;        //Return since we have no target        if (!m_creature->SelectHostilTarget() || !m_creature->getVictim() )            return;         // enrage        if(Enrage_Timer<diff)        {            //Cast            m_creature->CastSpell(m_creature, SPELL_ENRAGE, true);            Enrage_Timer = 600000;        }else Enrage_Timer -= diff;         // Cleave        if (Cleave_Timer < diff )        {            //Cast            m_creature->CastSpell(m_creature->getVictim(), SPELL_CLEAVE, true);            Cleave_Timer = 9000;        }else Cleave_Timer -= diff; 		// Rain of Fire        if (Rain_of_Fire_Timer < diff )        {            target=SelectUnit(SELECT_TARGET_RANDOM, 1);             if(target!=NULL)            {              //Cast              DoCast(target, SPELL_RAIN_OF_FIRE);            }              Rain_of_Fire_Timer = 35000;        }else Rain_of_Fire_Timer -= diff;         //Doom        if (INFERNO_Timmer < diff )		{            target=SelectUnit(SELECT_TARGET_RANDOM, 1);            if(target!=NULL)            {             SpellEntry const *spellInfo = GetSpellStore()->LookupEntry( SPELL_INFERNO );             if(spellInfo)             {               for(uint32 i = 0;i<3;i++)               {               uint8 eff = spellInfo->Effect[i];               if (eff>=TOTAL_SPELL_EFFECTS)                continue;               if(eff == SPELL_EFFECT_APPLY_AURA )               {                Aura *Aur = new CustomAura(spellInfo, i, NULL, target);                target->AddAura(Aur);               }			   }			 }               switch(rand()%3)              {              case 0:                  DoYell(SAY_INFERNO,LANG_UNIVERSAL,NULL);                  DoPlaySoundToSet(m_creature, SOUND_INFERNO);                  break;              case 1:                  DoYell(SAY_SLAY,LANG_UNIVERSAL,NULL);                  DoPlaySoundToSet(m_creature, SOUND_SLAY);                  break;              default:                  break;              }               INFERNOVictim_Guid=target->GetGUID();              INFERNO_Expire_Timer=20000;			}              INFERNO_Timmer = 45000;        }else INFERNO_Timmer -= diff;         //Doom expire       if(INFERNOVictim_Guid!=0)        if (INFERNO_Expire_Timer < diff )        {                Unit* currentUnit1=Unit::GetUnit((*m_creature),DoomVictim_Guid);                if(currentUnit1!=NULL)                 {                      //kill victim                      if(currentUnit1->isAlive()&&(m_creature!=NULL))                             m_creature->DealDamage(currentUnit1, currentUnit1->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_NORMAL, NULL, false);                  }            INFERNOVictim_Guid=0;         }else INFERNO_Expire_Timer -= diff;          DoMeleeAttackIfReady();    };  }; CreatureAI* GetAI_boss_anetheron(Creature *_Creature){    return new boss_anetheronAI (_Creature);}   //Doomguard struct MANGOS_DLL_DECL anetheron_infernoAI : public ScriptedAI{    anetheron_infernoAI(Creature *c) : ScriptedAI(c)    {         Reset();    }     uint32 Inferno_Timmer;    uint32 Immolation_Timer;     void Reset()    {    Inferno_Timmer=9000;    Immolation_Timer=7000;     }     void AttackStart(Unit *who)    {        if (!who)            return;         if (who->isTargetableForAttack() && who != m_creature)        {            //Begin attack            DoStartMeleeAttack(who);        }    }     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 attack                DoStartMeleeAttack(who);            }        }    }     void UpdateAI(const uint32 diff)    {        //Return since we have no target        if (!m_creature->SelectHostilTarget() || !m_creature->getVictim() )            return;         // Warstomp        if (Warstomp_Timmer < diff )        {            //Cast            m_creature->CastSpell(m_creature->getVictim(), SPELL_WARSTOMP, true);            Warstomp_Timmer = 15000;        }else Warstomp_Timmer -= diff;                 {            //Cast            m_creature->CastSpell(m_creature->getVictim(), SPELL_CRIPPLE, true);                 }		{            //Cast            m_creature->CastSpell(m_creature, SPELL_IMMOLATION, true);                       }         DoMeleeAttackIfReady();    };  }; CreatureAI* GetAI_mob_anetheron_inferno(Creature *_Creature){    return new anetheron_infernoAI (_Creature);}   void AddSC_boss_anetheron(){    Script *newscript;     newscript = new Script;    newscript->Name="mob_anetheron_inferno";    newscript->GetAI = GetAI_mob_anetheron_inferno;    m_scripts[nrscripts++] = newscript;     newscript = new Script;    newscript->Name="boss_anetheron";    newscript->GetAI = GetAI_boss_anetheron;    m_scripts[nrscripts++] = newscript;}