mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
wipe gui calls from effects
This commit is contained in:
@@ -29,8 +29,6 @@ import forge.game.spellability.TargetRestrictions;
|
||||
import forge.game.trigger.TriggerType;
|
||||
import forge.game.zone.Zone;
|
||||
import forge.game.zone.ZoneType;
|
||||
import forge.gui.GuiChoose;
|
||||
import forge.gui.GuiDialog;
|
||||
import forge.util.Aggregates;
|
||||
import forge.util.Lang;
|
||||
|
||||
@@ -663,9 +661,9 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
|
||||
int changeNum = sa.hasParam("ChangeNum") ? AbilityUtils.calculateAmount(source, sa.getParam("ChangeNum"),
|
||||
sa) : 1;
|
||||
|
||||
if (optional && !GuiDialog.confirm(source, defined ? "Put that card from " + origin + "to " + destination : "Search " + origin + "?")) {
|
||||
if( optional && !decider.getController().confirmAction(sa, PlayerActionConfirmMode.ChangeZoneGeneral, defined ? "Put that card from " + origin + "to " + destination : "Search " + origin + "?"))
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
List<Card> fetchList;
|
||||
boolean shuffleMandatory = true;
|
||||
@@ -735,7 +733,7 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
|
||||
source.clearImprinted();
|
||||
}
|
||||
|
||||
for (int i = 0; i < changeNum; i++) {
|
||||
for (int i = 0; i < changeNum && destination != null; i++) {
|
||||
if (sa.hasParam("DifferentNames")) {
|
||||
for (Card c : movedCards) {
|
||||
fetchList = CardLists.filter(fetchList, Predicates.not(CardPredicates.nameEquals(c.getName())));
|
||||
@@ -746,26 +744,27 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
|
||||
fetchList = CardLists.getValidCards(fetchList, "Card.cmcLE" + Integer.toString(totcmc), source.getController(), source);
|
||||
}
|
||||
}
|
||||
if ((fetchList.size() == 0) || (destination == null)) {
|
||||
break;
|
||||
}
|
||||
|
||||
Card c;
|
||||
Card c = null;
|
||||
if (sa.hasParam("AtRandom")) {
|
||||
c = Aggregates.random(fetchList);
|
||||
} else if (sa.hasParam("Defined")) {
|
||||
c = fetchList.get(0);
|
||||
c = Iterables.getFirst(fetchList, null);
|
||||
} else {
|
||||
boolean mustChoose = sa.hasParam("Mandatory");
|
||||
// card has to be on battlefield or in own hand
|
||||
if (mustChoose && fetchList.size() == 1) {
|
||||
c = fetchList.get(0);
|
||||
} else {
|
||||
c = decider.getController().chooseSingleEntityForEffect(fetchList, sa, selectPrompt, !mustChoose);
|
||||
}
|
||||
c = decider.getController().chooseSingleEntityForEffect(fetchList, sa, selectPrompt, !sa.hasParam("Mandatory"));
|
||||
}
|
||||
|
||||
if (c == null) {
|
||||
final int num = Math.min(fetchList.size(), changeNum - i);
|
||||
String message = String.format("Cancel Search? Up to %d more cards can change zones.", num);
|
||||
|
||||
if (fetchList.isEmpty() || decider.getController().confirmAction(sa, PlayerActionConfirmMode.ChangeZoneGeneral, message)) {
|
||||
break;
|
||||
}
|
||||
i--;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (c != null) {
|
||||
fetchList.remove(c);
|
||||
Card movedCard = null;
|
||||
|
||||
@@ -852,7 +851,7 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
|
||||
final Combat combat = game.getCombat();
|
||||
if ( null != combat ) {
|
||||
final List<GameEntity> e = combat.getDefenders();
|
||||
final GameEntity defender = e.size() == 1 ? e.get(0) : GuiChoose.one("Declare " + c, e);
|
||||
final GameEntity defender = player.getController().chooseSingleEntityForEffect(e, sa, "Declare " + c);
|
||||
combat.addAttacker(c, defender);
|
||||
}
|
||||
}
|
||||
@@ -903,15 +902,6 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
|
||||
if (totalcmc != null) {
|
||||
totcmc -= movedCard.getCMC();
|
||||
}
|
||||
} else {
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
final int num = Math.min(fetchList.size(), changeNum - i);
|
||||
sb.append("Cancel Search? Up to ").append(num).append(" more cards can change zones.");
|
||||
|
||||
if (((i + 1) == changeNum) || GuiDialog.confirm(source, sb.toString())) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (sa.hasParam("Reveal") && !movedCards.isEmpty()) {
|
||||
ZoneType zt = null;
|
||||
|
||||
@@ -90,7 +90,7 @@ public class ManaEffect extends SpellAbilityEffect {
|
||||
if (chosen.equals("")) {
|
||||
chosen = MagicColor.Constant.BLACK;
|
||||
}
|
||||
GuiChoose.reveal("Computer picked", chosen);
|
||||
game.action.nofityOfValue(sa, card, "Computer picked" + chosen, activator);
|
||||
String manaString = "";
|
||||
for (int i = 0; i < amount; i++) {
|
||||
manaString = manaString + MagicColor.toShortString(chosen) + " ";
|
||||
@@ -149,7 +149,7 @@ public class ManaEffect extends SpellAbilityEffect {
|
||||
if (chosen.equals("")) {
|
||||
chosen = MagicColor.Constant.GREEN;
|
||||
}
|
||||
GuiChoose.reveal("Computer picked", chosen);
|
||||
game.action.nofityOfValue(sa, card, "Computer picked " + chosen, act);
|
||||
abMana.setExpressChoice(MagicColor.toShortString(chosen));
|
||||
}
|
||||
if (abMana.getExpressChoice().isEmpty()) {
|
||||
|
||||
@@ -9,7 +9,8 @@ public enum PlayerActionConfirmMode {
|
||||
// BraidOfFire,
|
||||
FromOpeningHand,
|
||||
ChangeZoneToAltDestination,
|
||||
ChangeZoneFromAltSource;
|
||||
ChangeZoneFromAltSource,
|
||||
ChangeZoneGeneral;
|
||||
// Ripple;
|
||||
|
||||
|
||||
|
||||
@@ -1041,7 +1041,7 @@ public class PlayerControllerHuman extends PlayerController {
|
||||
@Override
|
||||
public void revealAnte(String message, Multimap<Player, PaperCard> removedAnteCards) {
|
||||
for (Player p : removedAnteCards.keySet()) {
|
||||
GuiChoose.reveal(message + " from " + Lang.getPossesive(mayBeYou(p)) + " deck", removedAnteCards.get(p));
|
||||
GuiChoose.reveal(message + " from " + Lang.getPossessedObject(mayBeYou(p), "deck"), removedAnteCards.get(p));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user