confirmAction: add Map Params

This commit is contained in:
Hans Mackowiak
2022-06-22 23:32:57 +02:00
parent a812c3b550
commit e92198c254
85 changed files with 142 additions and 105 deletions

View File

@@ -1326,7 +1326,7 @@ public class AiController {
return discardList; return discardList;
} }
public boolean confirmAction(SpellAbility sa, PlayerActionConfirmMode mode, String message) { public boolean confirmAction(SpellAbility sa, PlayerActionConfirmMode mode, String message, Map<String, Object> params) {
if (mode == PlayerActionConfirmMode.AlternativeDamageAssignment) { if (mode == PlayerActionConfirmMode.AlternativeDamageAssignment) {
return true; return true;
} }
@@ -1339,7 +1339,7 @@ public class AiController {
mode); mode);
throw new IllegalArgumentException(exMsg); throw new IllegalArgumentException(exMsg);
} }
return SpellApiToAi.Converter.get(api).confirmAction(player, sa, mode, message); return SpellApiToAi.Converter.get(api).confirmAction(player, sa, mode, message, null);
} }
public boolean confirmBidAction(SpellAbility sa, PlayerActionConfirmMode mode, String message, int bid, Player winner) { public boolean confirmBidAction(SpellAbility sa, PlayerActionConfirmMode mode, String message, int bid, Player winner) {

View File

@@ -269,8 +269,8 @@ public class PlayerControllerAi extends PlayerController {
} }
@Override @Override
public boolean confirmAction(SpellAbility sa, PlayerActionConfirmMode mode, String message) { public boolean confirmAction(SpellAbility sa, PlayerActionConfirmMode mode, String message, Map<String, Object> params) {
return getAi().confirmAction(sa, mode, message); return getAi().confirmAction(sa, mode, message, params);
} }
@Override @Override

View File

@@ -305,7 +305,7 @@ public abstract class SpellAbilityAi {
return SpellApiToAi.Converter.get(ab.getApi()).chkAIDrawback(ab, aiPlayer) && (subAb == null || chkDrawbackWithSubs(aiPlayer, subAb)); return SpellApiToAi.Converter.get(ab.getApi()).chkAIDrawback(ab, aiPlayer) && (subAb == null || chkDrawbackWithSubs(aiPlayer, subAb));
} }
public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message) { public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message, Map<String, Object> params) {
System.err.println("Warning: default (ie. inherited from base class) implementation of confirmAction is used by " + sa.getHostCard().getName() + " for " + this.getClass().getName() + ". Consider declaring an overloaded method"); System.err.println("Warning: default (ie. inherited from base class) implementation of confirmAction is used by " + sa.getHostCard().getName() + " for " + this.getClass().getName() + ". Consider declaring an overloaded method");
return true; return true;
} }

View File

@@ -1,6 +1,8 @@
package forge.ai.ability; package forge.ai.ability;
import java.util.Map;
import forge.ai.SpellAbilityAi; import forge.ai.SpellAbilityAi;
import forge.game.player.Player; import forge.game.player.Player;
import forge.game.player.PlayerActionConfirmMode; import forge.game.player.PlayerActionConfirmMode;
@@ -16,7 +18,7 @@ public class AlwaysPlayAi extends SpellAbilityAi {
} }
@Override @Override
public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message) { public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message, Map<String, Object> params) {
return true; return true;
} }
} }

View File

@@ -85,7 +85,7 @@ public class AmassAi extends SpellAbilityAi {
} }
@Override @Override
public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message) { public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message, Map<String, Object> params) {
return true; return true;
} }

View File

@@ -240,7 +240,7 @@ public class AnimateAi extends SpellAbilityAi {
} }
@Override @Override
public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message) { public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message, Map<String, Object> params) {
return player.getGame().getPhaseHandler().getPhase().isBefore(PhaseType.MAIN2); return player.getGame().getPhaseHandler().getPhase().isBefore(PhaseType.MAIN2);
} }

View File

@@ -1729,7 +1729,7 @@ public class AttachAi extends SpellAbilityAi {
} }
@Override @Override
public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message) { public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message, Map<String, Object> params) {
return true; return true;
} }

View File

@@ -1739,7 +1739,7 @@ public class ChangeZoneAi extends SpellAbilityAi {
* @see forge.card.ability.SpellAbilityAi#confirmAction(forge.game.player.Player, forge.card.spellability.SpellAbility, forge.game.player.PlayerActionConfirmMode, java.lang.String) * @see forge.card.ability.SpellAbilityAi#confirmAction(forge.game.player.Player, forge.card.spellability.SpellAbility, forge.game.player.PlayerActionConfirmMode, java.lang.String)
*/ */
@Override @Override
public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message) { public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message, Map<String, Object> params) {
// AI was never asked // AI was never asked
return true; return true;
} }

View File

