Force player choice for mandatory costs

This commit is contained in:
tool4EvEr
2021-03-02 19:33:40 +01:00
parent 03a63da029
commit 65fc79a746
6 changed files with 16 additions and 7 deletions

View File

@@ -515,6 +515,7 @@ public class Cost implements Serializable {
public final Cost copy() {
Cost toRet = new Cost();
toRet.isAbility = this.isAbility;
toRet.isMandatory = this.isMandatory;
for (CostPart cp : this.costParts) {
toRet.costParts.add(cp.copy());
}

View File

@@ -4,7 +4,7 @@ Types:Creature Minion
PT:*/*
K:Trample
R:Event$ Moved | ValidCard$ Card.Self | Destination$ Battlefield | ReplaceWith$ PayLife | Description$ As CARDNAME enters the battlefield, pay any amount of life.
SVar:PayLife:AB$ StoreSVar | Cost$ PayLife<X> | References$ X | SVar$ LifePaidOnETB | Type$ Calculate | Expression$ X | SubAbility$ MoveToPlay
SVar:PayLife:AB$ StoreSVar | Cost$ Mandatory PayLife<X> | References$ X | SVar$ LifePaidOnETB | Type$ Calculate | Expression$ X | SubAbility$ MoveToPlay
SVar:MoveToPlay:DB$ ChangeZone | Defined$ ReplacedCard | Origin$ All | Destination$ Battlefield
S:Mode$ Continuous | EffectZone$ All | CharacteristicDefining$ True | SetPower$ LifePaidOnETB | SetToughness$ LifePaidOnETB | Description$ CARDNAME's power and toughness are each equal to the life paid as it entered the battlefield.
SVar:X:Count$xPaid

View File

@@ -4,7 +4,7 @@ Types:Creature
PT:*/*
K:Trample
R:Event$ Moved | ValidCard$ Card.Self | Destination$ Battlefield | ReplaceWith$ PayLife | Description$ As CARDNAME enters the battlefield, pay any amount of life. The amount you pay can't be more than the total number of white nontoken permanents your opponents control plus the total number of white cards in their graveyards.
SVar:PayLife:AB$ StoreSVar | Cost$ PayLife<X> | XMaxLimit$ Limit | References$ X,Limit,Active,Buried | SVar$ LifePaidOnETB | Type$ Calculate | Expression$ X | SubAbility$ MoveToPlay
SVar:PayLife:AB$ StoreSVar | Cost$ Mandatory PayLife<X> | XMaxLimit$ Limit | References$ X,Limit,Active,Buried | SVar$ LifePaidOnETB | Type$ Calculate | Expression$ X | SubAbility$ MoveToPlay
SVar:MoveToPlay:DB$ ChangeZone | Defined$ ReplacedCard | Origin$ All | Destination$ Battlefield
#Dont use References, when the variable is set by StoreSVar
S:Mode$ Continuous | EffectZone$ All | CharacteristicDefining$ True | SetPower$ LifePaidOnETB | SetToughness$ LifePaidOnETB | Description$ CARDNAME's power and toughness are each equal to the life paid as it entered the battlefield.

View File

@@ -2,7 +2,7 @@ Name:Phyrexian Processor
ManaCost:4
Types:Artifact
R:Event$ Moved | ValidCard$ Card.Self | Destination$ Battlefield | ReplaceWith$ PayLife | Description$ As CARDNAME enters the battlefield, pay any amount of life.
SVar:PayLife:AB$ StoreSVar | Cost$ PayLife<X> | References$ X | SVar$ LifePaidOnETB | Type$ Calculate | Expression$ X | SubAbility$ MoveToPlay
SVar:PayLife:AB$ StoreSVar | Cost$ Mandatory PayLife<X> | References$ X | SVar$ LifePaidOnETB | Type$ Calculate | Expression$ X | SubAbility$ MoveToPlay
SVar:MoveToPlay:DB$ ChangeZone | Defined$ ReplacedCard | Origin$ All | Destination$ Battlefield
A:AB$ Token | Cost$ 4 T | TokenAmount$ 1 | TokenScript$ b_x_x_minion | TokenOwner$ You | TokenPower$ LifePaidOnETB | TokenToughness$ LifePaidOnETB | LegacyImage$ b x x minion usg | SpellDescription$ Create an X/X black Minion creature token, where X is the life paid as CARDNAME entered the battlefield.
SVar:X:Count$xPaid

View File

@@ -555,7 +555,8 @@ public class HumanCostDecision extends CostDecisionMakerBase {
c = AbilityUtils.calculateAmount(source, amount, ability);
}
if (player.canPayLife(c) && player.getController().confirmPayment(cost, Localizer.getInstance().getMessage("lblPayNLifeConfirm", String.valueOf(c)),ability)) {
// for costs declared mandatory, this is only reachable with a valid amount
if (ability.getPayCosts().isMandatory() || (player.canPayLife(c) && player.getController().confirmPayment(cost, Localizer.getInstance().getMessage("lblPayNLifeConfirm", String.valueOf(c)),ability))) {
return PaymentDecision.number(c);
}
return null;

View File

@@ -327,10 +327,10 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
public Integer announceRequirements(final SpellAbility ability, final String announce) {
int max = Integer.MAX_VALUE;
boolean canChooseZero = true;
Cost cost = ability.getPayCosts();
if ("X".equals(announce)) {
canChooseZero = !ability.hasParam("XCantBe0");
Cost cost = ability.getPayCosts();
if (ability.hasParam("XMaxLimit")) {
max = Math.min(max, AbilityUtils.calculateAmount(ability.getHostCard(), ability.getParam("XMaxLimit"), ability));
}
@@ -355,8 +355,15 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
if (min > max) {
return null;
}
return getGui().getInteger(localizer.getMessage("lblChooseAnnounceForCard", announce,
CardTranslation.getTranslatedName(ability.getHostCard().getName())) , min, max, min + 9);
if (cost.isMandatory()) {
return chooseNumber(ability, localizer.getMessage("lblChooseAnnounceForCard", announce,
CardTranslation.getTranslatedName(ability.getHostCard().getName())) , min, max);
}
else {
return getGui().getInteger(localizer.getMessage("lblChooseAnnounceForCard", announce,
CardTranslation.getTranslatedName(ability.getHostCard().getName())) , min, max, min + 9);
}
}
@Override