Core/Scripts: Replace rand with urand in most cases (using regexp)

Used: perl -pi -e 's/([0-9]+) \+ rand\(\)\%([0-9]+)/"urand(".$1.", ".($1+$2).")"/ge'
This commit is contained in:
Spp
2011-12-28 10:51:16 +01:00
parent 4fb634f9a5
commit 3792b470e0
66 changed files with 309 additions and 309 deletions
@@ -105,15 +105,15 @@ public:
ai->EnterEvadeMode();
ai->Spells[0].SpellId = SPELL_BLIZZARD;
ai->Spells[0].Cooldown = 15000 + rand()%20000;
ai->Spells[0].Cooldown = urand(15000, 35000);
ai->Spells[0].TargetType = TARGETTYPE_RANDOM;
ai->Spells[1].SpellId = SPELL_PYROBLAST;
ai->Spells[1].Cooldown = 5500 + rand()%4000;
ai->Spells[1].Cooldown = urand(5500, 9500);
ai->Spells[1].TargetType = TARGETTYPE_RANDOM;
ai->Spells[2].SpellId = SPELL_SUMMON_ELEMENTALS;
ai->Spells[2].Cooldown = 15000 + rand()%30000;
ai->Spells[2].Cooldown = urand(15000, 45000);
ai->Spells[2].TargetType = TARGETTYPE_SELF;
return ai;
@@ -187,11 +187,11 @@ public:
ai->EnterEvadeMode();
ai->Spells[0].SpellId = SPELL_CHAIN_LIGHTNING;
ai->Spells[0].Cooldown = 3000 + rand()%5000;
ai->Spells[0].Cooldown = urand(3000, 8000);
ai->Spells[0].TargetType = TARGETTYPE_VICTIM;
ai->Spells[1].SpellId = SPELL_SUMMON_DIRE_WOLF;
ai->Spells[1].Cooldown = 6000 + rand()%35000;
ai->Spells[1].Cooldown = urand(6000, 41000);
ai->Spells[1].TargetType = TARGETTYPE_RANDOM;
return ai;
@@ -68,9 +68,9 @@ public:
void Reset()
{
Holy_Light_Timer = 20000 + rand()%10000;
Holy_Light_Timer = urand(20000, 30000);
Cleanse_Timer = 10000;
HammerOfJustice_Timer = 20000 + rand()%15000;
HammerOfJustice_Timer = urand(20000, 35000);
HolyShield_Timer = 240000;
DevotionAura_Timer = 3000;
Consecration_Timer = 8000;
@@ -134,14 +134,14 @@ public:
if (DevotionAura_Timer <= diff)
{
DoCast(me, SPELL_DEVOTION_AURA);
DevotionAura_Timer = 45000 + rand()%10000;
DevotionAura_Timer = urand(45000, 55000);
} else DevotionAura_Timer -= diff;
//Consecration
if (Consecration_Timer <= diff)
{
//DoCast(me->getVictim(), SPELL_CONSECRATION);
Consecration_Timer = 5000 + rand()%5000;
Consecration_Timer = urand(5000, 10000);
} else Consecration_Timer -= diff;
DoMeleeAttackIfReady();
@@ -68,8 +68,8 @@ public:
void Reset()
{
SandBreath_Timer = 8000 + rand()%8000;
ImpendingDeath_Timer = 25000 + rand()%5000;
SandBreath_Timer = urand(8000, 16000);
ImpendingDeath_Timer = urand(25000, 30000);
WingBuffet_Timer = 35000;
Mda_Timer = 40000;
}
@@ -108,7 +108,7 @@ public:
DoScriptText(RAND(SAY_BREATH1, SAY_BREATH2), me);
SandBreath_Timer = 10000 + rand()%10000;
SandBreath_Timer = urand(10000, 20000);
} else SandBreath_Timer -= diff;
if (ImpendingDeath_Timer <= diff)
@@ -61,7 +61,7 @@ public:
{
AmnenarsWrath_Timer = 8000;
FrostBolt_Timer = 1000;
FrostNova_Timer = 10000 + rand()%5000;
FrostNova_Timer = urand(10000, 15000);
Spectrals30 = false;
Spectrals60 = false;
Hp = false;
@@ -65,8 +65,8 @@ public:
void Reset()
{
Cleave_Timer = 4000 + rand()%4000;
ToxicVolley_Timer = 6000 + rand()%6000;
Cleave_Timer = urand(4000, 8000);
ToxicVolley_Timer = urand(6000, 12000);
Check_Timer = 2000;
VemDead = false;
@@ -98,14 +98,14 @@ public:
if (Cleave_Timer <= diff)
{
DoCast(me->getVictim(), SPELL_CLEAVE);
Cleave_Timer = 5000 + rand()%7000;
Cleave_Timer = urand(5000, 12000);
} else Cleave_Timer -= diff;
//ToxicVolley_Timer
if (ToxicVolley_Timer <= diff)
{
DoCast(me->getVictim(), SPELL_TOXIC_VOLLEY);
ToxicVolley_Timer = 10000 + rand()%5000;
ToxicVolley_Timer = urand(10000, 15000);
} else ToxicVolley_Timer -= diff;
if (!HealthAbovePct(5) && !Death)
@@ -161,8 +161,8 @@ public:
void Reset()
{
Charge_Timer = 15000 + rand()%12000;
KnockBack_Timer = 8000 + rand()%12000;
Charge_Timer = urand(15000, 27000);
KnockBack_Timer = urand(8000, 20000);
Enrage_Timer = 120000;
Enraged = false;
@@ -202,7 +202,7 @@ public:
AttackStart(target);
}
Charge_Timer = 8000 + rand()%8000;
Charge_Timer = urand(8000, 16000);
} else Charge_Timer -= diff;
//KnockBack_Timer
@@ -211,7 +211,7 @@ public:
DoCast(me->getVictim(), SPELL_KNOCKBACK);
if (DoGetThreat(me->getVictim()))
DoModifyThreatPercent(me->getVictim(), -80);
KnockBack_Timer = 15000 + rand()%10000;
KnockBack_Timer = urand(15000, 25000);
} else KnockBack_Timer -= diff;
//Enrage_Timer
@@ -254,8 +254,8 @@ public:
void Reset()
{
Heal_Timer = 25000 + rand()%15000;
Fear_Timer = 12000 + rand()%12000;
Heal_Timer = urand(25000, 40000);
Fear_Timer = urand(12000, 24000);
Check_Timer = 2000;
VemDead = false;
@@ -63,9 +63,9 @@ public:
void Reset()
{
MortalWound_Timer = 10000 + rand()%5000;
SpawnHatchlings_Timer = 6000 + rand()%6000;
SpawnSpawns_Timer = 15000 + rand()%30000;
MortalWound_Timer = urand(10000, 15000);
SpawnHatchlings_Timer = urand(6000, 12000);
SpawnSpawns_Timer = urand(15000, 45000);
}
void SummonSpawn(Unit* victim)
@@ -106,7 +106,7 @@ public:
if (MortalWound_Timer <= diff)
{
DoCast(me->getVictim(), SPELL_MORTAL_WOUND);
MortalWound_Timer = 10000 + rand()%10000;
MortalWound_Timer = urand(10000, 20000);
} else MortalWound_Timer -= diff;
//Summon 1-3 Spawns of Fankriss at random time.
@@ -127,7 +127,7 @@ public:
SummonSpawn(SelectTarget(SELECT_TARGET_RANDOM, 0));
break;
}
SpawnSpawns_Timer = 30000 + rand()%30000;
SpawnSpawns_Timer = urand(30000, 60000);
} else SpawnSpawns_Timer -= diff;
// Teleporting Random Target to one of the three tunnels and spawn 4 hatchlings near the gamer.
@@ -194,7 +194,7 @@ public:
break;
}
}
SpawnHatchlings_Timer = 45000 + rand()%15000;
SpawnHatchlings_Timer = urand(45000, 60000);
} else SpawnHatchlings_Timer -= diff;
}
@@ -61,11 +61,11 @@ public:
void Reset()
{
Frenzy_Timer = 25000 + rand()%10000;
Wyvern_Timer = 18000 + rand()%10000;
Frenzy_Timer = urand(25000, 35000);
Wyvern_Timer = urand(18000, 28000);
Spit_Timer = 8000;
PoisonBolt_Timer = 4000;
NoxiousPoison_Timer = 10000 + rand()%10000;
NoxiousPoison_Timer = urand(10000, 20000);
FrenzyBack_Timer = 15000;
Frenzy = false;
@@ -89,7 +89,7 @@ public:
DoScriptText(EMOTE_GENERIC_FRENZY_KILL, me);
Frenzy = true;
PoisonBolt_Timer = 3000;
Frenzy_Timer = 25000 + rand()%10000;
Frenzy_Timer = urand(25000, 35000);
} else Frenzy_Timer -= diff;
// Wyvern Timer
@@ -97,21 +97,21 @@ public:
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(target, SPELL_WYVERNSTING);
Wyvern_Timer = 15000 + rand()%17000;
Wyvern_Timer = urand(15000, 32000);
} else Wyvern_Timer -= diff;
//Spit Timer
if (Spit_Timer <= diff)
{
DoCast(me->getVictim(), SPELL_ACIDSPIT);
Spit_Timer = 5000 + rand()%5000;
Spit_Timer = urand(5000, 10000);
} else Spit_Timer -= diff;
//NoxiousPoison_Timer
if (NoxiousPoison_Timer <= diff)
{
DoCast(me->getVictim(), SPELL_NOXIOUSPOISON);
NoxiousPoison_Timer = 12000 + rand()%12000;
NoxiousPoison_Timer = urand(12000, 24000);
} else NoxiousPoison_Timer -= diff;
//PoisonBolt only if frenzy or berserk
@@ -59,12 +59,12 @@ public:
void Reset()
{
Sweep_Timer = 5000 + rand()%5000;
SandBlast_Timer = 20000 + rand()%15000;
Submerge_Timer = 90000 + rand()%60000;
Back_Timer = 30000 + rand()%15000;
ChangeTarget_Timer = 5000 + rand()%3000;
Spawn_Timer = 10000 + rand()%10000;
Sweep_Timer = urand(5000, 10000);
SandBlast_Timer = urand(20000, 35000);
Submerge_Timer = urand(90000, 150000);
Back_Timer = urand(30000, 45000);
ChangeTarget_Timer = urand(5000, 8000);
Spawn_Timer = urand(10000, 20000);
Enrage = false;
Submerged = false;
@@ -85,14 +85,14 @@ public:
if (!Submerged && Sweep_Timer <= diff)
{
DoCast(me->getVictim(), SPELL_SWEEP);
Sweep_Timer = 15000 + rand()%15000;
Sweep_Timer = urand(15000, 30000);
} else Sweep_Timer -= diff;
//SandBlast_Timer
if (!Submerged && SandBlast_Timer <= diff)
{
DoCast(me->getVictim(), SPELL_SANDBLAST);
SandBlast_Timer = 20000 + rand()%15000;
SandBlast_Timer = urand(20000, 35000);
} else SandBlast_Timer -= diff;
//Submerge_Timer
@@ -105,7 +105,7 @@ public:
DoCast(me, SPELL_DIRTMOUND_PASSIVE);
Submerged = true;
Back_Timer = 30000 + rand()%15000;
Back_Timer = urand(30000, 45000);
} else Submerge_Timer -= diff;
//ChangeTarget_Timer
@@ -117,7 +117,7 @@ public:
if (target)
DoTeleportTo(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ());
ChangeTarget_Timer = 10000 + rand()%10000;
ChangeTarget_Timer = urand(10000, 20000);
} else ChangeTarget_Timer -= diff;
//Back_Timer
@@ -129,7 +129,7 @@ public:
DoCast(me->getVictim(), SPELL_GROUND_RUPTURE);
Submerged = false;
Submerge_Timer = 60000 + rand()%60000;
Submerge_Timer = urand(60000, 120000);
} else Back_Timer -= diff;
DoMeleeAttackIfReady();
@@ -66,9 +66,9 @@ public:
void Reset()
{
WhirlWind_Timer = 30000;
WhirlWindRandom_Timer = 3000 + rand()%4000;
WhirlWindRandom_Timer = urand(3000, 7000);
WhirlWindEnd_Timer = 15000;
AggroReset_Timer = 45000 + rand()%10000;
AggroReset_Timer = urand(45000, 55000);
AggroResetEnd_Timer = 5000;
EnrageHard_Timer = 10*60000;
@@ -111,13 +111,13 @@ public:
me->TauntApply(target);
AttackStart(target);
}
WhirlWindRandom_Timer = 3000 + rand()%4000;
WhirlWindRandom_Timer = urand(3000, 7000);
} else WhirlWindRandom_Timer -= diff;
if (WhirlWindEnd_Timer <= diff)
{
WhirlWind = false;
WhirlWind_Timer = 25000 + rand()%15000;
WhirlWind_Timer = urand(25000, 40000);
} else WhirlWindEnd_Timer -= diff;
}
@@ -140,7 +140,7 @@ public:
AttackStart(target);
}
AggroReset = true;
AggroReset_Timer = 2000 + rand()%3000;
AggroReset_Timer = urand(2000, 5000);
} else AggroReset_Timer -= diff;
if (AggroReset)
@@ -149,7 +149,7 @@ public:
{
AggroReset = false;
AggroResetEnd_Timer = 5000;
AggroReset_Timer = 35000 + rand()%10000;
AggroReset_Timer = urand(35000, 45000);
} else AggroResetEnd_Timer -= diff;
}
@@ -207,9 +207,9 @@ public:
void Reset()
{
WhirlWind_Timer = 30000;
WhirlWindRandom_Timer = 3000 + rand()%4000;
WhirlWindRandom_Timer = urand(3000, 7000);
WhirlWindEnd_Timer = 15000;
AggroReset_Timer = 45000 + rand()%10000;
AggroReset_Timer = urand(45000, 55000);
AggroResetEnd_Timer = 5000;
KnockBack_Timer = 10000;
@@ -231,7 +231,7 @@ public:
{
DoCast(me, SPELL_WHIRLWINDADD);
WhirlWind = true;
WhirlWind_Timer = 25000 + rand()%15000;
WhirlWind_Timer = urand(25000, 40000);
WhirlWindEnd_Timer = 15000;
} else WhirlWind_Timer -= diff;
@@ -247,7 +247,7 @@ public:
AttackStart(target);
}
WhirlWindRandom_Timer = 3000 + rand()%4000;
WhirlWindRandom_Timer = urand(3000, 7000);
} else WhirlWindRandom_Timer -= diff;
if (WhirlWindEnd_Timer <= diff)
@@ -269,13 +269,13 @@ public:
}
AggroReset = true;
AggroReset_Timer = 2000 + rand()%3000;
AggroReset_Timer = urand(2000, 5000);
} else AggroReset_Timer -= diff;
if (KnockBack_Timer <= diff)
{
DoCast(me, SPELL_WHIRLWINDADD);
KnockBack_Timer = 10000 + rand()%10000;
KnockBack_Timer = urand(10000, 20000);
} else KnockBack_Timer -= diff;
}
@@ -285,7 +285,7 @@ public:
{
AggroReset = false;
AggroResetEnd_Timer = 5000;
AggroReset_Timer = 30000 + rand()%10000;
AggroReset_Timer = urand(30000, 40000);
} else AggroResetEnd_Timer -= diff;
}
@@ -82,10 +82,10 @@ public:
void Reset()
{
ArcaneExplosion_Timer = 6000 + rand()%6000;
ArcaneExplosion_Timer = urand(6000, 12000);
EarthShock_Timer = 2000;
FullFillment_Timer = 15000;
Blink_Timer = 8000 + rand()%12000;
Blink_Timer = urand(8000, 20000);
Invisible_Timer = 500;
Images75 = false;
@@ -128,7 +128,7 @@ public:
if (ArcaneExplosion_Timer <= diff)
{
DoCast(me->getVictim(), SPELL_ARCANE_EXPLOSION);
ArcaneExplosion_Timer = 8000 + rand()%10000;
ArcaneExplosion_Timer = urand(8000, 18000);
} else ArcaneExplosion_Timer -= diff;
//If we are within range melee the target
@@ -171,7 +171,7 @@ public:
}
DoStopAttack();
Blink_Timer= 20000 + rand()%20000;
Blink_Timer= urand(20000, 40000);
} else Blink_Timer -= diff;
int procent = (int) (me->GetHealthPct() + 0.5f);
@@ -88,7 +88,7 @@ struct boss_twinemperorsAI : public ScriptedAI
AfterTeleport = false;
tspellcasted = false;
AfterTeleportTimer = 0;
Abuse_Bug_Timer = 10000 + rand()%7000;
Abuse_Bug_Timer = urand(10000, 17000);
BugsTimer = 2000;
me->ClearUnitState(UNIT_STAT_STUNNED);
DontYellWhenDead = false;
@@ -347,7 +347,7 @@ struct boss_twinemperorsAI : public ScriptedAI
if (c)
{
CastSpellOnBug(c);
Abuse_Bug_Timer = 10000 + rand()%7000;
Abuse_Bug_Timer = urand(10000, 17000);
}
else
{
@@ -407,9 +407,9 @@ public:
void Reset()
{
TwinReset();
UpperCut_Timer = 14000 + rand()%15000;
UnbalancingStrike_Timer = 8000 + rand()%10000;
Scarabs_Timer = 7000 + rand()%7000;
UpperCut_Timer = urand(14000, 29000);
UnbalancingStrike_Timer = urand(8000, 18000);
Scarabs_Timer = urand(7000, 14000);
//Added. Can be removed if its included in DB.
me->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_MAGIC, true);
@@ -495,9 +495,9 @@ public:
{
TwinReset();
ShadowBolt_Timer = 0;
Blizzard_Timer = 15000 + rand()%5000;
Blizzard_Timer = urand(15000, 20000);
ArcaneBurst_Timer = 1000;
Scorpions_Timer = 7000 + rand()%7000;
Scorpions_Timer = urand(7000, 14000);
//Added. Can be removed if its included in DB.
me->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, true);
@@ -243,7 +243,7 @@ public:
void Reset()
{
Dynamite_Timer = 8000;
Emote_Timer = 120000 + rand()%30000;
Emote_Timer = urand(120000, 150000);
me->setFaction(NormFaction);
me->SetUInt32Value(UNIT_NPC_FLAGS, NpcFlags);
@@ -264,7 +264,7 @@ public:
{
DoScriptText(SAY_TEXT, me);
DoScriptText(SAY_EMOTE, me);
Emote_Timer = 120000 + rand()%30000;
Emote_Timer = urand(120000, 150000);
} else Emote_Timer -= diff;
}
else if (IsTreeEvent)
@@ -62,11 +62,11 @@ public:
void Reset()
{
MarkOfFrost_Timer = 35000;
ManaStorm_Timer = 5000 + rand()%12000;
Chill_Timer = 10000 + rand()%20000;
Breath_Timer = 2000 + rand()%6000;
ManaStorm_Timer = urand(5000, 17000);
Chill_Timer = urand(10000, 30000);
Breath_Timer = urand(2000, 8000);
Teleport_Timer = 30000;
Reflect_Timer = 15000 + rand()%15000;
Reflect_Timer = urand(15000, 30000);
Cleave_Timer = 7000;
Enrage_Timer = 0;
Enraged = false;
@@ -109,14 +109,14 @@ public:
if (Chill_Timer <= diff)
{
DoCast(me->getVictim(), SPELL_CHILL);
Chill_Timer = 13000 + rand()%12000;
Chill_Timer = urand(13000, 25000);
} else Chill_Timer -= diff;
//Breath_Timer
if (Breath_Timer <= diff)
{
DoCast(me->getVictim(), SPELL_FROSTBREATH);
Breath_Timer = 10000 + rand()%5000;
Breath_Timer = urand(10000, 15000);
} else Breath_Timer -= diff;
//ManaStorm_Timer
@@ -124,14 +124,14 @@ public:
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(target, SPELL_MANASTORM);
ManaStorm_Timer = 7500 + rand()%5000;
ManaStorm_Timer = urand(7500, 12500);
} else ManaStorm_Timer -= diff;
//Reflect_Timer
if (Reflect_Timer <= diff)
{
DoCast(me, SPELL_REFLECT);
Reflect_Timer = 20000 + rand()%15000;
Reflect_Timer = urand(20000, 35000);
} else Reflect_Timer -= diff;
//Cleave_Timer