*Kael'thas (tk:eye)

- corretly despawn all phoenix
- enable phoenix's fly mode
- spawn eggs on the ground even if bird died mid-air
- small code realignment and cleanup

--HG--
branch : trunk
This commit is contained in:
Rat
2009-04-17 15:45:08 +02:00
parent e4c0f52127
commit bb5b040411
@@ -147,6 +147,7 @@ float KaelthasWeapons[7][5] =
#define TIME_PHASE_3_4 120000
#define KAEL_VISIBLE_RANGE 50.0f
#define ROOM_BASE_Z 49.0f
//Base AI for Advisors
struct TRINITY_DLL_DECL advisorbase_ai : public ScriptedAI
@@ -1386,15 +1387,35 @@ struct TRINITY_DLL_DECL mob_kael_flamestrikeAI : public ScriptedAI
//Phoenix AI
struct TRINITY_DLL_DECL mob_phoenix_tkAI : public ScriptedAI
{
mob_phoenix_tkAI(Creature *c) : ScriptedAI(c) {}
mob_phoenix_tkAI(Creature *c) : ScriptedAI(c)
{
pInstance = ((ScriptedInstance*)c->GetInstanceData());
}
ScriptedInstance* pInstance;
uint32 Cycle_Timer;
uint8 SummonEgg;
bool egg;
void JustDied(Unit *victim)
{
if(egg)
{
float x,y,z;
m_creature->GetPosition(x,y,z);
z = m_creature->GetMap()->GetVmapHeight(x,y,z,true);
if(z == INVALID_HEIGHT)
z = ROOM_BASE_Z;
m_creature->SummonCreature(PHOENIX_EGG,x,y,z,m_creature->GetOrientation(),TEMPSUMMON_TIMED_DESPAWN,16000);
m_creature->RemoveCorpse();
}
}
void Reset()
{
m_creature->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT + MOVEMENTFLAG_LEVITATING);//birds can fly! :)
egg = true;
Cycle_Timer = 2000;
SummonEgg = 0;
m_creature->CastSpell(m_creature,SPELL_BURN,true);
}
@@ -1402,42 +1423,36 @@ struct TRINITY_DLL_DECL mob_phoenix_tkAI : public ScriptedAI
void DamageTaken(Unit* pKiller, uint32 &damage)
{
if(m_creature->GetHealth() < damage && SummonEgg < 2){
damage = 0;
SummonEgg = 1;
}
}
void UpdateAI(const uint32 diff)
{
if (!UpdateVictim())
return;
if(SummonEgg < 2){
if (Cycle_Timer < diff)
{
if(pInstance)//check for boss reset
{
Creature* Kael = Unit::GetCreature((*m_creature), pInstance->GetData64(DATA_KAELTHAS));
if (Kael && Kael->getThreatManager().getThreatList().empty())
{
egg = false;
m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
Cycle_Timer = 2000;
return;
}
}
//spell Burn should possible do this, but it doesn't, so do this for now.
uint32 dmg = urand(4500,5500);
if (m_creature->GetHealth() > dmg)
m_creature->SetHealth(uint32(m_creature->GetHealth()-dmg));
else//kill itt
m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
Cycle_Timer = 2000;
}else Cycle_Timer -= diff;
}else {
if(Cycle_Timer < diff){
m_creature->SummonCreature(PHOENIX_EGG,m_creature->GetPositionX(),m_creature->GetPositionY(),m_creature->GetPositionZ(),m_creature->GetOrientation(),TEMPSUMMON_TIMED_DESPAWN,16000);
m_creature->DealDamage(m_creature, m_creature->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
m_creature->RemoveCorpse();
}else Cycle_Timer -= diff;
}
if(SummonEgg == 1){ //hack die animation
m_creature->RemoveAllAuras();
DoStartNoMovement(m_creature->getVictim());
m_creature->SetUInt32Value(UNIT_FIELD_BYTES_1, PLAYER_STATE_DEAD);
SummonEgg = 2;
Cycle_Timer = 1000;
}
if(SummonEgg < 2)DoMeleeAttackIfReady();
if (!UpdateVictim())
return;
DoMeleeAttackIfReady();
}
};
@@ -1482,7 +1497,8 @@ struct TRINITY_DLL_DECL mob_phoenix_egg_tkAI : public ScriptedAI
{
if (Rebirth_Timer < diff)
{
if(!summoned){
if(!summoned)
{
Creature* Phoenix = m_creature->SummonCreature(PHOENIX,m_creature->GetPositionX(),m_creature->GetPositionY(),m_creature->GetPositionZ(),m_creature->GetOrientation(),TEMPSUMMON_CORPSE_DESPAWN,5000);
summoned = true;
}