@@ -1,6 +1,7 @@
package forge.ai.ability; package forge.ai.ability;
import java.util.Collections; import java.util.Collections;
import java.util.Map;
import com.google.common.base.Predicates; import com.google.common.base.Predicates;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;
@@ -334,7 +335,7 @@ public class ChangeZoneAllAi extends SpellAbilityAi {
* @see forge.card.ability.SpellAbilityAi#confirmAction(forge.game.player.Player, forge.card.spellability.SpellAbility, forge.game.player.PlayerActionConfirmMode, java.lang.String) * @see forge.card.ability.SpellAbilityAi#confirmAction(forge.game.player.Player, forge.card.spellability.SpellAbility, forge.game.player.PlayerActionConfirmMode, java.lang.String)
*/ */
@Override @Override
public boolean confirmAction(Player ai, SpellAbility sa, PlayerActionConfirmMode mode, String message) { public boolean confirmAction(Player ai, SpellAbility sa, PlayerActionConfirmMode mode, String message, Map<String, Object> params) {
final Card source = sa.getHostCard(); final Card source = sa.getHostCard();
final String hostName = source.getName(); final String hostName = source.getName();
final ZoneType origin = ZoneType.listValueOf(sa.getParam("Origin")).get(0); final ZoneType origin = ZoneType.listValueOf(sa.getParam("Origin")).get(0);

View File

@@ -154,7 +154,7 @@ public class CloneAi extends SpellAbilityAi {
* @see forge.card.ability.SpellAbilityAi#confirmAction(forge.game.player.Player, forge.card.spellability.SpellAbility, forge.game.player.PlayerActionConfirmMode, java.lang.String) * @see forge.card.ability.SpellAbilityAi#confirmAction(forge.game.player.Player, forge.card.spellability.SpellAbility, forge.game.player.PlayerActionConfirmMode, java.lang.String)
*/ */
@Override @Override
public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message) { public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message, Map<String, Object> params) {
if (sa.hasParam("AILogic") && (!sa.usesTargeting() || sa.isTargetNumberValid())) { if (sa.hasParam("AILogic") && (!sa.usesTargeting() || sa.isTargetNumberValid())) {
// Had a special logic for it and managed to target, so confirm if viable // Had a special logic for it and managed to target, so confirm if viable
if ("CloneBestCreature".equals(sa.getParam("AILogic"))) { if ("CloneBestCreature".equals(sa.getParam("AILogic"))) {

View File

@@ -224,7 +224,7 @@ public class CopyPermanentAi extends SpellAbilityAi {
* @see forge.card.ability.SpellAbilityAi#confirmAction(forge.game.player.Player, forge.card.spellability.SpellAbility, forge.game.player.PlayerActionConfirmMode, java.lang.String) * @see forge.card.ability.SpellAbilityAi#confirmAction(forge.game.player.Player, forge.card.spellability.SpellAbility, forge.game.player.PlayerActionConfirmMode, java.lang.String)
*/ */
@Override @Override
public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message) { public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message, Map<String, Object> params) {
//TODO: add logic here //TODO: add logic here
return true; return true;
} }

View File

@@ -134,7 +134,7 @@ public class CopySpellAbilityAi extends SpellAbilityAi {
} }
@Override @Override
public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message) { public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message, Map<String, Object> params) {
// Chain of Acid requires special attention here since otherwise the AI will confirm the copy and then // Chain of Acid requires special attention here since otherwise the AI will confirm the copy and then
// run into the necessity of confirming a mandatory Destroy, thus destroying all of its own permanents. // run into the necessity of confirming a mandatory Destroy, thus destroying all of its own permanents.
if ("ChainOfAcid".equals(sa.getParam("AILogic"))) { if ("ChainOfAcid".equals(sa.getParam("AILogic"))) {

View File

@@ -913,7 +913,7 @@ public class CountersPutAi extends CountersAi {
} }
@Override @Override
public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message) { public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message, Map<String, Object> params) {
final Card source = sa.getHostCard(); final Card source = sa.getHostCard();
if (mode == PlayerActionConfirmMode.Tribute) { if (mode == PlayerActionConfirmMode.Tribute) {
// add counter if that opponent has a giant creature // add counter if that opponent has a giant creature

View File

@@ -1,6 +1,7 @@
package forge.ai.ability; package forge.ai.ability;
import java.util.List; import java.util.List;
import java.util.Map;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
@@ -151,7 +152,7 @@ public class CountersPutAllAi extends SpellAbilityAi {
* @see forge.card.ability.SpellAbilityAi#confirmAction(forge.game.player.Player, forge.card.spellability.SpellAbility, forge.game.player.PlayerActionConfirmMode, java.lang.String) * @see forge.card.ability.SpellAbilityAi#confirmAction(forge.game.player.Player, forge.card.spellability.SpellAbility, forge.game.player.PlayerActionConfirmMode, java.lang.String)
*/ */
@Override @Override
public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message) { public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message, Map<String, Object> params) {
return player.getCreaturesInPlay().size() >= player.getWeakestOpponent().getCreaturesInPlay().size(); return player.getCreaturesInPlay().size() >= player.getWeakestOpponent().getCreaturesInPlay().size();
} }

View File

@@ -1,5 +1,7 @@
package forge.ai.ability; package forge.ai.ability;
import java.util.Map;
import forge.ai.SpellAbilityAi; import forge.ai.SpellAbilityAi;
import forge.game.phase.PhaseHandler; import forge.game.phase.PhaseHandler;
import forge.game.phase.PhaseType; import forge.game.phase.PhaseType;
@@ -30,7 +32,7 @@ public class DayTimeAi extends SpellAbilityAi {
} }
@Override @Override
public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message) { public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message, Map<String, Object> params) {
return true; return true;
} }
} }

View File

@@ -209,7 +209,7 @@ public class DigAi extends SpellAbilityAi {
* @see forge.card.ability.SpellAbilityAi#confirmAction(forge.card.spellability.SpellAbility, forge.game.player.PlayerActionConfirmMode, java.lang.String) * @see forge.card.ability.SpellAbilityAi#confirmAction(forge.card.spellability.SpellAbility, forge.game.player.PlayerActionConfirmMode, java.lang.String)
*/ */
@Override @Override
public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message) { public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message, Map<String, Object> params) {
Card topc = player.getZone(ZoneType.Library).get(0); Card topc = player.getZone(ZoneType.Library).get(0);
// AI actions for individual cards (until this AI can be generalized) // AI actions for individual cards (until this AI can be generalized)

View File

@@ -1,5 +1,7 @@
package forge.ai.ability; package forge.ai.ability;
import java.util.Map;
import forge.ai.AiAttackController; import forge.ai.AiAttackController;
import forge.ai.ComputerUtil; import forge.ai.ComputerUtil;
import forge.ai.SpellAbilityAi; import forge.ai.SpellAbilityAi;
@@ -94,7 +96,7 @@ public class DigMultipleAi extends SpellAbilityAi {
* @see forge.card.ability.SpellAbilityAi#confirmAction(forge.card.spellability.SpellAbility, forge.game.player.PlayerActionConfirmMode, java.lang.String) * @see forge.card.ability.SpellAbilityAi#confirmAction(forge.card.spellability.SpellAbility, forge.game.player.PlayerActionConfirmMode, java.lang.String)
*/ */
@Override @Override
public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message) { public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message, Map<String, Object> params) {
return true; return true;
} }
} }

View File

@@ -1,6 +1,7 @@
package forge.ai.ability; package forge.ai.ability;
import java.util.List; import java.util.List;
import java.util.Map;
import forge.ai.AiAttackController; import forge.ai.AiAttackController;
import forge.ai.ComputerUtilCost; import forge.ai.ComputerUtilCost;
@@ -122,7 +123,7 @@ public class DigUntilAi extends SpellAbilityAi {
* @see forge.card.ability.SpellAbilityAi#confirmAction(forge.card.spellability.SpellAbility, forge.game.player.PlayerActionConfirmMode, java.lang.String) * @see forge.card.ability.SpellAbilityAi#confirmAction(forge.card.spellability.SpellAbility, forge.game.player.PlayerActionConfirmMode, java.lang.String)
*/ */
@Override @Override
public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message) { public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message, Map<String, Object> params) {
if (sa.hasParam("AILogic")) { if (sa.hasParam("AILogic")) {
final String logic = sa.getParam("AILogic"); final String logic = sa.getParam("AILogic");
if ("OathOfDruids".equals(logic)) { if ("OathOfDruids".equals(logic)) {

View File

@@ -2,6 +2,7 @@ package forge.ai.ability;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map;
import forge.ai.ComputerUtil; import forge.ai.ComputerUtil;
import forge.ai.ComputerUtilAbility; import forge.ai.ComputerUtilAbility;
@@ -211,11 +212,11 @@ public class DiscardAi extends SpellAbilityAi {
return true; return true;
} }
public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message) { public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message, Map<String, Object> params) {
if (mode == PlayerActionConfirmMode.Random) { if (mode == PlayerActionConfirmMode.Random) {
// TODO For now AI will always discard Random used currently with: Balduvian Horde and similar cards // TODO For now AI will always discard Random used currently with: Balduvian Horde and similar cards
return true; return true;
} }
return super.confirmAction(player, sa, mode, message); return super.confirmAction(player, sa, mode, message, params);
} }
} }

View File

@@ -18,6 +18,8 @@
*/ */
package forge.ai.ability; package forge.ai.ability;
import java.util.Map;
import forge.ai.AiCostDecision; import forge.ai.AiCostDecision;
import forge.ai.AiProps; import forge.ai.AiProps;
import forge.ai.ComputerUtil; import forge.ai.ComputerUtil;
@@ -541,7 +543,7 @@ public class DrawAi extends SpellAbilityAi {
* @see forge.card.ability.SpellAbilityAi#confirmAction(forge.game.player.Player, forge.card.spellability.SpellAbility, forge.game.player.PlayerActionConfirmMode, java.lang.String) * @see forge.card.ability.SpellAbilityAi#confirmAction(forge.game.player.Player, forge.card.spellability.SpellAbility, forge.game.player.PlayerActionConfirmMode, java.lang.String)
*/ */
@Override @Override
public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message) { public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message, Map<String, Object> params) {
int numCards = sa.hasParam("NumCards") ? AbilityUtils.calculateAmount(sa.getHostCard(), sa.getParam("NumCards"), sa) : 1; int numCards = sa.hasParam("NumCards") ? AbilityUtils.calculateAmount(sa.getHostCard(), sa.getParam("NumCards"), sa) : 1;
// AI shouldn't mill itself // AI shouldn't mill itself
if (numCards < player.getZone(ZoneType.Library).size()) if (numCards < player.getZone(ZoneType.Library).size())

View File

@@ -70,7 +70,7 @@ public final class EncodeAi extends SpellAbilityAi {
* forge.game.player.PlayerActionConfirmMode, java.lang.String) * forge.game.player.PlayerActionConfirmMode, java.lang.String)
*/ */
@Override @Override
public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message) { public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message, Map<String, Object> params) {
// only try to encode if there is a creature it can be used on // only try to encode if there is a creature it can be used on
return chooseCard(player, player.getCreaturesInPlay(), true) != null; return chooseCard(player, player.getCreaturesInPlay(), true) != null;
} }

View File

@@ -1,5 +1,7 @@
package forge.ai.ability; package forge.ai.ability;
import java.util.Map;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import forge.ai.SpellAbilityAi; import forge.ai.SpellAbilityAi;
import forge.game.card.Card; import forge.game.card.Card;
@@ -42,7 +44,7 @@ public class FlipOntoBattlefieldAi extends SpellAbilityAi {
} }
@Override @Override
public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message) { public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message, Map<String, Object> params) {
return true; return true;
} }
} }

View File

@@ -1,6 +1,8 @@
package forge.ai.ability; package forge.ai.ability;
import java.util.Map;
import forge.ai.SpellAbilityAi; import forge.ai.SpellAbilityAi;
import forge.game.phase.PhaseHandler; import forge.game.phase.PhaseHandler;
import forge.game.phase.PhaseType; import forge.game.phase.PhaseType;
@@ -20,7 +22,7 @@ public class InvestigateAi extends SpellAbilityAi {
} }
@Override @Override
public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message) { public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message, Map<String, Object> params) {
return true; return true;
} }
} }

View File

@@ -1,6 +1,8 @@
package forge.ai.ability; package forge.ai.ability;
import java.util.Map;
import forge.ai.ComputerUtilCard; import forge.ai.ComputerUtilCard;
import forge.ai.PlayerControllerAi; import forge.ai.PlayerControllerAi;
import forge.ai.SpellAbilityAi; import forge.ai.SpellAbilityAi;
@@ -32,7 +34,7 @@ public class LearnAi extends SpellAbilityAi {
} }
@Override @Override
public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message) { public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message, Map<String, Object> params) {
return true; return true;
} }

View File

@@ -43,7 +43,7 @@ public class ManifestAi extends SpellAbilityAi {
* @see forge.card.ability.SpellAbilityAi#confirmAction(forge.game.player.Player, forge.card.spellability.SpellAbility, forge.game.player.PlayerActionConfirmMode, java.lang.String) * @see forge.card.ability.SpellAbilityAi#confirmAction(forge.game.player.Player, forge.card.spellability.SpellAbility, forge.game.player.PlayerActionConfirmMode, java.lang.String)
*/ */
@Override @Override
public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message) { public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message, Map<String, Object> params) {
return true; return true;
} }

View File

