checkstyle

This commit is contained in:
jendave
2011-10-29 08:04:51 +00:00
parent ac437d084f
commit df80bd64a8
49 changed files with 128 additions and 115 deletions

View File

@@ -118,7 +118,7 @@ public class AIPlayer extends Player {
*/ */
public final boolean dredge() { public final boolean dredge() {
CardList dredgers = getDredge(); CardList dredgers = getDredge();
Random random = MyRandom.random; Random random = MyRandom.getRandom();
// use dredge if there are more than one of them in your graveyard // use dredge if there are more than one of them in your graveyard
if (dredgers.size() > 1 || (dredgers.size() == 1 && random.nextBoolean())) { if (dredgers.size() > 1 || (dredgers.size() == 1 && random.nextBoolean())) {
@@ -186,7 +186,7 @@ public class AIPlayer extends Player {
} else if (libPos.equalsIgnoreCase("Bottom")) { } else if (libPos.equalsIgnoreCase("Bottom")) {
position = -1; position = -1;
} else { } else {
Random r = MyRandom.random; Random r = MyRandom.getRandom();
if (r.nextBoolean()) { if (r.nextBoolean()) {
position = 0; position = 0;
} else { } else {
@@ -263,7 +263,7 @@ public class AIPlayer extends Player {
num = topN.size(); num = topN.size();
// put the rest on top in random order // put the rest on top in random order
for (int i = 0; i < num; i++) { for (int i = 0; i < num; i++) {
Random rndm = MyRandom.random; Random rndm = MyRandom.getRandom();
int r = rndm.nextInt(topN.size()); int r = rndm.nextInt(topN.size());
Card c = topN.get(r); Card c = topN.get(r);
AllZone.getGameAction().moveToLibrary(c); AllZone.getGameAction().moveToLibrary(c);

View File

@@ -7756,7 +7756,7 @@ public class Card extends GameEntity implements Comparable<Card> {
return; return;
} }
Random r = MyRandom.random; Random r = MyRandom.getRandom();
SetInfo si = getCharacteristics().getSets().get(r.nextInt(getCharacteristics().getSets().size())); SetInfo si = getCharacteristics().getSets().get(r.nextInt(getCharacteristics().getSets().size()));
curSetCode = si.Code; curSetCode = si.Code;

View File

@@ -725,9 +725,9 @@ public class CardList implements Iterable<Card> {
public final void shuffle() { public final void shuffle() {
// reseed Random each time we want to Shuffle // reseed Random each time we want to Shuffle
// MyRandom.random = MyRandom.random; // MyRandom.random = MyRandom.random;
Collections.shuffle(list, MyRandom.random); Collections.shuffle(list, MyRandom.getRandom());
Collections.shuffle(list, MyRandom.random); Collections.shuffle(list, MyRandom.getRandom());
Collections.shuffle(list, MyRandom.random); Collections.shuffle(list, MyRandom.getRandom());
} }
/** /**

View File

@@ -30,7 +30,7 @@ import forge.properties.NewConstants;
*/ */
public final class CardUtil { public final class CardUtil {
/** Constant <code>RANDOM</code>. */ /** Constant <code>RANDOM</code>. */
public static final Random RANDOM = MyRandom.random; public static final Random RANDOM = MyRandom.getRandom();
/** /**
* Do not instantiate. * Do not instantiate.

View File

@@ -25,7 +25,7 @@ public class ComputerUtil_Attack2 {
private CardList playerCreatures; private CardList playerCreatures;
private int blockerLife; private int blockerLife;
private Random random = MyRandom.random; private Random random = MyRandom.getRandom();
private final int randomInt = random.nextInt(); private final int randomInt = random.nextInt();
private CardList humanList; // holds human player creatures private CardList humanList; // holds human player creatures
@@ -358,7 +358,7 @@ public class ComputerUtil_Attack2 {
// Randomly determine who EVERYONE is attacking // Randomly determine who EVERYONE is attacking
// would be better to determine more individually // would be better to determine more individually
int n = MyRandom.random.nextInt(defs.size()); int n = MyRandom.getRandom().nextInt(defs.size());
Object entity = AllZone.getComputerPlayer().getMustAttackEntity(); Object entity = AllZone.getComputerPlayer().getMustAttackEntity();
if (null != entity) { if (null != entity) {

View File

@@ -1311,7 +1311,7 @@ public class GameAction {
Card.resetUniqueNumber(); Card.resetUniqueNumber();
boolean canRandomFoil = Constant.Runtime.RANDOM_FOIL[0] boolean canRandomFoil = Constant.Runtime.RANDOM_FOIL[0]
&& Constant.Runtime.getGameType().equals(GameType.Constructed); && Constant.Runtime.getGameType().equals(GameType.Constructed);
Random generator = MyRandom.random; Random generator = MyRandom.getRandom();
for (Entry<CardPrinted, Integer> stackOfCards : humanDeck.getMain()) { for (Entry<CardPrinted, Integer> stackOfCards : humanDeck.getMain()) {
CardPrinted cardPrinted = stackOfCards.getKey(); CardPrinted cardPrinted = stackOfCards.getKey();
for (int i = 0; i < stackOfCards.getValue(); i++) { for (int i = 0; i < stackOfCards.getValue(); i++) {
@@ -1331,7 +1331,7 @@ public class GameAction {
// Assign random foiling on approximately 1:20 cards // Assign random foiling on approximately 1:20 cards
if (cardPrinted.isFoil() || (canRandomFoil && MyRandom.percentTrue(5))) { if (cardPrinted.isFoil() || (canRandomFoil && MyRandom.percentTrue(5))) {
int iFoil = MyRandom.random.nextInt(9) + 1; int iFoil = MyRandom.getRandom().nextInt(9) + 1;
card.setFoil(iFoil); card.setFoil(iFoil);
} }
@@ -1361,7 +1361,7 @@ public class GameAction {
// Assign random foiling on approximately 1:20 cards // Assign random foiling on approximately 1:20 cards
if (cardPrinted.isFoil() || (canRandomFoil && MyRandom.percentTrue(5))) { if (cardPrinted.isFoil() || (canRandomFoil && MyRandom.percentTrue(5))) {
int iFoil = MyRandom.random.nextInt(9) + 1; int iFoil = MyRandom.getRandom().nextInt(9) + 1;
card.setFoil(iFoil); card.setFoil(iFoil);
} }
@@ -1601,7 +1601,7 @@ public class GameAction {
ForgeProps.getLocalized(GAMEACTION_TEXT.COIN_TOSS), JOptionPane.DEFAULT_OPTION, ForgeProps.getLocalized(GAMEACTION_TEXT.COIN_TOSS), JOptionPane.DEFAULT_OPTION,
JOptionPane.INFORMATION_MESSAGE, null, possibleValues, possibleValues[0]); JOptionPane.INFORMATION_MESSAGE, null, possibleValues, possibleValues[0]);
int Flip = MyRandom.random.nextInt(2); int Flip = MyRandom.getRandom().nextInt(2);
String Human_Flip = " "; String Human_Flip = " ";
String Computer_Flip = " "; String Computer_Flip = " ";
// JOptionPane.showMessageDialog(null, q, "", // JOptionPane.showMessageDialog(null, q, "",
@@ -1650,7 +1650,7 @@ public class GameAction {
} }
if (HLibrary.size() > 0) { if (HLibrary.size() > 0) {
setHumanCut(HLibrary.get(MyRandom.random.nextInt(HLibrary.size()))); setHumanCut(HLibrary.get(MyRandom.getRandom().nextInt(HLibrary.size())));
} else { } else {
computerStartsGame(); computerStartsGame();
JOptionPane JOptionPane
@@ -1661,7 +1661,7 @@ public class GameAction {
} }
if (CLibrary.size() > 0) { if (CLibrary.size() > 0) {
setComputerCut(CLibrary.get(MyRandom.random.nextInt(CLibrary.size()))); setComputerCut(CLibrary.get(MyRandom.getRandom().nextInt(CLibrary.size())));
} else { } else {
JOptionPane.showMessageDialog(null, ForgeProps.getLocalized(GAMEACTION_TEXT.COMPUTER_MANA_COST) JOptionPane.showMessageDialog(null, ForgeProps.getLocalized(GAMEACTION_TEXT.COMPUTER_MANA_COST)
+ "\r\n" + ForgeProps.getLocalized(GAMEACTION_TEXT.HUMAN_STARTS), "", + "\r\n" + ForgeProps.getLocalized(GAMEACTION_TEXT.HUMAN_STARTS), "",
@@ -1696,7 +1696,7 @@ public class GameAction {
sb.append(ForgeProps.getLocalized(GAMEACTION_TEXT.EQUAL_CONVERTED_MANA) + "\r\n"); sb.append(ForgeProps.getLocalized(GAMEACTION_TEXT.EQUAL_CONVERTED_MANA) + "\r\n");
if (i == Cut_CountMax - 1) { if (i == Cut_CountMax - 1) {
sb.append(ForgeProps.getLocalized(GAMEACTION_TEXT.RESOLVE_STARTER)); sb.append(ForgeProps.getLocalized(GAMEACTION_TEXT.RESOLVE_STARTER));
if (MyRandom.random.nextInt(2) == 1) { if (MyRandom.getRandom().nextInt(2) == 1) {
JOptionPane.showMessageDialog(null, sb + ForgeProps.getLocalized(GAMEACTION_TEXT.HUMAN_WIN), JOptionPane.showMessageDialog(null, sb + ForgeProps.getLocalized(GAMEACTION_TEXT.HUMAN_WIN),
"", JOptionPane.INFORMATION_MESSAGE); "", JOptionPane.INFORMATION_MESSAGE);
} else { } else {

View File

@@ -509,11 +509,11 @@ public final class GameActionUtil {
String choice = ""; String choice = "";
String[] choices = { "heads", "tails" }; String[] choices = { "heads", "tails" };
boolean flip = MyRandom.random.nextBoolean(); boolean flip = MyRandom.getRandom().nextBoolean();
if (caller.isHuman()) { if (caller.isHuman()) {
choice = (String) GuiUtils.getChoice(source.getName() + " - Call coin flip", choices); choice = (String) GuiUtils.getChoice(source.getName() + " - Call coin flip", choices);
} else { } else {
choice = choices[MyRandom.random.nextInt(2)]; choice = choices[MyRandom.getRandom().nextInt(2)];
} }
boolean winFlip = flip == choice.equals("heads"); boolean winFlip = flip == choice.equals("heads");

View File

@@ -338,7 +338,7 @@ public abstract class GuiDownloader extends DefaultBoundedRangeModel implements
BufferedInputStream in; BufferedInputStream in;
BufferedOutputStream out; BufferedOutputStream out;
Random r = MyRandom.random; Random r = MyRandom.getRandom();
Proxy p = null; Proxy p = null;
if (type == 0) { if (type == 0) {

View File

@@ -28,10 +28,10 @@ public abstract class Move {
public abstract int getScore(); public abstract int getScore();
/** The best move. */ /** The best move. */
public Move bestMove = null; private Move bestMove = null;
/** The best score. */ /** The best score. */
public int bestScore = Integer.MIN_VALUE; private int bestScore = Integer.MIN_VALUE;
/** /**
* <p> * <p>

View File

@@ -13,7 +13,7 @@ import java.util.Random;
*/ */
public class MyRandom { public class MyRandom {
/** Constant <code>random</code>. */ /** Constant <code>random</code>. */
public static Random random = new Random(); private static Random random = new Random();
/** /**
* <p> * <p>
@@ -26,6 +26,20 @@ public class MyRandom {
* @return a boolean. * @return a boolean.
*/ */
public static boolean percentTrue(final int percent) { public static boolean percentTrue(final int percent) {
return percent > random.nextInt(100); return percent > getRandom().nextInt(100);
}
/**
* @return the random
*/
public static Random getRandom() {
return random;
}
/**
* @param random the random to set
*/
public static void setRandom(Random random) {
MyRandom.random = random; // TODO: Add 0 to parameter's name.
} }
} }

View File

@@ -1539,7 +1539,7 @@ public abstract class Player extends GameEntity {
ArrayList<Object> list = new ArrayList<Object>(Arrays.asList(c)); ArrayList<Object> list = new ArrayList<Object>(Arrays.asList(c));
// overdone but wanted to make sure it was really random // overdone but wanted to make sure it was really random
Random random = MyRandom.random; Random random = MyRandom.getRandom();
Collections.shuffle(list, random); Collections.shuffle(list, random);
Collections.shuffle(list, random); Collections.shuffle(list, random);
Collections.shuffle(list, random); Collections.shuffle(list, random);

View File

@@ -139,7 +139,7 @@ public class BoosterGenerator {
int index = Integer.MAX_VALUE; int index = Integer.MAX_VALUE;
for (int iCard = 0; iCard < count; iCard++) { for (int iCard = 0; iCard < count; iCard++) {
if (index >= listSize) { if (index >= listSize) {
Collections.shuffle(source, MyRandom.random); Collections.shuffle(source, MyRandom.getRandom());
index = 0; index = 0;
} }
result.add(source.get(index)); result.add(source.get(index));
@@ -166,18 +166,18 @@ public class BoosterGenerator {
int indexRares = Integer.MAX_VALUE; int indexRares = Integer.MAX_VALUE;
int indexMythics = Integer.MAX_VALUE; int indexMythics = Integer.MAX_VALUE;
for (int iCard = 0; iCard < count; iCard++) { for (int iCard = 0; iCard < count; iCard++) {
int rollD8 = MyRandom.random.nextInt(8); int rollD8 = MyRandom.getRandom().nextInt(8);
boolean takeMythic = mythicsSize > 0 && rollD8 < 1; boolean takeMythic = mythicsSize > 0 && rollD8 < 1;
if (takeMythic) { if (takeMythic) {
if (indexRares >= raresSize) { if (indexRares >= raresSize) {
Collections.shuffle(mythics, MyRandom.random); Collections.shuffle(mythics, MyRandom.getRandom());
indexMythics = 0; indexMythics = 0;
} }
result.add(mythics.get(indexMythics)); result.add(mythics.get(indexMythics));
indexMythics++; indexMythics++;
} else { } else {
if (indexRares >= raresSize) { if (indexRares >= raresSize) {
Collections.shuffle(rares, MyRandom.random); Collections.shuffle(rares, MyRandom.getRandom());
indexRares = 0; indexRares = 0;
} }
result.add(rares.get(indexRares)); result.add(rares.get(indexRares));

View File

@@ -71,7 +71,7 @@ public final class BoosterUtils {
Predicate<CardPrinted> filterMythics = Predicate.and(filter, CardPrinted.Predicates.Presets.isMythicRare); Predicate<CardPrinted> filterMythics = Predicate.and(filter, CardPrinted.Predicates.Presets.isMythicRare);
boolean haveMythics = filterMythics.any(cardpool); boolean haveMythics = filterMythics.any(cardpool);
for (int iSlot = 0; haveMythics && iSlot < numRare; iSlot++) { for (int iSlot = 0; haveMythics && iSlot < numRare; iSlot++) {
if (MyRandom.random.nextInt(7) < 1) { // a bit higher chance to get if (MyRandom.getRandom().nextInt(7) < 1) { // a bit higher chance to get
// a mythic // a mythic
nRares--; nRares--;
nMythics++; nMythics++;
@@ -252,7 +252,7 @@ public final class BoosterUtils {
*/ */
public static List<CardPrinted> getVariety(final List<CardPrinted> in) { public static List<CardPrinted> getVariety(final List<CardPrinted> in) {
List<CardPrinted> out = new ArrayList<CardPrinted>(); List<CardPrinted> out = new ArrayList<CardPrinted>();
Collections.shuffle(in, MyRandom.random); Collections.shuffle(in, MyRandom.getRandom());
for (int i = 0; i < Constant.Color.COLORS.length; i++) { for (int i = 0; i < Constant.Color.COLORS.length; i++) {
CardPrinted check = findCardOfColor(in, i); CardPrinted check = findCardOfColor(in, i);

View File

@@ -234,7 +234,7 @@ public class AbilityFactory_AlterLife {
* @return a boolean. * @return a boolean.
*/ */
public static boolean gainLifeCanPlayAI(final AbilityFactory af, final SpellAbility sa) { public static boolean gainLifeCanPlayAI(final AbilityFactory af, final SpellAbility sa) {
Random r = MyRandom.random; Random r = MyRandom.getRandom();
HashMap<String, String> params = af.getMapParams(); HashMap<String, String> params = af.getMapParams();
Cost abCost = sa.getPayCosts(); Cost abCost = sa.getPayCosts();
final Card source = sa.getSourceCard(); final Card source = sa.getSourceCard();
@@ -596,7 +596,7 @@ public class AbilityFactory_AlterLife {
* @return a boolean. * @return a boolean.
*/ */
public static boolean loseLifeCanPlayAI(final AbilityFactory af, final SpellAbility sa) { public static boolean loseLifeCanPlayAI(final AbilityFactory af, final SpellAbility sa) {
Random r = MyRandom.random; Random r = MyRandom.getRandom();
Cost abCost = sa.getPayCosts(); Cost abCost = sa.getPayCosts();
final Card source = sa.getSourceCard(); final Card source = sa.getSourceCard();
HashMap<String, String> params = af.getMapParams(); HashMap<String, String> params = af.getMapParams();
@@ -1276,7 +1276,7 @@ public class AbilityFactory_AlterLife {
* @return a boolean. * @return a boolean.
*/ */
private static boolean setLifeCanPlayAI(final AbilityFactory af, final SpellAbility sa) { private static boolean setLifeCanPlayAI(final AbilityFactory af, final SpellAbility sa) {
Random r = MyRandom.random; Random r = MyRandom.getRandom();
// Ability_Cost abCost = sa.getPayCosts(); // Ability_Cost abCost = sa.getPayCosts();
final Card source = sa.getSourceCard(); final Card source = sa.getSourceCard();
int life = AllZone.getComputerPlayer().getLife(); int life = AllZone.getComputerPlayer().getLife();
@@ -1630,7 +1630,7 @@ public class AbilityFactory_AlterLife {
* @return a boolean. * @return a boolean.
*/ */
private static boolean exchangeLifeCanPlayAI(final AbilityFactory af, final SpellAbility sa) { private static boolean exchangeLifeCanPlayAI(final AbilityFactory af, final SpellAbility sa) {
Random r = MyRandom.random; Random r = MyRandom.getRandom();
int life = AllZone.getComputerPlayer().getLife(); int life = AllZone.getComputerPlayer().getLife();
int hLife = AllZone.getHumanPlayer().getLife(); int hLife = AllZone.getHumanPlayer().getLife();

View File

@@ -812,7 +812,7 @@ public class AbilityFactory_Attach {
* @return true, if successful * @return true, if successful
*/ */
public static boolean attachCanPlayAI(final AbilityFactory af, final SpellAbility sa) { public static boolean attachCanPlayAI(final AbilityFactory af, final SpellAbility sa) {
Random r = MyRandom.random; Random r = MyRandom.getRandom();
Map<String, String> params = af.getMapParams(); Map<String, String> params = af.getMapParams();
Cost abCost = sa.getPayCosts(); Cost abCost = sa.getPayCosts();
final Card source = sa.getSourceCard(); final Card source = sa.getSourceCard();

View File

@@ -379,7 +379,7 @@ public final class AbilityFactory_ChangeZone {
} }
} }
Random r = MyRandom.random; Random r = MyRandom.getRandom();
// prevent run-away activations - first time will always return true // prevent run-away activations - first time will always return true
boolean chance = r.nextFloat() <= Math.pow(.6667, sa.getActivationsThisTurn()); boolean chance = r.nextFloat() <= Math.pow(.6667, sa.getActivationsThisTurn());
@@ -1147,7 +1147,7 @@ public final class AbilityFactory_ChangeZone {
float pct = origin.equals(Zone.Battlefield) ? .8f : .667f; float pct = origin.equals(Zone.Battlefield) ? .8f : .667f;
Random r = MyRandom.random; Random r = MyRandom.getRandom();
if (abCost != null) { if (abCost != null) {
// AI currently disabled for these costs // AI currently disabled for these costs
@@ -1962,7 +1962,7 @@ public final class AbilityFactory_ChangeZone {
} }
Random r = MyRandom.random; Random r = MyRandom.getRandom();
// prevent run-away activations - first time will always return true // prevent run-away activations - first time will always return true
boolean chance = r.nextFloat() <= Math.pow(.6667, sa.getActivationsThisTurn()); boolean chance = r.nextFloat() <= Math.pow(.6667, sa.getActivationsThisTurn());

View File

@@ -222,7 +222,7 @@ public final class AbilityFactory_Copy {
chance = .667; // 66.7% chance for sorcery speed (since it will chance = .667; // 66.7% chance for sorcery speed (since it will
// never activate EOT) // never activate EOT)
} }
Random r = MyRandom.random; Random r = MyRandom.getRandom();
if (r.nextFloat() <= Math.pow(chance, sa.getActivationsThisTurn() + 1)) { if (r.nextFloat() <= Math.pow(chance, sa.getActivationsThisTurn() + 1)) {
return copyPermanentTriggerAI(af, sa, false); return copyPermanentTriggerAI(af, sa, false);
} else { } else {

View File

@@ -252,7 +252,7 @@ public class AbilityFactory_CounterMagic {
if (toPay <= usableManaSources) { if (toPay <= usableManaSources) {
// If this is a reusable Resource, feel free to play it most of // If this is a reusable Resource, feel free to play it most of
// the time // the time
if (!sa.getPayCosts().isReusuableResource() || (MyRandom.random.nextFloat() < .4)) { if (!sa.getPayCosts().isReusuableResource() || (MyRandom.getRandom().nextFloat() < .4)) {
return false; return false;
} }
} }
@@ -330,7 +330,7 @@ public class AbilityFactory_CounterMagic {
if (toPay <= usableManaSources) { if (toPay <= usableManaSources) {
// If this is a reusable Resource, feel free to play it most // If this is a reusable Resource, feel free to play it most
// of the time // of the time
if (!sa.getPayCosts().isReusuableResource() || (MyRandom.random.nextFloat() < .4)) { if (!sa.getPayCosts().isReusuableResource() || (MyRandom.getRandom().nextFloat() < .4)) {
return false; return false;
} }
} }

View File

@@ -240,7 +240,7 @@ public class AbilityFactory_Counters {
// based on // based on
// what the expected targets could be // what the expected targets could be
HashMap<String, String> params = af.getMapParams(); HashMap<String, String> params = af.getMapParams();
Random r = MyRandom.random; Random r = MyRandom.getRandom();
Cost abCost = sa.getPayCosts(); Cost abCost = sa.getPayCosts();
Target abTgt = sa.getTarget(); Target abTgt = sa.getTarget();
final Card source = sa.getSourceCard(); final Card source = sa.getSourceCard();
@@ -873,7 +873,7 @@ public class AbilityFactory_Counters {
// AI needs to be expanded, since this function can be pretty complex // AI needs to be expanded, since this function can be pretty complex
// based on what // based on what
// the expected targets could be // the expected targets could be
Random r = MyRandom.random; Random r = MyRandom.getRandom();
Cost abCost = sa.getPayCosts(); Cost abCost = sa.getPayCosts();
// Target abTgt = sa.getTarget(); // Target abTgt = sa.getTarget();
final Card source = sa.getSourceCard(); final Card source = sa.getSourceCard();
@@ -1598,7 +1598,7 @@ public class AbilityFactory_Counters {
// AI needs to be expanded, since this function can be pretty complex // AI needs to be expanded, since this function can be pretty complex
// based on what // based on what
// the expected targets could be // the expected targets could be
Random r = MyRandom.random; Random r = MyRandom.getRandom();
HashMap<String, String> params = af.getMapParams(); HashMap<String, String> params = af.getMapParams();
Cost abCost = sa.getPayCosts(); Cost abCost = sa.getPayCosts();
final Card source = sa.getSourceCard(); final Card source = sa.getSourceCard();
@@ -2144,7 +2144,7 @@ public class AbilityFactory_Counters {
// based on what // based on what
// the expected targets could be // the expected targets could be
HashMap<String, String> params = af.getMapParams(); HashMap<String, String> params = af.getMapParams();
Random r = MyRandom.random; Random r = MyRandom.getRandom();
String amountStr = params.get("CounterNum"); String amountStr = params.get("CounterNum");
// TODO handle proper calculation of X values based on Cost // TODO handle proper calculation of X values based on Cost

View File

@@ -327,7 +327,7 @@ public class AbilityFactory_DealDamage {
} }
if (AF.isAbility()) { if (AF.isAbility()) {
Random r = MyRandom.random; // prevent run-away activations Random r = MyRandom.getRandom(); // prevent run-away activations
if (r.nextFloat() <= Math.pow(.6667, saMe.getActivationsThisTurn())) { if (r.nextFloat() <= Math.pow(.6667, saMe.getActivationsThisTurn())) {
rr = true; rr = true;
} }
@@ -948,7 +948,7 @@ public class AbilityFactory_DealDamage {
private boolean damageAllCanPlayAI(final AbilityFactory af, final SpellAbility sa) { private boolean damageAllCanPlayAI(final AbilityFactory af, final SpellAbility sa) {
// AI needs to be expanded, since this function can be pretty complex // AI needs to be expanded, since this function can be pretty complex
// based on what the expected targets could be // based on what the expected targets could be
Random r = MyRandom.random; Random r = MyRandom.getRandom();
Cost abCost = sa.getPayCosts(); Cost abCost = sa.getPayCosts();
final Card source = sa.getSourceCard(); final Card source = sa.getSourceCard();
final HashMap<String, String> params = af.getMapParams(); final HashMap<String, String> params = af.getMapParams();

View File

@@ -704,7 +704,7 @@ public final class AbilityFactory_Debuff {
*/ */
private static boolean debuffAllCanPlayAI(final AbilityFactory af, final SpellAbility sa) { private static boolean debuffAllCanPlayAI(final AbilityFactory af, final SpellAbility sa) {
String valid = ""; String valid = "";
Random r = MyRandom.random; Random r = MyRandom.getRandom();
// final Card source = sa.getSourceCard(); // final Card source = sa.getSourceCard();
Card hostCard = af.getHostCard(); Card hostCard = af.getHostCard();
HashMap<String, String> params = af.getMapParams(); HashMap<String, String> params = af.getMapParams();

View File

@@ -157,7 +157,7 @@ public class AbilityFactory_Destroy {
private static boolean destroyCanPlayAI(final AbilityFactory af, final SpellAbility sa) { private static boolean destroyCanPlayAI(final AbilityFactory af, final SpellAbility sa) {
// AI needs to be expanded, since this function can be pretty complex // AI needs to be expanded, since this function can be pretty complex
// based on what the expected targets could be // based on what the expected targets could be
Random r = MyRandom.random; Random r = MyRandom.getRandom();
Cost abCost = sa.getPayCosts(); Cost abCost = sa.getPayCosts();
Target abTgt = sa.getTarget(); Target abTgt = sa.getTarget();
final Card source = sa.getSourceCard(); final Card source = sa.getSourceCard();
@@ -704,7 +704,7 @@ public class AbilityFactory_Destroy {
private static boolean destroyAllCanPlayAI(final AbilityFactory af, final SpellAbility sa, final boolean noRegen) { private static boolean destroyAllCanPlayAI(final AbilityFactory af, final SpellAbility sa, final boolean noRegen) {
// AI needs to be expanded, since this function can be pretty complex // AI needs to be expanded, since this function can be pretty complex
// based on what the expected targets could be // based on what the expected targets could be
Random r = MyRandom.random; Random r = MyRandom.getRandom();
Cost abCost = sa.getPayCosts(); Cost abCost = sa.getPayCosts();
final Card source = sa.getSourceCard(); final Card source = sa.getSourceCard();
final HashMap<String, String> params = af.getMapParams(); final HashMap<String, String> params = af.getMapParams();

View File

@@ -192,7 +192,7 @@ public class AbilityFactory_Effect {
* @return a boolean. * @return a boolean.
*/ */
public static boolean effectCanPlayAI(final AbilityFactory af, final SpellAbility sa) { public static boolean effectCanPlayAI(final AbilityFactory af, final SpellAbility sa) {
Random r = MyRandom.random; Random r = MyRandom.getRandom();
HashMap<String, String> params = af.getMapParams(); HashMap<String, String> params = af.getMapParams();
String stackable = params.get("Stackable"); String stackable = params.get("Stackable");

View File

@@ -947,7 +947,7 @@ public class AbilityFactory_Mana {
Target tgt = af.getAbTgt(); Target tgt = af.getAbTgt();
Card source = sa.getSourceCard(); Card source = sa.getSourceCard();
Random r = MyRandom.random; Random r = MyRandom.getRandom();
boolean randomReturn = r.nextFloat() <= Math.pow(.6667, sa.getActivationsThisTurn()); boolean randomReturn = r.nextFloat() <= Math.pow(.6667, sa.getActivationsThisTurn());
if (tgt == null) { if (tgt == null) {

View File

@@ -222,7 +222,7 @@ public class AbilityFactory_PermanentState {
return false; return false;
} }
Random r = MyRandom.random; Random r = MyRandom.getRandom();
boolean randomReturn = r.nextFloat() <= Math.pow(.6667, sa.getActivationsThisTurn() + 1); boolean randomReturn = r.nextFloat() <= Math.pow(.6667, sa.getActivationsThisTurn() + 1);
if (tgt == null) { if (tgt == null) {
@@ -772,7 +772,7 @@ public class AbilityFactory_PermanentState {
Target tgt = af.getAbTgt(); Target tgt = af.getAbTgt();
Card source = sa.getSourceCard(); Card source = sa.getSourceCard();
Random r = MyRandom.random; Random r = MyRandom.getRandom();
boolean randomReturn = r.nextFloat() <= Math.pow(.6667, sa.getActivationsThisTurn()); boolean randomReturn = r.nextFloat() <= Math.pow(.6667, sa.getActivationsThisTurn());
Phase phase = AllZone.getPhase(); Phase phase = AllZone.getPhase();
@@ -1525,7 +1525,7 @@ public class AbilityFactory_PermanentState {
validTappables = validTappables.getValidCards(valid, source.getController(), source); validTappables = validTappables.getValidCards(valid, source.getController(), source);
validTappables = validTappables.filter(CardListFilter.UNTAPPED); validTappables = validTappables.filter(CardListFilter.UNTAPPED);
Random r = MyRandom.random; Random r = MyRandom.getRandom();
boolean rr = false; boolean rr = false;
if (r.nextFloat() <= Math.pow(.6667, sa.getActivationsThisTurn())) { if (r.nextFloat() <= Math.pow(.6667, sa.getActivationsThisTurn())) {
rr = true; rr = true;
@@ -1630,7 +1630,7 @@ public class AbilityFactory_PermanentState {
CardList validTappables = getTapAllTargets(valid, source); CardList validTappables = getTapAllTargets(valid, source);
Random r = MyRandom.random; Random r = MyRandom.getRandom();
boolean rr = false; boolean rr = false;
if (r.nextFloat() <= Math.pow(.6667, sa.getActivationsThisTurn())) { if (r.nextFloat() <= Math.pow(.6667, sa.getActivationsThisTurn())) {
rr = true; rr = true;
@@ -1849,7 +1849,7 @@ public class AbilityFactory_PermanentState {
Target tgt = af.getAbTgt(); Target tgt = af.getAbTgt();
Card source = sa.getSourceCard(); Card source = sa.getSourceCard();
Random r = MyRandom.random; Random r = MyRandom.getRandom();
boolean randomReturn = r.nextFloat() <= Math.pow(.6667, sa.getActivationsThisTurn()); boolean randomReturn = r.nextFloat() <= Math.pow(.6667, sa.getActivationsThisTurn());
if (tgt == null) { if (tgt == null) {
@@ -2179,7 +2179,7 @@ public class AbilityFactory_PermanentState {
Card source = sa.getSourceCard(); Card source = sa.getSourceCard();
final HashMap<String, String> params = af.getMapParams(); final HashMap<String, String> params = af.getMapParams();
Random r = MyRandom.random; Random r = MyRandom.getRandom();
boolean randomReturn = r.nextFloat() <= Math.pow(.6667, sa.getActivationsThisTurn() + 1); boolean randomReturn = r.nextFloat() <= Math.pow(.6667, sa.getActivationsThisTurn() + 1);
ArrayList<Card> tgtCards; ArrayList<Card> tgtCards;

View File

@@ -491,12 +491,12 @@ public class AbilityFactory_Pump {
} else if (card.hasSickness() ^ Keywords.contains("Haste")) { } else if (card.hasSickness() ^ Keywords.contains("Haste")) {
return false; return false;
} else if (hostCard.equals(card)) { } else if (hostCard.equals(card)) {
Random r = MyRandom.random; Random r = MyRandom.getRandom();
if (r.nextFloat() <= Math.pow(.6667, activations)) { if (r.nextFloat() <= Math.pow(.6667, activations)) {
return CardFactoryUtil.AI_doesCreatureAttack(card) && !sa.getPayCosts().getTap(); return CardFactoryUtil.AI_doesCreatureAttack(card) && !sa.getPayCosts().getTap();
} }
} else { } else {
Random r = MyRandom.random; Random r = MyRandom.getRandom();
return (r.nextFloat() <= Math.pow(.6667, activations)); return (r.nextFloat() <= Math.pow(.6667, activations));
} }
} }
@@ -1061,7 +1061,7 @@ public class AbilityFactory_Pump {
*/ */
private boolean pumpAllCanPlayAI(final SpellAbility sa) { private boolean pumpAllCanPlayAI(final SpellAbility sa) {
String valid = ""; String valid = "";
Random r = MyRandom.random; Random r = MyRandom.getRandom();
// final Card source = sa.getSourceCard(); // final Card source = sa.getSourceCard();
params = AF.getMapParams(); params = AF.getMapParams();
final int defense = getNumDefense(sa); final int defense = getNumDefense(sa);

View File

@@ -225,7 +225,7 @@ public final class AbilityFactory_Reveal {
chance = .667; // 66.7% chance for sorcery speed (since it will chance = .667; // 66.7% chance for sorcery speed (since it will
// never activate EOT) // never activate EOT)
} }
Random r = MyRandom.random; Random r = MyRandom.getRandom();
boolean randomReturn = r.nextFloat() <= Math.pow(chance, sa.getActivationsThisTurn() + 1); boolean randomReturn = r.nextFloat() <= Math.pow(chance, sa.getActivationsThisTurn() + 1);
Target tgt = sa.getTarget(); Target tgt = sa.getTarget();
@@ -785,7 +785,7 @@ public final class AbilityFactory_Reveal {
chance = .667; // 66.7% chance for sorcery speed (since it will chance = .667; // 66.7% chance for sorcery speed (since it will
// never activate EOT) // never activate EOT)
} }
Random r = MyRandom.random; Random r = MyRandom.getRandom();
boolean randomReturn = r.nextFloat() <= Math.pow(chance, sa.getActivationsThisTurn() + 1); boolean randomReturn = r.nextFloat() <= Math.pow(chance, sa.getActivationsThisTurn() + 1);
Target tgt = sa.getTarget(); Target tgt = sa.getTarget();
@@ -1136,7 +1136,7 @@ public final class AbilityFactory_Reveal {
return false; return false;
} }
Random r = MyRandom.random; Random r = MyRandom.getRandom();
boolean randomReturn = r.nextFloat() <= Math.pow(.667, sa.getActivationsThisTurn() + 1); boolean randomReturn = r.nextFloat() <= Math.pow(.667, sa.getActivationsThisTurn() + 1);
if (AbilityFactory.playReusable(sa)) { if (AbilityFactory.playReusable(sa)) {
@@ -1524,7 +1524,7 @@ public final class AbilityFactory_Reveal {
chance = .667; // 66.7% chance for sorcery speed (since it will chance = .667; // 66.7% chance for sorcery speed (since it will
// never activate EOT) // never activate EOT)
} }
Random r = MyRandom.random; Random r = MyRandom.getRandom();
boolean randomReturn = r.nextFloat() <= Math.pow(chance, sa.getActivationsThisTurn() + 1); boolean randomReturn = r.nextFloat() <= Math.pow(chance, sa.getActivationsThisTurn() + 1);
if (AbilityFactory.playReusable(sa)) { if (AbilityFactory.playReusable(sa)) {
@@ -2059,7 +2059,7 @@ public final class AbilityFactory_Reveal {
return false; return false;
} }
Random r = MyRandom.random; Random r = MyRandom.getRandom();
boolean randomReturn = r.nextFloat() <= Math.pow(.667, sa.getActivationsThisTurn() + 1); boolean randomReturn = r.nextFloat() <= Math.pow(.667, sa.getActivationsThisTurn() + 1);
if (AbilityFactory.playReusable(sa)) { if (AbilityFactory.playReusable(sa)) {

View File

@@ -708,7 +708,7 @@ public class AbilityFactory_Sacrifice {
public static boolean sacrificeAllCanPlayAI(final AbilityFactory af, final SpellAbility sa) { public static boolean sacrificeAllCanPlayAI(final AbilityFactory af, final SpellAbility sa) {
// AI needs to be expanded, since this function can be pretty complex // AI needs to be expanded, since this function can be pretty complex
// based on what the expected targets could be // based on what the expected targets could be
Random r = MyRandom.random; Random r = MyRandom.getRandom();
Cost abCost = sa.getPayCosts(); Cost abCost = sa.getPayCosts();
final Card source = sa.getSourceCard(); final Card source = sa.getSourceCard();
final HashMap<String, String> params = af.getMapParams(); final HashMap<String, String> params = af.getMapParams();

View File

@@ -280,7 +280,7 @@ public class AbilityFactory_Token extends AbilityFactory {
// return true; // return true;
// prevent run-away activations - first time will always return true // prevent run-away activations - first time will always return true
Random r = MyRandom.random; Random r = MyRandom.getRandom();
final Card source = sa.getSourceCard(); final Card source = sa.getSourceCard();
boolean chance = r.nextFloat() <= Math.pow(.9, sa.getActivationsThisTurn()); boolean chance = r.nextFloat() <= Math.pow(.9, sa.getActivationsThisTurn());

View File

@@ -290,7 +290,7 @@ public class AbilityFactory_ZoneAffecting {
{ {
chance = .9; // 90% for end of opponents turn chance = .9; // 90% for end of opponents turn
} }
Random r = MyRandom.random; Random r = MyRandom.getRandom();
boolean randomReturn = r.nextFloat() <= Math.pow(chance, sa.getActivationsThisTurn() + 1); boolean randomReturn = r.nextFloat() <= Math.pow(chance, sa.getActivationsThisTurn() + 1);
if (AbilityFactory.playReusable(sa)) { if (AbilityFactory.playReusable(sa)) {
@@ -741,7 +741,7 @@ public class AbilityFactory_ZoneAffecting {
return false; return false;
} }
Random r = MyRandom.random; Random r = MyRandom.getRandom();
// Don't use draw abilities before main 2 if possible // Don't use draw abilities before main 2 if possible
if (AllZone.getPhase().isBefore(Constant.Phase.MAIN2) && !params.containsKey("ActivationPhases")) { if (AllZone.getPhase().isBefore(Constant.Phase.MAIN2) && !params.containsKey("ActivationPhases")) {
@@ -1413,7 +1413,7 @@ public class AbilityFactory_ZoneAffecting {
chance = .9; // 90% for end of opponents turn chance = .9; // 90% for end of opponents turn
} }
Random r = MyRandom.random; Random r = MyRandom.getRandom();
boolean randomReturn = r.nextFloat() <= Math.pow(chance, sa.getActivationsThisTurn() + 1); boolean randomReturn = r.nextFloat() <= Math.pow(chance, sa.getActivationsThisTurn() + 1);
if (AbilityFactory.playReusable(sa)) { if (AbilityFactory.playReusable(sa)) {

View File

@@ -61,7 +61,7 @@ import forge.gui.input.Input_PayManaCostUtil;
* @version $Id$ * @version $Id$
*/ */
public class CardFactoryUtil { public class CardFactoryUtil {
private static Random random = MyRandom.random; private static Random random = MyRandom.getRandom();
/** /**
* <p> * <p>
@@ -215,7 +215,7 @@ public class CardFactoryUtil {
if (nbLand.size() > 0) { if (nbLand.size() > 0) {
// TODO - Rank non basics? // TODO - Rank non basics?
final Random r = MyRandom.random; final Random r = MyRandom.getRandom();
return nbLand.get(r.nextInt(nbLand.size())); return nbLand.get(r.nextInt(nbLand.size()));
} }
@@ -247,7 +247,7 @@ public class CardFactoryUtil {
} }
} }
final Random r = MyRandom.random; final Random r = MyRandom.getRandom();
return bLand.get(r.nextInt(bLand.size())); // random tapped land of return bLand.get(r.nextInt(bLand.size())); // random tapped land of
// least represented type // least represented type
} }

View File

@@ -253,7 +253,7 @@ public class CardFactory_Creatures {
if (card.getController().isHuman()) { if (card.getController().isHuman()) {
choice = GuiUtils.getChoice("Choose one", choices); choice = GuiUtils.getChoice("Choose one", choices);
} else { } else {
choice = choices[MyRandom.random.nextInt(3)]; choice = choices[MyRandom.getRandom().nextInt(3)];
} }
if (choice.equals("2/2 with flying")) { if (choice.equals("2/2 with flying")) {

View File

@@ -508,7 +508,7 @@ public class CardFactory_Instants {
} }
// comp randomly selects one of the three cards // comp randomly selects one of the three cards
final Card choice = selectedCards.get(MyRandom.random.nextInt(2)); final Card choice = selectedCards.get(MyRandom.getRandom().nextInt(2));
selectedCards.remove(choice); selectedCards.remove(choice);
AllZone.getGameAction().moveToHand(choice); AllZone.getGameAction().moveToHand(choice);

View File

@@ -75,7 +75,7 @@ class CardFactory_Lands {
boolean pay = false; boolean pay = false;
if (AllZone.getComputerPlayer().getLife() > 9) { if (AllZone.getComputerPlayer().getLife() > 9) {
pay = MyRandom.random.nextBoolean(); pay = MyRandom.getRandom().nextBoolean();
} }
if (pay) { if (pay) {

View File

@@ -141,7 +141,7 @@ public abstract class DeckGeneration {
String stDeck; String stDeck;
if (o.toString().equals("Random")) { if (o.toString().equals("Random")) {
Random r = MyRandom.random; Random r = MyRandom.getRandom();
stDeck = tNames.get(r.nextInt(tNames.size() - 1) + 1); stDeck = tNames.get(r.nextInt(tNames.size() - 1) + 1);
} else { } else {
stDeck = o.toString(); stDeck = o.toString();
@@ -167,7 +167,7 @@ public abstract class DeckGeneration {
* @return a {@link forge.deck.Deck} object. * @return a {@link forge.deck.Deck} object.
*/ */
private static Deck generate2ColorDeck(final PlayerType p) { private static Deck generate2ColorDeck(final PlayerType p) {
Random r = MyRandom.random; Random r = MyRandom.getRandom();
ArrayList<String> colors = new ArrayList<String>(); ArrayList<String> colors = new ArrayList<String>();
colors.add("Random"); colors.add("Random");
@@ -222,7 +222,7 @@ public abstract class DeckGeneration {
* @return a {@link forge.deck.Deck} object. * @return a {@link forge.deck.Deck} object.
*/ */
private static Deck generate3ColorDeck(final PlayerType p) { private static Deck generate3ColorDeck(final PlayerType p) {
Random r = MyRandom.random; Random r = MyRandom.getRandom();
ArrayList<String> colors = new ArrayList<String>(); ArrayList<String> colors = new ArrayList<String>();
colors.add("Random"); colors.add("Random");

View File

@@ -44,7 +44,7 @@ public class Generate2ColorDeck {
* a {@link java.lang.String} object. * a {@link java.lang.String} object.
*/ */
public Generate2ColorDeck(final String Clr1, final String Clr2) { public Generate2ColorDeck(final String Clr1, final String Clr2) {
r = MyRandom.random; r = MyRandom.getRandom();
cardCounts = new HashMap<String, Integer>(); cardCounts = new HashMap<String, Integer>();

View File

@@ -47,7 +47,7 @@ public class Generate3ColorDeck {
* a {@link java.lang.String} object. * a {@link java.lang.String} object.
*/ */
public Generate3ColorDeck(final String Clr1, final String Clr2, final String Clr3) { public Generate3ColorDeck(final String Clr1, final String Clr2, final String Clr3) {
r = MyRandom.random; r = MyRandom.getRandom();
cardCounts = new HashMap<String, Integer>(); cardCounts = new HashMap<String, Integer>();

View File

@@ -61,7 +61,7 @@ public class Generate5ColorDeck {
*/ */
public Generate5ColorDeck(final String clr1, final String clr2, final String clr3, final String clr4, public Generate5ColorDeck(final String clr1, final String clr2, final String clr3, final String clr4,
final String clr5) { final String clr5) {
r = MyRandom.random; r = MyRandom.getRandom();
cardCounts = new HashMap<String, Integer>(); cardCounts = new HashMap<String, Integer>();

View File

@@ -155,7 +155,7 @@ public class GenerateThemeDeck {
String tmpDeck = ""; String tmpDeck = "";
// begin assigning cards to the deck // begin assigning cards to the deck
Random r = MyRandom.random; Random r = MyRandom.getRandom();
for (int i = 0; i < groups.size(); i++) { for (int i = 0; i < groups.size(); i++) {
Grp g = groups.get(i); Grp g = groups.get(i);

View File

@@ -333,7 +333,7 @@ public class BoosterDraftAI {
CardList otherCreatures = AIPlayables.getType("Creature"); CardList otherCreatures = AIPlayables.getType("Creature");
while (nCreatures > 1 && otherCreatures.size() > 1) { while (nCreatures > 1 && otherCreatures.size() > 1) {
Card c = otherCreatures.get(MyRandom.random.nextInt(otherCreatures.size() - 1)); Card c = otherCreatures.get(MyRandom.getRandom().nextInt(otherCreatures.size() - 1));
outList.add(c); outList.add(c);
cardsNeeded--; cardsNeeded--;
nCreatures--; nCreatures--;
@@ -349,7 +349,7 @@ public class BoosterDraftAI {
int ii = 0; int ii = 0;
while (cardsNeeded > 0 && others.size() > 1) { while (cardsNeeded > 0 && others.size() > 1) {
Card c = others.get(MyRandom.random.nextInt(others.size() - 1)); Card c = others.get(MyRandom.getRandom().nextInt(others.size() - 1));
//out.addMain(c.getName()); //out.addMain(c.getName());
outList.add(c); outList.add(c);
@@ -368,7 +368,7 @@ public class BoosterDraftAI {
//if (z.size() < 1) //if (z.size() < 1)
// throw new RuntimeException("BoosterDraftAI : buildDeck() error, deck does not have enough non-lands"); // throw new RuntimeException("BoosterDraftAI : buildDeck() error, deck does not have enough non-lands");
Card c = z.get(MyRandom.random.nextInt(z.size() - 1)); Card c = z.get(MyRandom.getRandom().nextInt(z.size() - 1));
//out.addMain(c.getName()); //out.addMain(c.getName());
outList.add(c); outList.add(c);
@@ -470,13 +470,13 @@ public class BoosterDraftAI {
} }
while (outList.size() > 40) { while (outList.size() > 40) {
Card c = outList.get(MyRandom.random.nextInt(outList.size() - 1)); Card c = outList.get(MyRandom.getRandom().nextInt(outList.size() - 1));
outList.remove(c); outList.remove(c);
AIPlayables.add(c); AIPlayables.add(c);
} }
while (outList.size() < 40) { while (outList.size() < 40) {
Card c = AIPlayables.get(MyRandom.random.nextInt(AIPlayables.size() - 1)); Card c = AIPlayables.get(MyRandom.getRandom().nextInt(AIPlayables.size() - 1));
outList.add(c); outList.add(c);
AIPlayables.remove(c); AIPlayables.remove(c);
} }
@@ -542,7 +542,7 @@ public class BoosterDraftAI {
*/ */
private int[] getDeckColors() { private int[] getDeckColors() {
int[] out = new int[nDecks]; int[] out = new int[nDecks];
int start = MyRandom.random.nextInt(10); int start = MyRandom.getRandom().nextInt(10);
for (int i = 0; i < out.length; i++) { for (int i = 0; i < out.length; i++) {
//% to get an index between 0 and deckColorChoices.length //% to get an index between 0 and deckColorChoices.length

View File

@@ -233,7 +233,7 @@ public class SealedDeck {
CardList splashCreatures = AIPlayables.getType("Creature").getColor(dcAI.Splash); CardList splashCreatures = AIPlayables.getType("Creature").getColor(dcAI.Splash);
while (nCreatures > 1 && splashCreatures.size() > 1) { while (nCreatures > 1 && splashCreatures.size() > 1) {
Card c = splashCreatures.get(MyRandom.random.nextInt(splashCreatures.size() - 1)); Card c = splashCreatures.get(MyRandom.getRandom().nextInt(splashCreatures.size() - 1));
deck.add(c); deck.add(c);
aiCardpool.remove(c); aiCardpool.remove(c);
@@ -256,7 +256,7 @@ public class SealedDeck {
spells.addAll(AIPlayables.getType("Enchantment").getOnly2Colors(dcAI.Color1, dcAI.Color2)); spells.addAll(AIPlayables.getType("Enchantment").getOnly2Colors(dcAI.Color1, dcAI.Color2));
while (cardsNeeded > 0 && spells.size() > 1) { while (cardsNeeded > 0 && spells.size() > 1) {
Card c = spells.get(MyRandom.random.nextInt(spells.size() - 1)); Card c = spells.get(MyRandom.getRandom().nextInt(spells.size() - 1));
deck.add(c); deck.add(c);
spells.remove(c); spells.remove(c);
AIPlayables.remove(c); AIPlayables.remove(c);
@@ -268,7 +268,7 @@ public class SealedDeck {
splashSpells.addAll(AIPlayables.getType("Sorcery").getColor(dcAI.Splash)); splashSpells.addAll(AIPlayables.getType("Sorcery").getColor(dcAI.Splash));
while (cardsNeeded > 0 && splashSpells.size() > 1) { while (cardsNeeded > 0 && splashSpells.size() > 1) {
Card c = splashSpells.get(MyRandom.random.nextInt(splashSpells.size() - 1)); Card c = splashSpells.get(MyRandom.getRandom().nextInt(splashSpells.size() - 1));
deck.add(c); deck.add(c);
splashSpells.remove(c); splashSpells.remove(c);
AIPlayables.remove(c); AIPlayables.remove(c);

View File

@@ -1000,8 +1000,8 @@ public class DeckAnalysis extends javax.swing.JDialog {
private JList getJList1() { private JList getJList1() {
List<CardPrinted> rList = deck.toFlatList(); List<CardPrinted> rList = deck.toFlatList();
Collections.shuffle(rList, MyRandom.random); Collections.shuffle(rList, MyRandom.getRandom());
Collections.shuffle(rList, MyRandom.random); Collections.shuffle(rList, MyRandom.getRandom());
ListModel jList1Model; ListModel jList1Model;
if (jListFirstHand == null) { if (jListFirstHand == null) {

View File

@@ -549,7 +549,7 @@ public final class QuestData {
* This method should be called whenever the opponents should change. * This method should be called whenever the opponents should change.
*/ */
public void randomizeOpponents() { public void randomizeOpponents() {
randomSeed = MyRandom.random.nextLong(); randomSeed = MyRandom.getRandom().nextLong();
} }
// SERIALIZATION - related things // SERIALIZATION - related things

View File

@@ -280,7 +280,7 @@ public final class QuestUtilCards {
q.shopList.addAllCards(pack.getBoosterPack(7, 3, 1, 0, 0, 0, 0, 0, 0)); q.shopList.addAllCards(pack.getBoosterPack(7, 3, 1, 0, 0, 0, 0, 0, 0));
// add some boosters // add some boosters
int rollD100 = MyRandom.random.nextInt(100); int rollD100 = MyRandom.getRandom().nextInt(100);
Predicate<CardSet> filter = rollD100 < 40 ? filterT2booster : (rollD100 < 75 ? filterExtButT2 Predicate<CardSet> filter = rollD100 < 40 ? filterT2booster : (rollD100 < 75 ? filterExtButT2
: filterNotExt); : filterNotExt);
q.shopList.addAllCards(filter.random(SetUtils.getAllSets(), 1, BoosterPack.fnFromSet)); q.shopList.addAllCards(filter.random(SetUtils.getAllSets(), 1, BoosterPack.fnFromSet));

View File

@@ -61,7 +61,7 @@ public class ReadPriceList implements NewConstants {
private HashMap<String, Integer> readFile(final File file) { private HashMap<String, Integer> readFile(final File file) {
BufferedReader in; BufferedReader in;
HashMap<String, Integer> map = new HashMap<String, Integer>(); HashMap<String, Integer> map = new HashMap<String, Integer>();
Random r = MyRandom.random; Random r = MyRandom.getRandom();
try { try {
in = new BufferedReader(new FileReader(file)); in = new BufferedReader(new FileReader(file));

View File

@@ -510,7 +510,7 @@ public class QuestWinLoseHandler extends WinLoseModeHandler {
private boolean getLuckyCoinResult() { private boolean getLuckyCoinResult() {
boolean hasCoin = model.qData.getInventory().getItemLevel("Lucky Coin") >= 1; boolean hasCoin = model.qData.getInventory().getItemLevel("Lucky Coin") >= 1;
return MyRandom.random.nextFloat() <= (hasCoin ? 0.65f : 0.5f); return MyRandom.getRandom().nextFloat() <= (hasCoin ? 0.65f : 0.5f);
} }
/** /**

View File

@@ -1006,7 +1006,7 @@ public class Gui_HomeScreen {
String stDeck; String stDeck;
if (t.toString().equals("Random")) { if (t.toString().equals("Random")) {
Random r = MyRandom.random; Random r = MyRandom.getRandom();
stDeck = tNames.get(r.nextInt(tNames.size() - 1) + 1); stDeck = tNames.get(r.nextInt(tNames.size() - 1) + 1);
} else { } else {
stDeck = t.toString(); stDeck = t.toString();
@@ -1034,7 +1034,7 @@ public class Gui_HomeScreen {
c1 = GuiUtils.getChoice("Select first color.", colors.toArray()).toString(); c1 = GuiUtils.getChoice("Select first color.", colors.toArray()).toString();
if (c1.equals("Random")) { if (c1.equals("Random")) {
c1 = colors.get(MyRandom.random.nextInt(colors.size() - 1) + 1); c1 = colors.get(MyRandom.getRandom().nextInt(colors.size() - 1) + 1);
} }
colors.remove(c1); colors.remove(c1);
@@ -1042,14 +1042,14 @@ public class Gui_HomeScreen {
c2 = GuiUtils.getChoice("Select second color.", colors.toArray()).toString(); c2 = GuiUtils.getChoice("Select second color.", colors.toArray()).toString();
if (c2.equals("Random")) { if (c2.equals("Random")) {
c2 = colors.get(MyRandom.random.nextInt(colors.size() - 1) + 1); c2 = colors.get(MyRandom.getRandom().nextInt(colors.size() - 1) + 1);
} }
} else { } else {
// if (p.equals("C")) // if (p.equals("C"))
pt = PlayerType.COMPUTER; pt = PlayerType.COMPUTER;
c1 = colors.get(MyRandom.random.nextInt(colors.size() - 1) + 1); c1 = colors.get(MyRandom.getRandom().nextInt(colors.size() - 1) + 1);
colors.remove(c1); colors.remove(c1);
c2 = colors.get(MyRandom.random.nextInt(colors.size() - 1) + 1); c2 = colors.get(MyRandom.getRandom().nextInt(colors.size() - 1) + 1);
} }
Generate2ColorDeck gen = new Generate2ColorDeck(c1, c2); Generate2ColorDeck gen = new Generate2ColorDeck(c1, c2);
CardList d = gen.get2ColorDeck(60, pt); CardList d = gen.get2ColorDeck(60, pt);
@@ -1077,7 +1077,7 @@ public class Gui_HomeScreen {
c1 = GuiUtils.getChoice("Select first color.", colors.toArray()).toString(); c1 = GuiUtils.getChoice("Select first color.", colors.toArray()).toString();
if (c1.equals("Random")) { if (c1.equals("Random")) {
c1 = colors.get(MyRandom.random.nextInt(colors.size() - 1) + 1); c1 = colors.get(MyRandom.getRandom().nextInt(colors.size() - 1) + 1);
} }
colors.remove(c1); colors.remove(c1);
@@ -1085,25 +1085,25 @@ public class Gui_HomeScreen {
c2 = GuiUtils.getChoice("Select second color.", colors.toArray()).toString(); c2 = GuiUtils.getChoice("Select second color.", colors.toArray()).toString();
if (c2.equals("Random")) { if (c2.equals("Random")) {
c2 = colors.get(MyRandom.random.nextInt(colors.size() - 1) + 1); c2 = colors.get(MyRandom.getRandom().nextInt(colors.size() - 1) + 1);
} }
colors.remove(c2); colors.remove(c2);
c3 = GuiUtils.getChoice("Select third color.", colors.toArray()).toString(); c3 = GuiUtils.getChoice("Select third color.", colors.toArray()).toString();
if (c3.equals("Random")) { if (c3.equals("Random")) {
c3 = colors.get(MyRandom.random.nextInt(colors.size() - 1) + 1); c3 = colors.get(MyRandom.getRandom().nextInt(colors.size() - 1) + 1);
} }
} else { } else {
// if (p.equals("C")) // if (p.equals("C"))
pt = PlayerType.COMPUTER; pt = PlayerType.COMPUTER;
c1 = colors.get(MyRandom.random.nextInt(colors.size() - 1) + 1); c1 = colors.get(MyRandom.getRandom().nextInt(colors.size() - 1) + 1);
colors.remove(c1); colors.remove(c1);
c2 = colors.get(MyRandom.random.nextInt(colors.size() - 1) + 1); c2 = colors.get(MyRandom.getRandom().nextInt(colors.size() - 1) + 1);
colors.remove(c2); colors.remove(c2);
c3 = colors.get(MyRandom.random.nextInt(colors.size() - 1) + 1); c3 = colors.get(MyRandom.getRandom().nextInt(colors.size() - 1) + 1);
} }
Generate3ColorDeck gen = new Generate3ColorDeck(c1, c2, c3); Generate3ColorDeck gen = new Generate3ColorDeck(c1, c2, c3);
CardList d = gen.get3ColorDeck(60, pt); CardList d = gen.get3ColorDeck(60, pt);
@@ -1130,7 +1130,7 @@ public class Gui_HomeScreen {
} }
if (subDecks.size() > 0) { if (subDecks.size() > 0) {
int n = MyRandom.random.nextInt(subDecks.size()); int n = MyRandom.getRandom().nextInt(subDecks.size());
ret = subDecks.get(n); ret = subDecks.get(n);
} else { } else {

View File

@@ -721,7 +721,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
final Deck getRandomDeck(final Deck[] d) { final Deck getRandomDeck(final Deck[] d) {
// get a random number between 0 and d.length // get a random number between 0 and d.length
// int i = (int) (Math.random() * d.length); // int i = (int) (Math.random() * d.length);
Random r = MyRandom.random; Random r = MyRandom.getRandom();
return d[r.nextInt(d.length)]; return d[r.nextInt(d.length)];
} }

View File

@@ -133,8 +133,7 @@ public class BuildInfoTest {
*/ */
private File makeTmpJarWithManifest(final String fileNamePrefix, final String fileNameSuffix, private File makeTmpJarWithManifest(final String fileNamePrefix, final String fileNameSuffix,
final String[] nameValuePairs) final String[] nameValuePairs)
throws IOException throws IOException {
{
if (nameValuePairs.length % 2 != 0) { if (nameValuePairs.length % 2 != 0) {
throw new IllegalArgumentException("nameValuePairs must contain an even number of elements."); throw new IllegalArgumentException("nameValuePairs must contain an even number of elements.");
} }