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
target.setCancelWithSelectedAllowed(true);
target.setCancelAllowed(true);
FThreads.setInputAndWait(target);
if(!target.hasCancelled()) {
for (final Card sac : target.getSelected()) {

View File

@@ -3571,8 +3571,9 @@ public class CardFactoryUtil {
card2 = ComputerUtilCard.getBestCreatureAI(aiChoices);
}
} else {
InputSelectCards inp = new InputSelectCardsFromList(0, 1, choices);
inp.setMessage("Select target artifact creature to put +1/+1 counter on it");
InputSelectCards inp = new InputSelectCardsFromList(1, 1, choices);
inp.setCancelAllowed(true);
inp.setMessage("Select target artifact creature to give it +1/+1 counters from the dead " + card);
FThreads.setInputAndWait(inp);
if( !inp.hasCancelled() ) {
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 max;
public boolean allowUnselect = false;
private boolean allowCancelWithNotEmptyList = false;
private boolean allowCancel = false;
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();
CMatchUI.SINGLETON_INSTANCE.showMessage(msgToShow);
boolean canCancel = (min == 0 && selected.isEmpty()) || isCancelWithSelectedAllowed();
boolean canCancel = (min == 0 && selected.isEmpty()) || allowCancel;
boolean canOk = hasEnoughTargets();
if (canOk && canCancel) {
@@ -125,6 +125,5 @@ public abstract class InputSelectManyBase<T extends GameEntity> extends InputSyn
public final boolean isUnselectAllowed() { return allowUnselect; }
public final void setUnselectAllowed(boolean allow) { this.allowUnselect = allow; }
public final boolean isCancelWithSelectedAllowed() { return allowCancelWithNotEmptyList; }
public final void setCancelWithSelectedAllowed(boolean allow) { this.allowCancelWithNotEmptyList = allow ; }
public final void setCancelAllowed(boolean allow) { this.allowCancel = allow ; }
}

View File

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