Prohibit the use of duplicate Rnd methods.

This commit is contained in:
MobiusDev
2018-09-14 01:17:54 +00:00
parent 16ad1d2b48
commit b4e8040541
233 changed files with 596 additions and 594 deletions

View File

@ -76,7 +76,7 @@ public final class Confuse extends AbstractEffect
if (!targetList.isEmpty())
{
// Choosing randomly a new target
final L2Character target = targetList.get(Rnd.nextInt(targetList.size()));
final L2Character target = targetList.get(Rnd.get(targetList.size()));
// Attacking the target
effected.setTarget(target);
effected.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);

View File

@ -140,6 +140,6 @@ public final class Harvesting extends AbstractEffect
{
basicSuccess = 1;
}
return Rnd.nextInt(99) < basicSuccess;
return Rnd.get(99) < basicSuccess;
}
}

View File

@ -129,6 +129,6 @@ public final class Sow extends AbstractEffect
// chance can't be less than 1%
Math.max(basicSuccess, 1);
return Rnd.nextInt(99) < basicSuccess;
return Rnd.get(99) < basicSuccess;
}
}

View File

@ -116,7 +116,7 @@ public class FriendlyNpcAI extends L2AttackableAI
final int combinedCollision = collision + originalAttackTarget.getTemplate().getCollisionRadius();
if (!npc.isMovementDisabled() && (Rnd.nextInt(100) <= 3))
if (!npc.isMovementDisabled() && (Rnd.get(100) <= 3))
{
for (L2Attackable nearby : L2World.getInstance().getVisibleObjects(npc, L2Attackable.class))
{

View File

@ -497,7 +497,7 @@ public class L2AttackableAI extends L2CharacterAI
}
// Chance to forget attackers after some time
if ((npc.getCurrentHp() == npc.getMaxHp()) && (npc.getCurrentMp() == npc.getMaxMp()) && !npc.getAttackByList().isEmpty() && (Rnd.nextInt(500) == 0))
if ((npc.getCurrentHp() == npc.getMaxHp()) && (npc.getCurrentMp() == npc.getMaxMp()) && !npc.getAttackByList().isEmpty() && (Rnd.get(500) == 0))
{
npc.clearAggroList();
npc.getAttackByList().clear();
@ -567,7 +567,7 @@ public class L2AttackableAI extends L2CharacterAI
moveTo(x1, y1, leader.getZ());
return;
}
else if (Rnd.nextInt(RANDOM_WALK_RATE) == 0)
else if (Rnd.get(RANDOM_WALK_RATE) == 0)
{
for (Skill sk : npc.getTemplate().getAISkills(AISkillScope.BUFF))
{
@ -582,7 +582,7 @@ public class L2AttackableAI extends L2CharacterAI
}
}
// Order to the L2MonsterInstance to random walk (1/100)
else if ((npc.getSpawn() != null) && (Rnd.nextInt(RANDOM_WALK_RATE) == 0) && npc.isRandomWalkingEnabled())
else if ((npc.getSpawn() != null) && (Rnd.get(RANDOM_WALK_RATE) == 0) && npc.isRandomWalkingEnabled())
{
int x1 = 0;
int y1 = 0;
@ -610,7 +610,7 @@ public class L2AttackableAI extends L2CharacterAI
}
else
{
final int deltaX = Rnd.nextInt(range * 2); // x
final int deltaX = Rnd.get(range * 2); // x
int deltaY = Rnd.get(deltaX, range * 2); // distance
deltaY = (int) Math.sqrt((deltaY * deltaY) - (deltaX * deltaX)); // y
x1 = (deltaX + x1) - range;
@ -745,7 +745,7 @@ public class L2AttackableAI extends L2CharacterAI
// In case many mobs are trying to hit from same place, move a bit, circling around the target
// Note from Gnacik:
// On l2js because of that sometimes mobs don't attack player only running around player without any sense, so decrease chance for now
if (!npc.isMovementDisabled() && (Rnd.nextInt(100) <= 3))
if (!npc.isMovementDisabled() && (Rnd.get(100) <= 3))
{
for (L2Attackable nearby : L2World.getInstance().getVisibleObjects(npc, L2Attackable.class))
{

View File

@ -63,10 +63,10 @@ public final class L2ControllableMobAI extends L2AttackableAI
if (!Util.checkIfInRange(MobGroupTable.FOLLOW_RANGE, me, getForcedTarget(), true))
{
final int signX = (Rnd.nextInt(2) == 0) ? -1 : 1;
final int signY = (Rnd.nextInt(2) == 0) ? -1 : 1;
final int randX = Rnd.nextInt(MobGroupTable.FOLLOW_RANGE);
final int randY = Rnd.nextInt(MobGroupTable.FOLLOW_RANGE);
final int signX = (Rnd.get(2) == 0) ? -1 : 1;
final int signY = (Rnd.get(2) == 0) ? -1 : 1;
final int randX = Rnd.get(MobGroupTable.FOLLOW_RANGE);
final int randY = Rnd.get(MobGroupTable.FOLLOW_RANGE);
moveTo(getForcedTarget().getX() + (signX * randX), getForcedTarget().getY() + (signY * randY), getForcedTarget().getZ());
}
@ -350,7 +350,7 @@ public final class L2ControllableMobAI extends L2AttackableAI
target = hated;
}
if (!_actor.isMuted() && (Rnd.nextInt(5) == 3))
if (!_actor.isMuted() && (Rnd.get(5) == 3))
{
for (Skill sk : _actor.getAllSkills())
{
@ -449,7 +449,7 @@ public final class L2ControllableMobAI extends L2AttackableAI
}
});
return !potentialTarget.isEmpty() ? potentialTarget.get(Rnd.nextInt(potentialTarget.size())) : null;
return !potentialTarget.isEmpty() ? potentialTarget.get(Rnd.get(potentialTarget.size())) : null;
}
private L2ControllableMobInstance findNextGroupTarget()

View File

@ -308,7 +308,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
if (crop.getStartAmount() != crop.getAmount())
{
long count = (long) ((crop.getStartAmount() - crop.getAmount()) * 0.9);
if ((count < 1) && (Rnd.nextInt(99) < 90))
if ((count < 1) && (Rnd.get(99) < 90))
{
count = 1;
}

View File

@ -68,7 +68,7 @@ public class L2GroupSpawn extends L2Spawn
final L2Npc mob = new L2ControllableMobInstance(_template);
mob.setCurrentHpMp(mob.getMaxHp(), mob.getMaxMp());
mob.setHeading(getHeading() == -1 ? Rnd.nextInt(61794) : getHeading());
mob.setHeading(getHeading() == -1 ? Rnd.get(61794) : getHeading());
mob.setSpawn(this);
mob.spawnMe(newlocx, newlocy, newlocz);

View File

@ -426,7 +426,7 @@ public class L2Spawn extends Location implements IIdentifiable, INamable
// Set the heading of the L2NpcInstance (random heading if not defined)
if (getHeading() == -1)
{
npc.setHeading(Rnd.nextInt(61794));
npc.setHeading(Rnd.get(61794));
}
else
{

View File

@ -150,7 +150,7 @@ public class L2Territory
if (_procMax > 0)
{
int pos = 0;
final int rnd = Rnd.nextInt(_procMax);
final int rnd = Rnd.get(_procMax);
for (Point p1 : _points)
{
pos += p1._proc;

View File

@ -147,10 +147,10 @@ public final class MobGroup
{
final L2GroupSpawn spawn = new L2GroupSpawn(_npcTemplate);
final int signX = (Rnd.nextInt(2) == 0) ? -1 : 1;
final int signY = (Rnd.nextInt(2) == 0) ? -1 : 1;
final int randX = Rnd.nextInt(MobGroupTable.RANDOM_RANGE);
final int randY = Rnd.nextInt(MobGroupTable.RANDOM_RANGE);
final int signX = (Rnd.get(2) == 0) ? -1 : 1;
final int signY = (Rnd.get(2) == 0) ? -1 : 1;
final int randX = Rnd.get(MobGroupTable.RANDOM_RANGE);
final int randY = Rnd.get(MobGroupTable.RANDOM_RANGE);
spawn.setXYZ(x + (signX * randX), y + (signY * randY), z);
spawn.stopRespawn();
@ -185,8 +185,8 @@ public final class MobGroup
if (!mobInst.isDead())
{
final int x = player.getX() + Rnd.nextInt(50);
final int y = player.getY() + Rnd.nextInt(50);
final int x = player.getX() + Rnd.get(50);
final int y = player.getY() + Rnd.get(50);
mobInst.teleToLocation(new Location(x, y, player.getZ()), true);
((L2ControllableMobAI) mobInst.getAI()).follow(player);
@ -203,7 +203,7 @@ public final class MobGroup
return null;
}
int choice = Rnd.nextInt(getMobs().size());
int choice = Rnd.get(getMobs().size());
for (L2ControllableMobInstance mob : getMobs())
{
if (--choice == 0)
@ -321,10 +321,10 @@ public final class MobGroup
continue;
}
final int signX = (Rnd.nextInt(2) == 0) ? -1 : 1;
final int signY = (Rnd.nextInt(2) == 0) ? -1 : 1;
final int randX = Rnd.nextInt(MobGroupTable.RANDOM_RANGE);
final int randY = Rnd.nextInt(MobGroupTable.RANDOM_RANGE);
final int signX = (Rnd.get(2) == 0) ? -1 : 1;
final int signY = (Rnd.get(2) == 0) ? -1 : 1;
final int randX = Rnd.get(MobGroupTable.RANDOM_RANGE);
final int randY = Rnd.get(MobGroupTable.RANDOM_RANGE);
final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI();
ai.move(activeChar.getX() + (signX * randX), activeChar.getY() + (signY * randY), activeChar.getZ());

View File

@ -68,7 +68,7 @@ public class OlympiadGameClassed extends OlympiadGameNormal
Participant[] opponents;
while (!classList.isEmpty())
{
list = classList.get(Rnd.nextInt(classList.size()));
list = classList.get(Rnd.get(classList.size()));
if ((list == null) || (list.size() < 2))
{
classList.remove(list);

View File

@ -76,7 +76,7 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
while (set.size() > 1)
{
int random = Rnd.nextInt(set.size());
int random = Rnd.get(set.size());
Iterator<Integer> iter = set.iterator();
while (iter.hasNext())
{
@ -94,7 +94,7 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
continue;
}
random = Rnd.nextInt(set.size());
random = Rnd.get(set.size());
iter = set.iterator();
while (iter.hasNext())
{

View File

@ -39,7 +39,7 @@ public final class OptionDataCategory
Options result = null;
do
{
double random = Rnd.get() * 100.0;
double random = Rnd.nextDouble() * 100.0;
for (Map.Entry<Options, Double> entry : _options.entrySet())
{
if (entry.getValue() >= random)

View File

@ -37,7 +37,7 @@ public final class OptionDataGroup
Options result = null;
do
{
double random = Rnd.get() * 100.0;
double random = Rnd.nextDouble() * 100.0;
for (OptionDataCategory category : _categories)
{
if (category.getChance() >= random)

View File

@ -138,8 +138,8 @@ public class ZoneCylinder extends L2ZoneForm
@Override
public Location getRandomPoint()
{
final int q = (int) (Rnd.get() * 2 * Math.PI);
final int r = (int) Math.sqrt(Rnd.get());
final int q = (int) (Rnd.nextDouble() * 2 * Math.PI);
final int r = (int) Math.sqrt(Rnd.nextDouble());
final int x = (int) ((_rad * r * Math.cos(q)) + _x);
final int y = (int) ((_rad * r * Math.sin(q)) + _y);

View File

@ -261,7 +261,7 @@ public final class GameServerTable implements IGameXmlReader
*/
public KeyPair getKeyPair()
{
return _keyPairs[Rnd.nextInt(10)];
return _keyPairs[Rnd.get(10)];
}
/**

View File

@ -484,7 +484,7 @@ public class LoginController
*/
public ScrambledKeyPair getScrambledRSAKeyPair()
{
return _keyPairs[Rnd.nextInt(10)];
return _keyPairs[Rnd.get(10)];
}
/**

View File

@ -76,7 +76,7 @@ public final class Confuse extends AbstractEffect
if (!targetList.isEmpty())
{
// Choosing randomly a new target
final L2Character target = targetList.get(Rnd.nextInt(targetList.size()));
final L2Character target = targetList.get(Rnd.get(targetList.size()));
// Attacking the target
effected.setTarget(target);
effected.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);

View File

@ -140,6 +140,6 @@ public final class Harvesting extends AbstractEffect
{
basicSuccess = 1;
}
return Rnd.nextInt(99) < basicSuccess;
return Rnd.get(99) < basicSuccess;
}
}

View File

@ -129,6 +129,6 @@ public final class Sow extends AbstractEffect
// chance can't be less than 1%
Math.max(basicSuccess, 1);
return Rnd.nextInt(99) < basicSuccess;
return Rnd.get(99) < basicSuccess;
}
}

View File

@ -116,7 +116,7 @@ public class FriendlyNpcAI extends L2AttackableAI
final int combinedCollision = collision + originalAttackTarget.getTemplate().getCollisionRadius();
if (!npc.isMovementDisabled() && (Rnd.nextInt(100) <= 3))
if (!npc.isMovementDisabled() && (Rnd.get(100) <= 3))
{
for (L2Attackable nearby : L2World.getInstance().getVisibleObjects(npc, L2Attackable.class))
{

View File

@ -497,7 +497,7 @@ public class L2AttackableAI extends L2CharacterAI
}
// Chance to forget attackers after some time
if ((npc.getCurrentHp() == npc.getMaxHp()) && (npc.getCurrentMp() == npc.getMaxMp()) && !npc.getAttackByList().isEmpty() && (Rnd.nextInt(500) == 0))
if ((npc.getCurrentHp() == npc.getMaxHp()) && (npc.getCurrentMp() == npc.getMaxMp()) && !npc.getAttackByList().isEmpty() && (Rnd.get(500) == 0))
{
npc.clearAggroList();
npc.getAttackByList().clear();
@ -567,7 +567,7 @@ public class L2AttackableAI extends L2CharacterAI
moveTo(x1, y1, leader.getZ());
return;
}
else if (Rnd.nextInt(RANDOM_WALK_RATE) == 0)
else if (Rnd.get(RANDOM_WALK_RATE) == 0)
{
for (Skill sk : npc.getTemplate().getAISkills(AISkillScope.BUFF))
{
@ -582,7 +582,7 @@ public class L2AttackableAI extends L2CharacterAI
}
}
// Order to the L2MonsterInstance to random walk (1/100)
else if ((npc.getSpawn() != null) && (Rnd.nextInt(RANDOM_WALK_RATE) == 0) && npc.isRandomWalkingEnabled())
else if ((npc.getSpawn() != null) && (Rnd.get(RANDOM_WALK_RATE) == 0) && npc.isRandomWalkingEnabled())
{
int x1 = 0;
int y1 = 0;
@ -610,7 +610,7 @@ public class L2AttackableAI extends L2CharacterAI
}
else
{
final int deltaX = Rnd.nextInt(range * 2); // x
final int deltaX = Rnd.get(range * 2); // x
int deltaY = Rnd.get(deltaX, range * 2); // distance
deltaY = (int) Math.sqrt((deltaY * deltaY) - (deltaX * deltaX)); // y
x1 = (deltaX + x1) - range;
@ -745,7 +745,7 @@ public class L2AttackableAI extends L2CharacterAI
// In case many mobs are trying to hit from same place, move a bit, circling around the target
// Note from Gnacik:
// On l2js because of that sometimes mobs don't attack player only running around player without any sense, so decrease chance for now
if (!npc.isMovementDisabled() && (Rnd.nextInt(100) <= 3))
if (!npc.isMovementDisabled() && (Rnd.get(100) <= 3))
{
for (L2Attackable nearby : L2World.getInstance().getVisibleObjects(npc, L2Attackable.class))
{

View File

@ -63,10 +63,10 @@ public final class L2ControllableMobAI extends L2AttackableAI
if (!Util.checkIfInRange(MobGroupTable.FOLLOW_RANGE, me, getForcedTarget(), true))
{
final int signX = (Rnd.nextInt(2) == 0) ? -1 : 1;
final int signY = (Rnd.nextInt(2) == 0) ? -1 : 1;
final int randX = Rnd.nextInt(MobGroupTable.FOLLOW_RANGE);
final int randY = Rnd.nextInt(MobGroupTable.FOLLOW_RANGE);
final int signX = (Rnd.get(2) == 0) ? -1 : 1;
final int signY = (Rnd.get(2) == 0) ? -1 : 1;
final int randX = Rnd.get(MobGroupTable.FOLLOW_RANGE);
final int randY = Rnd.get(MobGroupTable.FOLLOW_RANGE);
moveTo(getForcedTarget().getX() + (signX * randX), getForcedTarget().getY() + (signY * randY), getForcedTarget().getZ());
}
@ -350,7 +350,7 @@ public final class L2ControllableMobAI extends L2AttackableAI
target = hated;
}
if (!_actor.isMuted() && (Rnd.nextInt(5) == 3))
if (!_actor.isMuted() && (Rnd.get(5) == 3))
{
for (Skill sk : _actor.getAllSkills())
{
@ -449,7 +449,7 @@ public final class L2ControllableMobAI extends L2AttackableAI
}
});
return !potentialTarget.isEmpty() ? potentialTarget.get(Rnd.nextInt(potentialTarget.size())) : null;
return !potentialTarget.isEmpty() ? potentialTarget.get(Rnd.get(potentialTarget.size())) : null;
}
private L2ControllableMobInstance findNextGroupTarget()

View File

@ -308,7 +308,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
if (crop.getStartAmount() != crop.getAmount())
{
long count = (long) ((crop.getStartAmount() - crop.getAmount()) * 0.9);
if ((count < 1) && (Rnd.nextInt(99) < 90))
if ((count < 1) && (Rnd.get(99) < 90))
{
count = 1;
}

View File

@ -68,7 +68,7 @@ public class L2GroupSpawn extends L2Spawn
final L2Npc mob = new L2ControllableMobInstance(_template);
mob.setCurrentHpMp(mob.getMaxHp(), mob.getMaxMp());
mob.setHeading(getHeading() == -1 ? Rnd.nextInt(61794) : getHeading());
mob.setHeading(getHeading() == -1 ? Rnd.get(61794) : getHeading());
mob.setSpawn(this);
mob.spawnMe(newlocx, newlocy, newlocz);

View File

@ -426,7 +426,7 @@ public class L2Spawn extends Location implements IIdentifiable, INamable
// Set the heading of the L2NpcInstance (random heading if not defined)
if (getHeading() == -1)
{
npc.setHeading(Rnd.nextInt(61794));
npc.setHeading(Rnd.get(61794));
}
else
{

View File

@ -150,7 +150,7 @@ public class L2Territory
if (_procMax > 0)
{
int pos = 0;
final int rnd = Rnd.nextInt(_procMax);
final int rnd = Rnd.get(_procMax);
for (Point p1 : _points)
{
pos += p1._proc;

View File

@ -147,10 +147,10 @@ public final class MobGroup
{
final L2GroupSpawn spawn = new L2GroupSpawn(_npcTemplate);
final int signX = (Rnd.nextInt(2) == 0) ? -1 : 1;
final int signY = (Rnd.nextInt(2) == 0) ? -1 : 1;
final int randX = Rnd.nextInt(MobGroupTable.RANDOM_RANGE);
final int randY = Rnd.nextInt(MobGroupTable.RANDOM_RANGE);
final int signX = (Rnd.get(2) == 0) ? -1 : 1;
final int signY = (Rnd.get(2) == 0) ? -1 : 1;
final int randX = Rnd.get(MobGroupTable.RANDOM_RANGE);
final int randY = Rnd.get(MobGroupTable.RANDOM_RANGE);
spawn.setXYZ(x + (signX * randX), y + (signY * randY), z);
spawn.stopRespawn();
@ -185,8 +185,8 @@ public final class MobGroup
if (!mobInst.isDead())
{
final int x = player.getX() + Rnd.nextInt(50);
final int y = player.getY() + Rnd.nextInt(50);
final int x = player.getX() + Rnd.get(50);
final int y = player.getY() + Rnd.get(50);
mobInst.teleToLocation(new Location(x, y, player.getZ()), true);
((L2ControllableMobAI) mobInst.getAI()).follow(player);
@ -203,7 +203,7 @@ public final class MobGroup
return null;
}
int choice = Rnd.nextInt(getMobs().size());
int choice = Rnd.get(getMobs().size());
for (L2ControllableMobInstance mob : getMobs())
{
if (--choice == 0)
@ -321,10 +321,10 @@ public final class MobGroup
continue;
}
final int signX = (Rnd.nextInt(2) == 0) ? -1 : 1;
final int signY = (Rnd.nextInt(2) == 0) ? -1 : 1;
final int randX = Rnd.nextInt(MobGroupTable.RANDOM_RANGE);
final int randY = Rnd.nextInt(MobGroupTable.RANDOM_RANGE);
final int signX = (Rnd.get(2) == 0) ? -1 : 1;
final int signY = (Rnd.get(2) == 0) ? -1 : 1;
final int randX = Rnd.get(MobGroupTable.RANDOM_RANGE);
final int randY = Rnd.get(MobGroupTable.RANDOM_RANGE);
final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI();
ai.move(activeChar.getX() + (signX * randX), activeChar.getY() + (signY * randY), activeChar.getZ());

View File

@ -68,7 +68,7 @@ public class OlympiadGameClassed extends OlympiadGameNormal
Participant[] opponents;
while (!classList.isEmpty())
{
list = classList.get(Rnd.nextInt(classList.size()));
list = classList.get(Rnd.get(classList.size()));
if ((list == null) || (list.size() < 2))
{
classList.remove(list);

View File

@ -76,7 +76,7 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
while (set.size() > 1)
{
int random = Rnd.nextInt(set.size());
int random = Rnd.get(set.size());
Iterator<Integer> iter = set.iterator();
while (iter.hasNext())
{
@ -94,7 +94,7 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
continue;
}
random = Rnd.nextInt(set.size());
random = Rnd.get(set.size());
iter = set.iterator();
while (iter.hasNext())
{

View File

@ -39,7 +39,7 @@ public final class OptionDataCategory
Options result = null;
do
{
double random = Rnd.get() * 100.0;
double random = Rnd.nextDouble() * 100.0;
for (Map.Entry<Options, Double> entry : _options.entrySet())
{
if (entry.getValue() >= random)

View File

@ -37,7 +37,7 @@ public final class OptionDataGroup
Options result = null;
do
{
double random = Rnd.get() * 100.0;
double random = Rnd.nextDouble() * 100.0;
for (OptionDataCategory category : _categories)
{
if (category.getChance() >= random)

View File

@ -138,8 +138,8 @@ public class ZoneCylinder extends L2ZoneForm
@Override
public Location getRandomPoint()
{
final int q = (int) (Rnd.get() * 2 * Math.PI);
final int r = (int) Math.sqrt(Rnd.get());
final int q = (int) (Rnd.nextDouble() * 2 * Math.PI);
final int r = (int) Math.sqrt(Rnd.nextDouble());
final int x = (int) ((_rad * r * Math.cos(q)) + _x);
final int y = (int) ((_rad * r * Math.sin(q)) + _y);

View File

@ -261,7 +261,7 @@ public final class GameServerTable implements IGameXmlReader
*/
public KeyPair getKeyPair()
{
return _keyPairs[Rnd.nextInt(10)];
return _keyPairs[Rnd.get(10)];
}
/**

View File

@ -484,7 +484,7 @@ public class LoginController
*/
public ScrambledKeyPair getScrambledRSAKeyPair()
{
return _keyPairs[Rnd.nextInt(10)];
return _keyPairs[Rnd.get(10)];
}
/**

View File

@ -76,7 +76,7 @@ public final class Confuse extends AbstractEffect
if (!targetList.isEmpty())
{
// Choosing randomly a new target
final L2Character target = targetList.get(Rnd.nextInt(targetList.size()));
final L2Character target = targetList.get(Rnd.get(targetList.size()));
// Attacking the target
effected.setTarget(target);
effected.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);

View File

@ -140,6 +140,6 @@ public final class Harvesting extends AbstractEffect
{
basicSuccess = 1;
}
return Rnd.nextInt(99) < basicSuccess;
return Rnd.get(99) < basicSuccess;
}
}

View File

@ -129,6 +129,6 @@ public final class Sow extends AbstractEffect
// chance can't be less than 1%
Math.max(basicSuccess, 1);
return Rnd.nextInt(99) < basicSuccess;
return Rnd.get(99) < basicSuccess;
}
}

View File

@ -116,7 +116,7 @@ public class FriendlyNpcAI extends L2AttackableAI
final int combinedCollision = collision + originalAttackTarget.getTemplate().getCollisionRadius();
if (!npc.isMovementDisabled() && (Rnd.nextInt(100) <= 3))
if (!npc.isMovementDisabled() && (Rnd.get(100) <= 3))
{
for (L2Attackable nearby : L2World.getInstance().getVisibleObjects(npc, L2Attackable.class))
{

View File

@ -497,7 +497,7 @@ public class L2AttackableAI extends L2CharacterAI
}
// Chance to forget attackers after some time
if ((npc.getCurrentHp() == npc.getMaxHp()) && (npc.getCurrentMp() == npc.getMaxMp()) && !npc.getAttackByList().isEmpty() && (Rnd.nextInt(500) == 0))
if ((npc.getCurrentHp() == npc.getMaxHp()) && (npc.getCurrentMp() == npc.getMaxMp()) && !npc.getAttackByList().isEmpty() && (Rnd.get(500) == 0))
{
npc.clearAggroList();
npc.getAttackByList().clear();
@ -567,7 +567,7 @@ public class L2AttackableAI extends L2CharacterAI
moveTo(x1, y1, leader.getZ());
return;
}
else if (Rnd.nextInt(RANDOM_WALK_RATE) == 0)
else if (Rnd.get(RANDOM_WALK_RATE) == 0)
{
for (Skill sk : npc.getTemplate().getAISkills(AISkillScope.BUFF))
{
@ -582,7 +582,7 @@ public class L2AttackableAI extends L2CharacterAI
}
}
// Order to the L2MonsterInstance to random walk (1/100)
else if ((npc.getSpawn() != null) && (Rnd.nextInt(RANDOM_WALK_RATE) == 0) && npc.isRandomWalkingEnabled())
else if ((npc.getSpawn() != null) && (Rnd.get(RANDOM_WALK_RATE) == 0) && npc.isRandomWalkingEnabled())
{
int x1 = 0;
int y1 = 0;
@ -610,7 +610,7 @@ public class L2AttackableAI extends L2CharacterAI
}
else
{
final int deltaX = Rnd.nextInt(range * 2); // x
final int deltaX = Rnd.get(range * 2); // x
int deltaY = Rnd.get(deltaX, range * 2); // distance
deltaY = (int) Math.sqrt((deltaY * deltaY) - (deltaX * deltaX)); // y
x1 = (deltaX + x1) - range;
@ -745,7 +745,7 @@ public class L2AttackableAI extends L2CharacterAI
// In case many mobs are trying to hit from same place, move a bit, circling around the target
// Note from Gnacik:
// On l2js because of that sometimes mobs don't attack player only running around player without any sense, so decrease chance for now
if (!npc.isMovementDisabled() && (Rnd.nextInt(100) <= 3))
if (!npc.isMovementDisabled() && (Rnd.get(100) <= 3))
{
for (L2Attackable nearby : L2World.getInstance().getVisibleObjects(npc, L2Attackable.class))
{

View File

@ -63,10 +63,10 @@ public final class L2ControllableMobAI extends L2AttackableAI
if (!Util.checkIfInRange(MobGroupTable.FOLLOW_RANGE, me, getForcedTarget(), true))
{
final int signX = (Rnd.nextInt(2) == 0) ? -1 : 1;
final int signY = (Rnd.nextInt(2) == 0) ? -1 : 1;
final int randX = Rnd.nextInt(MobGroupTable.FOLLOW_RANGE);
final int randY = Rnd.nextInt(MobGroupTable.FOLLOW_RANGE);
final int signX = (Rnd.get(2) == 0) ? -1 : 1;
final int signY = (Rnd.get(2) == 0) ? -1 : 1;
final int randX = Rnd.get(MobGroupTable.FOLLOW_RANGE);
final int randY = Rnd.get(MobGroupTable.FOLLOW_RANGE);
moveTo(getForcedTarget().getX() + (signX * randX), getForcedTarget().getY() + (signY * randY), getForcedTarget().getZ());
}
@ -350,7 +350,7 @@ public final class L2ControllableMobAI extends L2AttackableAI
target = hated;
}
if (!_actor.isMuted() && (Rnd.nextInt(5) == 3))
if (!_actor.isMuted() && (Rnd.get(5) == 3))
{
for (Skill sk : _actor.getAllSkills())
{
@ -449,7 +449,7 @@ public final class L2ControllableMobAI extends L2AttackableAI
}
});
return !potentialTarget.isEmpty() ? potentialTarget.get(Rnd.nextInt(potentialTarget.size())) : null;
return !potentialTarget.isEmpty() ? potentialTarget.get(Rnd.get(potentialTarget.size())) : null;
}
private L2ControllableMobInstance findNextGroupTarget()

View File

@ -308,7 +308,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
if (crop.getStartAmount() != crop.getAmount())
{
long count = (long) ((crop.getStartAmount() - crop.getAmount()) * 0.9);
if ((count < 1) && (Rnd.nextInt(99) < 90))
if ((count < 1) && (Rnd.get(99) < 90))
{
count = 1;
}

View File

@ -68,7 +68,7 @@ public class L2GroupSpawn extends L2Spawn
final L2Npc mob = new L2ControllableMobInstance(_template);
mob.setCurrentHpMp(mob.getMaxHp(), mob.getMaxMp());
mob.setHeading(getHeading() == -1 ? Rnd.nextInt(61794) : getHeading());
mob.setHeading(getHeading() == -1 ? Rnd.get(61794) : getHeading());
mob.setSpawn(this);
mob.spawnMe(newlocx, newlocy, newlocz);

View File

@ -426,7 +426,7 @@ public class L2Spawn extends Location implements IIdentifiable, INamable
// Set the heading of the L2NpcInstance (random heading if not defined)
if (getHeading() == -1)
{
npc.setHeading(Rnd.nextInt(61794));
npc.setHeading(Rnd.get(61794));
}
else
{

View File

@ -150,7 +150,7 @@ public class L2Territory
if (_procMax > 0)
{
int pos = 0;
final int rnd = Rnd.nextInt(_procMax);
final int rnd = Rnd.get(_procMax);
for (Point p1 : _points)
{
pos += p1._proc;

View File

@ -147,10 +147,10 @@ public final class MobGroup
{
final L2GroupSpawn spawn = new L2GroupSpawn(_npcTemplate);
final int signX = (Rnd.nextInt(2) == 0) ? -1 : 1;
final int signY = (Rnd.nextInt(2) == 0) ? -1 : 1;
final int randX = Rnd.nextInt(MobGroupTable.RANDOM_RANGE);
final int randY = Rnd.nextInt(MobGroupTable.RANDOM_RANGE);
final int signX = (Rnd.get(2) == 0) ? -1 : 1;
final int signY = (Rnd.get(2) == 0) ? -1 : 1;
final int randX = Rnd.get(MobGroupTable.RANDOM_RANGE);
final int randY = Rnd.get(MobGroupTable.RANDOM_RANGE);
spawn.setXYZ(x + (signX * randX), y + (signY * randY), z);
spawn.stopRespawn();
@ -185,8 +185,8 @@ public final class MobGroup
if (!mobInst.isDead())
{
final int x = player.getX() + Rnd.nextInt(50);
final int y = player.getY() + Rnd.nextInt(50);
final int x = player.getX() + Rnd.get(50);
final int y = player.getY() + Rnd.get(50);
mobInst.teleToLocation(new Location(x, y, player.getZ()), true);
((L2ControllableMobAI) mobInst.getAI()).follow(player);
@ -203,7 +203,7 @@ public final class MobGroup
return null;
}
int choice = Rnd.nextInt(getMobs().size());
int choice = Rnd.get(getMobs().size());
for (L2ControllableMobInstance mob : getMobs())
{
if (--choice == 0)
@ -321,10 +321,10 @@ public final class MobGroup
continue;
}
final int signX = (Rnd.nextInt(2) == 0) ? -1 : 1;
final int signY = (Rnd.nextInt(2) == 0) ? -1 : 1;
final int randX = Rnd.nextInt(MobGroupTable.RANDOM_RANGE);
final int randY = Rnd.nextInt(MobGroupTable.RANDOM_RANGE);
final int signX = (Rnd.get(2) == 0) ? -1 : 1;
final int signY = (Rnd.get(2) == 0) ? -1 : 1;
final int randX = Rnd.get(MobGroupTable.RANDOM_RANGE);
final int randY = Rnd.get(MobGroupTable.RANDOM_RANGE);
final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI();
ai.move(activeChar.getX() + (signX * randX), activeChar.getY() + (signY * randY), activeChar.getZ());

View File

@ -68,7 +68,7 @@ public class OlympiadGameClassed extends OlympiadGameNormal
Participant[] opponents;
while (!classList.isEmpty())
{
list = classList.get(Rnd.nextInt(classList.size()));
list = classList.get(Rnd.get(classList.size()));
if ((list == null) || (list.size() < 2))
{
classList.remove(list);

View File

@ -76,7 +76,7 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
while (set.size() > 1)
{
int random = Rnd.nextInt(set.size());
int random = Rnd.get(set.size());
Iterator<Integer> iter = set.iterator();
while (iter.hasNext())
{
@ -94,7 +94,7 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
continue;
}
random = Rnd.nextInt(set.size());
random = Rnd.get(set.size());
iter = set.iterator();
while (iter.hasNext())
{

View File

@ -39,7 +39,7 @@ public final class OptionDataCategory
Options result = null;
do
{
double random = Rnd.get() * 100.0;
double random = Rnd.nextDouble() * 100.0;
for (Map.Entry<Options, Double> entry : _options.entrySet())
{
if (entry.getValue() >= random)

View File

@ -37,7 +37,7 @@ public final class OptionDataGroup
Options result = null;
do
{
double random = Rnd.get() * 100.0;
double random = Rnd.nextDouble() * 100.0;
for (OptionDataCategory category : _categories)
{
if (category.getChance() >= random)

View File

@ -138,8 +138,8 @@ public class ZoneCylinder extends L2ZoneForm
@Override
public Location getRandomPoint()
{
final int q = (int) (Rnd.get() * 2 * Math.PI);
final int r = (int) Math.sqrt(Rnd.get());
final int q = (int) (Rnd.nextDouble() * 2 * Math.PI);
final int r = (int) Math.sqrt(Rnd.nextDouble());
final int x = (int) ((_rad * r * Math.cos(q)) + _x);
final int y = (int) ((_rad * r * Math.sin(q)) + _y);

View File

@ -261,7 +261,7 @@ public final class GameServerTable implements IGameXmlReader
*/
public KeyPair getKeyPair()
{
return _keyPairs[Rnd.nextInt(10)];
return _keyPairs[Rnd.get(10)];
}
/**

View File

@ -484,7 +484,7 @@ public class LoginController
*/
public ScrambledKeyPair getScrambledRSAKeyPair()
{
return _keyPairs[Rnd.nextInt(10)];
return _keyPairs[Rnd.get(10)];
}
/**

View File

@ -76,7 +76,7 @@ public final class Confuse extends AbstractEffect
if (!targetList.isEmpty())
{
// Choosing randomly a new target
final L2Character target = targetList.get(Rnd.nextInt(targetList.size()));
final L2Character target = targetList.get(Rnd.get(targetList.size()));
// Attacking the target
effected.setTarget(target);
effected.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);

View File

@ -140,6 +140,6 @@ public final class Harvesting extends AbstractEffect
{
basicSuccess = 1;
}
return Rnd.nextInt(99) < basicSuccess;
return Rnd.get(99) < basicSuccess;
}
}

View File

@ -129,6 +129,6 @@ public final class Sow extends AbstractEffect
// chance can't be less than 1%
Math.max(basicSuccess, 1);
return Rnd.nextInt(99) < basicSuccess;
return Rnd.get(99) < basicSuccess;
}
}

View File

@ -116,7 +116,7 @@ public class FriendlyNpcAI extends L2AttackableAI
final int combinedCollision = collision + originalAttackTarget.getTemplate().getCollisionRadius();
if (!npc.isMovementDisabled() && (Rnd.nextInt(100) <= 3))
if (!npc.isMovementDisabled() && (Rnd.get(100) <= 3))
{
for (L2Attackable nearby : L2World.getInstance().getVisibleObjects(npc, L2Attackable.class))
{

View File

@ -497,7 +497,7 @@ public class L2AttackableAI extends L2CharacterAI
}
// Chance to forget attackers after some time
if ((npc.getCurrentHp() == npc.getMaxHp()) && (npc.getCurrentMp() == npc.getMaxMp()) && !npc.getAttackByList().isEmpty() && (Rnd.nextInt(500) == 0))
if ((npc.getCurrentHp() == npc.getMaxHp()) && (npc.getCurrentMp() == npc.getMaxMp()) && !npc.getAttackByList().isEmpty() && (Rnd.get(500) == 0))
{
npc.clearAggroList();
npc.getAttackByList().clear();
@ -567,7 +567,7 @@ public class L2AttackableAI extends L2CharacterAI
moveTo(x1, y1, leader.getZ());
return;
}
else if (Rnd.nextInt(RANDOM_WALK_RATE) == 0)
else if (Rnd.get(RANDOM_WALK_RATE) == 0)
{
for (Skill sk : npc.getTemplate().getAISkills(AISkillScope.BUFF))
{
@ -582,7 +582,7 @@ public class L2AttackableAI extends L2CharacterAI
}
}
// Order to the L2MonsterInstance to random walk (1/100)
else if ((npc.getSpawn() != null) && (Rnd.nextInt(RANDOM_WALK_RATE) == 0) && npc.isRandomWalkingEnabled())
else if ((npc.getSpawn() != null) && (Rnd.get(RANDOM_WALK_RATE) == 0) && npc.isRandomWalkingEnabled())
{
int x1 = 0;
int y1 = 0;
@ -610,7 +610,7 @@ public class L2AttackableAI extends L2CharacterAI
}
else
{
final int deltaX = Rnd.nextInt(range * 2); // x
final int deltaX = Rnd.get(range * 2); // x
int deltaY = Rnd.get(deltaX, range * 2); // distance
deltaY = (int) Math.sqrt((deltaY * deltaY) - (deltaX * deltaX)); // y
x1 = (deltaX + x1) - range;
@ -745,7 +745,7 @@ public class L2AttackableAI extends L2CharacterAI
// In case many mobs are trying to hit from same place, move a bit, circling around the target
// Note from Gnacik:
// On l2js because of that sometimes mobs don't attack player only running around player without any sense, so decrease chance for now
if (!npc.isMovementDisabled() && (Rnd.nextInt(100) <= 3))
if (!npc.isMovementDisabled() && (Rnd.get(100) <= 3))
{
for (L2Attackable nearby : L2World.getInstance().getVisibleObjects(npc, L2Attackable.class))
{

View File

@ -63,10 +63,10 @@ public final class L2ControllableMobAI extends L2AttackableAI
if (!Util.checkIfInRange(MobGroupTable.FOLLOW_RANGE, me, getForcedTarget(), true))
{
final int signX = (Rnd.nextInt(2) == 0) ? -1 : 1;
final int signY = (Rnd.nextInt(2) == 0) ? -1 : 1;
final int randX = Rnd.nextInt(MobGroupTable.FOLLOW_RANGE);
final int randY = Rnd.nextInt(MobGroupTable.FOLLOW_RANGE);
final int signX = (Rnd.get(2) == 0) ? -1 : 1;
final int signY = (Rnd.get(2) == 0) ? -1 : 1;
final int randX = Rnd.get(MobGroupTable.FOLLOW_RANGE);
final int randY = Rnd.get(MobGroupTable.FOLLOW_RANGE);
moveTo(getForcedTarget().getX() + (signX * randX), getForcedTarget().getY() + (signY * randY), getForcedTarget().getZ());
}
@ -350,7 +350,7 @@ public final class L2ControllableMobAI extends L2AttackableAI
target = hated;
}
if (!_actor.isMuted() && (Rnd.nextInt(5) == 3))
if (!_actor.isMuted() && (Rnd.get(5) == 3))
{
for (Skill sk : _actor.getAllSkills())
{
@ -449,7 +449,7 @@ public final class L2ControllableMobAI extends L2AttackableAI
}
});
return !potentialTarget.isEmpty() ? potentialTarget.get(Rnd.nextInt(potentialTarget.size())) : null;
return !potentialTarget.isEmpty() ? potentialTarget.get(Rnd.get(potentialTarget.size())) : null;
}
private L2ControllableMobInstance findNextGroupTarget()

View File

@ -308,7 +308,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
if (crop.getStartAmount() != crop.getAmount())
{
long count = (long) ((crop.getStartAmount() - crop.getAmount()) * 0.9);
if ((count < 1) && (Rnd.nextInt(99) < 90))
if ((count < 1) && (Rnd.get(99) < 90))
{
count = 1;
}

View File

@ -68,7 +68,7 @@ public class L2GroupSpawn extends L2Spawn
final L2Npc mob = new L2ControllableMobInstance(_template);
mob.setCurrentHpMp(mob.getMaxHp(), mob.getMaxMp());
mob.setHeading(getHeading() == -1 ? Rnd.nextInt(61794) : getHeading());
mob.setHeading(getHeading() == -1 ? Rnd.get(61794) : getHeading());
mob.setSpawn(this);
mob.spawnMe(newlocx, newlocy, newlocz);

View File

@ -426,7 +426,7 @@ public class L2Spawn extends Location implements IIdentifiable, INamable
// Set the heading of the L2NpcInstance (random heading if not defined)
if (getHeading() == -1)
{
npc.setHeading(Rnd.nextInt(61794));
npc.setHeading(Rnd.get(61794));
}
else
{

View File

@ -150,7 +150,7 @@ public class L2Territory
if (_procMax > 0)
{
int pos = 0;
final int rnd = Rnd.nextInt(_procMax);
final int rnd = Rnd.get(_procMax);
for (Point p1 : _points)
{
pos += p1._proc;

View File

@ -147,10 +147,10 @@ public final class MobGroup
{
final L2GroupSpawn spawn = new L2GroupSpawn(_npcTemplate);
final int signX = (Rnd.nextInt(2) == 0) ? -1 : 1;
final int signY = (Rnd.nextInt(2) == 0) ? -1 : 1;
final int randX = Rnd.nextInt(MobGroupTable.RANDOM_RANGE);
final int randY = Rnd.nextInt(MobGroupTable.RANDOM_RANGE);
final int signX = (Rnd.get(2) == 0) ? -1 : 1;
final int signY = (Rnd.get(2) == 0) ? -1 : 1;
final int randX = Rnd.get(MobGroupTable.RANDOM_RANGE);
final int randY = Rnd.get(MobGroupTable.RANDOM_RANGE);
spawn.setXYZ(x + (signX * randX), y + (signY * randY), z);
spawn.stopRespawn();
@ -185,8 +185,8 @@ public final class MobGroup
if (!mobInst.isDead())
{
final int x = player.getX() + Rnd.nextInt(50);
final int y = player.getY() + Rnd.nextInt(50);
final int x = player.getX() + Rnd.get(50);
final int y = player.getY() + Rnd.get(50);
mobInst.teleToLocation(new Location(x, y, player.getZ()), true);
((L2ControllableMobAI) mobInst.getAI()).follow(player);
@ -203,7 +203,7 @@ public final class MobGroup
return null;
}
int choice = Rnd.nextInt(getMobs().size());
int choice = Rnd.get(getMobs().size());
for (L2ControllableMobInstance mob : getMobs())
{
if (--choice == 0)
@ -321,10 +321,10 @@ public final class MobGroup
continue;
}
final int signX = (Rnd.nextInt(2) == 0) ? -1 : 1;
final int signY = (Rnd.nextInt(2) == 0) ? -1 : 1;
final int randX = Rnd.nextInt(MobGroupTable.RANDOM_RANGE);
final int randY = Rnd.nextInt(MobGroupTable.RANDOM_RANGE);
final int signX = (Rnd.get(2) == 0) ? -1 : 1;
final int signY = (Rnd.get(2) == 0) ? -1 : 1;
final int randX = Rnd.get(MobGroupTable.RANDOM_RANGE);
final int randY = Rnd.get(MobGroupTable.RANDOM_RANGE);
final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI();
ai.move(activeChar.getX() + (signX * randX), activeChar.getY() + (signY * randY), activeChar.getZ());

View File

@ -68,7 +68,7 @@ public class OlympiadGameClassed extends OlympiadGameNormal
Participant[] opponents;
while (!classList.isEmpty())
{
list = classList.get(Rnd.nextInt(classList.size()));
list = classList.get(Rnd.get(classList.size()));
if ((list == null) || (list.size() < 2))
{
classList.remove(list);

View File

@ -76,7 +76,7 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
while (set.size() > 1)
{
int random = Rnd.nextInt(set.size());
int random = Rnd.get(set.size());
Iterator<Integer> iter = set.iterator();
while (iter.hasNext())
{
@ -94,7 +94,7 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
continue;
}
random = Rnd.nextInt(set.size());
random = Rnd.get(set.size());
iter = set.iterator();
while (iter.hasNext())
{

View File

@ -39,7 +39,7 @@ public final class OptionDataCategory
Options result = null;
do
{
double random = Rnd.get() * 100.0;
double random = Rnd.nextDouble() * 100.0;
for (Map.Entry<Options, Double> entry : _options.entrySet())
{
if (entry.getValue() >= random)

View File

@ -37,7 +37,7 @@ public final class OptionDataGroup
Options result = null;
do
{
double random = Rnd.get() * 100.0;
double random = Rnd.nextDouble() * 100.0;
for (OptionDataCategory category : _categories)
{
if (category.getChance() >= random)

View File

@ -138,8 +138,8 @@ public class ZoneCylinder extends L2ZoneForm
@Override
public Location getRandomPoint()
{
final int q = (int) (Rnd.get() * 2 * Math.PI);
final int r = (int) Math.sqrt(Rnd.get());
final int q = (int) (Rnd.nextDouble() * 2 * Math.PI);
final int r = (int) Math.sqrt(Rnd.nextDouble());
final int x = (int) ((_rad * r * Math.cos(q)) + _x);
final int y = (int) ((_rad * r * Math.sin(q)) + _y);

View File

@ -261,7 +261,7 @@ public final class GameServerTable implements IGameXmlReader
*/
public KeyPair getKeyPair()
{
return _keyPairs[Rnd.nextInt(10)];
return _keyPairs[Rnd.get(10)];
}
/**

View File

@ -484,7 +484,7 @@ public class LoginController
*/
public ScrambledKeyPair getScrambledRSAKeyPair()
{
return _keyPairs[Rnd.nextInt(10)];
return _keyPairs[Rnd.get(10)];
}
/**

View File

@ -76,7 +76,7 @@ public final class Confuse extends AbstractEffect
if (!targetList.isEmpty())
{
// Choosing randomly a new target
final L2Character target = targetList.get(Rnd.nextInt(targetList.size()));
final L2Character target = targetList.get(Rnd.get(targetList.size()));
// Attacking the target
effected.setTarget(target);
effected.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);

View File

@ -140,6 +140,6 @@ public final class Harvesting extends AbstractEffect
{
basicSuccess = 1;
}
return Rnd.nextInt(99) < basicSuccess;
return Rnd.get(99) < basicSuccess;
}
}

View File

@ -129,6 +129,6 @@ public final class Sow extends AbstractEffect
// chance can't be less than 1%
Math.max(basicSuccess, 1);
return Rnd.nextInt(99) < basicSuccess;
return Rnd.get(99) < basicSuccess;
}
}

View File

@ -116,7 +116,7 @@ public class FriendlyNpcAI extends L2AttackableAI
final int combinedCollision = collision + originalAttackTarget.getTemplate().getCollisionRadius();
if (!npc.isMovementDisabled() && (Rnd.nextInt(100) <= 3))
if (!npc.isMovementDisabled() && (Rnd.get(100) <= 3))
{
for (L2Attackable nearby : L2World.getInstance().getVisibleObjects(npc, L2Attackable.class))
{

View File

@ -497,7 +497,7 @@ public class L2AttackableAI extends L2CharacterAI
}
// Chance to forget attackers after some time
if ((npc.getCurrentHp() == npc.getMaxHp()) && (npc.getCurrentMp() == npc.getMaxMp()) && !npc.getAttackByList().isEmpty() && (Rnd.nextInt(500) == 0))
if ((npc.getCurrentHp() == npc.getMaxHp()) && (npc.getCurrentMp() == npc.getMaxMp()) && !npc.getAttackByList().isEmpty() && (Rnd.get(500) == 0))
{
npc.clearAggroList();
npc.getAttackByList().clear();
@ -567,7 +567,7 @@ public class L2AttackableAI extends L2CharacterAI
moveTo(x1, y1, leader.getZ());
return;
}
else if (Rnd.nextInt(RANDOM_WALK_RATE) == 0)
else if (Rnd.get(RANDOM_WALK_RATE) == 0)
{
for (Skill sk : npc.getTemplate().getAISkills(AISkillScope.BUFF))
{
@ -582,7 +582,7 @@ public class L2AttackableAI extends L2CharacterAI
}
}
// Order to the L2MonsterInstance to random walk (1/100)
else if ((npc.getSpawn() != null) && (Rnd.nextInt(RANDOM_WALK_RATE) == 0) && npc.isRandomWalkingEnabled())
else if ((npc.getSpawn() != null) && (Rnd.get(RANDOM_WALK_RATE) == 0) && npc.isRandomWalkingEnabled())
{
int x1 = 0;
int y1 = 0;
@ -610,7 +610,7 @@ public class L2AttackableAI extends L2CharacterAI
}
else
{
final int deltaX = Rnd.nextInt(range * 2); // x
final int deltaX = Rnd.get(range * 2); // x
int deltaY = Rnd.get(deltaX, range * 2); // distance
deltaY = (int) Math.sqrt((deltaY * deltaY) - (deltaX * deltaX)); // y
x1 = (deltaX + x1) - range;
@ -745,7 +745,7 @@ public class L2AttackableAI extends L2CharacterAI
// In case many mobs are trying to hit from same place, move a bit, circling around the target
// Note from Gnacik:
// On l2js because of that sometimes mobs don't attack player only running around player without any sense, so decrease chance for now
if (!npc.isMovementDisabled() && (Rnd.nextInt(100) <= 3))
if (!npc.isMovementDisabled() && (Rnd.get(100) <= 3))
{
for (L2Attackable nearby : L2World.getInstance().getVisibleObjects(npc, L2Attackable.class))
{

View File

@ -63,10 +63,10 @@ public final class L2ControllableMobAI extends L2AttackableAI
if (!Util.checkIfInRange(MobGroupTable.FOLLOW_RANGE, me, getForcedTarget(), true))
{
final int signX = (Rnd.nextInt(2) == 0) ? -1 : 1;
final int signY = (Rnd.nextInt(2) == 0) ? -1 : 1;
final int randX = Rnd.nextInt(MobGroupTable.FOLLOW_RANGE);
final int randY = Rnd.nextInt(MobGroupTable.FOLLOW_RANGE);
final int signX = (Rnd.get(2) == 0) ? -1 : 1;
final int signY = (Rnd.get(2) == 0) ? -1 : 1;
final int randX = Rnd.get(MobGroupTable.FOLLOW_RANGE);
final int randY = Rnd.get(MobGroupTable.FOLLOW_RANGE);
moveTo(getForcedTarget().getX() + (signX * randX), getForcedTarget().getY() + (signY * randY), getForcedTarget().getZ());
}
@ -350,7 +350,7 @@ public final class L2ControllableMobAI extends L2AttackableAI
target = hated;
}
if (!_actor.isMuted() && (Rnd.nextInt(5) == 3))
if (!_actor.isMuted() && (Rnd.get(5) == 3))
{
for (Skill sk : _actor.getAllSkills())
{
@ -449,7 +449,7 @@ public final class L2ControllableMobAI extends L2AttackableAI
}
});
return !potentialTarget.isEmpty() ? potentialTarget.get(Rnd.nextInt(potentialTarget.size())) : null;
return !potentialTarget.isEmpty() ? potentialTarget.get(Rnd.get(potentialTarget.size())) : null;
}
private L2ControllableMobInstance findNextGroupTarget()

View File

@ -308,7 +308,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
if (crop.getStartAmount() != crop.getAmount())
{
long count = (long) ((crop.getStartAmount() - crop.getAmount()) * 0.9);
if ((count < 1) && (Rnd.nextInt(99) < 90))
if ((count < 1) && (Rnd.get(99) < 90))
{
count = 1;
}

View File

@ -68,7 +68,7 @@ public class L2GroupSpawn extends L2Spawn
final L2Npc mob = new L2ControllableMobInstance(_template);
mob.setCurrentHpMp(mob.getMaxHp(), mob.getMaxMp());
mob.setHeading(getHeading() == -1 ? Rnd.nextInt(61794) : getHeading());
mob.setHeading(getHeading() == -1 ? Rnd.get(61794) : getHeading());
mob.setSpawn(this);
mob.spawnMe(newlocx, newlocy, newlocz);

View File

@ -426,7 +426,7 @@ public class L2Spawn extends Location implements IIdentifiable, INamable
// Set the heading of the L2NpcInstance (random heading if not defined)
if (getHeading() == -1)
{
npc.setHeading(Rnd.nextInt(61794));
npc.setHeading(Rnd.get(61794));
}
else
{

View File

@ -150,7 +150,7 @@ public class L2Territory
if (_procMax > 0)
{
int pos = 0;
final int rnd = Rnd.nextInt(_procMax);
final int rnd = Rnd.get(_procMax);
for (Point p1 : _points)
{
pos += p1._proc;

View File

@ -147,10 +147,10 @@ public final class MobGroup
{
final L2GroupSpawn spawn = new L2GroupSpawn(_npcTemplate);
final int signX = (Rnd.nextInt(2) == 0) ? -1 : 1;
final int signY = (Rnd.nextInt(2) == 0) ? -1 : 1;
final int randX = Rnd.nextInt(MobGroupTable.RANDOM_RANGE);
final int randY = Rnd.nextInt(MobGroupTable.RANDOM_RANGE);
final int signX = (Rnd.get(2) == 0) ? -1 : 1;
final int signY = (Rnd.get(2) == 0) ? -1 : 1;
final int randX = Rnd.get(MobGroupTable.RANDOM_RANGE);
final int randY = Rnd.get(MobGroupTable.RANDOM_RANGE);
spawn.setXYZ(x + (signX * randX), y + (signY * randY), z);
spawn.stopRespawn();
@ -185,8 +185,8 @@ public final class MobGroup
if (!mobInst.isDead())
{
final int x = player.getX() + Rnd.nextInt(50);
final int y = player.getY() + Rnd.nextInt(50);
final int x = player.getX() + Rnd.get(50);
final int y = player.getY() + Rnd.get(50);
mobInst.teleToLocation(new Location(x, y, player.getZ()), true);
((L2ControllableMobAI) mobInst.getAI()).follow(player);
@ -203,7 +203,7 @@ public final class MobGroup
return null;
}
int choice = Rnd.nextInt(getMobs().size());
int choice = Rnd.get(getMobs().size());
for (L2ControllableMobInstance mob : getMobs())
{
if (--choice == 0)
@ -321,10 +321,10 @@ public final class MobGroup
continue;
}
final int signX = (Rnd.nextInt(2) == 0) ? -1 : 1;
final int signY = (Rnd.nextInt(2) == 0) ? -1 : 1;
final int randX = Rnd.nextInt(MobGroupTable.RANDOM_RANGE);
final int randY = Rnd.nextInt(MobGroupTable.RANDOM_RANGE);
final int signX = (Rnd.get(2) == 0) ? -1 : 1;
final int signY = (Rnd.get(2) == 0) ? -1 : 1;
final int randX = Rnd.get(MobGroupTable.RANDOM_RANGE);
final int randY = Rnd.get(MobGroupTable.RANDOM_RANGE);
final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI();
ai.move(activeChar.getX() + (signX * randX), activeChar.getY() + (signY * randY), activeChar.getZ());

View File

@ -68,7 +68,7 @@ public class OlympiadGameClassed extends OlympiadGameNormal
Participant[] opponents;
while (!classList.isEmpty())
{
list = classList.get(Rnd.nextInt(classList.size()));
list = classList.get(Rnd.get(classList.size()));
if ((list == null) || (list.size() < 2))
{
classList.remove(list);

View File

@ -76,7 +76,7 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
while (set.size() > 1)
{
int random = Rnd.nextInt(set.size());
int random = Rnd.get(set.size());
Iterator<Integer> iter = set.iterator();
while (iter.hasNext())
{
@ -94,7 +94,7 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
continue;
}
random = Rnd.nextInt(set.size());
random = Rnd.get(set.size());
iter = set.iterator();
while (iter.hasNext())
{

View File

@ -39,7 +39,7 @@ public final class OptionDataCategory
Options result = null;
do
{
double random = Rnd.get() * 100.0;
double random = Rnd.nextDouble() * 100.0;
for (Map.Entry<Options, Double> entry : _options.entrySet())
{
if (entry.getValue() >= random)

View File

@ -37,7 +37,7 @@ public final class OptionDataGroup
Options result = null;
do
{
double random = Rnd.get() * 100.0;
double random = Rnd.nextDouble() * 100.0;
for (OptionDataCategory category : _categories)
{
if (category.getChance() >= random)

View File

@ -138,8 +138,8 @@ public class ZoneCylinder extends L2ZoneForm
@Override
public Location getRandomPoint()
{
final int q = (int) (Rnd.get() * 2 * Math.PI);
final int r = (int) Math.sqrt(Rnd.get());
final int q = (int) (Rnd.nextDouble() * 2 * Math.PI);
final int r = (int) Math.sqrt(Rnd.nextDouble());
final int x = (int) ((_rad * r * Math.cos(q)) + _x);
final int y = (int) ((_rad * r * Math.sin(q)) + _y);

View File

@ -261,7 +261,7 @@ public final class GameServerTable implements IGameXmlReader
*/
public KeyPair getKeyPair()
{
return _keyPairs[Rnd.nextInt(10)];
return _keyPairs[Rnd.get(10)];
}
/**

View File

@ -484,7 +484,7 @@ public class LoginController
*/
public ScrambledKeyPair getScrambledRSAKeyPair()
{
return _keyPairs[Rnd.nextInt(10)];
return _keyPairs[Rnd.get(10)];
}
/**

View File

@ -76,7 +76,7 @@ public final class Confuse extends AbstractEffect
if (!targetList.isEmpty())
{
// Choosing randomly a new target
final L2Character target = targetList.get(Rnd.nextInt(targetList.size()));
final L2Character target = targetList.get(Rnd.get(targetList.size()));
// Attacking the target
effected.setTarget(target);
effected.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);

View File

@ -140,6 +140,6 @@ public final class Harvesting extends AbstractEffect
{
basicSuccess = 1;
}
return Rnd.nextInt(99) < basicSuccess;
return Rnd.get(99) < basicSuccess;
}
}

View File

@ -129,6 +129,6 @@ public final class Sow extends AbstractEffect
// chance can't be less than 1%
Math.max(basicSuccess, 1);
return Rnd.nextInt(99) < basicSuccess;
return Rnd.get(99) < basicSuccess;
}
}

View File

@ -116,7 +116,7 @@ public class FriendlyNpcAI extends L2AttackableAI
final int combinedCollision = collision + originalAttackTarget.getTemplate().getCollisionRadius();
if (!npc.isMovementDisabled() && (Rnd.nextInt(100) <= 3))
if (!npc.isMovementDisabled() && (Rnd.get(100) <= 3))
{
for (L2Attackable nearby : L2World.getInstance().getVisibleObjects(npc, L2Attackable.class))
{

View File

@ -497,7 +497,7 @@ public class L2AttackableAI extends L2CharacterAI
}
// Chance to forget attackers after some time
if ((npc.getCurrentHp() == npc.getMaxHp()) && (npc.getCurrentMp() == npc.getMaxMp()) && !npc.getAttackByList().isEmpty() && (Rnd.nextInt(500) == 0))
if ((npc.getCurrentHp() == npc.getMaxHp()) && (npc.getCurrentMp() == npc.getMaxMp()) && !npc.getAttackByList().isEmpty() && (Rnd.get(500) == 0))
{
npc.clearAggroList();
npc.getAttackByList().clear();
@ -567,7 +567,7 @@ public class L2AttackableAI extends L2CharacterAI
moveTo(x1, y1, leader.getZ());
return;
}
else if (Rnd.nextInt(RANDOM_WALK_RATE) == 0)
else if (Rnd.get(RANDOM_WALK_RATE) == 0)
{
for (Skill sk : npc.getTemplate().getAISkills(AISkillScope.BUFF))
{
@ -582,7 +582,7 @@ public class L2AttackableAI extends L2CharacterAI
}
}
// Order to the L2MonsterInstance to random walk (1/100)
else if ((npc.getSpawn() != null) && (Rnd.nextInt(RANDOM_WALK_RATE) == 0) && npc.isRandomWalkingEnabled())
else if ((npc.getSpawn() != null) && (Rnd.get(RANDOM_WALK_RATE) == 0) && npc.isRandomWalkingEnabled())
{
int x1 = 0;
int y1 = 0;
@ -610,7 +610,7 @@ public class L2AttackableAI extends L2CharacterAI
}
else
{
final int deltaX = Rnd.nextInt(range * 2); // x
final int deltaX = Rnd.get(range * 2); // x
int deltaY = Rnd.get(deltaX, range * 2); // distance
deltaY = (int) Math.sqrt((deltaY * deltaY) - (deltaX * deltaX)); // y
x1 = (deltaX + x1) - range;
@ -745,7 +745,7 @@ public class L2AttackableAI extends L2CharacterAI
// In case many mobs are trying to hit from same place, move a bit, circling around the target
// Note from Gnacik:
// On l2js because of that sometimes mobs don't attack player only running around player without any sense, so decrease chance for now
if (!npc.isMovementDisabled() && (Rnd.nextInt(100) <= 3))
if (!npc.isMovementDisabled() && (Rnd.get(100) <= 3))
{
for (L2Attackable nearby : L2World.getInstance().getVisibleObjects(npc, L2Attackable.class))
{

View File

@ -63,10 +63,10 @@ public final class L2ControllableMobAI extends L2AttackableAI
if (!Util.checkIfInRange(MobGroupTable.FOLLOW_RANGE, me, getForcedTarget(), true))
{
final int signX = (Rnd.nextInt(2) == 0) ? -1 : 1;
final int signY = (Rnd.nextInt(2) == 0) ? -1 : 1;
final int randX = Rnd.nextInt(MobGroupTable.FOLLOW_RANGE);
final int randY = Rnd.nextInt(MobGroupTable.FOLLOW_RANGE);
final int signX = (Rnd.get(2) == 0) ? -1 : 1;
final int signY = (Rnd.get(2) == 0) ? -1 : 1;
final int randX = Rnd.get(MobGroupTable.FOLLOW_RANGE);
final int randY = Rnd.get(MobGroupTable.FOLLOW_RANGE);
moveTo(getForcedTarget().getX() + (signX * randX), getForcedTarget().getY() + (signY * randY), getForcedTarget().getZ());
}
@ -350,7 +350,7 @@ public final class L2ControllableMobAI extends L2AttackableAI
target = hated;
}
if (!_actor.isMuted() && (Rnd.nextInt(5) == 3))
if (!_actor.isMuted() && (Rnd.get(5) == 3))
{
for (Skill sk : _actor.getAllSkills())
{
@ -449,7 +449,7 @@ public final class L2ControllableMobAI extends L2AttackableAI
}
});
return !potentialTarget.isEmpty() ? potentialTarget.get(Rnd.nextInt(potentialTarget.size())) : null;
return !potentialTarget.isEmpty() ? potentialTarget.get(Rnd.get(potentialTarget.size())) : null;
}
private L2ControllableMobInstance findNextGroupTarget()

View File

@ -308,7 +308,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
if (crop.getStartAmount() != crop.getAmount())
{
long count = (long) ((crop.getStartAmount() - crop.getAmount()) * 0.9);
if ((count < 1) && (Rnd.nextInt(99) < 90))
if ((count < 1) && (Rnd.get(99) < 90))
{
count = 1;
}

View File

@ -68,7 +68,7 @@ public class L2GroupSpawn extends L2Spawn
final L2Npc mob = new L2ControllableMobInstance(_template);
mob.setCurrentHpMp(mob.getMaxHp(), mob.getMaxMp());
mob.setHeading(getHeading() == -1 ? Rnd.nextInt(61794) : getHeading());
mob.setHeading(getHeading() == -1 ? Rnd.get(61794) : getHeading());
mob.setSpawn(this);
mob.spawnMe(newlocx, newlocy, newlocz);

View File

@ -426,7 +426,7 @@ public class L2Spawn extends Location implements IIdentifiable, INamable
// Set the heading of the L2NpcInstance (random heading if not defined)
if (getHeading() == -1)
{
npc.setHeading(Rnd.nextInt(61794));
npc.setHeading(Rnd.get(61794));
}
else
{

View File

@ -150,7 +150,7 @@ public class L2Territory
if (_procMax > 0)
{
int pos = 0;
final int rnd = Rnd.nextInt(_procMax);
final int rnd = Rnd.get(_procMax);
for (Point p1 : _points)
{
pos += p1._proc;

Some files were not shown because too many files have changed in this diff Show More