@@ -196,7 +196,7 @@ public class MillAi extends SpellAbilityAi {
* @see forge.card.ability.SpellAbilityAi#confirmAction(forge.game.player.Player, forge.card.spellability.SpellAbility, forge.game.player.PlayerActionConfirmMode, java.lang.String) * @see forge.card.ability.SpellAbilityAi#confirmAction(forge.game.player.Player, forge.card.spellability.SpellAbility, forge.game.player.PlayerActionConfirmMode, java.lang.String)
*/ */
@Override @Override
public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message) { public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message, Map<String, Object> params) {
if ("TimmerianFiends".equals(sa.getParam("AILogic"))) { if ("TimmerianFiends".equals(sa.getParam("AILogic"))) {
return SpecialCardAi.TimmerianFiends.consider(player, sa); return SpecialCardAi.TimmerianFiends.consider(player, sa);
} }

View File

@@ -65,7 +65,7 @@ public class MutateAi extends SpellAbilityAi {
} }
@Override @Override
public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message) { public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message, Map<String, Object> params) {
return true; return true;
} }
} }

View File

@@ -1,5 +1,7 @@
package forge.ai.ability; package forge.ai.ability;
import java.util.Map;
import forge.ai.AiAttackController; import forge.ai.AiAttackController;
import forge.ai.SpellAbilityAi; import forge.ai.SpellAbilityAi;
import forge.ai.SpellApiToAi; import forge.ai.SpellApiToAi;
@@ -70,7 +72,7 @@ public class PeekAndRevealAi extends SpellAbilityAi {
* @see forge.card.ability.SpellAbilityAi#confirmAction(forge.game.player.Player, forge.card.spellability.SpellAbility, forge.game.player.PlayerActionConfirmMode, java.lang.String) * @see forge.card.ability.SpellAbilityAi#confirmAction(forge.game.player.Player, forge.card.spellability.SpellAbility, forge.game.player.PlayerActionConfirmMode, java.lang.String)
*/ */
@Override @Override
public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message) { public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message, Map<String, Object> params) {
AbilitySub subAb = sa.getSubAbility(); AbilitySub subAb = sa.getSubAbility();
return subAb != null && SpellApiToAi.Converter.get(subAb.getApi()).chkDrawbackWithSubs(player, subAb); return subAb != null && SpellApiToAi.Converter.get(subAb.getApi()).chkDrawbackWithSubs(player, subAb);
} }

View File

@@ -131,7 +131,7 @@ public class PlayAi extends SpellAbilityAi {
} }
@Override @Override
public boolean confirmAction(Player ai, SpellAbility sa, PlayerActionConfirmMode mode, String message) { public boolean confirmAction(Player ai, SpellAbility sa, PlayerActionConfirmMode mode, String message, Map<String, Object> params) {
return true; return true;
} }

View File

@@ -24,6 +24,7 @@ import org.apache.commons.lang3.StringUtils;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map;
public class PumpAi extends PumpAiBase { public class PumpAi extends PumpAiBase {
@@ -781,7 +782,7 @@ public class PumpAi extends PumpAiBase {
} }
@Override @Override
public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message) { public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message, Map<String, Object> params) {
//TODO Add logic here if necessary but I think the AI won't cast //TODO Add logic here if necessary but I think the AI won't cast
//the spell in the first place if it would curse its own creature //the spell in the first place if it would curse its own creature
//and the pump isn't mandatory //and the pump isn't mandatory

View File

@@ -1,6 +1,8 @@
package forge.ai.ability; package forge.ai.ability;
import java.util.Map;
import forge.ai.AiCardMemory; import forge.ai.AiCardMemory;
import forge.ai.AiController; import forge.ai.AiController;
import forge.ai.AiProps; import forge.ai.AiProps;
@@ -92,7 +94,7 @@ public class RearrangeTopOfLibraryAi extends SpellAbilityAi {
* @see forge.card.ability.SpellAbilityAi#confirmAction(forge.game.player.Player, forge.card.spellability.SpellAbility, forge.game.player.PlayerActionConfirmMode, java.lang.String) * @see forge.card.ability.SpellAbilityAi#confirmAction(forge.game.player.Player, forge.card.spellability.SpellAbility, forge.game.player.PlayerActionConfirmMode, java.lang.String)
*/ */
@Override @Override
public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message) { public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message, Map<String, Object> params) {
// Confirming this action means shuffling the library if asked. // Confirming this action means shuffling the library if asked.
// First, let's check if we can play the top card of the library // First, let's check if we can play the top card of the library

View File

@@ -1,6 +1,8 @@
package forge.ai.ability; package forge.ai.ability;
import java.util.Map;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;
import forge.ai.*; import forge.ai.*;
@@ -40,7 +42,7 @@ public class RepeatAi extends SpellAbilityAi {
} }
@Override @Override
public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message) { public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message, Map<String, Object> params) {
//TODO add logic to have computer make better choice (ArsenalNut) //TODO add logic to have computer make better choice (ArsenalNut)
return false; return false;
} }

View File

@@ -1,6 +1,8 @@
package forge.ai.ability; package forge.ai.ability;
import java.util.Map;
import forge.ai.SpellAbilityAi; import forge.ai.SpellAbilityAi;
import forge.game.Game; import forge.game.Game;
import forge.game.card.Card; import forge.game.card.Card;
@@ -43,7 +45,7 @@ public class RollDiceAi extends SpellAbilityAi {
} }
@Override @Override
public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message) { public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message, Map<String, Object> params) {
return true; return true;
} }
} }

View File

@@ -1,6 +1,7 @@
package forge.ai.ability; package forge.ai.ability;
import java.util.List; import java.util.List;
import java.util.Map;
import forge.ai.ComputerUtilCard; import forge.ai.ComputerUtilCard;
import forge.ai.ComputerUtilCost; import forge.ai.ComputerUtilCost;
@@ -175,7 +176,7 @@ public class SacrificeAi extends SpellAbilityAi {
} }
@Override @Override
public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message) { public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message, Map<String, Object> params) {
return true; return true;
} }

View File

@@ -1,5 +1,7 @@
package forge.ai.ability; package forge.ai.ability;
import java.util.Map;
import com.google.common.base.Predicates; import com.google.common.base.Predicates;
import forge.ai.ComputerUtilMana; import forge.ai.ComputerUtilMana;
@@ -132,7 +134,7 @@ public class ScryAi extends SpellAbilityAi {
} }
@Override @Override
public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message) { public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message, Map<String, Object> params) {
return true; return true;
} }
} }

View File

@@ -1,6 +1,7 @@
package forge.ai.ability; package forge.ai.ability;
import java.util.List; import java.util.List;
import java.util.Map;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
@@ -264,7 +265,7 @@ public class SetStateAi extends SpellAbilityAi {
return true; return true;
} }
public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message) { public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message, Map<String, Object> params) {
// TODO: improve the AI for when it may want to transform something that's optional to transform // TODO: improve the AI for when it may want to transform something that's optional to transform
return isSafeToTransformIntoLegendary(player, sa.getHostCard()); return isSafeToTransformIntoLegendary(player, sa.getHostCard());
} }

View File

@@ -1,5 +1,7 @@
package forge.ai.ability; package forge.ai.ability;
import java.util.Map;
import forge.ai.SpellAbilityAi; import forge.ai.SpellAbilityAi;
import forge.game.phase.PhaseType; import forge.game.phase.PhaseType;
import forge.game.player.Player; import forge.game.player.Player;
@@ -54,7 +56,7 @@ public class ShuffleAi extends SpellAbilityAi {
} }
@Override @Override
public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message) { public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message, Map<String, Object> params) {
// ai could analyze parameter denoting the player to shuffle // ai could analyze parameter denoting the player to shuffle
return true; return true;
} }

View File

@@ -1,5 +1,7 @@
package forge.ai.ability; package forge.ai.ability;
import java.util.Map;
import forge.ai.AiAttackController; import forge.ai.AiAttackController;
import forge.ai.SpellAbilityAi; import forge.ai.SpellAbilityAi;
import forge.game.player.Player; import forge.game.player.Player;
@@ -18,7 +20,7 @@ public class SkipPhaseAi extends SpellAbilityAi {
} }
@Override @Override
public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message) { public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message, Map<String, Object> params) {
return true; return true;
} }

View File

@@ -1,5 +1,7 @@
package forge.ai.ability; package forge.ai.ability;
import java.util.Map;
import forge.ai.AiCardMemory; import forge.ai.AiCardMemory;
import forge.ai.AiProps; import forge.ai.AiProps;
import forge.ai.ComputerUtilCost; import forge.ai.ComputerUtilCost;
@@ -119,7 +121,7 @@ public class SurveilAi extends SpellAbilityAi {
} }
@Override @Override
public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message) { public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message, Map<String, Object> params) {
return true; return true;
} }
} }

View File

@@ -311,7 +311,7 @@ public class TokenAi extends SpellAbilityAi {
* @see forge.card.ability.SpellAbilityAi#confirmAction(forge.game.player.Player, forge.card.spellability.SpellAbility, forge.game.player.PlayerActionConfirmMode, java.lang.String) * @see forge.card.ability.SpellAbilityAi#confirmAction(forge.game.player.Player, forge.card.spellability.SpellAbility, forge.game.player.PlayerActionConfirmMode, java.lang.String)
*/ */
@Override @Override
public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message) { public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message, Map<String, Object> params) {
// TODO: AILogic // TODO: AILogic
return true; return true;
} }

View File

@@ -36,7 +36,7 @@ public class VentureAi extends SpellAbilityAi {
} }
@Override @Override
public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message) { public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message, Map<String, Object> params) {
return true; return true;
} }

View File

