Public feed
#891745
/* 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"
#define SPELL_FEAR 31970
#define SPELL_AIR_BURST 32014
#define SPELL_GRIP_OF_THE_LEGION 31972
#define SPELL_FINGER_OF_DEATH 31984
#define SPELL_SOUL_CHARGE_PR 32053 //soul charge priest/pala/warlock
#define SPELL_SOUL_CHARGE_W 32054 //soul charge Warriors, Rogues, Mages
#define SPELL_SOUL_CHARGE_DR 32057 //soul charge Druids, Shamans, Hunters
#define SPELL_SOUL_CHARGE_VISUAL 32051
#define SPELL_SOUL_CHARGE_VISUAL2 32045
#define SPELL_SOUL_CHARGE_VISUAL3 32052
#define SAY_AGGRO "Your resistance is insignificant!"
#define SAY_DEATH "No, it cannot be! Nooo!"
#define SAY_GAIN_CHARGE1 "Your soul will languish for eternity."
#define SAY_GAIN_CHARGE2 "You are mine now."
#define SAY_GAIN_CHARGE3 "Bow to my will."
#define SAY_FEAR "Away vermin!"
struct MANGOS_DLL_DECL boss_archimondeAI : public ScriptedAI
{
boss_archimondeAI(Creature *c) : ScriptedAI(c)
{
pInstance = (c->GetInstanceData()) ? ((ScriptedInstance*)c->GetInstanceData()) : NULL;
//archimonde=c;
EnterEvadeMode();
}
ScriptedInstance *pInstance;
//Creature *archimonde;
uint32 Fear_Timer;
uint32 SoulChargePrCounter;
uint32 SoulChargeWCounter;
uint32 SoulChargeDrCounter;
uint32 SoulCharge_Timmer;
uint32 AirBurst_Timer;
uint32 GripOfTheLegion_Timer;
uint32 FingerOfDeath_timmer;
bool InCombat;
bool GainsSoul;
void EnterEvadeMode()
{
Fear_Timer=40000;
AirBurst_Timer=30000;
GripOfTheLegion_Timer=32000;
FingerOfDeath_timmer=10000;
SoulChargePrCounter=0;
SoulChargeWCounter=0;
SoulChargeDrCounter=0;
SoulCharge_Timmer=4000;
InCombat = false;
GainsSoul = 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->RemoveAllAuras();
m_creature->DeleteThreatList();
m_creature->CombatStop();
DoGoHome();
//
}
void JustDied(Unit* Killer)
{
DoYell(SAY_DEATH,LANG_UNIVERSAL,NULL);
}
void KilledUnit(Unit *victim)
{
if(InCombat)
{
if(victim->GetTypeId() == TYPEID_PLAYER)
{
switch(rand()%3)
{
case 0:
DoYell(SAY_GAIN_CHARGE1,LANG_UNIVERSAL,NULL);
break;
case 1:
DoYell(SAY_GAIN_CHARGE2,LANG_UNIVERSAL,NULL);
break;
case 2:
DoYell(SAY_GAIN_CHARGE3,LANG_UNIVERSAL,NULL);
break;
}
switch(victim->getClass())
{
case CLASS_PRIEST:
case CLASS_PALADIN:
case CLASS_WARLOCK:
if (SoulChargePrCounter<25)
SoulChargePrCounter++;
break;
case CLASS_ROGUE:
case CLASS_WARRIOR:
case CLASS_MAGE:
if(SoulChargeWCounter<25)
SoulChargeWCounter++;
break;
case CLASS_SHAMAN:
case CLASS_HUNTER:
case CLASS_DRUID:
if(SoulChargeWCounter<25)
SoulChargeDrCounter++;
break;
default:
break;
};
}
else
{
//SoulChargeDrCounter++;
}
GainsSoul= true;
};
}
void AttackStart(Unit *who)
{
if (!who)
return;
if (who->isTargetableForAttack() && who != m_creature)
{
//Begin attack
DoStartMeleeAttack(who);
if (!InCombat)
{
DoYell(SAY_AGGRO,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 attack
DoStartMeleeAttack(who);
if (!InCombat)
{
DoYell(SAY_AGGRO,LANG_UNIVERSAL,NULL);
InCombat = true;
//
}
}
}
}
void UpdateAI(const uint32 diff)
{
//Return since we have no target
if (!m_creature->SelectHostilTarget() || !m_creature->getVictim() )
return;
//soul charge visual
if (GainsSoul == true)
{
DoCast(m_creature,SPELL_SOUL_CHARGE_VISUAL);
GainsSoul = false;
/*SpellEntry const *spellInfo = sSpellStore.LookupEntry( SPELL_SOUL_CHARGE_VISUAL );
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 Aura(spellInfo, i, NULL, m_creature);
m_creature->AddAura(Aur);
}
}
}*/
}
/* if(SoulChargePrCounter+SoulChargeWCounter+SoulChargeDrCounter==0)
{
m_creature->RmoveAuraDueToSpell(SPELL_SOUL_CHARGE_VISUAL)
}*/
// Finger of death if topagro not in mele range
if (FingerOfDeath_timmer < diff)
{
Unit* target = NULL;
target = m_creature->getVictim();//SelectUnit(SELECT_TARGET_TOPAGGRO,1);
//Cast
if (target && (!(m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE))))
m_creature->CastSpell(target,SPELL_FINGER_OF_DEATH,true);
FingerOfDeath_timmer= 8000;
}else FingerOfDeath_timmer -= diff;
//soul charge
if (SoulCharge_Timmer < diff )
{
//Cast
if(SoulChargePrCounter>0)
{
SoulChargePrCounter--;
m_creature->CastSpell(m_creature->getVictim(), SPELL_SOUL_CHARGE_PR, true);
}
else if(SoulChargeWCounter >0)
{
SoulChargeWCounter--;
m_creature->CastSpell(m_creature->getVictim(), SPELL_SOUL_CHARGE_W, true);
}
else if(SoulChargeDrCounter >0)
{
SoulChargeDrCounter--;
m_creature->CastSpell(m_creature->getVictim(), SPELL_SOUL_CHARGE_DR, true);
}
SoulCharge_Timmer = 4000;
}else SoulCharge_Timmer -= diff;
// fear
if (Fear_Timer < diff )
{
//Cast
m_creature->CastSpell(m_creature->getVictim(), SPELL_FEAR, true);
DoYell(SAY_FEAR,LANG_UNIVERSAL,NULL);
Fear_Timer = 40000;
}else Fear_Timer -= diff;
// air burst
if (AirBurst_Timer < diff )
{
//Cast
m_creature->CastSpell(SelectUnit(SELECT_TARGET_RANDOM, 1), SPELL_AIR_BURST, true);
AirBurst_Timer = 30000;
}else AirBurst_Timer -= diff;
// grip of the legion
if (GripOfTheLegion_Timer < diff )
{
//Cast
m_creature->CastSpell(SelectUnit(SELECT_TARGET_RANDOM, 1), SPELL_GRIP_OF_THE_LEGION, true);
GripOfTheLegion_Timer = 6000;
}else GripOfTheLegion_Timer -= diff;
DoMeleeAttackIfReady();
}
};
CreatureAI* GetAI_boss_archimonde(Creature *_Creature)
{
return new boss_archimondeAI (_Creature);
}
void AddSC_boss_archimonde()
{
Script *newscript;
newscript = new Script;
newscript->Name="boss_archimonde1";
newscript->GetAI = GetAI_boss_archimonde;
m_scripts[nrscripts++] = newscript;
}