*Update Razorscale script, cleanup and tweak add spawning

--HG--
branch : trunk
This commit is contained in:
maximius
2009-10-18 16:37:04 -07:00
parent c6f5297e4c
commit 6c581e88b4
@@ -26,8 +26,8 @@ EndScriptData */
#include "precompiled.h" #include "precompiled.h"
#include "def_ulduar.h" #include "def_ulduar.h"
//wrong text ids. correct are beetwen -1000000 AND -1999999 //wrong text ids. correct are between -1000000 AND -1999999
//beetwen -2000000 and -2999999 are custom texts so wtf? //between -2000000 and -2999999 are custom texts so wtf?
#define SAY_AGGRO -2000000 #define SAY_AGGRO -2000000
#define SAY_KILL -2000001 #define SAY_KILL -2000001
#define SAY_PHASE_2_TRANS -2000002 #define SAY_PHASE_2_TRANS -2000002
@@ -132,7 +132,7 @@ struct TRINITY_DLL_DECL boss_razorscaleAI : public BossAI
m_creature->GetMotionMaster()->MoveTargetedHome(); m_creature->GetMotionMaster()->MoveTargetedHome();
} }
if (((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 99) && (Phase == 1)) if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 99 && Phase == 1)
{ {
Phase = 2; Phase = 2;
m_creature->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); m_creature->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING);
@@ -142,7 +142,7 @@ struct TRINITY_DLL_DECL boss_razorscaleAI : public BossAI
DoScriptText(SAY_PHASE_2_TRANS, m_creature); DoScriptText(SAY_PHASE_2_TRANS, m_creature);
} }
if (((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 50) && (Phase == 2)) if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 50 && Phase == 2)
{ {
Phase = 3; Phase = 3;
m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING);
@@ -164,9 +164,9 @@ struct TRINITY_DLL_DECL boss_razorscaleAI : public BossAI
if (DEVOURINGFLAMETimer < diff) if (DEVOURINGFLAMETimer < diff)
{ {
Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 1); if (Unit *target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)
if (target && !m_creature->HasInArc(M_PI, target)) if (!m_creature->HasInArc(M_PI, target))
DoCast(target, SPELL_DEVOURINGFLAME); DoCast(target, SPELL_DEVOURINGFLAME);
DEVOURINGFLAMETimer = 10000; DEVOURINGFLAMETimer = 10000;
} else DEVOURINGFLAMETimer -= diff; } else DEVOURINGFLAMETimer -= diff;
@@ -180,15 +180,13 @@ struct TRINITY_DLL_DECL boss_razorscaleAI : public BossAI
if (WingBuffetTimer < diff) if (WingBuffetTimer < diff)
{ {
DoCast(m_creature->getVictim(), SPELL_WINGBUFFET); DoCast(m_creature->getVictim(), SPELL_WINGBUFFET);
WingBuffetTimer = 7000 + ((rand()%8)*1000); WingBuffetTimer = urand(7000,14000);
} else WingBuffetTimer -= diff; } else WingBuffetTimer -= diff;
if (KnockAwayTimer < diff) if (KnockAwayTimer < diff)
{ {
if (rand()%100 <= 30) if (urand(0,99) < 30)
{
DoCast(m_creature->getVictim(), SPELL_KNOCK_AWAY); DoCast(m_creature->getVictim(), SPELL_KNOCK_AWAY);
}
KnockAwayTimer = 15000; KnockAwayTimer = 15000;
} else KnockAwayTimer -= diff; } else KnockAwayTimer -= diff;
@@ -197,16 +195,8 @@ struct TRINITY_DLL_DECL boss_razorscaleAI : public BossAI
if (BellowingRoarTimer < diff) if (BellowingRoarTimer < diff)
{ {
DoCast(m_creature->getVictim(), SPELL_BELLOWINGROAR); DoCast(m_creature->getVictim(), SPELL_BELLOWINGROAR);
BellowingRoarTimer = 30000; BellowingRoarTimer = 30000;
} else BellowingRoarTimer -= diff; } else BellowingRoarTimer -= diff;
if (SummonAddsTimer < diff)
{
SummonAdds(Phase);
SummonAddsTimer = 45000;
} else SummonAddsTimer -= diff;
} }
DoMeleeAttackIfReady(); DoMeleeAttackIfReady();
@@ -215,17 +205,9 @@ struct TRINITY_DLL_DECL boss_razorscaleAI : public BossAI
if (Phase == 2) if (Phase == 2)
{ {
if (InitialSpawn) if (InitialSpawn)
{ SummonAdds();
InitialSpawn = false;
for (uint32 i = 0; i < 4; ++i) InitialSpawn = false;
{
uint32 random = rand()%4;
Creature* Add = m_creature->SummonCreature(CREATURE_ADDS, SpawnLocations[random][0], SpawnLocations[random][1], SpawnLocations[random][2], 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000);
if (Add)
Add->AI()->AttackStart(SelectUnit(SELECT_TARGET_RANDOM, 0));
}
}
if (FireballTimer < diff) if (FireballTimer < diff)
{ {
@@ -236,7 +218,7 @@ struct TRINITY_DLL_DECL boss_razorscaleAI : public BossAI
if (MovementTimer < diff) if (MovementTimer < diff)
{ {
if (rand()%100 <= 30) if (urand(0,99) < 30)
{ {
DoScriptText(EMOTE_BREATH, m_creature); DoScriptText(EMOTE_BREATH, m_creature);
DoCast(m_creature->getVictim(), SPELL_FLAMEBUFFET); DoCast(m_creature->getVictim(), SPELL_FLAMEBUFFET);
@@ -247,50 +229,27 @@ struct TRINITY_DLL_DECL boss_razorscaleAI : public BossAI
} else MovementTimer -= diff; } else MovementTimer -= diff;
if (SummonAddsTimer < diff) if (SummonAddsTimer < diff)
{ SummonAdds();
SummonAdds(Phase); else SummonAddsTimer -= diff;
SummonAddsTimer = 45000;
} else SummonAddsTimer -= diff;
} }
} }
void ChangePosition() void ChangePosition()
{ {
/* Malfunctioning, Razorscale is flying around randomly, attacking players from hundreds of yards away. /* Malfunctioning, Razorscale is flying around randomly, attacking players from hundreds of yards away.
uint32 random = rand() % 4; uint8 random = urand(0,3);
if (random<4){ m_creature->GetMotionMaster()->MovePoint(0, MovementLocations[random][0], MovementLocations[random][1], MovementLocations[random][2]); */
m_creature->GetMotionMaster()->MovePoint(0, MovementLocations[random][0], MovementLocations[random][1], MovementLocations[random][2]);} */
} }
void SummonAdds(uint32 Phase) void SummonAdds()
{ {
if (Phase == 2) for (uint32 i = 0; i < 4; ++i)
{ {
uint32 max = rand()%10; uint8 random = urand(0,3);
for (uint32 i = 0; i < 4; ++i) if (Creature* Add = m_creature->SummonCreature(CREATURE_ADDS, SpawnLocations[random][0], SpawnLocations[random][1], SpawnLocations[random][2], 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000))
{ Add->AI()->AttackStart(SelectTarget(SELECT_TARGET_RANDOM, 0, 0, true));
uint32 random = rand()%3;
Creature* Add = m_creature->SummonCreature(CREATURE_ADDS, SpawnLocations[random][0], SpawnLocations[random][1], SpawnLocations[random][2], 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000);
if (Add)
Add->AI()->AttackStart(SelectUnit(SELECT_TARGET_RANDOM, 0));
}
}
if (Phase == 3)
{
uint32 max = rand() % 10 +1;
if (max < 1)
{
for (uint32 i = 0; i < max; ++i)
{
uint32 random = rand()%4;
Creature* Add = m_creature->SummonCreature(CREATURE_ADDS, SpawnLocations[random][0], SpawnLocations[random][1], SpawnLocations[random][2], 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000);
if (Add)
Add->AI()->AttackStart(SelectUnit(SELECT_TARGET_RANDOM, 0));
}
}
} }
SummonAddsTimer = 45000;
} }
}; };