@@ -1576,7 +1576,7 @@ public class GameAction {
c.getGame().getTracker().flush(); c.getGame().getTracker().flush();
c.setMoveToCommandZone(false); c.setMoveToCommandZone(false);
if (c.getOwner().getController().confirmAction(c.getFirstSpellAbility(), PlayerActionConfirmMode.ChangeZoneToAltDestination, c.getName() + ": If a commander is in a graveyard or in exile and that card was put into that zone since the last time state-based actions were checked, its owner may put it into the command zone.")) { if (c.getOwner().getController().confirmAction(c.getFirstSpellAbility(), PlayerActionConfirmMode.ChangeZoneToAltDestination, c.getName() + ": If a commander is in a graveyard or in exile and that card was put into that zone since the last time state-based actions were checked, its owner may put it into the command zone.", null)) {
moveTo(c.getOwner().getZone(ZoneType.Command), c, null); moveTo(c.getOwner().getZone(ZoneType.Command), c, null);
return true; return true;
} }

View File

@@ -25,7 +25,7 @@ public class AbandonEffect extends SpellAbilityEffect {
Player controller = source.getController(); Player controller = source.getController();
boolean isOptional = sa.hasParam("Optional"); boolean isOptional = sa.hasParam("Optional");
if (isOptional && !controller.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblWouldYouLikeAbandonSource", CardTranslation.getTranslatedName(source.getName())))) { if (isOptional && !controller.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblWouldYouLikeAbandonSource", CardTranslation.getTranslatedName(source.getName())), null)) {
return; return;
} }

View File

@@ -164,7 +164,7 @@ public class AnimateEffect extends AnimateEffectBase {
? TextUtil.fastReplace(sa.getParam("OptionQuestion"), "TARGETS", targets) ? TextUtil.fastReplace(sa.getParam("OptionQuestion"), "TARGETS", targets)
: getStackDescription(sa); : getStackDescription(sa);
if (!sa.getActivatingPlayer().getController().confirmAction(sa, null, message)) { if (!sa.getActivatingPlayer().getController().confirmAction(sa, null, message, null)) {
return; return;
} }
} }

View File

@@ -134,7 +134,7 @@ public class AttachEffect extends SpellAbilityEffect {
// If Cast Targets will be checked on the Stack // If Cast Targets will be checked on the Stack
for (final Card attachment : attachments) { for (final Card attachment : attachments) {
String message = Localizer.getInstance().getMessage("lblDoYouWantAttachSourceToTarget", CardTranslation.getTranslatedName(attachment.getName()), attachToName); String message = Localizer.getInstance().getMessage("lblDoYouWantAttachSourceToTarget", CardTranslation.getTranslatedName(attachment.getName()), attachToName);
if (sa.hasParam("Optional") && !p.getController().confirmAction(sa, null, message)) if (sa.hasParam("Optional") && !p.getController().confirmAction(sa, null, message, null))
// TODO add params for message // TODO add params for message
continue; continue;

View File

@@ -50,7 +50,7 @@ public class ChangeTargetsEffect extends SpellAbilityEffect {
// Redirect rules read 'you MAY choose new targets' ... okay! // Redirect rules read 'you MAY choose new targets' ... okay!
// TODO: Don't even ask to change targets, if the SA and subs don't actually have targets // TODO: Don't even ask to change targets, if the SA and subs don't actually have targets
boolean isOptional = sa.hasParam("Optional"); boolean isOptional = sa.hasParam("Optional");
if (isOptional && !chooser.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblDoYouWantChangeAbilityTargets", tgtSA.getHostCard().toString()))) { if (isOptional && !chooser.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblDoYouWantChangeAbilityTargets", tgtSA.getHostCard().toString()), null)) {
continue; continue;
} }
if (sa.hasParam("ChangeSingleTarget")) { if (sa.hasParam("ChangeSingleTarget")) {

View File

@@ -120,7 +120,7 @@ public class ChangeZoneAllEffect extends SpellAbilityEffect {
message = Localizer.getInstance().getMessage("lblMoveTargetFromOriginToDestination", targets, Lang.joinHomogenous(origin, ZoneType.Accessors.GET_TRANSLATED_NAME), destination.getTranslatedName()); message = Localizer.getInstance().getMessage("lblMoveTargetFromOriginToDestination", targets, Lang.joinHomogenous(origin, ZoneType.Accessors.GET_TRANSLATED_NAME), destination.getTranslatedName());
} }
if (!sa.getActivatingPlayer().getController().confirmAction(sa, null, message)) { if (!sa.getActivatingPlayer().getController().confirmAction(sa, null, message, null)) {
return; return;
} }
} }

View File

@@ -492,7 +492,7 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
PlayerCollection deciders = AbilityUtils.getDefinedPlayers(hostCard, sa.getParam("AlternativeDecider"), sa); PlayerCollection deciders = AbilityUtils.getDefinedPlayers(hostCard, sa.getParam("AlternativeDecider"), sa);
alterDecider = deciders.isEmpty() ? null : deciders.get(0); alterDecider = deciders.isEmpty() ? null : deciders.get(0);
} }
if (alterDecider != null && !alterDecider.getController().confirmAction(sa, PlayerActionConfirmMode.ChangeZoneToAltDestination, sb.toString())) { if (alterDecider != null && !alterDecider.getController().confirmAction(sa, PlayerActionConfirmMode.ChangeZoneToAltDestination, sb.toString(), null)) {
destination = ZoneType.smartValueOf(sa.getParam("DestinationAlternative")); destination = ZoneType.smartValueOf(sa.getParam("DestinationAlternative"));
altDest = true; altDest = true;
} }
@@ -564,7 +564,7 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
} }
final String prompt = TextUtil.concatWithSpace(Localizer.getInstance().getMessage("lblDoYouWantMoveTargetFromOriToDest", CardTranslation.getTranslatedName(gameCard.getName()), Lang.joinHomogenous(origin, ZoneType.Accessors.GET_TRANSLATED_NAME), destination.getTranslatedName())); final String prompt = TextUtil.concatWithSpace(Localizer.getInstance().getMessage("lblDoYouWantMoveTargetFromOriToDest", CardTranslation.getTranslatedName(gameCard.getName()), Lang.joinHomogenous(origin, ZoneType.Accessors.GET_TRANSLATED_NAME), destination.getTranslatedName()));
if (optional && !chooser.getController().confirmAction(sa, null, prompt) ) if (optional && !chooser.getController().confirmAction(sa, null, prompt, null) )
continue; continue;
final Zone originZone = game.getZoneOf(gameCard); final Zone originZone = game.getZoneOf(gameCard);
@@ -956,7 +956,7 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
sb.append(sa.getParam("AlternativeMessage")).append(" "); sb.append(sa.getParam("AlternativeMessage")).append(" ");
sb.append(altFetchList.size()).append(" " + Localizer.getInstance().getMessage("lblCardMatchSearchingTypeInAlternateZones")); sb.append(altFetchList.size()).append(" " + Localizer.getInstance().getMessage("lblCardMatchSearchingTypeInAlternateZones"));
if (!decider.getController().confirmAction(sa, PlayerActionConfirmMode.ChangeZoneFromAltSource, sb.toString())) { if (!decider.getController().confirmAction(sa, PlayerActionConfirmMode.ChangeZoneFromAltSource, sb.toString(), null)) {
origin = alt; origin = alt;
} }
} }
@@ -968,7 +968,7 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
final StringBuilder sb = new StringBuilder(); final StringBuilder sb = new StringBuilder();
sb.append(sa.getParam("AlternativeDestinationMessage")); sb.append(sa.getParam("AlternativeDestinationMessage"));
if (!decider.getController().confirmAction(sa, PlayerActionConfirmMode.ChangeZoneToAltDestination, sb.toString())) { if (!decider.getController().confirmAction(sa, PlayerActionConfirmMode.ChangeZoneToAltDestination, sb.toString(), null)) {
destination = ZoneType.smartValueOf(sa.getParam("DestinationAlternative")); destination = ZoneType.smartValueOf(sa.getParam("DestinationAlternative"));
libraryPos = sa.hasParam("LibraryPositionAlternative") ? Integer.parseInt(sa.getParam("LibraryPositionAlternative")) : 0; libraryPos = sa.hasParam("LibraryPositionAlternative") ? Integer.parseInt(sa.getParam("LibraryPositionAlternative")) : 0;
} }
@@ -985,7 +985,7 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
prompt = Localizer.getInstance().getMessage("lblSearchPlayerZoneConfirm", "{player's}", Lang.joinHomogenous(origin, ZoneType.Accessors.GET_TRANSLATED_NAME).toLowerCase()); prompt = Localizer.getInstance().getMessage("lblSearchPlayerZoneConfirm", "{player's}", Lang.joinHomogenous(origin, ZoneType.Accessors.GET_TRANSLATED_NAME).toLowerCase());
} }
String message = MessageUtil.formatMessage(prompt , decider, player); String message = MessageUtil.formatMessage(prompt , decider, player);
if (!decider.getController().confirmAction(sa, PlayerActionConfirmMode.ChangeZoneGeneral, message)) { if (!decider.getController().confirmAction(sa, PlayerActionConfirmMode.ChangeZoneGeneral, message, null)) {
return; return;
} }
} }
@@ -1071,7 +1071,7 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
continue; continue;
} }
SpellAbility tgtSA = decider.getController().getAbilityToPlay(tgtCard, sas); SpellAbility tgtSA = decider.getController().getAbilityToPlay(tgtCard, sas);
if (!decider.getController().confirmAction(tgtSA, null, Localizer.getInstance().getMessage("lblDoYouWantPlayCard", CardTranslation.getTranslatedName(tgtCard.getName())))) { if (!decider.getController().confirmAction(tgtSA, null, Localizer.getInstance().getMessage("lblDoYouWantPlayCard", CardTranslation.getTranslatedName(tgtCard.getName())), null)) {
continue; continue;
} }
tgtSA.setSVar("IsCastFromPlayEffect", "True"); tgtSA.setSVar("IsCastFromPlayEffect", "True");
@@ -1187,7 +1187,7 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
String message = Localizer.getInstance().getMessage("lblCancelSearchUpToSelectNumCards", String.valueOf(num)); String message = Localizer.getInstance().getMessage("lblCancelSearchUpToSelectNumCards", String.valueOf(num));
if (fetchList.isEmpty() || sa.hasParam("SkipCancelPrompt") || if (fetchList.isEmpty() || sa.hasParam("SkipCancelPrompt") ||
decider.getController().confirmAction(sa, PlayerActionConfirmMode.ChangeZoneGeneral, message)) { decider.getController().confirmAction(sa, PlayerActionConfirmMode.ChangeZoneGeneral, message, null)) {
break; break;
} }
i--; i--;

