Prohibit the use of duplicate Rnd methods.
This commit is contained in:
@@ -76,7 +76,7 @@ public final class Confuse extends AbstractEffect
|
|||||||
if (!targetList.isEmpty())
|
if (!targetList.isEmpty())
|
||||||
{
|
{
|
||||||
// Choosing randomly a new target
|
// 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
|
// Attacking the target
|
||||||
effected.setTarget(target);
|
effected.setTarget(target);
|
||||||
effected.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
|
effected.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
|
||||||
|
|||||||
@@ -140,6 +140,6 @@ public final class Harvesting extends AbstractEffect
|
|||||||
{
|
{
|
||||||
basicSuccess = 1;
|
basicSuccess = 1;
|
||||||
}
|
}
|
||||||
return Rnd.nextInt(99) < basicSuccess;
|
return Rnd.get(99) < basicSuccess;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -129,6 +129,6 @@ public final class Sow extends AbstractEffect
|
|||||||
|
|
||||||
// chance can't be less than 1%
|
// chance can't be less than 1%
|
||||||
Math.max(basicSuccess, 1);
|
Math.max(basicSuccess, 1);
|
||||||
return Rnd.nextInt(99) < basicSuccess;
|
return Rnd.get(99) < basicSuccess;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ public class FriendlyNpcAI extends L2AttackableAI
|
|||||||
|
|
||||||
final int combinedCollision = collision + originalAttackTarget.getTemplate().getCollisionRadius();
|
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))
|
for (L2Attackable nearby : L2World.getInstance().getVisibleObjects(npc, L2Attackable.class))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -497,7 +497,7 @@ public class L2AttackableAI extends L2CharacterAI
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Chance to forget attackers after some time
|
// 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.clearAggroList();
|
||||||
npc.getAttackByList().clear();
|
npc.getAttackByList().clear();
|
||||||
@@ -567,7 +567,7 @@ public class L2AttackableAI extends L2CharacterAI
|
|||||||
moveTo(x1, y1, leader.getZ());
|
moveTo(x1, y1, leader.getZ());
|
||||||
return;
|
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))
|
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)
|
// 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 x1 = 0;
|
||||||
int y1 = 0;
|
int y1 = 0;
|
||||||
@@ -610,7 +610,7 @@ public class L2AttackableAI extends L2CharacterAI
|
|||||||
}
|
}
|
||||||
else
|
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
|
int deltaY = Rnd.get(deltaX, range * 2); // distance
|
||||||
deltaY = (int) Math.sqrt((deltaY * deltaY) - (deltaX * deltaX)); // y
|
deltaY = (int) Math.sqrt((deltaY * deltaY) - (deltaX * deltaX)); // y
|
||||||
x1 = (deltaX + x1) - range;
|
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
|
// In case many mobs are trying to hit from same place, move a bit, circling around the target
|
||||||
// Note from Gnacik:
|
// 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
|
// 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))
|
for (L2Attackable nearby : L2World.getInstance().getVisibleObjects(npc, L2Attackable.class))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -63,10 +63,10 @@ public final class L2ControllableMobAI extends L2AttackableAI
|
|||||||
|
|
||||||
if (!Util.checkIfInRange(MobGroupTable.FOLLOW_RANGE, me, getForcedTarget(), true))
|
if (!Util.checkIfInRange(MobGroupTable.FOLLOW_RANGE, me, getForcedTarget(), true))
|
||||||
{
|
{
|
||||||
final int signX = (Rnd.nextInt(2) == 0) ? -1 : 1;
|
final int signX = (Rnd.get(2) == 0) ? -1 : 1;
|
||||||
final int signY = (Rnd.nextInt(2) == 0) ? -1 : 1;
|
final int signY = (Rnd.get(2) == 0) ? -1 : 1;
|
||||||
final int randX = Rnd.nextInt(MobGroupTable.FOLLOW_RANGE);
|
final int randX = Rnd.get(MobGroupTable.FOLLOW_RANGE);
|
||||||
final int randY = Rnd.nextInt(MobGroupTable.FOLLOW_RANGE);
|
final int randY = Rnd.get(MobGroupTable.FOLLOW_RANGE);
|
||||||
|
|
||||||
moveTo(getForcedTarget().getX() + (signX * randX), getForcedTarget().getY() + (signY * randY), getForcedTarget().getZ());
|
moveTo(getForcedTarget().getX() + (signX * randX), getForcedTarget().getY() + (signY * randY), getForcedTarget().getZ());
|
||||||
}
|
}
|
||||||
@@ -350,7 +350,7 @@ public final class L2ControllableMobAI extends L2AttackableAI
|
|||||||
target = hated;
|
target = hated;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_actor.isMuted() && (Rnd.nextInt(5) == 3))
|
if (!_actor.isMuted() && (Rnd.get(5) == 3))
|
||||||
{
|
{
|
||||||
for (Skill sk : _actor.getAllSkills())
|
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()
|
private L2ControllableMobInstance findNextGroupTarget()
|
||||||
|
|||||||
@@ -308,7 +308,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
|
|||||||
if (crop.getStartAmount() != crop.getAmount())
|
if (crop.getStartAmount() != crop.getAmount())
|
||||||
{
|
{
|
||||||
long count = (long) ((crop.getStartAmount() - crop.getAmount()) * 0.9);
|
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;
|
count = 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ public class L2GroupSpawn extends L2Spawn
|
|||||||
final L2Npc mob = new L2ControllableMobInstance(_template);
|
final L2Npc mob = new L2ControllableMobInstance(_template);
|
||||||
mob.setCurrentHpMp(mob.getMaxHp(), mob.getMaxMp());
|
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.setSpawn(this);
|
||||||
mob.spawnMe(newlocx, newlocy, newlocz);
|
mob.spawnMe(newlocx, newlocy, newlocz);
|
||||||
|
|||||||
@@ -426,7 +426,7 @@ public class L2Spawn extends Location implements IIdentifiable, INamable
|
|||||||
// Set the heading of the L2NpcInstance (random heading if not defined)
|
// Set the heading of the L2NpcInstance (random heading if not defined)
|
||||||
if (getHeading() == -1)
|
if (getHeading() == -1)
|
||||||
{
|
{
|
||||||
npc.setHeading(Rnd.nextInt(61794));
|
npc.setHeading(Rnd.get(61794));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ public class L2Territory
|
|||||||
if (_procMax > 0)
|
if (_procMax > 0)
|
||||||
{
|
{
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
final int rnd = Rnd.nextInt(_procMax);
|
final int rnd = Rnd.get(_procMax);
|
||||||
for (Point p1 : _points)
|
for (Point p1 : _points)
|
||||||
{
|
{
|
||||||
pos += p1._proc;
|
pos += p1._proc;
|
||||||
|
|||||||
@@ -147,10 +147,10 @@ public final class MobGroup
|
|||||||
{
|
{
|
||||||
final L2GroupSpawn spawn = new L2GroupSpawn(_npcTemplate);
|
final L2GroupSpawn spawn = new L2GroupSpawn(_npcTemplate);
|
||||||
|
|
||||||
final int signX = (Rnd.nextInt(2) == 0) ? -1 : 1;
|
final int signX = (Rnd.get(2) == 0) ? -1 : 1;
|
||||||
final int signY = (Rnd.nextInt(2) == 0) ? -1 : 1;
|
final int signY = (Rnd.get(2) == 0) ? -1 : 1;
|
||||||
final int randX = Rnd.nextInt(MobGroupTable.RANDOM_RANGE);
|
final int randX = Rnd.get(MobGroupTable.RANDOM_RANGE);
|
||||||
final int randY = Rnd.nextInt(MobGroupTable.RANDOM_RANGE);
|
final int randY = Rnd.get(MobGroupTable.RANDOM_RANGE);
|
||||||
|
|
||||||
spawn.setXYZ(x + (signX * randX), y + (signY * randY), z);
|
spawn.setXYZ(x + (signX * randX), y + (signY * randY), z);
|
||||||
spawn.stopRespawn();
|
spawn.stopRespawn();
|
||||||
@@ -185,8 +185,8 @@ public final class MobGroup
|
|||||||
|
|
||||||
if (!mobInst.isDead())
|
if (!mobInst.isDead())
|
||||||
{
|
{
|
||||||
final int x = player.getX() + Rnd.nextInt(50);
|
final int x = player.getX() + Rnd.get(50);
|
||||||
final int y = player.getY() + Rnd.nextInt(50);
|
final int y = player.getY() + Rnd.get(50);
|
||||||
|
|
||||||
mobInst.teleToLocation(new Location(x, y, player.getZ()), true);
|
mobInst.teleToLocation(new Location(x, y, player.getZ()), true);
|
||||||
((L2ControllableMobAI) mobInst.getAI()).follow(player);
|
((L2ControllableMobAI) mobInst.getAI()).follow(player);
|
||||||
@@ -203,7 +203,7 @@ public final class MobGroup
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
int choice = Rnd.nextInt(getMobs().size());
|
int choice = Rnd.get(getMobs().size());
|
||||||
for (L2ControllableMobInstance mob : getMobs())
|
for (L2ControllableMobInstance mob : getMobs())
|
||||||
{
|
{
|
||||||
if (--choice == 0)
|
if (--choice == 0)
|
||||||
@@ -321,10 +321,10 @@ public final class MobGroup
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
final int signX = (Rnd.nextInt(2) == 0) ? -1 : 1;
|
final int signX = (Rnd.get(2) == 0) ? -1 : 1;
|
||||||
final int signY = (Rnd.nextInt(2) == 0) ? -1 : 1;
|
final int signY = (Rnd.get(2) == 0) ? -1 : 1;
|
||||||
final int randX = Rnd.nextInt(MobGroupTable.RANDOM_RANGE);
|
final int randX = Rnd.get(MobGroupTable.RANDOM_RANGE);
|
||||||
final int randY = Rnd.nextInt(MobGroupTable.RANDOM_RANGE);
|
final int randY = Rnd.get(MobGroupTable.RANDOM_RANGE);
|
||||||
|
|
||||||
final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI();
|
final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI();
|
||||||
ai.move(activeChar.getX() + (signX * randX), activeChar.getY() + (signY * randY), activeChar.getZ());
|
ai.move(activeChar.getX() + (signX * randX), activeChar.getY() + (signY * randY), activeChar.getZ());
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ public class OlympiadGameClassed extends OlympiadGameNormal
|
|||||||
Participant[] opponents;
|
Participant[] opponents;
|
||||||
while (!classList.isEmpty())
|
while (!classList.isEmpty())
|
||||||
{
|
{
|
||||||
list = classList.get(Rnd.nextInt(classList.size()));
|
list = classList.get(Rnd.get(classList.size()));
|
||||||
if ((list == null) || (list.size() < 2))
|
if ((list == null) || (list.size() < 2))
|
||||||
{
|
{
|
||||||
classList.remove(list);
|
classList.remove(list);
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
|
|||||||
|
|
||||||
while (set.size() > 1)
|
while (set.size() > 1)
|
||||||
{
|
{
|
||||||
int random = Rnd.nextInt(set.size());
|
int random = Rnd.get(set.size());
|
||||||
Iterator<Integer> iter = set.iterator();
|
Iterator<Integer> iter = set.iterator();
|
||||||
while (iter.hasNext())
|
while (iter.hasNext())
|
||||||
{
|
{
|
||||||
@@ -94,7 +94,7 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
random = Rnd.nextInt(set.size());
|
random = Rnd.get(set.size());
|
||||||
iter = set.iterator();
|
iter = set.iterator();
|
||||||
while (iter.hasNext())
|
while (iter.hasNext())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ public final class OptionDataCategory
|
|||||||
Options result = null;
|
Options result = null;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
double random = Rnd.get() * 100.0;
|
double random = Rnd.nextDouble() * 100.0;
|
||||||
for (Map.Entry<Options, Double> entry : _options.entrySet())
|
for (Map.Entry<Options, Double> entry : _options.entrySet())
|
||||||
{
|
{
|
||||||
if (entry.getValue() >= random)
|
if (entry.getValue() >= random)
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public final class OptionDataGroup
|
|||||||
Options result = null;
|
Options result = null;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
double random = Rnd.get() * 100.0;
|
double random = Rnd.nextDouble() * 100.0;
|
||||||
for (OptionDataCategory category : _categories)
|
for (OptionDataCategory category : _categories)
|
||||||
{
|
{
|
||||||
if (category.getChance() >= random)
|
if (category.getChance() >= random)
|
||||||
|
|||||||
@@ -138,8 +138,8 @@ public class ZoneCylinder extends L2ZoneForm
|
|||||||
@Override
|
@Override
|
||||||
public Location getRandomPoint()
|
public Location getRandomPoint()
|
||||||
{
|
{
|
||||||
final int q = (int) (Rnd.get() * 2 * Math.PI);
|
final int q = (int) (Rnd.nextDouble() * 2 * Math.PI);
|
||||||
final int r = (int) Math.sqrt(Rnd.get());
|
final int r = (int) Math.sqrt(Rnd.nextDouble());
|
||||||
final int x = (int) ((_rad * r * Math.cos(q)) + _x);
|
final int x = (int) ((_rad * r * Math.cos(q)) + _x);
|
||||||
final int y = (int) ((_rad * r * Math.sin(q)) + _y);
|
final int y = (int) ((_rad * r * Math.sin(q)) + _y);
|
||||||
|
|
||||||
|
|||||||
@@ -261,7 +261,7 @@ public final class GameServerTable implements IGameXmlReader
|
|||||||
*/
|
*/
|
||||||
public KeyPair getKeyPair()
|
public KeyPair getKeyPair()
|
||||||
{
|
{
|
||||||
return _keyPairs[Rnd.nextInt(10)];
|
return _keyPairs[Rnd.get(10)];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -484,7 +484,7 @@ public class LoginController
|
|||||||
*/
|
*/
|
||||||
public ScrambledKeyPair getScrambledRSAKeyPair()
|
public ScrambledKeyPair getScrambledRSAKeyPair()
|
||||||
{
|
{
|
||||||
return _keyPairs[Rnd.nextInt(10)];
|
return _keyPairs[Rnd.get(10)];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ public final class Confuse extends AbstractEffect
|
|||||||
if (!targetList.isEmpty())
|
if (!targetList.isEmpty())
|
||||||
{
|
{
|
||||||
// Choosing randomly a new target
|
// 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
|
// Attacking the target
|
||||||
effected.setTarget(target);
|
effected.setTarget(target);
|
||||||
effected.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
|
effected.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
|
||||||
|
|||||||
@@ -140,6 +140,6 @@ public final class Harvesting extends AbstractEffect
|
|||||||
{
|
{
|
||||||
basicSuccess = 1;
|
basicSuccess = 1;
|
||||||
}
|
}
|
||||||
return Rnd.nextInt(99) < basicSuccess;
|
return Rnd.get(99) < basicSuccess;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -129,6 +129,6 @@ public final class Sow extends AbstractEffect
|
|||||||
|
|
||||||
// chance can't be less than 1%
|
// chance can't be less than 1%
|
||||||
Math.max(basicSuccess, 1);
|
Math.max(basicSuccess, 1);
|
||||||
return Rnd.nextInt(99) < basicSuccess;
|
return Rnd.get(99) < basicSuccess;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ public class FriendlyNpcAI extends L2AttackableAI
|
|||||||
|
|
||||||
final int combinedCollision = collision + originalAttackTarget.getTemplate().getCollisionRadius();
|
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))
|
for (L2Attackable nearby : L2World.getInstance().getVisibleObjects(npc, L2Attackable.class))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -497,7 +497,7 @@ public class L2AttackableAI extends L2CharacterAI
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Chance to forget attackers after some time
|
// 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.clearAggroList();
|
||||||
npc.getAttackByList().clear();
|
npc.getAttackByList().clear();
|
||||||
@@ -567,7 +567,7 @@ public class L2AttackableAI extends L2CharacterAI
|
|||||||
moveTo(x1, y1, leader.getZ());
|
moveTo(x1, y1, leader.getZ());
|
||||||
return;
|
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))
|
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)
|
// 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 x1 = 0;
|
||||||
int y1 = 0;
|
int y1 = 0;
|
||||||
@@ -610,7 +610,7 @@ public class L2AttackableAI extends L2CharacterAI
|
|||||||
}
|
}
|
||||||
else
|
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
|
int deltaY = Rnd.get(deltaX, range * 2); // distance
|
||||||
deltaY = (int) Math.sqrt((deltaY * deltaY) - (deltaX * deltaX)); // y
|
deltaY = (int) Math.sqrt((deltaY * deltaY) - (deltaX * deltaX)); // y
|
||||||
x1 = (deltaX + x1) - range;
|
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
|
// In case many mobs are trying to hit from same place, move a bit, circling around the target
|
||||||
// Note from Gnacik:
|
// 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
|
// 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))
|
for (L2Attackable nearby : L2World.getInstance().getVisibleObjects(npc, L2Attackable.class))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -63,10 +63,10 @@ public final class L2ControllableMobAI extends L2AttackableAI
|
|||||||
|
|
||||||
if (!Util.checkIfInRange(MobGroupTable.FOLLOW_RANGE, me, getForcedTarget(), true))
|
if (!Util.checkIfInRange(MobGroupTable.FOLLOW_RANGE, me, getForcedTarget(), true))
|
||||||
{
|
{
|
||||||
final int signX = (Rnd.nextInt(2) == 0) ? -1 : 1;
|
final int signX = (Rnd.get(2) == 0) ? -1 : 1;
|
||||||
final int signY = (Rnd.nextInt(2) == 0) ? -1 : 1;
|
final int signY = (Rnd.get(2) == 0) ? -1 : 1;
|
||||||
final int randX = Rnd.nextInt(MobGroupTable.FOLLOW_RANGE);
|
final int randX = Rnd.get(MobGroupTable.FOLLOW_RANGE);
|
||||||
final int randY = Rnd.nextInt(MobGroupTable.FOLLOW_RANGE);
|
final int randY = Rnd.get(MobGroupTable.FOLLOW_RANGE);
|
||||||
|
|
||||||
moveTo(getForcedTarget().getX() + (signX * randX), getForcedTarget().getY() + (signY * randY), getForcedTarget().getZ());
|
moveTo(getForcedTarget().getX() + (signX * randX), getForcedTarget().getY() + (signY * randY), getForcedTarget().getZ());
|
||||||
}
|
}
|
||||||
@@ -350,7 +350,7 @@ public final class L2ControllableMobAI extends L2AttackableAI
|
|||||||
target = hated;
|
target = hated;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_actor.isMuted() && (Rnd.nextInt(5) == 3))
|
if (!_actor.isMuted() && (Rnd.get(5) == 3))
|
||||||
{
|
{
|
||||||
for (Skill sk : _actor.getAllSkills())
|
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()
|
private L2ControllableMobInstance findNextGroupTarget()
|
||||||
|
|||||||
@@ -308,7 +308,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
|
|||||||
if (crop.getStartAmount() != crop.getAmount())
|
if (crop.getStartAmount() != crop.getAmount())
|
||||||
{
|
{
|
||||||
long count = (long) ((crop.getStartAmount() - crop.getAmount()) * 0.9);
|
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;
|
count = 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ public class L2GroupSpawn extends L2Spawn
|
|||||||
final L2Npc mob = new L2ControllableMobInstance(_template);
|
final L2Npc mob = new L2ControllableMobInstance(_template);
|
||||||
mob.setCurrentHpMp(mob.getMaxHp(), mob.getMaxMp());
|
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.setSpawn(this);
|
||||||
mob.spawnMe(newlocx, newlocy, newlocz);
|
mob.spawnMe(newlocx, newlocy, newlocz);
|
||||||
|
|||||||
@@ -426,7 +426,7 @@ public class L2Spawn extends Location implements IIdentifiable, INamable
|
|||||||
// Set the heading of the L2NpcInstance (random heading if not defined)
|
// Set the heading of the L2NpcInstance (random heading if not defined)
|
||||||
if (getHeading() == -1)
|
if (getHeading() == -1)
|
||||||
{
|
{
|
||||||
npc.setHeading(Rnd.nextInt(61794));
|
npc.setHeading(Rnd.get(61794));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ public class L2Territory
|
|||||||
if (_procMax > 0)
|
if (_procMax > 0)
|
||||||
{
|
{
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
final int rnd = Rnd.nextInt(_procMax);
|
final int rnd = Rnd.get(_procMax);
|
||||||
for (Point p1 : _points)
|
for (Point p1 : _points)
|
||||||
{
|
{
|
||||||
pos += p1._proc;
|
pos += p1._proc;
|
||||||
|
|||||||
@@ -147,10 +147,10 @@ public final class MobGroup
|
|||||||
{
|
{
|
||||||
final L2GroupSpawn spawn = new L2GroupSpawn(_npcTemplate);
|
final L2GroupSpawn spawn = new L2GroupSpawn(_npcTemplate);
|
||||||
|
|
||||||
final int signX = (Rnd.nextInt(2) == 0) ? -1 : 1;
|
final int signX = (Rnd.get(2) == 0) ? -1 : 1;
|
||||||
final int signY = (Rnd.nextInt(2) == 0) ? -1 : 1;
|
final int signY = (Rnd.get(2) == 0) ? -1 : 1;
|
||||||
final int randX = Rnd.nextInt(MobGroupTable.RANDOM_RANGE);
|
final int randX = Rnd.get(MobGroupTable.RANDOM_RANGE);
|
||||||
final int randY = Rnd.nextInt(MobGroupTable.RANDOM_RANGE);
|
final int randY = Rnd.get(MobGroupTable.RANDOM_RANGE);
|
||||||
|
|
||||||
spawn.setXYZ(x + (signX * randX), y + (signY * randY), z);
|
spawn.setXYZ(x + (signX * randX), y + (signY * randY), z);
|
||||||
spawn.stopRespawn();
|
spawn.stopRespawn();
|
||||||
@@ -185,8 +185,8 @@ public final class MobGroup
|
|||||||
|
|
||||||
if (!mobInst.isDead())
|
if (!mobInst.isDead())
|
||||||
{
|
{
|
||||||
final int x = player.getX() + Rnd.nextInt(50);
|
final int x = player.getX() + Rnd.get(50);
|
||||||
final int y = player.getY() + Rnd.nextInt(50);
|
final int y = player.getY() + Rnd.get(50);
|
||||||
|
|
||||||
mobInst.teleToLocation(new Location(x, y, player.getZ()), true);
|
mobInst.teleToLocation(new Location(x, y, player.getZ()), true);
|
||||||
((L2ControllableMobAI) mobInst.getAI()).follow(player);
|
((L2ControllableMobAI) mobInst.getAI()).follow(player);
|
||||||
@@ -203,7 +203,7 @@ public final class MobGroup
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
int choice = Rnd.nextInt(getMobs().size());
|
int choice = Rnd.get(getMobs().size());
|
||||||
for (L2ControllableMobInstance mob : getMobs())
|
for (L2ControllableMobInstance mob : getMobs())
|
||||||
{
|
{
|
||||||
if (--choice == 0)
|
if (--choice == 0)
|
||||||
@@ -321,10 +321,10 @@ public final class MobGroup
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
final int signX = (Rnd.nextInt(2) == 0) ? -1 : 1;
|
final int signX = (Rnd.get(2) == 0) ? -1 : 1;
|
||||||
final int signY = (Rnd.nextInt(2) == 0) ? -1 : 1;
|
final int signY = (Rnd.get(2) == 0) ? -1 : 1;
|
||||||
final int randX = Rnd.nextInt(MobGroupTable.RANDOM_RANGE);
|
final int randX = Rnd.get(MobGroupTable.RANDOM_RANGE);
|
||||||
final int randY = Rnd.nextInt(MobGroupTable.RANDOM_RANGE);
|
final int randY = Rnd.get(MobGroupTable.RANDOM_RANGE);
|
||||||
|
|
||||||
final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI();
|
final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI();
|
||||||
ai.move(activeChar.getX() + (signX * randX), activeChar.getY() + (signY * randY), activeChar.getZ());
|
ai.move(activeChar.getX() + (signX * randX), activeChar.getY() + (signY * randY), activeChar.getZ());
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ public class OlympiadGameClassed extends OlympiadGameNormal
|
|||||||
Participant[] opponents;
|
Participant[] opponents;
|
||||||
while (!classList.isEmpty())
|
while (!classList.isEmpty())
|
||||||
{
|
{
|
||||||
list = classList.get(Rnd.nextInt(classList.size()));
|
list = classList.get(Rnd.get(classList.size()));
|
||||||
if ((list == null) || (list.size() < 2))
|
if ((list == null) || (list.size() < 2))
|
||||||
{
|
{
|
||||||
classList.remove(list);
|
classList.remove(list);
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
|
|||||||
|
|
||||||
while (set.size() > 1)
|
while (set.size() > 1)
|
||||||
{
|
{
|
||||||
int random = Rnd.nextInt(set.size());
|
int random = Rnd.get(set.size());
|
||||||
Iterator<Integer> iter = set.iterator();
|
Iterator<Integer> iter = set.iterator();
|
||||||
while (iter.hasNext())
|
while (iter.hasNext())
|
||||||
{
|
{
|
||||||
@@ -94,7 +94,7 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
random = Rnd.nextInt(set.size());
|
random = Rnd.get(set.size());
|
||||||
iter = set.iterator();
|
iter = set.iterator();
|
||||||
while (iter.hasNext())
|
while (iter.hasNext())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ public final class OptionDataCategory
|
|||||||
Options result = null;
|
Options result = null;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
double random = Rnd.get() * 100.0;
|
double random = Rnd.nextDouble() * 100.0;
|
||||||
for (Map.Entry<Options, Double> entry : _options.entrySet())
|
for (Map.Entry<Options, Double> entry : _options.entrySet())
|
||||||
{
|
{
|
||||||
if (entry.getValue() >= random)
|
if (entry.getValue() >= random)
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public final class OptionDataGroup
|
|||||||
Options result = null;
|
Options result = null;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
double random = Rnd.get() * 100.0;
|
double random = Rnd.nextDouble() * 100.0;
|
||||||
for (OptionDataCategory category : _categories)
|
for (OptionDataCategory category : _categories)
|
||||||
{
|
{
|
||||||
if (category.getChance() >= random)
|
if (category.getChance() >= random)
|
||||||
|
|||||||
@@ -138,8 +138,8 @@ public class ZoneCylinder extends L2ZoneForm
|
|||||||
@Override
|
@Override
|
||||||
public Location getRandomPoint()
|
public Location getRandomPoint()
|
||||||
{
|
{
|
||||||
final int q = (int) (Rnd.get() * 2 * Math.PI);
|
final int q = (int) (Rnd.nextDouble() * 2 * Math.PI);
|
||||||
final int r = (int) Math.sqrt(Rnd.get());
|
final int r = (int) Math.sqrt(Rnd.nextDouble());
|
||||||
final int x = (int) ((_rad * r * Math.cos(q)) + _x);
|
final int x = (int) ((_rad * r * Math.cos(q)) + _x);
|
||||||
final int y = (int) ((_rad * r * Math.sin(q)) + _y);
|
final int y = (int) ((_rad * r * Math.sin(q)) + _y);
|
||||||
|
|
||||||
|
|||||||
@@ -261,7 +261,7 @@ public final class GameServerTable implements IGameXmlReader
|
|||||||
*/
|
*/
|
||||||
public KeyPair getKeyPair()
|
public KeyPair getKeyPair()
|
||||||
{
|
{
|
||||||
return _keyPairs[Rnd.nextInt(10)];
|
return _keyPairs[Rnd.get(10)];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -484,7 +484,7 @@ public class LoginController
|
|||||||
*/
|
*/
|
||||||
public ScrambledKeyPair getScrambledRSAKeyPair()
|
public ScrambledKeyPair getScrambledRSAKeyPair()
|
||||||
{
|
{
|
||||||
return _keyPairs[Rnd.nextInt(10)];
|
return _keyPairs[Rnd.get(10)];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ public final class Confuse extends AbstractEffect
|
|||||||
if (!targetList.isEmpty())
|
if (!targetList.isEmpty())
|
||||||
{
|
{
|
||||||
// Choosing randomly a new target
|
// 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
|
// Attacking the target
|
||||||
effected.setTarget(target);
|
effected.setTarget(target);
|
||||||
effected.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
|
effected.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
|
||||||
|
|||||||
@@ -140,6 +140,6 @@ public final class Harvesting extends AbstractEffect
|
|||||||
{
|
{
|
||||||
basicSuccess = 1;
|
basicSuccess = 1;
|
||||||
}
|
}
|
||||||
return Rnd.nextInt(99) < basicSuccess;
|
return Rnd.get(99) < basicSuccess;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -129,6 +129,6 @@ public final class Sow extends AbstractEffect
|
|||||||
|
|
||||||
// chance can't be less than 1%
|
// chance can't be less than 1%
|
||||||
Math.max(basicSuccess, 1);
|
Math.max(basicSuccess, 1);
|
||||||
return Rnd.nextInt(99) < basicSuccess;
|
return Rnd.get(99) < basicSuccess;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ public class FriendlyNpcAI extends L2AttackableAI
|
|||||||
|
|
||||||
final int combinedCollision = collision + originalAttackTarget.getTemplate().getCollisionRadius();
|
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))
|
for (L2Attackable nearby : L2World.getInstance().getVisibleObjects(npc, L2Attackable.class))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -497,7 +497,7 @@ public class L2AttackableAI extends L2CharacterAI
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Chance to forget attackers after some time
|
// 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.clearAggroList();
|
||||||
npc.getAttackByList().clear();
|
npc.getAttackByList().clear();
|
||||||
@@ -567,7 +567,7 @@ public class L2AttackableAI extends L2CharacterAI
|
|||||||
moveTo(x1, y1, leader.getZ());
|
moveTo(x1, y1, leader.getZ());
|
||||||
return;
|
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))
|
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)
|
// 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 x1 = 0;
|
||||||
int y1 = 0;
|
int y1 = 0;
|
||||||
@@ -610,7 +610,7 @@ public class L2AttackableAI extends L2CharacterAI
|
|||||||
}
|
}
|
||||||
else
|
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
|
int deltaY = Rnd.get(deltaX, range * 2); // distance
|
||||||
deltaY = (int) Math.sqrt((deltaY * deltaY) - (deltaX * deltaX)); // y
|
deltaY = (int) Math.sqrt((deltaY * deltaY) - (deltaX * deltaX)); // y
|
||||||
x1 = (deltaX + x1) - range;
|
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
|
// In case many mobs are trying to hit from same place, move a bit, circling around the target
|
||||||
// Note from Gnacik:
|
// 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
|
// 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))
|
for (L2Attackable nearby : L2World.getInstance().getVisibleObjects(npc, L2Attackable.class))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -63,10 +63,10 @@ public final class L2ControllableMobAI extends L2AttackableAI
|
|||||||
|
|
||||||
if (!Util.checkIfInRange(MobGroupTable.FOLLOW_RANGE, me, getForcedTarget(), true))
|
if (!Util.checkIfInRange(MobGroupTable.FOLLOW_RANGE, me, getForcedTarget(), true))
|
||||||
{
|
{
|
||||||
final int signX = (Rnd.nextInt(2) == 0) ? -1 : 1;
|
final int signX = (Rnd.get(2) == 0) ? -1 : 1;
|
||||||
final int signY = (Rnd.nextInt(2) == 0) ? -1 : 1;
|
final int signY = (Rnd.get(2) == 0) ? -1 : 1;
|
||||||
final int randX = Rnd.nextInt(MobGroupTable.FOLLOW_RANGE);
|
final int randX = Rnd.get(MobGroupTable.FOLLOW_RANGE);
|
||||||
final int randY = Rnd.nextInt(MobGroupTable.FOLLOW_RANGE);
|
final int randY = Rnd.get(MobGroupTable.FOLLOW_RANGE);
|
||||||
|
|
||||||
moveTo(getForcedTarget().getX() + (signX * randX), getForcedTarget().getY() + (signY * randY), getForcedTarget().getZ());
|
moveTo(getForcedTarget().getX() + (signX * randX), getForcedTarget().getY() + (signY * randY), getForcedTarget().getZ());
|
||||||
}
|
}
|
||||||
@@ -350,7 +350,7 @@ public final class L2ControllableMobAI extends L2AttackableAI
|
|||||||
target = hated;
|
target = hated;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_actor.isMuted() && (Rnd.nextInt(5) == 3))
|
if (!_actor.isMuted() && (Rnd.get(5) == 3))
|
||||||
{
|
{
|
||||||
for (Skill sk : _actor.getAllSkills())
|
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()
|
private L2ControllableMobInstance findNextGroupTarget()
|
||||||
|
|||||||
@@ -308,7 +308,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
|
|||||||
if (crop.getStartAmount() != crop.getAmount())
|
if (crop.getStartAmount() != crop.getAmount())
|
||||||
{
|
{
|
||||||
long count = (long) ((crop.getStartAmount() - crop.getAmount()) * 0.9);
|
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;
|
count = 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ public class L2GroupSpawn extends L2Spawn
|
|||||||
final L2Npc mob = new L2ControllableMobInstance(_template);
|
final L2Npc mob = new L2ControllableMobInstance(_template);
|
||||||
mob.setCurrentHpMp(mob.getMaxHp(), mob.getMaxMp());
|
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.setSpawn(this);
|
||||||
mob.spawnMe(newlocx, newlocy, newlocz);
|
mob.spawnMe(newlocx, newlocy, newlocz);
|
||||||
|
|||||||
@@ -426,7 +426,7 @@ public class L2Spawn extends Location implements IIdentifiable, INamable
|
|||||||
// Set the heading of the L2NpcInstance (random heading if not defined)
|
// Set the heading of the L2NpcInstance (random heading if not defined)
|
||||||
if (getHeading() == -1)
|
if (getHeading() == -1)
|
||||||
{
|
{
|
||||||
npc.setHeading(Rnd.nextInt(61794));
|
npc.setHeading(Rnd.get(61794));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ public class L2Territory
|
|||||||
if (_procMax > 0)
|
if (_procMax > 0)
|
||||||
{
|
{
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
final int rnd = Rnd.nextInt(_procMax);
|
final int rnd = Rnd.get(_procMax);
|
||||||
for (Point p1 : _points)
|
for (Point p1 : _points)
|
||||||
{
|
{
|
||||||
pos += p1._proc;
|
pos += p1._proc;
|
||||||
|
|||||||
@@ -147,10 +147,10 @@ public final class MobGroup
|
|||||||
{
|
{
|
||||||
final L2GroupSpawn spawn = new L2GroupSpawn(_npcTemplate);
|
final L2GroupSpawn spawn = new L2GroupSpawn(_npcTemplate);
|
||||||
|
|
||||||
final int signX = (Rnd.nextInt(2) == 0) ? -1 : 1;
|
final int signX = (Rnd.get(2) == 0) ? -1 : 1;
|
||||||
final int signY = (Rnd.nextInt(2) == 0) ? -1 : 1;
|
final int signY = (Rnd.get(2) == 0) ? -1 : 1;
|
||||||
final int randX = Rnd.nextInt(MobGroupTable.RANDOM_RANGE);
|
final int randX = Rnd.get(MobGroupTable.RANDOM_RANGE);
|
||||||
final int randY = Rnd.nextInt(MobGroupTable.RANDOM_RANGE);
|
final int randY = Rnd.get(MobGroupTable.RANDOM_RANGE);
|
||||||
|
|
||||||
spawn.setXYZ(x + (signX * randX), y + (signY * randY), z);
|
spawn.setXYZ(x + (signX * randX), y + (signY * randY), z);
|
||||||
spawn.stopRespawn();
|
spawn.stopRespawn();
|
||||||
@@ -185,8 +185,8 @@ public final class MobGroup
|
|||||||
|
|
||||||
if (!mobInst.isDead())
|
if (!mobInst.isDead())
|
||||||
{
|
{
|
||||||
final int x = player.getX() + Rnd.nextInt(50);
|
final int x = player.getX() + Rnd.get(50);
|
||||||
final int y = player.getY() + Rnd.nextInt(50);
|
final int y = player.getY() + Rnd.get(50);
|
||||||
|
|
||||||
mobInst.teleToLocation(new Location(x, y, player.getZ()), true);
|
mobInst.teleToLocation(new Location(x, y, player.getZ()), true);
|
||||||
((L2ControllableMobAI) mobInst.getAI()).follow(player);
|
((L2ControllableMobAI) mobInst.getAI()).follow(player);
|
||||||
@@ -203,7 +203,7 @@ public final class MobGroup
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
int choice = Rnd.nextInt(getMobs().size());
|
int choice = Rnd.get(getMobs().size());
|
||||||
for (L2ControllableMobInstance mob : getMobs())
|
for (L2ControllableMobInstance mob : getMobs())
|
||||||
{
|
{
|
||||||
if (--choice == 0)
|
if (--choice == 0)
|
||||||
@@ -321,10 +321,10 @@ public final class MobGroup
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
final int signX = (Rnd.nextInt(2) == 0) ? -1 : 1;
|
final int signX = (Rnd.get(2) == 0) ? -1 : 1;
|
||||||
final int signY = (Rnd.nextInt(2) == 0) ? -1 : 1;
|
final int signY = (Rnd.get(2) == 0) ? -1 : 1;
|
||||||
final int randX = Rnd.nextInt(MobGroupTable.RANDOM_RANGE);
|
final int randX = Rnd.get(MobGroupTable.RANDOM_RANGE);
|
||||||
final int randY = Rnd.nextInt(MobGroupTable.RANDOM_RANGE);
|
final int randY = Rnd.get(MobGroupTable.RANDOM_RANGE);
|
||||||
|
|
||||||
final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI();
|
final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI();
|
||||||
ai.move(activeChar.getX() + (signX * randX), activeChar.getY() + (signY * randY), activeChar.getZ());
|
ai.move(activeChar.getX() + (signX * randX), activeChar.getY() + (signY * randY), activeChar.getZ());
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ public class OlympiadGameClassed extends OlympiadGameNormal
|
|||||||
Participant[] opponents;
|
Participant[] opponents;
|
||||||
while (!classList.isEmpty())
|
while (!classList.isEmpty())
|
||||||
{
|
{
|
||||||
list = classList.get(Rnd.nextInt(classList.size()));
|
list = classList.get(Rnd.get(classList.size()));
|
||||||
if ((list == null) || (list.size() < 2))
|
if ((list == null) || (list.size() < 2))
|
||||||
{
|
{
|
||||||
classList.remove(list);
|
classList.remove(list);
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
|
|||||||
|
|
||||||
while (set.size() > 1)
|
while (set.size() > 1)
|
||||||
{
|
{
|
||||||
int random = Rnd.nextInt(set.size());
|
int random = Rnd.get(set.size());
|
||||||
Iterator<Integer> iter = set.iterator();
|
Iterator<Integer> iter = set.iterator();
|
||||||
while (iter.hasNext())
|
while (iter.hasNext())
|
||||||
{
|
{
|
||||||
@@ -94,7 +94,7 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
random = Rnd.nextInt(set.size());
|
random = Rnd.get(set.size());
|
||||||
iter = set.iterator();
|
iter = set.iterator();
|
||||||
while (iter.hasNext())
|
while (iter.hasNext())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ public final class OptionDataCategory
|
|||||||
Options result = null;
|
Options result = null;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
double random = Rnd.get() * 100.0;
|
double random = Rnd.nextDouble() * 100.0;
|
||||||
for (Map.Entry<Options, Double> entry : _options.entrySet())
|
for (Map.Entry<Options, Double> entry : _options.entrySet())
|
||||||
{
|
{
|
||||||
if (entry.getValue() >= random)
|
if (entry.getValue() >= random)
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public final class OptionDataGroup
|
|||||||
Options result = null;
|
Options result = null;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
double random = Rnd.get() * 100.0;
|
double random = Rnd.nextDouble() * 100.0;
|
||||||
for (OptionDataCategory category : _categories)
|
for (OptionDataCategory category : _categories)
|
||||||
{
|
{
|
||||||
if (category.getChance() >= random)
|
if (category.getChance() >= random)
|
||||||
|
|||||||
@@ -138,8 +138,8 @@ public class ZoneCylinder extends L2ZoneForm
|
|||||||
@Override
|
@Override
|
||||||
public Location getRandomPoint()
|
public Location getRandomPoint()
|
||||||
{
|
{
|
||||||
final int q = (int) (Rnd.get() * 2 * Math.PI);
|
final int q = (int) (Rnd.nextDouble() * 2 * Math.PI);
|
||||||
final int r = (int) Math.sqrt(Rnd.get());
|
final int r = (int) Math.sqrt(Rnd.nextDouble());
|
||||||
final int x = (int) ((_rad * r * Math.cos(q)) + _x);
|
final int x = (int) ((_rad * r * Math.cos(q)) + _x);
|
||||||
final int y = (int) ((_rad * r * Math.sin(q)) + _y);
|
final int y = (int) ((_rad * r * Math.sin(q)) + _y);
|
||||||
|
|
||||||
|
|||||||
@@ -261,7 +261,7 @@ public final class GameServerTable implements IGameXmlReader
|
|||||||
*/
|
*/
|
||||||
public KeyPair getKeyPair()
|
public KeyPair getKeyPair()
|
||||||
{
|
{
|
||||||
return _keyPairs[Rnd.nextInt(10)];
|
return _keyPairs[Rnd.get(10)];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -484,7 +484,7 @@ public class LoginController
|
|||||||
*/
|
*/
|
||||||
public ScrambledKeyPair getScrambledRSAKeyPair()
|
public ScrambledKeyPair getScrambledRSAKeyPair()
|
||||||
{
|
{
|
||||||
return _keyPairs[Rnd.nextInt(10)];
|
return _keyPairs[Rnd.get(10)];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ public final class Confuse extends AbstractEffect
|
|||||||
if (!targetList.isEmpty())
|
if (!targetList.isEmpty())
|
||||||
{
|
{
|
||||||
// Choosing randomly a new target
|
// 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
|
// Attacking the target
|
||||||
effected.setTarget(target);
|
effected.setTarget(target);
|
||||||
effected.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
|
effected.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
|
||||||
|
|||||||
@@ -140,6 +140,6 @@ public final class Harvesting extends AbstractEffect
|
|||||||
{
|
{
|
||||||
basicSuccess = 1;
|
basicSuccess = 1;
|
||||||
}
|
}
|
||||||
return Rnd.nextInt(99) < basicSuccess;
|
return Rnd.get(99) < basicSuccess;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -129,6 +129,6 @@ public final class Sow extends AbstractEffect
|
|||||||
|
|
||||||
// chance can't be less than 1%
|
// chance can't be less than 1%
|
||||||
Math.max(basicSuccess, 1);
|
Math.max(basicSuccess, 1);
|
||||||
return Rnd.nextInt(99) < basicSuccess;
|
return Rnd.get(99) < basicSuccess;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ public class FriendlyNpcAI extends L2AttackableAI
|
|||||||
|
|
||||||
final int combinedCollision = collision + originalAttackTarget.getTemplate().getCollisionRadius();
|
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))
|
for (L2Attackable nearby : L2World.getInstance().getVisibleObjects(npc, L2Attackable.class))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -497,7 +497,7 @@ public class L2AttackableAI extends L2CharacterAI
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Chance to forget attackers after some time
|
// 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.clearAggroList();
|
||||||
npc.getAttackByList().clear();
|
npc.getAttackByList().clear();
|
||||||
@@ -567,7 +567,7 @@ public class L2AttackableAI extends L2CharacterAI
|
|||||||
moveTo(x1, y1, leader.getZ());
|
moveTo(x1, y1, leader.getZ());
|
||||||
return;
|
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))
|
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)
|
// 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 x1 = 0;
|
||||||
int y1 = 0;
|
int y1 = 0;
|
||||||
@@ -610,7 +610,7 @@ public class L2AttackableAI extends L2CharacterAI
|
|||||||
}
|
}
|
||||||
else
|
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
|
int deltaY = Rnd.get(deltaX, range * 2); // distance
|
||||||
deltaY = (int) Math.sqrt((deltaY * deltaY) - (deltaX * deltaX)); // y
|
deltaY = (int) Math.sqrt((deltaY * deltaY) - (deltaX * deltaX)); // y
|
||||||
x1 = (deltaX + x1) - range;
|
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
|
// In case many mobs are trying to hit from same place, move a bit, circling around the target
|
||||||
// Note from Gnacik:
|
// 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
|
// 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))
|
for (L2Attackable nearby : L2World.getInstance().getVisibleObjects(npc, L2Attackable.class))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -63,10 +63,10 @@ public final class L2ControllableMobAI extends L2AttackableAI
|
|||||||
|
|
||||||
if (!Util.checkIfInRange(MobGroupTable.FOLLOW_RANGE, me, getForcedTarget(), true))
|
if (!Util.checkIfInRange(MobGroupTable.FOLLOW_RANGE, me, getForcedTarget(), true))
|
||||||
{
|
{
|
||||||
final int signX = (Rnd.nextInt(2) == 0) ? -1 : 1;
|
final int signX = (Rnd.get(2) == 0) ? -1 : 1;
|
||||||
final int signY = (Rnd.nextInt(2) == 0) ? -1 : 1;
|
final int signY = (Rnd.get(2) == 0) ? -1 : 1;
|
||||||
final int randX = Rnd.nextInt(MobGroupTable.FOLLOW_RANGE);
|
final int randX = Rnd.get(MobGroupTable.FOLLOW_RANGE);
|
||||||
final int randY = Rnd.nextInt(MobGroupTable.FOLLOW_RANGE);
|
final int randY = Rnd.get(MobGroupTable.FOLLOW_RANGE);
|
||||||
|
|
||||||
moveTo(getForcedTarget().getX() + (signX * randX), getForcedTarget().getY() + (signY * randY), getForcedTarget().getZ());
|
moveTo(getForcedTarget().getX() + (signX * randX), getForcedTarget().getY() + (signY * randY), getForcedTarget().getZ());
|
||||||
}
|
}
|
||||||
@@ -350,7 +350,7 @@ public final class L2ControllableMobAI extends L2AttackableAI
|
|||||||
target = hated;
|
target = hated;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_actor.isMuted() && (Rnd.nextInt(5) == 3))
|
if (!_actor.isMuted() && (Rnd.get(5) == 3))
|
||||||
{
|
{
|
||||||
for (Skill sk : _actor.getAllSkills())
|
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()
|
private L2ControllableMobInstance findNextGroupTarget()
|
||||||
|
|||||||
@@ -308,7 +308,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
|
|||||||
if (crop.getStartAmount() != crop.getAmount())
|
if (crop.getStartAmount() != crop.getAmount())
|
||||||
{
|
{
|
||||||
long count = (long) ((crop.getStartAmount() - crop.getAmount()) * 0.9);
|
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;
|
count = 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ public class L2GroupSpawn extends L2Spawn
|
|||||||
final L2Npc mob = new L2ControllableMobInstance(_template);
|
final L2Npc mob = new L2ControllableMobInstance(_template);
|
||||||
mob.setCurrentHpMp(mob.getMaxHp(), mob.getMaxMp());
|
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.setSpawn(this);
|
||||||
mob.spawnMe(newlocx, newlocy, newlocz);
|
mob.spawnMe(newlocx, newlocy, newlocz);
|
||||||
|
|||||||
@@ -426,7 +426,7 @@ public class L2Spawn extends Location implements IIdentifiable, INamable
|
|||||||
// Set the heading of the L2NpcInstance (random heading if not defined)
|
// Set the heading of the L2NpcInstance (random heading if not defined)
|
||||||
if (getHeading() == -1)
|
if (getHeading() == -1)
|
||||||
{
|
{
|
||||||
npc.setHeading(Rnd.nextInt(61794));
|
npc.setHeading(Rnd.get(61794));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ public class L2Territory
|
|||||||
if (_procMax > 0)
|
if (_procMax > 0)
|
||||||
{
|
{
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
final int rnd = Rnd.nextInt(_procMax);
|
final int rnd = Rnd.get(_procMax);
|
||||||
for (Point p1 : _points)
|
for (Point p1 : _points)
|
||||||
{
|
{
|
||||||
pos += p1._proc;
|
pos += p1._proc;
|
||||||
|
|||||||
@@ -147,10 +147,10 @@ public final class MobGroup
|
|||||||
{
|
{
|
||||||
final L2GroupSpawn spawn = new L2GroupSpawn(_npcTemplate);
|
final L2GroupSpawn spawn = new L2GroupSpawn(_npcTemplate);
|
||||||
|
|
||||||
final int signX = (Rnd.nextInt(2) == 0) ? -1 : 1;
|
final int signX = (Rnd.get(2) == 0) ? -1 : 1;
|
||||||
final int signY = (Rnd.nextInt(2) == 0) ? -1 : 1;
|
final int signY = (Rnd.get(2) == 0) ? -1 : 1;
|
||||||
final int randX = Rnd.nextInt(MobGroupTable.RANDOM_RANGE);
|
final int randX = Rnd.get(MobGroupTable.RANDOM_RANGE);
|
||||||
final int randY = Rnd.nextInt(MobGroupTable.RANDOM_RANGE);
|
final int randY = Rnd.get(MobGroupTable.RANDOM_RANGE);
|
||||||
|
|
||||||
spawn.setXYZ(x + (signX * randX), y + (signY * randY), z);
|
spawn.setXYZ(x + (signX * randX), y + (signY * randY), z);
|
||||||
spawn.stopRespawn();
|
spawn.stopRespawn();
|
||||||
@@ -185,8 +185,8 @@ public final class MobGroup
|
|||||||
|
|
||||||
if (!mobInst.isDead())
|
if (!mobInst.isDead())
|
||||||
{
|
{
|
||||||
final int x = player.getX() + Rnd.nextInt(50);
|
final int x = player.getX() + Rnd.get(50);
|
||||||
final int y = player.getY() + Rnd.nextInt(50);
|
final int y = player.getY() + Rnd.get(50);
|
||||||
|
|
||||||
mobInst.teleToLocation(new Location(x, y, player.getZ()), true);
|
mobInst.teleToLocation(new Location(x, y, player.getZ()), true);
|
||||||
((L2ControllableMobAI) mobInst.getAI()).follow(player);
|
((L2ControllableMobAI) mobInst.getAI()).follow(player);
|
||||||
@@ -203,7 +203,7 @@ public final class MobGroup
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
int choice = Rnd.nextInt(getMobs().size());
|
int choice = Rnd.get(getMobs().size());
|
||||||
for (L2ControllableMobInstance mob : getMobs())
|
for (L2ControllableMobInstance mob : getMobs())
|
||||||
{
|
{
|
||||||
if (--choice == 0)
|
if (--choice == 0)
|
||||||
@@ -321,10 +321,10 @@ public final class MobGroup
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
final int signX = (Rnd.nextInt(2) == 0) ? -1 : 1;
|
final int signX = (Rnd.get(2) == 0) ? -1 : 1;
|
||||||
final int signY = (Rnd.nextInt(2) == 0) ? -1 : 1;
|
final int signY = (Rnd.get(2) == 0) ? -1 : 1;
|
||||||
final int randX = Rnd.nextInt(MobGroupTable.RANDOM_RANGE);
|
final int randX = Rnd.get(MobGroupTable.RANDOM_RANGE);
|
||||||
final int randY = Rnd.nextInt(MobGroupTable.RANDOM_RANGE);
|
final int randY = Rnd.get(MobGroupTable.RANDOM_RANGE);
|
||||||
|
|
||||||
final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI();
|
final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI();
|
||||||
ai.move(activeChar.getX() + (signX * randX), activeChar.getY() + (signY * randY), activeChar.getZ());
|
ai.move(activeChar.getX() + (signX * randX), activeChar.getY() + (signY * randY), activeChar.getZ());
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ public class OlympiadGameClassed extends OlympiadGameNormal
|
|||||||
Participant[] opponents;
|
Participant[] opponents;
|
||||||
while (!classList.isEmpty())
|
while (!classList.isEmpty())
|
||||||
{
|
{
|
||||||
list = classList.get(Rnd.nextInt(classList.size()));
|
list = classList.get(Rnd.get(classList.size()));
|
||||||
if ((list == null) || (list.size() < 2))
|
if ((list == null) || (list.size() < 2))
|
||||||
{
|
{
|
||||||
classList.remove(list);
|
classList.remove(list);
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
|
|||||||
|
|
||||||
while (set.size() > 1)
|
while (set.size() > 1)
|
||||||
{
|
{
|
||||||
int random = Rnd.nextInt(set.size());
|
int random = Rnd.get(set.size());
|
||||||
Iterator<Integer> iter = set.iterator();
|
Iterator<Integer> iter = set.iterator();
|
||||||
while (iter.hasNext())
|
while (iter.hasNext())
|
||||||
{
|
{
|
||||||
@@ -94,7 +94,7 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
random = Rnd.nextInt(set.size());
|
random = Rnd.get(set.size());
|
||||||
iter = set.iterator();
|
iter = set.iterator();
|
||||||
while (iter.hasNext())
|
while (iter.hasNext())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ public final class OptionDataCategory
|
|||||||
Options result = null;
|
Options result = null;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
double random = Rnd.get() * 100.0;
|
double random = Rnd.nextDouble() * 100.0;
|
||||||
for (Map.Entry<Options, Double> entry : _options.entrySet())
|
for (Map.Entry<Options, Double> entry : _options.entrySet())
|
||||||
{
|
{
|
||||||
if (entry.getValue() >= random)
|
if (entry.getValue() >= random)
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public final class OptionDataGroup
|
|||||||
Options result = null;
|
Options result = null;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
double random = Rnd.get() * 100.0;
|
double random = Rnd.nextDouble() * 100.0;
|
||||||
for (OptionDataCategory category : _categories)
|
for (OptionDataCategory category : _categories)
|
||||||
{
|
{
|
||||||
if (category.getChance() >= random)
|
if (category.getChance() >= random)
|
||||||
|
|||||||
@@ -138,8 +138,8 @@ public class ZoneCylinder extends L2ZoneForm
|
|||||||
@Override
|
@Override
|
||||||
public Location getRandomPoint()
|
public Location getRandomPoint()
|
||||||
{
|
{
|
||||||
final int q = (int) (Rnd.get() * 2 * Math.PI);
|
final int q = (int) (Rnd.nextDouble() * 2 * Math.PI);
|
||||||
final int r = (int) Math.sqrt(Rnd.get());
|
final int r = (int) Math.sqrt(Rnd.nextDouble());
|
||||||
final int x = (int) ((_rad * r * Math.cos(q)) + _x);
|
final int x = (int) ((_rad * r * Math.cos(q)) + _x);
|
||||||
final int y = (int) ((_rad * r * Math.sin(q)) + _y);
|
final int y = (int) ((_rad * r * Math.sin(q)) + _y);
|
||||||
|
|
||||||
|
|||||||
@@ -261,7 +261,7 @@ public final class GameServerTable implements IGameXmlReader
|
|||||||
*/
|
*/
|
||||||
public KeyPair getKeyPair()
|
public KeyPair getKeyPair()
|
||||||
{
|
{
|
||||||
return _keyPairs[Rnd.nextInt(10)];
|
return _keyPairs[Rnd.get(10)];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -484,7 +484,7 @@ public class LoginController
|
|||||||
*/
|
*/
|
||||||
public ScrambledKeyPair getScrambledRSAKeyPair()
|
public ScrambledKeyPair getScrambledRSAKeyPair()
|
||||||
{
|
{
|
||||||
return _keyPairs[Rnd.nextInt(10)];
|
return _keyPairs[Rnd.get(10)];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ public final class Confuse extends AbstractEffect
|
|||||||
if (!targetList.isEmpty())
|
if (!targetList.isEmpty())
|
||||||
{
|
{
|
||||||
// Choosing randomly a new target
|
// 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
|
// Attacking the target
|
||||||
effected.setTarget(target);
|
effected.setTarget(target);
|
||||||
effected.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
|
effected.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
|
||||||
|
|||||||
@@ -140,6 +140,6 @@ public final class Harvesting extends AbstractEffect
|
|||||||
{
|
{
|
||||||
basicSuccess = 1;
|
basicSuccess = 1;
|
||||||
}
|
}
|
||||||
return Rnd.nextInt(99) < basicSuccess;
|
return Rnd.get(99) < basicSuccess;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -129,6 +129,6 @@ public final class Sow extends AbstractEffect
|
|||||||
|
|
||||||
// chance can't be less than 1%
|
// chance can't be less than 1%
|
||||||
Math.max(basicSuccess, 1);
|
Math.max(basicSuccess, 1);
|
||||||
return Rnd.nextInt(99) < basicSuccess;
|
return Rnd.get(99) < basicSuccess;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ public class FriendlyNpcAI extends L2AttackableAI
|
|||||||
|
|
||||||
final int combinedCollision = collision + originalAttackTarget.getTemplate().getCollisionRadius();
|
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))
|
for (L2Attackable nearby : L2World.getInstance().getVisibleObjects(npc, L2Attackable.class))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -497,7 +497,7 @@ public class L2AttackableAI extends L2CharacterAI
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Chance to forget attackers after some time
|
// 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.clearAggroList();
|
||||||
npc.getAttackByList().clear();
|
npc.getAttackByList().clear();
|
||||||
@@ -567,7 +567,7 @@ public class L2AttackableAI extends L2CharacterAI
|
|||||||
moveTo(x1, y1, leader.getZ());
|
moveTo(x1, y1, leader.getZ());
|
||||||
return;
|
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))
|
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)
|
// 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 x1 = 0;
|
||||||
int y1 = 0;
|
int y1 = 0;
|
||||||
@@ -610,7 +610,7 @@ public class L2AttackableAI extends L2CharacterAI
|
|||||||
}
|
}
|
||||||
else
|
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
|
int deltaY = Rnd.get(deltaX, range * 2); // distance
|
||||||
deltaY = (int) Math.sqrt((deltaY * deltaY) - (deltaX * deltaX)); // y
|
deltaY = (int) Math.sqrt((deltaY * deltaY) - (deltaX * deltaX)); // y
|
||||||
x1 = (deltaX + x1) - range;
|
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
|
// In case many mobs are trying to hit from same place, move a bit, circling around the target
|
||||||
// Note from Gnacik:
|
// 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
|
// 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))
|
for (L2Attackable nearby : L2World.getInstance().getVisibleObjects(npc, L2Attackable.class))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -63,10 +63,10 @@ public final class L2ControllableMobAI extends L2AttackableAI
|
|||||||
|
|
||||||
if (!Util.checkIfInRange(MobGroupTable.FOLLOW_RANGE, me, getForcedTarget(), true))
|
if (!Util.checkIfInRange(MobGroupTable.FOLLOW_RANGE, me, getForcedTarget(), true))
|
||||||
{
|
{
|
||||||
final int signX = (Rnd.nextInt(2) == 0) ? -1 : 1;
|
final int signX = (Rnd.get(2) == 0) ? -1 : 1;
|
||||||
final int signY = (Rnd.nextInt(2) == 0) ? -1 : 1;
|
final int signY = (Rnd.get(2) == 0) ? -1 : 1;
|
||||||
final int randX = Rnd.nextInt(MobGroupTable.FOLLOW_RANGE);
|
final int randX = Rnd.get(MobGroupTable.FOLLOW_RANGE);
|
||||||
final int randY = Rnd.nextInt(MobGroupTable.FOLLOW_RANGE);
|
final int randY = Rnd.get(MobGroupTable.FOLLOW_RANGE);
|
||||||
|
|
||||||
moveTo(getForcedTarget().getX() + (signX * randX), getForcedTarget().getY() + (signY * randY), getForcedTarget().getZ());
|
moveTo(getForcedTarget().getX() + (signX * randX), getForcedTarget().getY() + (signY * randY), getForcedTarget().getZ());
|
||||||
}
|
}
|
||||||
@@ -350,7 +350,7 @@ public final class L2ControllableMobAI extends L2AttackableAI
|
|||||||
target = hated;
|
target = hated;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_actor.isMuted() && (Rnd.nextInt(5) == 3))
|
if (!_actor.isMuted() && (Rnd.get(5) == 3))
|
||||||
{
|
{
|
||||||
for (Skill sk : _actor.getAllSkills())
|
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()
|
private L2ControllableMobInstance findNextGroupTarget()
|
||||||
|
|||||||
@@ -308,7 +308,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
|
|||||||
if (crop.getStartAmount() != crop.getAmount())
|
if (crop.getStartAmount() != crop.getAmount())
|
||||||
{
|
{
|
||||||
long count = (long) ((crop.getStartAmount() - crop.getAmount()) * 0.9);
|
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;
|
count = 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ public class L2GroupSpawn extends L2Spawn
|
|||||||
final L2Npc mob = new L2ControllableMobInstance(_template);
|
final L2Npc mob = new L2ControllableMobInstance(_template);
|
||||||
mob.setCurrentHpMp(mob.getMaxHp(), mob.getMaxMp());
|
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.setSpawn(this);
|
||||||
mob.spawnMe(newlocx, newlocy, newlocz);
|
mob.spawnMe(newlocx, newlocy, newlocz);
|
||||||
|
|||||||
@@ -426,7 +426,7 @@ public class L2Spawn extends Location implements IIdentifiable, INamable
|
|||||||
// Set the heading of the L2NpcInstance (random heading if not defined)
|
// Set the heading of the L2NpcInstance (random heading if not defined)
|
||||||
if (getHeading() == -1)
|
if (getHeading() == -1)
|
||||||
{
|
{
|
||||||
npc.setHeading(Rnd.nextInt(61794));
|
npc.setHeading(Rnd.get(61794));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ public class L2Territory
|
|||||||
if (_procMax > 0)
|
if (_procMax > 0)
|
||||||
{
|
{
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
final int rnd = Rnd.nextInt(_procMax);
|
final int rnd = Rnd.get(_procMax);
|
||||||
for (Point p1 : _points)
|
for (Point p1 : _points)
|
||||||
{
|
{
|
||||||
pos += p1._proc;
|
pos += p1._proc;
|
||||||
|
|||||||
@@ -147,10 +147,10 @@ public final class MobGroup
|
|||||||
{
|
{
|
||||||
final L2GroupSpawn spawn = new L2GroupSpawn(_npcTemplate);
|
final L2GroupSpawn spawn = new L2GroupSpawn(_npcTemplate);
|
||||||
|
|
||||||
final int signX = (Rnd.nextInt(2) == 0) ? -1 : 1;
|
final int signX = (Rnd.get(2) == 0) ? -1 : 1;
|
||||||
final int signY = (Rnd.nextInt(2) == 0) ? -1 : 1;
|
final int signY = (Rnd.get(2) == 0) ? -1 : 1;
|
||||||
final int randX = Rnd.nextInt(MobGroupTable.RANDOM_RANGE);
|
final int randX = Rnd.get(MobGroupTable.RANDOM_RANGE);
|
||||||
final int randY = Rnd.nextInt(MobGroupTable.RANDOM_RANGE);
|
final int randY = Rnd.get(MobGroupTable.RANDOM_RANGE);
|
||||||
|
|
||||||
spawn.setXYZ(x + (signX * randX), y + (signY * randY), z);
|
spawn.setXYZ(x + (signX * randX), y + (signY * randY), z);
|
||||||
spawn.stopRespawn();
|
spawn.stopRespawn();
|
||||||
@@ -185,8 +185,8 @@ public final class MobGroup
|
|||||||
|
|
||||||
if (!mobInst.isDead())
|
if (!mobInst.isDead())
|
||||||
{
|
{
|
||||||
final int x = player.getX() + Rnd.nextInt(50);
|
final int x = player.getX() + Rnd.get(50);
|
||||||
final int y = player.getY() + Rnd.nextInt(50);
|
final int y = player.getY() + Rnd.get(50);
|
||||||
|
|
||||||
mobInst.teleToLocation(new Location(x, y, player.getZ()), true);
|
mobInst.teleToLocation(new Location(x, y, player.getZ()), true);
|
||||||
((L2ControllableMobAI) mobInst.getAI()).follow(player);
|
((L2ControllableMobAI) mobInst.getAI()).follow(player);
|
||||||
@@ -203,7 +203,7 @@ public final class MobGroup
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
int choice = Rnd.nextInt(getMobs().size());
|
int choice = Rnd.get(getMobs().size());
|
||||||
for (L2ControllableMobInstance mob : getMobs())
|
for (L2ControllableMobInstance mob : getMobs())
|
||||||
{
|
{
|
||||||
if (--choice == 0)
|
if (--choice == 0)
|
||||||
@@ -321,10 +321,10 @@ public final class MobGroup
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
final int signX = (Rnd.nextInt(2) == 0) ? -1 : 1;
|
final int signX = (Rnd.get(2) == 0) ? -1 : 1;
|
||||||
final int signY = (Rnd.nextInt(2) == 0) ? -1 : 1;
|
final int signY = (Rnd.get(2) == 0) ? -1 : 1;
|
||||||
final int randX = Rnd.nextInt(MobGroupTable.RANDOM_RANGE);
|
final int randX = Rnd.get(MobGroupTable.RANDOM_RANGE);
|
||||||
final int randY = Rnd.nextInt(MobGroupTable.RANDOM_RANGE);
|
final int randY = Rnd.get(MobGroupTable.RANDOM_RANGE);
|
||||||
|
|
||||||
final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI();
|
final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI();
|
||||||
ai.move(activeChar.getX() + (signX * randX), activeChar.getY() + (signY * randY), activeChar.getZ());
|
ai.move(activeChar.getX() + (signX * randX), activeChar.getY() + (signY * randY), activeChar.getZ());
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ public class OlympiadGameClassed extends OlympiadGameNormal
|
|||||||
Participant[] opponents;
|
Participant[] opponents;
|
||||||
while (!classList.isEmpty())
|
while (!classList.isEmpty())
|
||||||
{
|
{
|
||||||
list = classList.get(Rnd.nextInt(classList.size()));
|
list = classList.get(Rnd.get(classList.size()));
|
||||||
if ((list == null) || (list.size() < 2))
|
if ((list == null) || (list.size() < 2))
|
||||||
{
|
{
|
||||||
classList.remove(list);
|
classList.remove(list);
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
|
|||||||
|
|
||||||
while (set.size() > 1)
|
while (set.size() > 1)
|
||||||
{
|
{
|
||||||
int random = Rnd.nextInt(set.size());
|
int random = Rnd.get(set.size());
|
||||||
Iterator<Integer> iter = set.iterator();
|
Iterator<Integer> iter = set.iterator();
|
||||||
while (iter.hasNext())
|
while (iter.hasNext())
|
||||||
{
|
{
|
||||||
@@ -94,7 +94,7 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
random = Rnd.nextInt(set.size());
|
random = Rnd.get(set.size());
|
||||||
iter = set.iterator();
|
iter = set.iterator();
|
||||||
while (iter.hasNext())
|
while (iter.hasNext())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ public final class OptionDataCategory
|
|||||||
Options result = null;
|
Options result = null;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
double random = Rnd.get() * 100.0;
|
double random = Rnd.nextDouble() * 100.0;
|
||||||
for (Map.Entry<Options, Double> entry : _options.entrySet())
|
for (Map.Entry<Options, Double> entry : _options.entrySet())
|
||||||
{
|
{
|
||||||
if (entry.getValue() >= random)
|
if (entry.getValue() >= random)
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public final class OptionDataGroup
|
|||||||
Options result = null;
|
Options result = null;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
double random = Rnd.get() * 100.0;
|
double random = Rnd.nextDouble() * 100.0;
|
||||||
for (OptionDataCategory category : _categories)
|
for (OptionDataCategory category : _categories)
|
||||||
{
|
{
|
||||||
if (category.getChance() >= random)
|
if (category.getChance() >= random)
|
||||||
|
|||||||
@@ -138,8 +138,8 @@ public class ZoneCylinder extends L2ZoneForm
|
|||||||
@Override
|
@Override
|
||||||
public Location getRandomPoint()
|
public Location getRandomPoint()
|
||||||
{
|
{
|
||||||
final int q = (int) (Rnd.get() * 2 * Math.PI);
|
final int q = (int) (Rnd.nextDouble() * 2 * Math.PI);
|
||||||
final int r = (int) Math.sqrt(Rnd.get());
|
final int r = (int) Math.sqrt(Rnd.nextDouble());
|
||||||
final int x = (int) ((_rad * r * Math.cos(q)) + _x);
|
final int x = (int) ((_rad * r * Math.cos(q)) + _x);
|
||||||
final int y = (int) ((_rad * r * Math.sin(q)) + _y);
|
final int y = (int) ((_rad * r * Math.sin(q)) + _y);
|
||||||
|
|
||||||
|
|||||||
@@ -261,7 +261,7 @@ public final class GameServerTable implements IGameXmlReader
|
|||||||
*/
|
*/
|
||||||
public KeyPair getKeyPair()
|
public KeyPair getKeyPair()
|
||||||
{
|
{
|
||||||
return _keyPairs[Rnd.nextInt(10)];
|
return _keyPairs[Rnd.get(10)];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -484,7 +484,7 @@ public class LoginController
|
|||||||
*/
|
*/
|
||||||
public ScrambledKeyPair getScrambledRSAKeyPair()
|
public ScrambledKeyPair getScrambledRSAKeyPair()
|
||||||
{
|
{
|
||||||
return _keyPairs[Rnd.nextInt(10)];
|
return _keyPairs[Rnd.get(10)];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ public final class Confuse extends AbstractEffect
|
|||||||
if (!targetList.isEmpty())
|
if (!targetList.isEmpty())
|
||||||
{
|
{
|
||||||
// Choosing randomly a new target
|
// 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
|
// Attacking the target
|
||||||
effected.setTarget(target);
|
effected.setTarget(target);
|
||||||
effected.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
|
effected.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
|
||||||
|
|||||||
@@ -140,6 +140,6 @@ public final class Harvesting extends AbstractEffect
|
|||||||
{
|
{
|
||||||
basicSuccess = 1;
|
basicSuccess = 1;
|
||||||
}
|
}
|
||||||
return Rnd.nextInt(99) < basicSuccess;
|
return Rnd.get(99) < basicSuccess;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -129,6 +129,6 @@ public final class Sow extends AbstractEffect
|
|||||||
|
|
||||||
// chance can't be less than 1%
|
// chance can't be less than 1%
|
||||||
Math.max(basicSuccess, 1);
|
Math.max(basicSuccess, 1);
|
||||||
return Rnd.nextInt(99) < basicSuccess;
|
return Rnd.get(99) < basicSuccess;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ public class FriendlyNpcAI extends L2AttackableAI
|
|||||||
|
|
||||||
final int combinedCollision = collision + originalAttackTarget.getTemplate().getCollisionRadius();
|
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))
|
for (L2Attackable nearby : L2World.getInstance().getVisibleObjects(npc, L2Attackable.class))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -497,7 +497,7 @@ public class L2AttackableAI extends L2CharacterAI
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Chance to forget attackers after some time
|
// 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.clearAggroList();
|
||||||
npc.getAttackByList().clear();
|
npc.getAttackByList().clear();
|
||||||
@@ -567,7 +567,7 @@ public class L2AttackableAI extends L2CharacterAI
|
|||||||
moveTo(x1, y1, leader.getZ());
|
moveTo(x1, y1, leader.getZ());
|
||||||
return;
|
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))
|
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)
|
// 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 x1 = 0;
|
||||||
int y1 = 0;
|
int y1 = 0;
|
||||||
@@ -610,7 +610,7 @@ public class L2AttackableAI extends L2CharacterAI
|
|||||||
}
|
}
|
||||||
else
|
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
|
int deltaY = Rnd.get(deltaX, range * 2); // distance
|
||||||
deltaY = (int) Math.sqrt((deltaY * deltaY) - (deltaX * deltaX)); // y
|
deltaY = (int) Math.sqrt((deltaY * deltaY) - (deltaX * deltaX)); // y
|
||||||
x1 = (deltaX + x1) - range;
|
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
|
// In case many mobs are trying to hit from same place, move a bit, circling around the target
|
||||||
// Note from Gnacik:
|
// 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
|
// 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))
|
for (L2Attackable nearby : L2World.getInstance().getVisibleObjects(npc, L2Attackable.class))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -63,10 +63,10 @@ public final class L2ControllableMobAI extends L2AttackableAI
|
|||||||
|
|
||||||
if (!Util.checkIfInRange(MobGroupTable.FOLLOW_RANGE, me, getForcedTarget(), true))
|
if (!Util.checkIfInRange(MobGroupTable.FOLLOW_RANGE, me, getForcedTarget(), true))
|
||||||
{
|
{
|
||||||
final int signX = (Rnd.nextInt(2) == 0) ? -1 : 1;
|
final int signX = (Rnd.get(2) == 0) ? -1 : 1;
|
||||||
final int signY = (Rnd.nextInt(2) == 0) ? -1 : 1;
|
final int signY = (Rnd.get(2) == 0) ? -1 : 1;
|
||||||
final int randX = Rnd.nextInt(MobGroupTable.FOLLOW_RANGE);
|
final int randX = Rnd.get(MobGroupTable.FOLLOW_RANGE);
|
||||||
final int randY = Rnd.nextInt(MobGroupTable.FOLLOW_RANGE);
|
final int randY = Rnd.get(MobGroupTable.FOLLOW_RANGE);
|
||||||
|
|
||||||
moveTo(getForcedTarget().getX() + (signX * randX), getForcedTarget().getY() + (signY * randY), getForcedTarget().getZ());
|
moveTo(getForcedTarget().getX() + (signX * randX), getForcedTarget().getY() + (signY * randY), getForcedTarget().getZ());
|
||||||
}
|
}
|
||||||
@@ -350,7 +350,7 @@ public final class L2ControllableMobAI extends L2AttackableAI
|
|||||||
target = hated;
|
target = hated;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_actor.isMuted() && (Rnd.nextInt(5) == 3))
|
if (!_actor.isMuted() && (Rnd.get(5) == 3))
|
||||||
{
|
{
|
||||||
for (Skill sk : _actor.getAllSkills())
|
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()
|
private L2ControllableMobInstance findNextGroupTarget()
|
||||||
|
|||||||
@@ -308,7 +308,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
|
|||||||
if (crop.getStartAmount() != crop.getAmount())
|
if (crop.getStartAmount() != crop.getAmount())
|
||||||
{
|
{
|
||||||
long count = (long) ((crop.getStartAmount() - crop.getAmount()) * 0.9);
|
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;
|
count = 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ public class L2GroupSpawn extends L2Spawn
|
|||||||
final L2Npc mob = new L2ControllableMobInstance(_template);
|
final L2Npc mob = new L2ControllableMobInstance(_template);
|
||||||
mob.setCurrentHpMp(mob.getMaxHp(), mob.getMaxMp());
|
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.setSpawn(this);
|
||||||
mob.spawnMe(newlocx, newlocy, newlocz);
|
mob.spawnMe(newlocx, newlocy, newlocz);
|
||||||
|
|||||||
@@ -426,7 +426,7 @@ public class L2Spawn extends Location implements IIdentifiable, INamable
|
|||||||
// Set the heading of the L2NpcInstance (random heading if not defined)
|
// Set the heading of the L2NpcInstance (random heading if not defined)
|
||||||
if (getHeading() == -1)
|
if (getHeading() == -1)
|
||||||
{
|
{
|
||||||
npc.setHeading(Rnd.nextInt(61794));
|
npc.setHeading(Rnd.get(61794));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ public class L2Territory
|
|||||||
if (_procMax > 0)
|
if (_procMax > 0)
|
||||||
{
|
{
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
final int rnd = Rnd.nextInt(_procMax);
|
final int rnd = Rnd.get(_procMax);
|
||||||
for (Point p1 : _points)
|
for (Point p1 : _points)
|
||||||
{
|
{
|
||||||
pos += p1._proc;
|
pos += p1._proc;
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user