mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28: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.trigger.TriggerType;
|
||||||
import forge.game.zone.Zone;
|
import forge.game.zone.Zone;
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
import forge.gui.GuiChoose;
|
|
||||||
import forge.gui.GuiDialog;
|
|
||||||
import forge.util.Aggregates;
|
import forge.util.Aggregates;
|
||||||
import forge.util.Lang;
|
import forge.util.Lang;
|
||||||
|
|
||||||
@@ -663,9 +661,9 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
|
|||||||
int changeNum = sa.hasParam("ChangeNum") ? AbilityUtils.calculateAmount(source, sa.getParam("ChangeNum"),
|
int changeNum = sa.hasParam("ChangeNum") ? AbilityUtils.calculateAmount(source, sa.getParam("ChangeNum"),
|
||||||
sa) : 1;
|
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;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
List<Card> fetchList;
|
List<Card> fetchList;
|
||||||
boolean shuffleMandatory = true;
|
boolean shuffleMandatory = true;
|
||||||
@@ -735,7 +733,7 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
|
|||||||
source.clearImprinted();
|
source.clearImprinted();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < changeNum; i++) {
|
for (int i = 0; i < changeNum && destination != null; i++) {
|
||||||
if (sa.hasParam("DifferentNames")) {
|
if (sa.hasParam("DifferentNames")) {
|
||||||
for (Card c : movedCards) {
|
for (Card c : movedCards) {
|
||||||
fetchList = CardLists.filter(fetchList, Predicates.not(CardPredicates.nameEquals(c.getName())));
|
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);
|
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")) {
|
if (sa.hasParam("AtRandom")) {
|
||||||
c = Aggregates.random(fetchList);
|
c = Aggregates.random(fetchList);
|
||||||
} else if (sa.hasParam("Defined")) {
|
} else if (sa.hasParam("Defined")) {
|
||||||
c = fetchList.get(0);
|
c = Iterables.getFirst(fetchList, null);
|
||||||
} else {
|
} else {
|
||||||
boolean mustChoose = sa.hasParam("Mandatory");
|
c = decider.getController().chooseSingleEntityForEffect(fetchList, sa, selectPrompt, !sa.hasParam("Mandatory"));
|
||||||
// card has to be on battlefield or in own hand
|
}
|
||||||
if (mustChoose && fetchList.size() == 1) {
|
|
||||||
c = fetchList.get(0);
|
if (c == null) {
|
||||||
} else {
|
final int num = Math.min(fetchList.size(), changeNum - i);
|
||||||
c = decider.getController().chooseSingleEntityForEffect(fetchList, sa, selectPrompt, !mustChoose);
|
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);
|
fetchList.remove(c);
|
||||||
Card movedCard = null;
|
Card movedCard = null;
|
||||||
|
|
||||||
@@ -852,7 +851,7 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
|
|||||||
final Combat combat = game.getCombat();
|
final Combat combat = game.getCombat();
|
||||||
if ( null != combat ) {
|
if ( null != combat ) {
|
||||||
final List<GameEntity> e = combat.getDefenders();
|
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);
|
combat.addAttacker(c, defender);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -903,15 +902,6 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
|
|||||||
if (totalcmc != null) {
|
if (totalcmc != null) {
|
||||||
totcmc -= movedCard.getCMC();
|
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()) {
|
if (sa.hasParam("Reveal") && !movedCards.isEmpty()) {
|
||||||
ZoneType zt = null;
|
ZoneType zt = null;
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ public class ManaEffect extends SpellAbilityEffect {
|
|||||||
if (chosen.equals("")) {
|
if (chosen.equals("")) {
|
||||||
chosen = MagicColor.Constant.BLACK;
|
chosen = MagicColor.Constant.BLACK;
|
||||||
}
|
}
|
||||||
GuiChoose.reveal("Computer picked", chosen);
|
game.action.nofityOfValue(sa, card, "Computer picked" + chosen, activator);
|
||||||
String manaString = "";
|
String manaString = "";
|
||||||
for (int i = 0; i < amount; i++) {
|
for (int i = 0; i < amount; i++) {
|
||||||
manaString = manaString + MagicColor.toShortString(chosen) + " ";
|
manaString = manaString + MagicColor.toShortString(chosen) + " ";
|
||||||
@@ -149,7 +149,7 @@ public class ManaEffect extends SpellAbilityEffect {
|
|||||||
if (chosen.equals("")) {
|
if (chosen.equals("")) {
|
||||||
chosen = MagicColor.Constant.GREEN;
|
chosen = MagicColor.Constant.GREEN;
|
||||||
}
|
}
|
||||||
GuiChoose.reveal("Computer picked", chosen);
|
game.action.nofityOfValue(sa, card, "Computer picked " + chosen, act);
|
||||||
abMana.setExpressChoice(MagicColor.toShortString(chosen));
|
abMana.setExpressChoice(MagicColor.toShortString(chosen));
|
||||||
}
|
}
|
||||||
if (abMana.getExpressChoice().isEmpty()) {
|
if (abMana.getExpressChoice().isEmpty()) {
|
||||||
|
|||||||
@@ -9,7 +9,8 @@ public enum PlayerActionConfirmMode {
|
|||||||
// BraidOfFire,
|
// BraidOfFire,
|
||||||
FromOpeningHand,
|
FromOpeningHand,
|
||||||
ChangeZoneToAltDestination,
|
ChangeZoneToAltDestination,
|
||||||
ChangeZoneFromAltSource;
|
ChangeZoneFromAltSource,
|
||||||
|
ChangeZoneGeneral;
|
||||||
// Ripple;
|
// Ripple;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1041,7 +1041,7 @@ public class PlayerControllerHuman extends PlayerController {
|
|||||||
@Override
|
@Override
|
||||||
public void revealAnte(String message, Multimap<Player, PaperCard> removedAnteCards) {
|
public void revealAnte(String message, Multimap<Player, PaperCard> removedAnteCards) {
|
||||||
for (Player p : removedAnteCards.keySet()) {
|
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