Minor Rnd method usage corrections.

This commit is contained in:
MobiusDev
2018-09-14 01:42:50 +00:00
parent b4e8040541
commit a2604e2048
55 changed files with 114 additions and 130 deletions

View File

@@ -2079,8 +2079,6 @@ public class SevenSignsFestival implements SpawnListener
protected void festivalInit()
{
boolean isPositive;
// Teleport all players to arena and notify them.
if ((_participants != null) && !_participants.isEmpty())
{
@@ -2100,9 +2098,7 @@ public class SevenSignsFestival implements SpawnListener
int x = _startLocation._x;
int y = _startLocation._y;
isPositive = (Rnd.get(2) == 1);
if (isPositive)
if (Rnd.nextBoolean())
{
x += Rnd.get(FESTIVAL_MAX_OFFSET_X);
y += Rnd.get(FESTIVAL_MAX_OFFSET_Y);
@@ -2173,8 +2169,6 @@ public class SevenSignsFestival implements SpawnListener
protected void moveMonstersToCenter()
{
boolean isPositive;
for (L2FestivalMonsterInstance festivalMob : _npcInsts)
{
if (festivalMob.isDead())
@@ -2196,9 +2190,7 @@ public class SevenSignsFestival implements SpawnListener
/*
* Random X and Y coords around the player start location, up to half of the maximum allowed offset are generated to prevent the mobs from all moving to the exact same place.
*/
isPositive = (Rnd.get(2) == 1);
if (isPositive)
if (Rnd.nextBoolean())
{
x += Rnd.get(FESTIVAL_MAX_OFFSET_X);
y += Rnd.get(FESTIVAL_MAX_OFFSET_Y);

View File

@@ -66,7 +66,7 @@ public final class L2ControllableMobAI extends L2AttackableAI
{
if (!Util.checkIfInRange(MobGroupTable.FOLLOW_RANGE, _actor, getForcedTarget(), true))
{
moveTo(getForcedTarget().getX() + (((Rnd.get(2) == 0) ? -1 : 1) * Rnd.get(MobGroupTable.FOLLOW_RANGE)), getForcedTarget().getY() + (((Rnd.get(2) == 0) ? -1 : 1) * Rnd.get(MobGroupTable.FOLLOW_RANGE)), getForcedTarget().getZ());
moveTo(getForcedTarget().getX() + ((Rnd.nextBoolean() ? -1 : 1) * Rnd.get(MobGroupTable.FOLLOW_RANGE)), getForcedTarget().getY() + ((Rnd.nextBoolean() ? -1 : 1) * Rnd.get(MobGroupTable.FOLLOW_RANGE)), getForcedTarget().getZ());
}
}

View File

@@ -1062,7 +1062,7 @@ public final class FourSepulchersManager
}
final List<L2SepulcherMonsterInstance> mobs = new CopyOnWriteArrayList<>();
final List<L2Spawn> monsterList = Rnd.get(2) == 0 ? _physicalMonsters.get(npcId) : _magicalMonsters.get(npcId);
final List<L2Spawn> monsterList = Rnd.nextBoolean() ? _physicalMonsters.get(npcId) : _magicalMonsters.get(npcId);
if (monsterList == null)
{
return;

View File

@@ -146,8 +146,8 @@ public final class MobGroup
{
final L2GroupSpawn spawn = new L2GroupSpawn(_npcTemplate);
final int signX = (Rnd.get(2) == 0) ? -1 : 1;
final int signY = (Rnd.get(2) == 0) ? -1 : 1;
final int signX = Rnd.nextBoolean() ? -1 : 1;
final int signY = Rnd.nextBoolean() ? -1 : 1;
final int randX = Rnd.get(MobGroupTable.RANDOM_RANGE);
final int randY = Rnd.get(MobGroupTable.RANDOM_RANGE);
@@ -306,7 +306,7 @@ public final class MobGroup
continue;
}
((L2ControllableMobAI) mobInst.getAI()).move(activeChar.getX() + (((Rnd.get(2) == 0) ? -1 : 1) * Rnd.get(MobGroupTable.RANDOM_RANGE)), activeChar.getY() + (((Rnd.get(2) == 0) ? -1 : 1) * Rnd.get(MobGroupTable.RANDOM_RANGE)), activeChar.getZ());
((L2ControllableMobAI) mobInst.getAI()).move(activeChar.getX() + ((Rnd.nextBoolean() ? -1 : 1) * Rnd.get(MobGroupTable.RANDOM_RANGE)), activeChar.getY() + ((Rnd.nextBoolean() ? -1 : 1) * Rnd.get(MobGroupTable.RANDOM_RANGE)), activeChar.getZ());
}
}