View File

@@ -180,7 +180,7 @@ public class CharmEffect extends SpellAbilityEffect {
num = Math.min(num, choices.size()); num = Math.min(num, choices.size());
boolean isOptional = sa.hasParam("Optional"); boolean isOptional = sa.hasParam("Optional");
if (isOptional && !activator.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblWouldYouLikeCharm", CardTranslation.getTranslatedName(source.getName())))) { if (isOptional && !activator.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblWouldYouLikeCharm", CardTranslation.getTranslatedName(source.getName())), null)) {
return false; return false;
} }

View File

@@ -131,7 +131,7 @@ public class ChooseCardEffect extends SpellAbilityEffect {
Localizer.getInstance().getMessage("lblSelectCreatureWithTotalPowerLessOrEqualTo", (totP - chosenP - negativeNum)) Localizer.getInstance().getMessage("lblSelectCreatureWithTotalPowerLessOrEqualTo", (totP - chosenP - negativeNum))
+ "\r\n(" + Localizer.getInstance().getMessage("lblSelected") + ":" + chosenPool + ")\r\n(" + Localizer.getInstance().getMessage("lblTotalPowerNum", chosenP) + ")", chosenP <= totP, null); + "\r\n(" + Localizer.getInstance().getMessage("lblSelected") + ":" + chosenPool + ")\r\n(" + Localizer.getInstance().getMessage("lblTotalPowerNum", chosenP) + ")", chosenP <= totP, null);
if (c == null) { if (c == null) {
if (p.getController().confirmAction(sa, PlayerActionConfirmMode.OptionalChoose, Localizer.getInstance().getMessage("lblCancelChooseConfirm"))) { if (p.getController().confirmAction(sa, PlayerActionConfirmMode.OptionalChoose, Localizer.getInstance().getMessage("lblCancelChooseConfirm"), null)) {
break; break;
} }
} else { } else {

View File

@@ -108,7 +108,7 @@ public class CloneEffect extends SpellAbilityEffect {
} }
final boolean optional = sa.hasParam("Optional"); final boolean optional = sa.hasParam("Optional");
if (optional && !host.getController().getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblDoYouWantCopy", CardTranslation.getTranslatedName(cardToCopy.getName())))) { if (optional && !host.getController().getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblDoYouWantCopy", CardTranslation.getTranslatedName(cardToCopy.getName())), null)) {
return; return;
} }

View File

@@ -89,7 +89,7 @@ public class ControlExchangeEffect extends SpellAbilityEffect {
if (sa.hasParam("Optional") && !sa.getActivatingPlayer().getController().confirmAction(sa, null, if (sa.hasParam("Optional") && !sa.getActivatingPlayer().getController().confirmAction(sa, null,
Localizer.getInstance().getMessage("lblExchangeControl", Localizer.getInstance().getMessage("lblExchangeControl",
CardTranslation.getTranslatedName(object1.getName()), CardTranslation.getTranslatedName(object1.getName()),
CardTranslation.getTranslatedName(object2.getName())))) { CardTranslation.getTranslatedName(object2.getName())), null)) {
return; return;
} }

View File

@@ -119,7 +119,7 @@ public class CopyPermanentEffect extends TokenEffectBase {
TokenCreateTable tokenTable = new TokenCreateTable(); TokenCreateTable tokenTable = new TokenCreateTable();
if (sa.hasParam("Optional") && !activator.getController().confirmAction(sa, null, if (sa.hasParam("Optional") && !activator.getController().confirmAction(sa, null,
Localizer.getInstance().getMessage("lblCopyPermanentConfirm"))) { Localizer.getInstance().getMessage("lblCopyPermanentConfirm"), null)) {
return; return;
} }
@@ -208,7 +208,7 @@ public class CopyPermanentEffect extends TokenEffectBase {
if (choosen != null) { if (choosen != null) {
tgtCards.add(choosen); tgtCards.add(choosen);
choices = CardLists.filter(choices, Predicates.not(CardPredicates.sharesNameWith(choosen))); choices = CardLists.filter(choices, Predicates.not(CardPredicates.sharesNameWith(choosen)));
} else if (chooser.getController().confirmAction(sa, PlayerActionConfirmMode.OptionalChoose, Localizer.getInstance().getMessage("lblCancelChooseConfirm"))) { } else if (chooser.getController().confirmAction(sa, PlayerActionConfirmMode.OptionalChoose, Localizer.getInstance().getMessage("lblCancelChooseConfirm"), null)) {
break; break;
} }
} }

View File

@@ -89,7 +89,7 @@ public class CopySpellAbilityEffect extends SpellAbilityEffect {
SpellAbility chosenSA = controller.getController().chooseSingleSpellForEffect(tgtSpells, sa, SpellAbility chosenSA = controller.getController().chooseSingleSpellForEffect(tgtSpells, sa,
Localizer.getInstance().getMessage("lblSelectASpellCopy"), ImmutableMap.of()); Localizer.getInstance().getMessage("lblSelectASpellCopy"), ImmutableMap.of());
if (isOptional && !controller.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblDoyouWantCopyTheSpell", CardTranslation.getTranslatedName(chosenSA.getHostCard().getName())))) { if (isOptional && !controller.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblDoyouWantCopyTheSpell", CardTranslation.getTranslatedName(chosenSA.getHostCard().getName())), null)) {
continue; continue;
} }

View File

