update a few custom Yes/No dialogs to use GameActionUtil.showYesNoDialog()

This commit is contained in:
jendave
2011-08-06 14:43:07 +00:00
parent 31c2234bc0
commit d509992fbf
3 changed files with 16 additions and 23 deletions

View File

@@ -362,7 +362,7 @@ public class AbilityFactory_CounterMagic {
else if(ActionID.equals("GainLife")) { else if(ActionID.equals("GainLife")) {
if(isOptional) { if(isOptional) {
if(Target == AllZone.HumanPlayer) { if(Target == AllZone.HumanPlayer) {
if(AllZone.Display.getChoice("Do you want to gain" + SplitActionParams[0] + "life?","Yes","No").equals("Yes")) { if(GameActionUtil.showYesNoDialog(srcSA.getSourceCard(), "Do you want to gain" + SplitActionParams[0] + "life?")) {
Target.gainLife(Integer.parseInt(SplitActionParams[0]), srcSA.getSourceCard()); Target.gainLife(Integer.parseInt(SplitActionParams[0]), srcSA.getSourceCard());
} }
} }
@@ -379,7 +379,7 @@ public class AbilityFactory_CounterMagic {
if(isOptional) { if(isOptional) {
System.out.println(Target); System.out.println(Target);
if(Target == AllZone.HumanPlayer) { if(Target == AllZone.HumanPlayer) {
if(AllZone.Display.getChoice("Do you want to reveal your hand?","Yes","No").equals("Yes")) { if(GameActionUtil.showYesNoDialog(srcSA.getSourceCard(), "Do you want to reveal your hand?")) {
//Does nothing now, of course, but sometime in the future the AI may be able to remember cards revealed and prioritize discard spells accordingly. //Does nothing now, of course, but sometime in the future the AI may be able to remember cards revealed and prioritize discard spells accordingly.
} }
} }
@@ -401,7 +401,7 @@ public class AbilityFactory_CounterMagic {
else if(ActionID.equals("RearrangeTopOfLibrary")) { else if(ActionID.equals("RearrangeTopOfLibrary")) {
if(isOptional) { if(isOptional) {
if(Target == AllZone.HumanPlayer) { if(Target == AllZone.HumanPlayer) {
if(AllZone.Display.getChoice("Do you want to rearrange the top " + SplitActionParams[0] + " cards of your library?","Yes","No").equals("Yes")) { if(GameActionUtil.showYesNoDialog(srcSA.getSourceCard(), "Do you want to rearrange the top " + SplitActionParams[0] + " cards of your library?")) {
AllZoneUtil.rearrangeTopOfLibrary(Target, Integer.parseInt(SplitActionParams[0]), false); AllZoneUtil.rearrangeTopOfLibrary(Target, Integer.parseInt(SplitActionParams[0]), false);
} }
} }

View File

@@ -385,10 +385,7 @@ public class Phase extends MyObservable
final Card crd = vaults.get(0); final Card crd = vaults.get(0);
if(turn.equals(AllZone.HumanPlayer)) { if(turn.equals(AllZone.HumanPlayer)) {
String[] choices = {"Yes", "No"}; if(GameActionUtil.showYesNoDialog(crd, "Untap " + crd + "?")) {
Object q = null;
q = AllZone.Display.getChoiceOptional("Untap " + crd + "?", choices);
if("Yes".equals(q)) {
crd.untap(); crd.untap();
turn = extraTurns.isEmpty() ? turn.getOpponent() : extraTurns.pop(); turn = extraTurns.isEmpty() ? turn.getOpponent() : extraTurns.pop();
} }

View File

@@ -338,13 +338,8 @@ public class PlayerZone_ComesIntoPlay extends DefaultPlayerZone {
@Override @Override
public void resolve() { public void resolve() {
if(crd.getController().equals(AllZone.HumanPlayer)) { if(crd.getController().equals(AllZone.HumanPlayer)) {
String[] choices = {"Yes", "No"}; if(GameActionUtil.showYesNoDialog(crd, "Attach " + crd + " to " + creat + "?")) {
if(AllZone.GameAction.isCardInZone(crd, graveZone)
Object q = null;
q = AllZone.Display.getChoiceOptional("Attach " + crd + " to " + creat + "?", choices);
if(q == null || q.equals("No")) ;
else if(AllZone.GameAction.isCardInZone(crd, graveZone)
&& AllZone.GameAction.isCardInPlay(creat) && creat.isCreature() && AllZone.GameAction.isCardInPlay(creat) && creat.isCreature()
&& creat.getNetAttack() == 1 && creat.getNetDefense() == 1) { && creat.getNetAttack() == 1 && creat.getNetDefense() == 1) {
graveZone.remove(crd); graveZone.remove(crd);
@@ -352,6 +347,7 @@ public class PlayerZone_ComesIntoPlay extends DefaultPlayerZone {
crd.equipCard(creat); crd.equipCard(creat);
} }
}
} else //computer } else //computer
{ {