mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
Merge branch 'fixpay' into 'master'
Force player choice for mandatory costs See merge request core-developers/forge!4074
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user