@@ -174,7 +174,7 @@ public class CountersPutEffect extends SpellAbilityEffect {
boolean putOnDefined = sa.hasParam("PutOnDefined"); boolean putOnDefined = sa.hasParam("PutOnDefined");
if (sa.hasParam("Optional") && !pc.confirmAction if (sa.hasParam("Optional") && !pc.confirmAction
(sa, null, Localizer.getInstance().getMessage("lblDoYouWantPutCounter"))) { (sa, null, Localizer.getInstance().getMessage("lblDoYouWantPutCounter"), null)) {
return; return;
} }
@@ -509,7 +509,7 @@ public class CountersPutEffect extends SpellAbilityEffect {
Player chooser = pc.chooseSingleEntityForEffect(activator.getOpponents(), sa, Player chooser = pc.chooseSingleEntityForEffect(activator.getOpponents(), sa,
Localizer.getInstance().getMessage("lblChooseAnOpponent"), params); Localizer.getInstance().getMessage("lblChooseAnOpponent"), params);
if (chooser.getController().confirmAction(sa, PlayerActionConfirmMode.Tribute, message)) { if (chooser.getController().confirmAction(sa, PlayerActionConfirmMode.Tribute, message, null)) {
gameCard.setTributed(true); gameCard.setTributed(true);
} else { } else {
continue; continue;

View File

@@ -76,7 +76,7 @@ public class CountersPutOrRemoveEffect extends SpellAbilityEffect {
} }
if (!eachExisting && sa.hasParam("Optional") && !pl.getController().confirmAction(sa, null, if (!eachExisting && sa.hasParam("Optional") && !pl.getController().confirmAction(sa, null,
Localizer.getInstance().getMessage("lblWouldYouLikePutRemoveCounters", ctype.getName(), Localizer.getInstance().getMessage("lblWouldYouLikePutRemoveCounters", ctype.getName(),
CardTranslation.getTranslatedName(gameCard.getName())))) { CardTranslation.getTranslatedName(gameCard.getName())), null)) {
continue; continue;
} }
if (!sa.usesTargeting() || gameCard.canBeTargetedBy(sa)) { if (!sa.usesTargeting() || gameCard.canBeTargetedBy(sa)) {

View File

@@ -83,7 +83,7 @@ public class CountersRemoveEffect extends SpellAbilityEffect {
if (sa.hasParam("Optional")) { if (sa.hasParam("Optional")) {
String ctrs = cntToRemove > 1 ? Localizer.getInstance().getMessage("lblCounters") : num.equals("All") ? Localizer.getInstance().getMessage("lblAllCounters") : Localizer.getInstance().getMessage("lblACounters"); String ctrs = cntToRemove > 1 ? Localizer.getInstance().getMessage("lblCounters") : num.equals("All") ? Localizer.getInstance().getMessage("lblAllCounters") : Localizer.getInstance().getMessage("lblACounters");
if (!sa.getActivatingPlayer().getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblRemove") + " " + ctrs + "?")) { if (!sa.getActivatingPlayer().getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblRemove") + " " + ctrs + "?", null)) {
return; return;
} }
} }

View File

@@ -156,7 +156,7 @@ public class DamageDealEffect extends DamageBaseEffect {
List<GameObject> tgts = getTargets(sa); List<GameObject> tgts = getTargets(sa);
if (sa.hasParam("OptionalDecider")) { if (sa.hasParam("OptionalDecider")) {
Player decider = Iterables.getFirst(AbilityUtils.getDefinedPlayers(hostCard, sa.getParam("OptionalDecider"), sa), null); Player decider = Iterables.getFirst(AbilityUtils.getDefinedPlayers(hostCard, sa.getParam("OptionalDecider"), sa), null);
if (decider != null && !decider.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblDoyouWantDealTargetDamageToTarget", String.valueOf(dmg), tgts.toString()))) { if (decider != null && !decider.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblDoyouWantDealTargetDamageToTarget", String.valueOf(dmg), tgts.toString()), null)) {
return; return;
} }
} }

View File

@@ -203,7 +203,7 @@ public class DigEffect extends SpellAbilityEffect {
else if (sa.hasParam("RevealOptional")) { else if (sa.hasParam("RevealOptional")) {
String question = TextUtil.concatWithSpace(Localizer.getInstance().getMessage("lblReveal") + ":", TextUtil.addSuffix(Lang.joinHomogenous(top),"?")); String question = TextUtil.concatWithSpace(Localizer.getInstance().getMessage("lblReveal") + ":", TextUtil.addSuffix(Lang.joinHomogenous(top),"?"));
hasRevealed = p.getController().confirmAction(sa, null, question); hasRevealed = p.getController().confirmAction(sa, null, question, null);
if (hasRevealed) { if (hasRevealed) {
game.getAction().reveal(top, p); game.getAction().reveal(top, p);
} }
@@ -276,7 +276,7 @@ public class DigEffect extends SpellAbilityEffect {
// Optional abilities that use a dialog box to prompt the user to skip the ability (e.g. Explorer's Scope, Quest for Ula's Temple) // Optional abilities that use a dialog box to prompt the user to skip the ability (e.g. Explorer's Scope, Quest for Ula's Temple)
if (optional && mayBeSkipped && !valid.isEmpty()) { if (optional && mayBeSkipped && !valid.isEmpty()) {
String prompt = !optionalAbilityPrompt.isEmpty() ? optionalAbilityPrompt : Localizer.getInstance().getMessage("lblWouldYouLikeProceedWithOptionalAbility") + " " + host + "?\n\n(" + sa.getDescription() + ")"; String prompt = !optionalAbilityPrompt.isEmpty() ? optionalAbilityPrompt : Localizer.getInstance().getMessage("lblWouldYouLikeProceedWithOptionalAbility") + " " + host + "?\n\n(" + sa.getDescription() + ")";
if (!p.getController().confirmAction(sa, null, TextUtil.fastReplace(prompt, "CARDNAME", CardTranslation.getTranslatedName(host.getName())))) { if (!p.getController().confirmAction(sa, null, TextUtil.fastReplace(prompt, "CARDNAME", CardTranslation.getTranslatedName(host.getName())), null)) {
return; return;
} }
} }

View File

@@ -120,7 +120,7 @@ public class DigUntilEffect extends SpellAbilityEffect {
continue; continue;
} }
if (!sa.usesTargeting() || p.canBeTargetedBy(sa)) { if (!sa.usesTargeting() || p.canBeTargetedBy(sa)) {
if (optional && !p.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblDoYouWantDigYourLibrary"))) { if (optional && !p.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblDoYouWantDigYourLibrary"), null)) {
continue; continue;
} }
CardCollection found = new CardCollection(); CardCollection found = new CardCollection();
@@ -171,7 +171,7 @@ public class DigUntilEffect extends SpellAbilityEffect {
final Card c = itr.next(); final Card c = itr.next();
final ZoneType origin = c.getZone().getZoneType(); final ZoneType origin = c.getZone().getZoneType();
if (optionalFound && !p.getController().confirmAction(sa, null, if (optionalFound && !p.getController().confirmAction(sa, null,
Localizer.getInstance().getMessage("lblDoYouWantPutCardToZone", foundDest.getTranslatedName()))) { Localizer.getInstance().getMessage("lblDoYouWantPutCardToZone", foundDest.getTranslatedName()), null)) {
continue; continue;
} }
Map<AbilityKey, Object> moveParams = AbilityKey.newMap(); Map<AbilityKey, Object> moveParams = AbilityKey.newMap();

View File

@@ -153,7 +153,7 @@ public class DiscardEffect extends SpellAbilityEffect {
} }
boolean runDiscard = !sa.hasParam("Optional") boolean runDiscard = !sa.hasParam("Optional")
|| p.getController().confirmAction(sa, PlayerActionConfirmMode.Random, sa.getParam("DiscardMessage")); || p.getController().confirmAction(sa, PlayerActionConfirmMode.Random, sa.getParam("DiscardMessage"), null);
if (runDiscard) { if (runDiscard) {
toBeDiscarded = AbilityUtils.getDefinedCards(source, sa.getParam("DefinedCards"), sa); toBeDiscarded = AbilityUtils.getDefinedCards(source, sa.getParam("DefinedCards"), sa);
@@ -197,7 +197,7 @@ public class DiscardEffect extends SpellAbilityEffect {
continue; continue;
} }
String message = Localizer.getInstance().getMessage("lblWouldYouLikeRandomDiscardTargetCard", String.valueOf(numCards)); String message = Localizer.getInstance().getMessage("lblWouldYouLikeRandomDiscardTargetCard", String.valueOf(numCards));
boolean runDiscard = !sa.hasParam("Optional") || p.getController().confirmAction(sa, PlayerActionConfirmMode.Random, message); boolean runDiscard = !sa.hasParam("Optional") || p.getController().confirmAction(sa, PlayerActionConfirmMode.Random, message, null);
if (runDiscard) { if (runDiscard) {
final String valid = sa.getParamOrDefault("DiscardValid", "Card"); final String valid = sa.getParamOrDefault("DiscardValid", "Card");

View File

@@ -72,7 +72,7 @@ public class DrawEffect extends SpellAbilityEffect {
continue; continue;
} }
if (optional && !p.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblDoYouWantDrawCards", Lang.nounWithAmount(numCards, " card")))) { if (optional && !p.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblDoYouWantDrawCards", Lang.nounWithAmount(numCards, " card")), null)) {
continue; continue;
} }

View File

@@ -48,7 +48,7 @@ public class EncodeEffect extends SpellAbilityEffect {
} }
// Handle choice of whether or not to encoded // Handle choice of whether or not to encoded
if (!player.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblDoYouWantExileCardAndEncodeOntoYouCreature", CardTranslation.getTranslatedName(host.getName())))) { if (!player.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblDoYouWantExileCardAndEncodeOntoYouCreature", CardTranslation.getTranslatedName(host.getName())), null)) {
return; return;
} }

View File

@@ -20,7 +20,7 @@ public class EndTurnEffect extends SpellAbilityEffect {
public void resolve(SpellAbility sa) { public void resolve(SpellAbility sa) {
final List<Player> enders = getDefinedPlayersOrTargeted(sa, "Defined"); final List<Player> enders = getDefinedPlayersOrTargeted(sa, "Defined");
final Player ender = enders.isEmpty() ? sa.getActivatingPlayer() : enders.get(0); final Player ender = enders.isEmpty() ? sa.getActivatingPlayer() : enders.get(0);
if (sa.hasParam("Optional") && !ender.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblDoYouWantEndTurn"))) { if (sa.hasParam("Optional") && !ender.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblDoYouWantEndTurn"), null)) {
return; return;
} }
Game game = ender.getGame(); Game game = ender.getGame();

View File

@@ -59,7 +59,7 @@ public class FightEffect extends DamageBaseEffect {
Player controller = host.getController(); Player controller = host.getController();
boolean isOptional = sa.hasParam("Optional"); boolean isOptional = sa.hasParam("Optional");
if (isOptional && !controller.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblWouldYouLikeFight", CardTranslation.getTranslatedName(fighters.get(0).getName()), CardTranslation.getTranslatedName(fighters.get(1).getName())))) { if (isOptional && !controller.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblWouldYouLikeFight", CardTranslation.getTranslatedName(fighters.get(0).getName()), CardTranslation.getTranslatedName(fighters.get(1).getName())), null)) {
return; return;
} }

View File

