Add Frenetic Efreet

Some cleanup in AF_Phases and GameActionUtil.FlipACoin
This commit is contained in:
Sol
2011-10-12 12:37:26 +00:00
parent ab50e639ad
commit 5a3c3ca188
4 changed files with 27 additions and 11 deletions

View File

@@ -661,22 +661,20 @@ public final class GameActionUtil {
public static boolean flipACoin(final Player caller, final Card source) {
String choice = "";
String[] choices = {"heads", "tails"};
boolean flip = (50 > MyRandom.random.nextInt(100));
boolean flip = MyRandom.random.nextBoolean();
if (caller.isHuman()) {
choice = (String) GuiUtils.getChoice(source.getName() + " - Call coin flip", choices);
} else {
choice = choices[MyRandom.random.nextInt(2)];
}
if ((flip == true && choice.equals("heads")) || (flip == false && choice.equals("tails"))) {
JOptionPane.showMessageDialog(null, source.getName() + " - " + caller + " wins flip.",
source.getName(), JOptionPane.PLAIN_MESSAGE);
return true;
} else {
JOptionPane.showMessageDialog(null, source.getName() + " - " + caller + " loses flip.",
source.getName(), JOptionPane.PLAIN_MESSAGE);
return false;
}
boolean winFlip = flip == choice.equals("heads");
String winMsg = winFlip ? " wins flip." : " loses flip.";
JOptionPane.showMessageDialog(null, source.getName() + " - " + caller + winMsg,
source.getName(), JOptionPane.PLAIN_MESSAGE);
return winFlip;
}
/**

View File

@@ -2013,7 +2013,9 @@ public class AbilityFactory_PermanentState {
}
for (Card tgtC : tgtCards) {
tgtC.phase();
if (!tgtC.isPhasedOut()) {
tgtC.phase();
}
}
}
}// end of AbilityFactory_PermanentState class