mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
TangleWires input updated
This commit is contained in:
@@ -10,7 +10,7 @@ public class InputSelectCardsFromList extends InputSelectCards {
|
|||||||
private final List<Card> validChoices;
|
private final List<Card> validChoices;
|
||||||
|
|
||||||
public InputSelectCardsFromList(int min, int max, List<Card> validCards) {
|
public InputSelectCardsFromList(int min, int max, List<Card> validCards) {
|
||||||
super(min, max);
|
super(min, Math.min(max, validCards.size())); // to avoid hangs
|
||||||
this.validChoices = validCards;
|
this.validChoices = validCards;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ import forge.CardPredicates;
|
|||||||
import forge.FThreads;
|
import forge.FThreads;
|
||||||
import forge.CardPredicates.Presets;
|
import forge.CardPredicates.Presets;
|
||||||
import forge.CounterType;
|
import forge.CounterType;
|
||||||
import forge.Singletons;
|
|
||||||
import forge.card.cardfactory.CardFactoryUtil;
|
import forge.card.cardfactory.CardFactoryUtil;
|
||||||
import forge.card.cost.Cost;
|
import forge.card.cost.Cost;
|
||||||
import forge.card.mana.ManaCost;
|
import forge.card.mana.ManaCost;
|
||||||
@@ -38,7 +37,6 @@ import forge.card.spellability.Ability;
|
|||||||
import forge.card.spellability.AbilityManaPart;
|
import forge.card.spellability.AbilityManaPart;
|
||||||
import forge.card.spellability.AbilityStatic;
|
import forge.card.spellability.AbilityStatic;
|
||||||
import forge.card.spellability.SpellAbility;
|
import forge.card.spellability.SpellAbility;
|
||||||
import forge.control.input.InputBase;
|
|
||||||
import forge.control.input.InputPayManaExecuteCommands;
|
import forge.control.input.InputPayManaExecuteCommands;
|
||||||
import forge.control.input.InputSelectCards;
|
import forge.control.input.InputSelectCards;
|
||||||
import forge.control.input.InputSelectCardsFromList;
|
import forge.control.input.InputSelectCardsFromList;
|
||||||
@@ -52,12 +50,9 @@ import forge.game.ai.ComputerUtilMana;
|
|||||||
import forge.game.player.AIPlayer;
|
import forge.game.player.AIPlayer;
|
||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
import forge.game.zone.PlayerZone;
|
import forge.game.zone.PlayerZone;
|
||||||
import forge.game.zone.Zone;
|
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
import forge.gui.GuiChoose;
|
import forge.gui.GuiChoose;
|
||||||
import forge.gui.GuiDialog;
|
import forge.gui.GuiDialog;
|
||||||
import forge.gui.match.CMatchUI;
|
|
||||||
import forge.view.ButtonUtil;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -969,15 +964,14 @@ public class Upkeep extends Phase {
|
|||||||
@Override
|
@Override
|
||||||
public void resolve() {
|
public void resolve() {
|
||||||
final int num = source.getCounters(CounterType.FADE);
|
final int num = source.getCounters(CounterType.FADE);
|
||||||
final List<Card> list = CardLists.filter(player.getCardsIn(ZoneType.Battlefield), new Predicate<Card>() {
|
final List<Card> list = new ArrayList<Card>();
|
||||||
@Override
|
for( Card c : player.getCardsIn(ZoneType.Battlefield)) {
|
||||||
public boolean apply(final Card c) {
|
if ((c.isArtifact() || c.isLand() || c.isCreature()) && c.isUntapped())
|
||||||
return (c.isArtifact() || c.isLand() || c.isCreature()) && c.isUntapped();
|
list.add(c);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
for (int i = 0; i < num; i++) {
|
|
||||||
if (player.isComputer()) {
|
if (player.isComputer()) {
|
||||||
|
for (int i = 0; i < num; i++) {
|
||||||
Card toTap = ComputerUtilCard.getWorstPermanentAI(list, false, false, false, false);
|
Card toTap = ComputerUtilCard.getWorstPermanentAI(list, false, false, false, false);
|
||||||
// try to find non creature cards without tap abilities
|
// try to find non creature cards without tap abilities
|
||||||
List<Card> betterList = CardLists.filter(list, new Predicate<Card>() {
|
List<Card> betterList = CardLists.filter(list, new Predicate<Card>() {
|
||||||
@@ -1002,39 +996,19 @@ public class Upkeep extends Phase {
|
|||||||
toTap.tap();
|
toTap.tap();
|
||||||
list.remove(toTap);
|
list.remove(toTap);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Singletons.getModel().getMatch().getInput().setInput(new InputBase() {
|
InputSelectCards inp = new InputSelectCardsFromList(num, num, list);
|
||||||
private static final long serialVersionUID = 5313424586016061612L;
|
inp.setMessage(source.getName() + " - Select %d untapped artifact(s), creature(s), or land(s) you control");
|
||||||
|
FThreads.setInputAndWait(inp);
|
||||||
@Override
|
for(Card crd : inp.getSelected())
|
||||||
public void showMessage() {
|
crd.tap();
|
||||||
if (list.isEmpty()) {
|
|
||||||
this.stop();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
String message = String.format("%s - Select %d untapped artifact(s), creature(s), or land(s) you control", source.getName(), num);
|
|
||||||
CMatchUI.SINGLETON_INSTANCE.showMessage(message);
|
|
||||||
ButtonUtil.disableAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void selectCard(final Card card) {
|
|
||||||
Zone zone = game.getZoneOf(card);
|
|
||||||
if (zone.is(ZoneType.Battlefield, player) && list.contains(card)) {
|
|
||||||
card.tap();
|
|
||||||
list.remove(card);
|
|
||||||
this.stop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
ability.setStackDescription(source.getName() + " - " + player
|
String message = source.getName() + " - " + player + " taps X artifacts, creatures or lands he or she controls.";
|
||||||
+ " taps X artifacts, creatures or lands he or she controls.");
|
ability.setStackDescription(message);
|
||||||
ability.setDescription(source.getName() + " - " + player
|
ability.setDescription(message);
|
||||||
+ " taps X artifacts, creatures or lands he or she controls.");
|
|
||||||
ability.setActivatingPlayer(source.getController());
|
ability.setActivatingPlayer(source.getController());
|
||||||
|
|
||||||
game.getStack().addSimultaneousStackEntry(ability);
|
game.getStack().addSimultaneousStackEntry(ability);
|
||||||
|
|||||||
Reference in New Issue
Block a user