@@ -40,7 +40,7 @@ public class InvestigateEffect extends TokenEffectBase {
for (final Player p : getTargetPlayers(sa)) { for (final Player p : getTargetPlayers(sa)) {
for (int i = 0; i < amount; i++) { for (int i = 0; i < amount; i++) {
if (sa.hasParam("Optional") && !p.getController().confirmAction(sa, null, if (sa.hasParam("Optional") && !p.getController().confirmAction(sa, null,
Localizer.getInstance().getMessage("lblWouldYouLikeInvestigate"))) { Localizer.getInstance().getMessage("lblWouldYouLikeInvestigate"), null)) {
return; return;
} }

View File

@@ -40,7 +40,7 @@ public class ManaEffect extends SpellAbilityEffect {
final boolean optional = sa.hasParam("Optional"); final boolean optional = sa.hasParam("Optional");
final Game game = sa.getActivatingPlayer().getGame(); final Game game = sa.getActivatingPlayer().getGame();
if (optional && !sa.getActivatingPlayer().getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblDoYouWantAddMana"))) { if (optional && !sa.getActivatingPlayer().getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblDoYouWantAddMana"), null)) {
return; return;
} }

View File

@@ -48,7 +48,7 @@ public class MillEffect extends SpellAbilityEffect {
if (sa.hasParam("Optional")) { if (sa.hasParam("Optional")) {
final String prompt = TextUtil.concatWithSpace(Localizer.getInstance().getMessage("lblDoYouWantPutLibraryCardsTo", destination.getTranslatedName())); final String prompt = TextUtil.concatWithSpace(Localizer.getInstance().getMessage("lblDoYouWantPutLibraryCardsTo", destination.getTranslatedName()));
// CR 701.13b // CR 701.13b
if (numCards > p.getZone(ZoneType.Library).size() || !p.getController().confirmAction(sa, null, prompt)) { if (numCards > p.getZone(ZoneType.Library).size() || !p.getController().confirmAction(sa, null, prompt, null)) {
continue; continue;
} }
} }

View File

@@ -87,7 +87,7 @@ public class PeekAndRevealEffect extends SpellAbilityEffect {
} }
if (doReveal && sa.hasParam("RevealOptional")) if (doReveal && sa.hasParam("RevealOptional"))
doReveal = peekingPlayer.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblRevealCardToOtherPlayers")); doReveal = peekingPlayer.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblRevealCardToOtherPlayers"), null);
if (doReveal) { if (doReveal) {
peekingPlayer.getGame().getAction().reveal(revealableCards, ZoneType.Library, libraryToPeek, !noPeek, peekingPlayer.getGame().getAction().reveal(revealableCards, ZoneType.Library, libraryToPeek, !noPeek,

View File

@@ -259,7 +259,7 @@ public class PlayEffect extends SpellAbilityEffect {
} }
if (singleOption && sa.getTargetCard() == null) if (singleOption && sa.getTargetCard() == null)
sa.setPlayEffectCard(tgtCard);// show card to play rather than showing the source card sa.setPlayEffectCard(tgtCard);// show card to play rather than showing the source card
if (singleOption && !controller.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblDoYouWantPlayCard", CardTranslation.getTranslatedName(tgtCard.getName())))) { if (singleOption && !controller.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblDoYouWantPlayCard", CardTranslation.getTranslatedName(tgtCard.getName())), null)) {
if (wasFaceDown) { if (wasFaceDown) {
tgtCard.turnFaceDownNoUpdate(); tgtCard.turnFaceDownNoUpdate();
tgtCard.updateStateForView(); tgtCard.updateStateForView();

View File

@@ -352,7 +352,7 @@ public class PumpEffect extends SpellAbilityEffect {
? TextUtil.fastReplace(sa.getParam("OptionQuestion"), "TARGETS", targets) ? TextUtil.fastReplace(sa.getParam("OptionQuestion"), "TARGETS", targets)
: Localizer.getInstance().getMessage("lblApplyPumpToTarget", targets); : Localizer.getInstance().getMessage("lblApplyPumpToTarget", targets);
if (!sa.getActivatingPlayer().getController().confirmAction(sa, null, message)) { if (!sa.getActivatingPlayer().getController().confirmAction(sa, null, message, null)) {
return; return;
} }
} }

View File

@@ -116,7 +116,7 @@ public class RearrangeTopOfLibraryEffect extends SpellAbilityEffect {
Card next = orderedCards.get(i); Card next = orderedCards.get(i);
player.getGame().getAction().moveToLibrary(next, 0, sa); player.getGame().getAction().moveToLibrary(next, 0, sa);
} }
if (mayshuffle && activator.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblDoyouWantShuffleTheLibrary"))) { if (mayshuffle && activator.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblDoyouWantShuffleTheLibrary"), null)) {
player.shuffle(sa); player.shuffle(sa);
} }
} }

View File

