InputSelectManyBase - gave some methods cleared names, adjusted input responsible for Modular ability

This commit is contained in:
Maxmtg
2013-03-29 06:35:08 +00:00
parent 97b418c9de
commit 38e40ed2c0
5 changed files with 9 additions and 10 deletions

View File

@@ -512,7 +512,7 @@ public class CardFactoryCreatures {
} }
}; // Input }; // Input
target.setCancelWithSelectedAllowed(true); target.setCancelAllowed(true);
FThreads.setInputAndWait(target); FThreads.setInputAndWait(target);
if(!target.hasCancelled()) { if(!target.hasCancelled()) {
for (final Card sac : target.getSelected()) { for (final Card sac : target.getSelected()) {

View File

@@ -3571,8 +3571,9 @@ public class CardFactoryUtil {
card2 = ComputerUtilCard.getBestCreatureAI(aiChoices); card2 = ComputerUtilCard.getBestCreatureAI(aiChoices);
} }
} else { } else {
InputSelectCards inp = new InputSelectCardsFromList(0, 1, choices); InputSelectCards inp = new InputSelectCardsFromList(1, 1, choices);
inp.setMessage("Select target artifact creature to put +1/+1 counter on it"); inp.setCancelAllowed(true);
inp.setMessage("Select target artifact creature to give it +1/+1 counters from the dead " + card);
FThreads.setInputAndWait(inp); FThreads.setInputAndWait(inp);
if( !inp.hasCancelled() ) { if( !inp.hasCancelled() ) {
card2 = inp.getSelected().get(0); card2 = inp.getSelected().get(0);

View File

@@ -16,7 +16,7 @@ public abstract class InputSelectManyBase<T extends GameEntity> extends InputSyn
protected final int min; protected final int min;
protected final int max; protected final int max;
public boolean allowUnselect = false; public boolean allowUnselect = false;
private boolean allowCancelWithNotEmptyList = false; private boolean allowCancel = false;
private String message = "Source-Card-Name - Select %d more card(s)"; private String message = "Source-Card-Name - Select %d more card(s)";
@@ -36,7 +36,7 @@ public abstract class InputSelectManyBase<T extends GameEntity> extends InputSyn
String msgToShow = getMessage(); String msgToShow = getMessage();
CMatchUI.SINGLETON_INSTANCE.showMessage(msgToShow); CMatchUI.SINGLETON_INSTANCE.showMessage(msgToShow);
boolean canCancel = (min == 0 && selected.isEmpty()) || isCancelWithSelectedAllowed(); boolean canCancel = (min == 0 && selected.isEmpty()) || allowCancel;
boolean canOk = hasEnoughTargets(); boolean canOk = hasEnoughTargets();
if (canOk && canCancel) { if (canOk && canCancel) {
@@ -125,6 +125,5 @@ public abstract class InputSelectManyBase<T extends GameEntity> extends InputSyn
public final boolean isUnselectAllowed() { return allowUnselect; } public final boolean isUnselectAllowed() { return allowUnselect; }
public final void setUnselectAllowed(boolean allow) { this.allowUnselect = allow; } public final void setUnselectAllowed(boolean allow) { this.allowUnselect = allow; }
public final boolean isCancelWithSelectedAllowed() { return allowCancelWithNotEmptyList; } public final void setCancelAllowed(boolean allow) { this.allowCancel = allow ; }
public final void setCancelWithSelectedAllowed(boolean allow) { this.allowCancelWithNotEmptyList = allow ; }
} }

View File

@@ -531,7 +531,7 @@ public final class GameActionUtil {
InputSelectCards inp = new InputSelectCardsFromList(amount, amount, choiceList); InputSelectCards inp = new InputSelectCardsFromList(amount, amount, choiceList);
inp.setMessage("Select %d card(s) to return to hand"); inp.setMessage("Select %d card(s) to return to hand");
inp.setCancelWithSelectedAllowed(true); inp.setCancelAllowed(true);
FThreads.setInputAndWait(inp); FThreads.setInputAndWait(inp);
if( inp.hasCancelled() || inp.getSelected().size() != amount) if( inp.hasCancelled() || inp.getSelected().size() != amount)
@@ -550,7 +550,7 @@ public final class GameActionUtil {
InputSelectCards inp = new InputSelectCardsFromList(amount, amount, choiceList); InputSelectCards inp = new InputSelectCardsFromList(amount, amount, choiceList);
inp.setMessage("Select %d card(s) to discard"); inp.setMessage("Select %d card(s) to discard");
inp.setCancelWithSelectedAllowed(true); inp.setCancelAllowed(true);
FThreads.setInputAndWait(inp); FThreads.setInputAndWait(inp);
if( inp.hasCancelled() || inp.getSelected().size() != amount) if( inp.hasCancelled() || inp.getSelected().size() != amount)

View File

@@ -324,7 +324,6 @@ public class PlayerControllerHuman extends PlayerController {
int max = minDiscard == 0 ? Integer.MAX_VALUE : minDiscard; int max = minDiscard == 0 ? Integer.MAX_VALUE : minDiscard;
InputSelectCards inp = new InputSelectCardsFromList(minDiscard, max, valid); InputSelectCards inp = new InputSelectCardsFromList(minDiscard, max, valid);
inp.setCancelWithSelectedAllowed(false);
inp.setMessage("Discard %d cards"); inp.setMessage("Discard %d cards");
FThreads.setInputAndWait(inp); FThreads.setInputAndWait(inp);
return inp.getSelected(); return inp.getSelected();