Fix irand(min,max) usage (min shall always be lower than max)

--HG--
branch : trunk
This commit is contained in:
Trazom62
2010-01-22 18:38:33 +01:00
parent b57fec2961
commit 7b3691ac9e
8 changed files with 11 additions and 11 deletions
@@ -45,7 +45,7 @@ struct TRINITY_DLL_DECL boss_ambassador_flamelashAI : public ScriptedAI
void SummonSpirits(Unit* victim) void SummonSpirits(Unit* victim)
{ {
if (Creature *Spirit = DoSpawnCreature(9178, RAND(irand(0,-9),irand(0,9)), RAND(irand(0,-9),irand(0,9)), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000)) if (Creature *Spirit = DoSpawnCreature(9178, irand(-9,9), irand(-9,9), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000))
Spirit->AI()->AttackStart(victim); Spirit->AI()->AttackStart(victim);
} }
@@ -55,13 +55,13 @@ struct TRINITY_DLL_DECL boss_general_angerforgeAI : public ScriptedAI
void SummonAdds(Unit* victim) void SummonAdds(Unit* victim)
{ {
if (Creature *SummonedAdd = DoSpawnCreature(8901, RAND(irand(0,-14),irand(0,14)), RAND(irand(0,-14),irand(0,14)), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 120000)) if (Creature *SummonedAdd = DoSpawnCreature(8901, irand(-14,14), irand(-14,14), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 120000))
SummonedAdd->AI()->AttackStart(victim); SummonedAdd->AI()->AttackStart(victim);
} }
void SummonMedics(Unit* victim) void SummonMedics(Unit* victim)
{ {
if (Creature *SummonedMedic = DoSpawnCreature(8894, RAND(irand(0,-9),irand(0,9)), RAND(irand(0,-9),irand(0,9)), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 120000)) if (Creature *SummonedMedic = DoSpawnCreature(8894, irand(-9,9), irand(-9,9), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 120000))
SummonedMedic->AI()->AttackStart(victim); SummonedMedic->AI()->AttackStart(victim);
} }
+1 -1
View File
@@ -66,7 +66,7 @@ struct TRINITY_DLL_DECL boss_kruulAI : public ScriptedAI
void SummonHounds(Unit* pVictim) void SummonHounds(Unit* pVictim)
{ {
if (Creature *Hound = DoSpawnCreature(19207, RAND(irand(0,-9),irand(0,9)), RAND(irand(0,-9),irand(0,9)), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000)) if (Creature *Hound = DoSpawnCreature(19207, irand(-9,9), irand(-9,9), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000))
Hound->AI()->AttackStart(pVictim); Hound->AI()->AttackStart(pVictim);
} }
@@ -53,7 +53,7 @@ struct TRINITY_DLL_DECL boss_jandicebarovAI : public ScriptedAI
void SummonIllusions(Unit* victim) void SummonIllusions(Unit* victim)
{ {
if (Creature *Illusion = DoSpawnCreature(11439, RAND(irand(0,-9),irand(0,9)), RAND(irand(0,-9),irand(0,9)), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000)) if (Creature *Illusion = DoSpawnCreature(11439, irand(-9,9), irand(-9,9), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000))
Illusion->AI()->AttackStart(victim); Illusion->AI()->AttackStart(victim);
} }
@@ -51,13 +51,13 @@ struct TRINITY_DLL_DECL boss_kormokAI : public ScriptedAI
void SummonMinions(Unit* victim) void SummonMinions(Unit* victim)
{ {
if (Creature *SummonedMinion = DoSpawnCreature(16119, RAND(irand(0,-7),irand(0,7)), RAND(irand(0,-7),irand(0,7)), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 120000)) if (Creature *SummonedMinion = DoSpawnCreature(16119, irand(-7,7), irand(-7,7), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 120000))
SummonedMinion->AI()->AttackStart(victim); SummonedMinion->AI()->AttackStart(victim);
} }
void SummonMages(Unit* victim) void SummonMages(Unit* victim)
{ {
if (Creature *SummonedMage = DoSpawnCreature(16120, RAND(irand(0,-9),irand(0,9)), RAND(irand(0,-9),irand(0,9)), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 120000)) if (Creature *SummonedMage = DoSpawnCreature(16120, irand(-9,9), irand(-9,9), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 120000))
SummonedMage->AI()->AttackStart(victim); SummonedMage->AI()->AttackStart(victim);
} }
@@ -63,7 +63,7 @@ struct TRINITY_DLL_DECL boss_nerubenkanAI : public ScriptedAI
void RaiseUndeadScarab(Unit* pVictim) void RaiseUndeadScarab(Unit* pVictim)
{ {
if (Creature* pUndeadScarab = DoSpawnCreature(10876, RAND(irand(-9,0),irand(0,9)), RAND(irand(-9,0),irand(0,9)), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 180000)) if (Creature* pUndeadScarab = DoSpawnCreature(10876, irand(-9,9), irand(-9,9), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 180000))
if (pUndeadScarab->AI()) if (pUndeadScarab->AI())
pUndeadScarab->AI()->AttackStart(pVictim); pUndeadScarab->AI()->AttackStart(pVictim);
} }
@@ -213,8 +213,8 @@ struct TRINITY_DLL_DECL boss_janalaiAI : public ScriptedAI
float dx, dy; float dx, dy;
for (int i(0); i < 40; ++i) for (int i(0); i < 40; ++i)
{ {
dx =(rand()%(area_dx))-(area_dx/2); dx = irand(-area_dx/2, area_dx/2);
dy =(rand()%(area_dy))-(area_dy/2); dy = irand(-area_dy/2, area_dy/2);
Creature* bomb = DoSpawnCreature(MOB_FIRE_BOMB, dx, dy, 0, 0, TEMPSUMMON_TIMED_DESPAWN, 15000); Creature* bomb = DoSpawnCreature(MOB_FIRE_BOMB, dx, dy, 0, 0, TEMPSUMMON_TIMED_DESPAWN, 15000);
if (bomb) FireBombGUIDs[i] = bomb->GetGUID(); if (bomb) FireBombGUIDs[i] = bomb->GetGUID();
@@ -51,7 +51,7 @@ struct TRINITY_DLL_DECL boss_noxxionAI : public ScriptedAI
void SummonAdds(Unit* pVictim) void SummonAdds(Unit* pVictim)
{ {
if (Creature *Add = DoSpawnCreature(13456, RAND(irand(0,-7),irand(0,7)), RAND(irand(0,-7),irand(0,7)), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 90000)) if (Creature *Add = DoSpawnCreature(13456, irand(-7,7), irand(-7,7), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 90000))
Add->AI()->AttackStart(pVictim); Add->AI()->AttackStart(pVictim);
} }