@@ -47,7 +47,7 @@ public class RepeatEachEffect extends SpellAbilityEffect {
final Player player = sa.getActivatingPlayer(); final Player player = sa.getActivatingPlayer();
final Game game = player.getGame(); final Game game = player.getGame();
if (sa.hasParam("Optional") && sa.hasParam("OptionPrompt") && //for now, OptionPrompt is needed if (sa.hasParam("Optional") && sa.hasParam("OptionPrompt") && //for now, OptionPrompt is needed
!player.getController().confirmAction(sa, null, sa.getParam("OptionPrompt"))) { !player.getController().confirmAction(sa, null, sa.getParam("OptionPrompt"), null)) {
return; return;
} }
@@ -151,7 +151,7 @@ public class RepeatEachEffect extends SpellAbilityEffect {
} }
} }
for (final Player p : repeatPlayers) { for (final Player p : repeatPlayers) {
if (optional && !p.getController().confirmAction(repeat, null, sa.getParam("RepeatOptionalMessage"))) { if (optional && !p.getController().confirmAction(repeat, null, sa.getParam("RepeatOptionalMessage"), null)) {
continue; continue;
} }
if (nextTurn) { if (nextTurn) {

View File

@@ -115,7 +115,7 @@ public class RepeatEffect extends SpellAbilityEffect {
Player decider = sa.hasParam("RepeatOptionalDecider") Player decider = sa.hasParam("RepeatOptionalDecider")
? AbilityUtils.getDefinedPlayers(sa.getHostCard(), sa.getParam("RepeatOptionalDecider"), sa).get(0) ? AbilityUtils.getDefinedPlayers(sa.getHostCard(), sa.getParam("RepeatOptionalDecider"), sa).get(0)
: sa.getActivatingPlayer(); : sa.getActivatingPlayer();
return decider.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblDoYouWantRepeatProcessAgain")); return decider.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblDoYouWantRepeatProcessAgain"), null);
} }
return true; return true;

View File

@@ -41,7 +41,7 @@ public class RevealHandEffect extends SpellAbilityEffect {
for (final Player p : getTargetPlayers(sa)) { for (final Player p : getTargetPlayers(sa)) {
if ((tgt == null) || p.canBeTargetedBy(sa)) { if ((tgt == null) || p.canBeTargetedBy(sa)) {
if (optional && !p.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblDoYouWantRevealYourHand"))) { if (optional && !p.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblDoYouWantRevealYourHand"), null)) {
continue; continue;
} }
CardCollectionView hand = p.getCardsIn(ZoneType.Hand); CardCollectionView hand = p.getCardsIn(ZoneType.Hand);

View File

@@ -46,7 +46,7 @@ public class SacrificeEffect extends SpellAbilityEffect {
if (sa.hasParam("Echo")) { if (sa.hasParam("Echo")) {
boolean isPaid; boolean isPaid;
if (activator.hasKeyword("You may pay 0 rather than pay the echo cost for permanents you control.") if (activator.hasKeyword("You may pay 0 rather than pay the echo cost for permanents you control.")
&& activator.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblDoYouWantPayEcho") + " {0}?")) { && activator.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblDoYouWantPayEcho") + " {0}?", null)) {
isPaid = true; isPaid = true;
} else { } else {
isPaid = activator.getController().payManaOptional(card, new Cost(sa.getParam("Echo"), true), isPaid = activator.getController().payManaOptional(card, new Cost(sa.getParam("Echo"), true),
@@ -110,7 +110,7 @@ public class SacrificeEffect extends SpellAbilityEffect {
if (valid.equals("Self") && game.getZoneOf(card) != null) { if (valid.equals("Self") && game.getZoneOf(card) != null) {
if (game.getZoneOf(card).is(ZoneType.Battlefield)) { if (game.getZoneOf(card).is(ZoneType.Battlefield)) {
if (!optional || activator.getController().confirmAction(sa, null, if (!optional || activator.getController().confirmAction(sa, null,
Localizer.getInstance().getMessage("lblDoYouWantSacrificeThis", card.getName()))) { Localizer.getInstance().getMessage("lblDoYouWantSacrificeThis", card.getName()), null)) {
if (game.getAction().sacrifice(card, sa, true, table, params) != null) { if (game.getAction().sacrifice(card, sa, true, table, params) != null) {
if (remSacrificed) { if (remSacrificed) {
card.addRemembered(card); card.addRemembered(card);
@@ -153,7 +153,7 @@ public class SacrificeEffect extends SpellAbilityEffect {
if (sa.hasParam("Random")) { if (sa.hasParam("Random")) {
choosenToSacrifice = Aggregates.random(validTargets, Math.min(amount, validTargets.size()), new CardCollection()); choosenToSacrifice = Aggregates.random(validTargets, Math.min(amount, validTargets.size()), new CardCollection());
} else if (optional && !p.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblDoYouWantSacrifice"))) { } else if (optional && !p.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblDoYouWantSacrifice"), null)) {
choosenToSacrifice = CardCollection.EMPTY; choosenToSacrifice = CardCollection.EMPTY;
} else { } else {
boolean isStrict = sa.hasParam("StrictAmount"); boolean isStrict = sa.hasParam("StrictAmount");

View File

@@ -44,7 +44,7 @@ public class ScryEffect extends SpellAbilityEffect {
// Optional here for spells that have optional multi-player scrying // Optional here for spells that have optional multi-player scrying
for (final Player p : getTargetPlayers(sa)) { for (final Player p : getTargetPlayers(sa)) {
if ( (!sa.usesTargeting() || p.canBeTargetedBy(sa)) && if ( (!sa.usesTargeting() || p.canBeTargetedBy(sa)) &&
(!isOptional || p.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblDoYouWanttoScry"))) ) { (!isOptional || p.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblDoYouWanttoScry"), null)) ) {
players.add(p); players.add(p);
} }
} }

View File

@@ -150,7 +150,7 @@ public class SetStateEffect extends SpellAbilityEffect {
if (optional) { if (optional) {
String message = TextUtil.concatWithSpace("Transform", gameCard.getName(), "?"); String message = TextUtil.concatWithSpace("Transform", gameCard.getName(), "?");
if (!p.getController().confirmAction(sa, PlayerActionConfirmMode.Random, message)) { if (!p.getController().confirmAction(sa, PlayerActionConfirmMode.Random, message, null)) {
return; return;
} }
} }

View File

@@ -21,7 +21,7 @@ public class ShuffleEffect extends SpellAbilityEffect {
for (final Player p : tgtPlayers) { for (final Player p : tgtPlayers) {
if ((tgt == null) || p.canBeTargetedBy(sa)) { if ((tgt == null) || p.canBeTargetedBy(sa)) {
boolean mustShuffle = !optional || sa.getActivatingPlayer().getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblHaveTargetShuffle", p.getName())); boolean mustShuffle = !optional || sa.getActivatingPlayer().getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblHaveTargetShuffle", p.getName()), null);
if (mustShuffle) if (mustShuffle)
p.shuffle(sa); p.shuffle(sa);
} }

View File

@@ -43,7 +43,7 @@ public class SurveilEffect extends SpellAbilityEffect {
for (final Player p : getTargetPlayers(sa)) { for (final Player p : getTargetPlayers(sa)) {
if (!sa.usesTargeting() || p.canBeTargetedBy(sa)) { if (!sa.usesTargeting() || p.canBeTargetedBy(sa)) {
if (isOptional && !p.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblDoYouWantSurveil"))) { if (isOptional && !p.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblDoYouWantSurveil"), null)) {
continue; continue;
} }

View File

@@ -724,7 +724,7 @@ public class Combat {
"defending player and/or any number of creatures they control.") "defending player and/or any number of creatures they control.")
&& blocker.getController().getController().confirmAction(null, null, && blocker.getController().getController().confirmAction(null, null,
Localizer.getInstance().getMessage("lblAssignCombatDamageAsChoose", Localizer.getInstance().getMessage("lblAssignCombatDamageAsChoose",
CardTranslation.getTranslatedName(blocker.getName()))); CardTranslation.getTranslatedName(blocker.getName())), null);
// choose defending player // choose defending player
if (divideCombatDamageAsChoose) { if (divideCombatDamageAsChoose) {
defender = blocker.getController().getController().chooseSingleEntityForEffect(attackingPlayer.getOpponents(), null, Localizer.getInstance().getMessage("lblChoosePlayer"), null); defender = blocker.getController().getController().chooseSingleEntityForEffect(attackingPlayer.getOpponents(), null, Localizer.getInstance().getMessage("lblChoosePlayer"), null);
@@ -803,7 +803,7 @@ public class Combat {
if (!assignToPlayer && attacker.getGame().getCombat().isBlocked(attacker) && attacker.hasKeyword("You may have CARDNAME assign its combat damage as though it weren't blocked.")) { if (!assignToPlayer && attacker.getGame().getCombat().isBlocked(attacker) && attacker.hasKeyword("You may have CARDNAME assign its combat damage as though it weren't blocked.")) {
assignToPlayer = assigningPlayer.getController().confirmAction(emptySA, PlayerActionConfirmMode.AlternativeDamageAssignment, assignToPlayer = assigningPlayer.getController().confirmAction(emptySA, PlayerActionConfirmMode.AlternativeDamageAssignment,
Localizer.getInstance().getMessage("lblAssignCombatDamageWerentBlocked", Localizer.getInstance().getMessage("lblAssignCombatDamageWerentBlocked",
CardTranslation.getTranslatedName(attacker.getName()))); CardTranslation.getTranslatedName(attacker.getName())), null);
} }
boolean divideCombatDamageAsChoose = false; boolean divideCombatDamageAsChoose = false;
@@ -815,7 +815,7 @@ public class Combat {
"defending player and/or any number of creatures they control.") "defending player and/or any number of creatures they control.")
&& assigningPlayer.getController().confirmAction(emptySA, PlayerActionConfirmMode.AlternativeDamageAssignment, && assigningPlayer.getController().confirmAction(emptySA, PlayerActionConfirmMode.AlternativeDamageAssignment,
Localizer.getInstance().getMessage("lblAssignCombatDamageAsChoose", Localizer.getInstance().getMessage("lblAssignCombatDamageAsChoose",
CardTranslation.getTranslatedName(attacker.getName()))); CardTranslation.getTranslatedName(attacker.getName())), null);
if (defender instanceof Card && divideCombatDamageAsChoose) { if (defender instanceof Card && divideCombatDamageAsChoose) {
defender = getDefenderPlayerByAttacker(attacker); defender = getDefenderPlayerByAttacker(attacker);
} }
@@ -826,7 +826,7 @@ public class Combat {
"a creature defending player controls.") && "a creature defending player controls.") &&
assigningPlayer.getController().confirmAction(emptySA, PlayerActionConfirmMode.AlternativeDamageAssignment, assigningPlayer.getController().confirmAction(emptySA, PlayerActionConfirmMode.AlternativeDamageAssignment,
Localizer.getInstance().getMessage("lblAssignCombatDamageToCreature", Localizer.getInstance().getMessage("lblAssignCombatDamageToCreature",
CardTranslation.getTranslatedName(attacker.getName()))); CardTranslation.getTranslatedName(attacker.getName())), null);
if (divideCombatDamageAsChoose) { if (divideCombatDamageAsChoose) {
if (orderedBlockers == null || orderedBlockers.isEmpty()) { if (orderedBlockers == null || orderedBlockers.isEmpty()) {
orderedBlockers = getDefendersCreatures(); orderedBlockers = getDefendersCreatures();

View File

@@ -134,7 +134,7 @@ public abstract class PlayerController {
public abstract <T extends GameEntity> List<T> chooseEntitiesForEffect(FCollectionView<T> optionList, int min, int max, DelayedReveal delayedReveal, SpellAbility sa, String title, Player relatedPlayer, Map<String, Object> params); public abstract <T extends GameEntity> List<T> chooseEntitiesForEffect(FCollectionView<T> optionList, int min, int max, DelayedReveal delayedReveal, SpellAbility sa, String title, Player relatedPlayer, Map<String, Object> params);
public abstract boolean confirmAction(SpellAbility sa, PlayerActionConfirmMode mode, String message); public abstract boolean confirmAction(SpellAbility sa, PlayerActionConfirmMode mode, String message, Map<String, Object> params);
public abstract boolean confirmBidAction(SpellAbility sa, PlayerActionConfirmMode bidlife, String string, int bid, Player winner); public abstract boolean confirmBidAction(SpellAbility sa, PlayerActionConfirmMode bidlife, String string, int bid, Player winner);
public abstract boolean confirmReplacementEffect(ReplacementEffect replacementEffect, SpellAbility effectSA, GameEntity affected, String question); public abstract boolean confirmReplacementEffect(ReplacementEffect replacementEffect, SpellAbility effectSA, GameEntity affected, String question);
public abstract boolean confirmStaticApplication(Card hostCard, GameEntity affected, String logic, String message); public abstract boolean confirmStaticApplication(Card hostCard, GameEntity affected, String logic, String message);

View File

@@ -191,7 +191,7 @@ public class PlayerControllerForTests extends PlayerController {
} }
@Override @Override
public boolean confirmAction(SpellAbility sa, PlayerActionConfirmMode mode, String message) { public boolean confirmAction(SpellAbility sa, PlayerActionConfirmMode mode, String message, Map<String, Object> newParam) {
return true; return true;
} }

View File

@@ -106,7 +106,7 @@ public class HumanPlaySpellAbility {
} }
final boolean playerManaConversion = human.hasManaConversion() final boolean playerManaConversion = human.hasManaConversion()
&& human.getController().confirmAction(ability, null, "Do you want to spend mana as though it were mana of any color to pay the cost?"); && human.getController().confirmAction(ability, null, "Do you want to spend mana as though it were mana of any color to pay the cost?", null);
Cost abCost = ability.getPayCosts(); Cost abCost = ability.getPayCosts();
CostPayment payment = new CostPayment(abCost, ability); CostPayment payment = new CostPayment(abCost, ability);

View File

@@ -733,7 +733,7 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
* SpellAbility, java.lang.String, java.lang.String) * SpellAbility, java.lang.String, java.lang.String)
*/ */
@Override @Override
public boolean confirmAction(final SpellAbility sa, final PlayerActionConfirmMode mode, final String message) { public boolean confirmAction(final SpellAbility sa, final PlayerActionConfirmMode mode, final String message, Map<String, Object> params) {
if (sa != null && sa.getHostCard() != null && sa.hasParam("ShowCardInPrompt")) { if (sa != null && sa.getHostCard() != null && sa.hasParam("ShowCardInPrompt")) {
// The card wants another thing displayed in the prompt on mouse over rather than itself // The card wants another thing displayed in the prompt on mouse over rather than itself
Card show = null; Card show = null;