mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
Refactor confirm for cleaner distinction
This commit is contained in:
@@ -1203,7 +1203,7 @@ public class AiController {
|
||||
}
|
||||
|
||||
public boolean confirmAction(SpellAbility sa, PlayerActionConfirmMode mode, String message, Map<String, Object> params) {
|
||||
if (mode == PlayerActionConfirmMode.AlternativeDamageAssignment || mode == PlayerActionConfirmMode.ChangeZoneToAltDestination) {
|
||||
if (mode == PlayerActionConfirmMode.ChangeZoneToAltDestination) {
|
||||
System.err.printf("Overriding AI confirmAction decision for %s, defaulting to true.\n", mode);
|
||||
return true;
|
||||
}
|
||||
@@ -1232,7 +1232,7 @@ public class AiController {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean confirmStaticApplication(Card hostCard, GameEntity affected, String logic, String message) {
|
||||
public boolean confirmStaticApplication(Card hostCard, String logic) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -252,8 +252,8 @@ public class PlayerControllerAi extends PlayerController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean confirmStaticApplication(Card hostCard, GameEntity affected, String logic, String message) {
|
||||
return getAi().confirmStaticApplication(hostCard, affected, logic, message);
|
||||
public boolean confirmStaticApplication(Card hostCard, PlayerActionConfirmMode mode, String message, String logic) {
|
||||
return getAi().confirmStaticApplication(hostCard, logic);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -785,15 +785,13 @@ public class Combat {
|
||||
assigningPlayer = orderedBlockers.get(0).getController();
|
||||
}
|
||||
|
||||
final SpellAbility emptySA = new SpellAbility.EmptySa(ApiType.Cleanup, attacker);
|
||||
|
||||
boolean assignToPlayer = false;
|
||||
if (StaticAbilityAssignCombatDamageAsUnblocked.assignCombatDamageAsUnblocked(attacker, false)) {
|
||||
assignToPlayer = true;
|
||||
}
|
||||
if (!assignToPlayer && attacker.getGame().getCombat().isBlocked(attacker)
|
||||
&& StaticAbilityAssignCombatDamageAsUnblocked.assignCombatDamageAsUnblocked(attacker)) {
|
||||
assignToPlayer = assigningPlayer.getController().confirmAction(emptySA, PlayerActionConfirmMode.AlternativeDamageAssignment,
|
||||
assignToPlayer = assigningPlayer.getController().confirmStaticApplication(attacker, PlayerActionConfirmMode.AlternativeDamageAssignment,
|
||||
Localizer.getInstance().getMessage("lblAssignCombatDamageWerentBlocked",
|
||||
CardTranslation.getTranslatedName(attacker.getName())), null);
|
||||
}
|
||||
@@ -805,7 +803,7 @@ public class Combat {
|
||||
divideCombatDamageAsChoose = getDefendersCreatures().size() > 0 &&
|
||||
attacker.hasKeyword("You may assign CARDNAME's combat damage divided as you choose among " +
|
||||
"defending player and/or any number of creatures they control.")
|
||||
&& assigningPlayer.getController().confirmAction(emptySA, PlayerActionConfirmMode.AlternativeDamageAssignment,
|
||||
&& assigningPlayer.getController().confirmStaticApplication(attacker, PlayerActionConfirmMode.AlternativeDamageAssignment,
|
||||
Localizer.getInstance().getMessage("lblAssignCombatDamageAsChoose",
|
||||
CardTranslation.getTranslatedName(attacker.getName())), null);
|
||||
if (defender instanceof Card && divideCombatDamageAsChoose) {
|
||||
@@ -816,7 +814,7 @@ public class Combat {
|
||||
getDefendersCreatures().size() > 0 &&
|
||||
attacker.hasKeyword("If CARDNAME is unblocked, you may have it assign its combat damage to " +
|
||||
"a creature defending player controls.") &&
|
||||
assigningPlayer.getController().confirmAction(emptySA, PlayerActionConfirmMode.AlternativeDamageAssignment,
|
||||
assigningPlayer.getController().confirmStaticApplication(attacker, PlayerActionConfirmMode.AlternativeDamageAssignment,
|
||||
Localizer.getInstance().getMessage("lblAssignCombatDamageToCreature",
|
||||
CardTranslation.getTranslatedName(attacker.getName())), null);
|
||||
if (divideCombatDamageAsChoose) {
|
||||
@@ -849,6 +847,7 @@ public class Combat {
|
||||
else if (orderedBlockers == null || orderedBlockers.isEmpty()) {
|
||||
attackers.remove(attacker);
|
||||
if (assignCombatDamageToCreature) {
|
||||
final SpellAbility emptySA = new SpellAbility.EmptySa(ApiType.Cleanup, attacker);
|
||||
Card chosen = attacker.getController().getController().chooseCardsForEffect(getDefendersCreatures(),
|
||||
emptySA, Localizer.getInstance().getMessage("lblChooseCreature"), 1, 1, false, null).get(0);
|
||||
damageMap.put(attacker, chosen, damageDealt);
|
||||
|
||||
@@ -133,7 +133,7 @@ public abstract class PlayerController {
|
||||
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 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, PlayerActionConfirmMode mode, String logic, String message);
|
||||
public abstract boolean confirmTrigger(WrappedAbility sa);
|
||||
public abstract Player chooseStartingPlayer(boolean isFirstGame);
|
||||
|
||||
|
||||
@@ -191,13 +191,12 @@ public class PlayerControllerForTests extends PlayerController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean confirmBidAction(SpellAbility sa,
|
||||
PlayerActionConfirmMode bidlife, String string, int bid, Player winner) {
|
||||
public boolean confirmBidAction(SpellAbility sa, PlayerActionConfirmMode bidlife, String string, int bid, Player winner) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean confirmStaticApplication(Card hostCard, GameEntity affected, String logic, String message) {
|
||||
public boolean confirmStaticApplication(Card hostCard, PlayerActionConfirmMode mode, String message, String logic) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ public class HumanPlaySpellAbility {
|
||||
ability = GameActionUtil.addExtraKeywordCost(ability);
|
||||
|
||||
final boolean playerManaConversion = human.hasManaConversion()
|
||||
&& human.getController().confirmAction(ability, null, "Do you want to spend mana as though it were mana of any type to pay the cost?", null);
|
||||
&& human.getController().confirmStaticApplication(c, null, "Do you want to spend mana as though it were mana of any type to pay the cost?", null);
|
||||
|
||||
Cost abCost = ability.getPayCosts();
|
||||
CostPayment payment = new CostPayment(abCost, ability);
|
||||
|
||||
@@ -797,8 +797,7 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean confirmStaticApplication(final Card hostCard, final GameEntity affected, final String logic,
|
||||
final String message) {
|
||||
public boolean confirmStaticApplication(final Card hostCard, PlayerActionConfirmMode mode, final String message, final String logic) {
|
||||
return InputConfirm.confirm(this, CardView.get(hostCard), message);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user