*Some changes in Kalecgos script - by darktabbit

--HG--
branch : trunk
This commit is contained in:
Blaymoira
2009-02-13 16:26:57 +01:00
parent dfc3d115c5
commit 0421212873
2 changed files with 95 additions and 82 deletions
@@ -108,7 +108,17 @@ void hyjalAI::Reset()
else error_log(ERROR_INST_DATA); else error_log(ERROR_INST_DATA);
//Visibility //Visibility
m_creature->SetVisibility(VISIBILITY_ON); switch(m_creature->GetEntry())
{
case 17772: if(pInstance->GetData(DATA_ANETHERONEVENT) == DONE)
m_creature->SetVisibility(VISIBILITY_OFF);
else m_creature->SetVisibility(VISIBILITY_ON);
break;
case 17852: if(pInstance->GetData(DATA_AZGALOREVENT) == DONE)
m_creature->SetVisibility(VISIBILITY_OFF);
else m_creature->SetVisibility(VISIBILITY_ON);
break;
}
//If Jaina evades, reset the visibility of all other creatures in the grid. //If Jaina evades, reset the visibility of all other creatures in the grid.
if(CreatureList.empty()) if(CreatureList.empty())
@@ -16,8 +16,9 @@
/* ScriptData /* ScriptData
SDName: Boss_Kalecgos SDName: Boss_Kalecgos
SD%Complete: 0 SD%Complete: 95
SDComment: VERIFY SCRIPT SDComment:
SDCategory: Sunwell_Plateau
EndScriptData */ EndScriptData */
#include "precompiled.h" #include "precompiled.h"
@@ -68,7 +69,7 @@ EndScriptData */
#define SPELL_BANISH 44836 #define SPELL_BANISH 44836
#define SPELL_TRANSFORM_KALEC 44670 #define SPELL_TRANSFORM_KALEC 44670
#define SPELL_ENRAGE 44807 #define SPELL_ENRAGE 44806
#define SPELL_CORRUPTION_STRIKE 45029 #define SPELL_CORRUPTION_STRIKE 45029
#define SPELL_AGONY_CURSE 45032 #define SPELL_AGONY_CURSE 45032
@@ -119,8 +120,8 @@ struct TRINITY_DLL_DECL boss_kalecgosAI : public ScriptedAI
{ {
if(pInstance) if(pInstance)
{ {
uint64 SathGUID = pInstance->GetData64(DATA_SATHROVARR); SathGUID = pInstance->GetData64(DATA_SATHROVARR);
uint64 DoorGUID = pInstance->GetData64(DATA_GO_FORCEFIELD); DoorGUID = pInstance->GetData64(DATA_GO_FORCEFIELD);
} }
Unit *Sath = Unit::GetUnit(*m_creature,SathGUID); Unit *Sath = Unit::GetUnit(*m_creature,SathGUID);
@@ -147,7 +148,6 @@ struct TRINITY_DLL_DECL boss_kalecgosAI : public ScriptedAI
isFriendly = false; isFriendly = false;
isEnraged = false; isEnraged = false;
isBanished = false; isBanished = false;
//m_creature->CastSpell(m_creature, AURA_SUNWELL_RADIANCE, true);
} }
void DamageTaken(Unit *done_by, uint32 &damage) void DamageTaken(Unit *done_by, uint32 &damage)
@@ -192,7 +192,6 @@ struct TRINITY_DLL_DECL boss_kalecgosAI : public ScriptedAI
{ {
case 1: case 1:
m_creature->setFaction(35); m_creature->setFaction(35);
DoCast(m_creature, SPELL_TRANSFORM_KALEC);
TalkTimer = 1000; TalkTimer = 1000;
break; break;
case 2: case 2:
@@ -251,6 +250,7 @@ struct TRINITY_DLL_DECL boss_sathrovarrAI : public ScriptedAI
uint32 AgonyCurseTimer; uint32 AgonyCurseTimer;
uint32 ShadowBoltTimer; uint32 ShadowBoltTimer;
uint32 CheckTimer; uint32 CheckTimer;
uint32 ResetThreat;
uint64 KalecGUID; uint64 KalecGUID;
uint64 KalecgosGUID; uint64 KalecgosGUID;
@@ -274,11 +274,9 @@ struct TRINITY_DLL_DECL boss_sathrovarrAI : public ScriptedAI
AgonyCurseTimer = 20000; AgonyCurseTimer = 20000;
CorruptionStrikeTimer = 13000; CorruptionStrikeTimer = 13000;
CheckTimer = 1000; CheckTimer = 1000;
ResetThreat = 1000;
isEnraged = false; isEnraged = false;
isBanished = false; isBanished = false;
//m_creature->CastSpell(m_creature, AURA_SPECTRAL_INVISIBILITY, true);
//m_creature->CastSpell(m_creature, AURA_SUNWELL_RADIANCE, true);
//m_creature->CastSpell(m_creature, AURA_DEMONIC_VISUAL, true);
} }
void Aggro(Unit* who) void Aggro(Unit* who)
@@ -343,8 +341,6 @@ struct TRINITY_DLL_DECL boss_sathrovarrAI : public ScriptedAI
i_pl->RemoveAurasDueToSpell(AURA_SPECTRAL_REALM); i_pl->RemoveAurasDueToSpell(AURA_SPECTRAL_REALM);
} }
void Enrage(); // demon and dragon should enrage at the same time
void UpdateAI(const uint32 diff) void UpdateAI(const uint32 diff)
{ {
if (!UpdateVictim()) if (!UpdateVictim())
@@ -352,8 +348,14 @@ struct TRINITY_DLL_DECL boss_sathrovarrAI : public ScriptedAI
if(CheckTimer < diff) if(CheckTimer < diff)
{ {
if(!isEnraged && (m_creature->GetHealth()*100)/m_creature->GetMaxHealth() < 10) if (((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 10) && !isEnraged)
Enrage(); {
Unit* Kalecgos = Unit::GetUnit(*m_creature, KalecgosGUID);
if (Kalecgos)
Kalecgos->CastSpell(Kalecgos, SPELL_ENRAGE, true);
DoCast(m_creature, SPELL_ENRAGE, true);
isEnraged = true;
}
if(!isBanished && (m_creature->GetHealth()*100)/m_creature->GetMaxHealth() < 1) if(!isBanished && (m_creature->GetHealth()*100)/m_creature->GetMaxHealth() < 1)
{ {
@@ -366,7 +368,7 @@ struct TRINITY_DLL_DECL boss_sathrovarrAI : public ScriptedAI
} }
else else
{ {
m_creature->CastSpell(m_creature, SPELL_BANISH, true); DoCast(m_creature, SPELL_BANISH);
isBanished = true; isBanished = true;
} }
} }
@@ -379,6 +381,22 @@ struct TRINITY_DLL_DECL boss_sathrovarrAI : public ScriptedAI
CheckTimer = 1000; CheckTimer = 1000;
}else CheckTimer -= diff; }else CheckTimer -= diff;
if(ResetThreat < diff)
{
if ( ( m_creature->getVictim()->HasAura(AURA_SPECTRAL_EXHAUSTION,0)) && (m_creature->getVictim()->GetTypeId() == TYPEID_PLAYER) )
{
for(std::list<HostilReference*>::iterator itr = m_creature->getThreatManager().getThreatList().begin(); itr != m_creature->getThreatManager().getThreatList().end(); ++itr)
{
if(((*itr)->getUnitGuid()) == (m_creature->getVictim()->GetGUID()))
{
(*itr)->removeReference();
break;
}
}
}
ResetThreat = 1000;
}else ResetThreat -= diff;
if(ShadowBoltTimer < diff) if(ShadowBoltTimer < diff)
{ {
DoScriptText(SAY_SATH_SPELL1, m_creature); DoScriptText(SAY_SATH_SPELL1, m_creature);
@@ -435,9 +453,6 @@ struct TRINITY_DLL_DECL boss_kalecAI : public ScriptedAI
YellSequence = 0; YellSequence = 0;
isEnraged = false; isEnraged = false;
//m_creature->CastSpell(m_creature, AURA_SPECTRAL_INVISIBILITY, true);
//m_creature->CastSpell(m_creature, AURA_SUNWELL_RADIANCE, true);
} }
void Aggro(Unit* who) {} void Aggro(Unit* who) {}
@@ -452,11 +467,8 @@ struct TRINITY_DLL_DECL boss_kalecAI : public ScriptedAI
void UpdateAI(const uint32 diff) void UpdateAI(const uint32 diff)
{ {
if(!m_creature->getVictim()) // only victim is Sath if (!UpdateVictim())
{
EnterEvadeMode();
return; return;
}
if(YellTimer < diff) if(YellTimer < diff)
{ {
@@ -533,10 +545,13 @@ void boss_kalecgosAI::UpdateAI(const uint32 diff)
if(CheckTimer < diff) if(CheckTimer < diff)
{ {
if(!isEnraged && (m_creature->GetHealth()*100)/m_creature->GetMaxHealth() < 10) if (((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 10) && !isEnraged)
{ {
if(Unit *Sath = Unit::GetUnit(*m_creature, SathGUID)) Unit* Sath = Unit::GetUnit(*m_creature, SathGUID);
((boss_sathrovarrAI*)((Creature*)Sath)->AI())->Enrage(); if (Sath)
Sath->CastSpell(Sath, SPELL_ENRAGE, true);
DoCast(m_creature, SPELL_ENRAGE, true);
isEnraged = true;
} }
if(!isBanished && (m_creature->GetHealth()*100)/m_creature->GetMaxHealth() < 1) if(!isBanished && (m_creature->GetHealth()*100)/m_creature->GetMaxHealth() < 1)
@@ -550,17 +565,17 @@ void boss_kalecgosAI::UpdateAI(const uint32 diff)
} }
else else
{ {
m_creature->CastSpell(m_creature, SPELL_BANISH, true); DoCast(m_creature, SPELL_BANISH);
isBanished = true; isBanished = true;
} }
} }
else else
{ {
DoTextEmote("is unable to find Sath", NULL); error_log("TSCR: Didn't find Shathrowar. Kalecgos event reseted.");
EnterEvadeMode(); EnterEvadeMode();
} }
} }
CheckTimer = 1000; //every 1 sec we check this CheckTimer = 1000;
}else CheckTimer -= diff; }else CheckTimer -= diff;
if(ArcaneBuffetTimer < diff) if(ArcaneBuffetTimer < diff)
@@ -583,42 +598,30 @@ void boss_kalecgosAI::UpdateAI(const uint32 diff)
if(WildMagicTimer < diff) if(WildMagicTimer < diff)
{ {
DoCast(m_creature, WildMagic[rand()%6]); Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0);
if(target && target->isAlive())
DoCast(target, WildMagic[rand()%6]);
WildMagicTimer = 20000; WildMagicTimer = 20000;
}else WildMagicTimer -= diff; }else WildMagicTimer -= diff;
if(SpectralBlastTimer < diff) if(SpectralBlastTimer < diff)
{ {
m_creature->CastSpell(m_creature, SPELL_SPECTRAL_BLAST, true); Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0);
if( ( target != m_creature->getVictim() ) && target->isAlive() && !(target->HasAura(AURA_SPECTRAL_EXHAUSTION, 0)) )
{
DoCast(target, SPELL_SPECTRAL_BLAST);
SpectralBlastTimer = 20000+(rand()%5000); SpectralBlastTimer = 20000+(rand()%5000);
}
else
{
SpectralBlastTimer = 1000;
}
}else SpectralBlastTimer -= diff; }else SpectralBlastTimer -= diff;
DoMeleeAttackIfReady(); DoMeleeAttackIfReady();
} }
} }
void boss_sathrovarrAI::Enrage()
{
Unit *Kalecgos = Unit::GetUnit(*m_creature, KalecgosGUID);
Unit *Kalec = Unit::GetUnit(*m_creature, KalecGUID);
if(!Kalecgos)
{
error_log("SD2 ERROR: unable to find Kalecgos");
return;
}
if(!Kalec)
{
error_log("SD2 ERROR: unable to find Kalec");
return;
}
DoScriptText(SAY_SATH_ENRAGE, m_creature);
m_creature->CastSpell(m_creature, SPELL_ENRAGE, true);
Kalecgos->CastSpell(Kalecgos, SPELL_ENRAGE, true);
isEnraged = true;
((boss_kalecgosAI*)((Creature*)Kalecgos)->AI())->isEnraged = true;
((boss_kalecAI*)((Creature*)Kalec)->AI())->isEnraged = true;
}
bool GOkalocegos_teleporter(Player *player, GameObject* _GO) bool GOkalocegos_teleporter(Player *player, GameObject* _GO)
{ {
if(player->HasAura(AURA_SPECTRAL_EXHAUSTION, 0)) if(player->HasAura(AURA_SPECTRAL_EXHAUSTION, 0))