mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
Fix for Temporal Extortion
This commit is contained in:
@@ -1551,8 +1551,7 @@ public class AbilityUtils {
|
|||||||
boolean alreadyPaid = false;
|
boolean alreadyPaid = false;
|
||||||
for (Player payer : allPayers) {
|
for (Player payer : allPayers) {
|
||||||
if (unlessCost.equals("LifeTotalHalfUp")) {
|
if (unlessCost.equals("LifeTotalHalfUp")) {
|
||||||
String halfup = Integer.toString((int) Math.ceil(payer.getLife() / 2.0));
|
cost = new Cost("PayLife<Count$YourLifeTotal/HalfUp>", true);
|
||||||
cost = new Cost("PayLife<" + halfup + ">", true);
|
|
||||||
}
|
}
|
||||||
alreadyPaid |= payer.getController().payCostToPreventEffect(cost, sa, alreadyPaid, allPayers);
|
alreadyPaid |= payer.getController().payCostToPreventEffect(cost, sa, alreadyPaid, allPayers);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -198,8 +198,6 @@ public class HumanPlay {
|
|||||||
req.playAbility(!useOldTargets, false, true);
|
req.playAbility(!useOldTargets, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------
|
|
||||||
|
|
||||||
private static int getAmountFromPart(CostPart part, Card source, SpellAbility sourceAbility) {
|
private static int getAmountFromPart(CostPart part, Card source, SpellAbility sourceAbility) {
|
||||||
String amountString = part.getAmount();
|
String amountString = part.getAmount();
|
||||||
return StringUtils.isNumeric(amountString) ? Integer.parseInt(amountString) : AbilityUtils.calculateAmount(source, amountString, sourceAbility);
|
return StringUtils.isNumeric(amountString) ? Integer.parseInt(amountString) : AbilityUtils.calculateAmount(source, amountString, sourceAbility);
|
||||||
@@ -267,11 +265,15 @@ public class HumanPlay {
|
|||||||
boolean mayRemovePart = true;
|
boolean mayRemovePart = true;
|
||||||
|
|
||||||
if (part instanceof CostPayLife) {
|
if (part instanceof CostPayLife) {
|
||||||
final int amount = getAmountFromPart(part, source, sourceAbility);
|
if (!part.canPay(sourceAbility, p)) {
|
||||||
if (!p.canPayLife(amount)) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int amount = getAmountFromPart(part, source, sourceAbility);
|
||||||
|
if (part.getAmount().contains("/Half")) {
|
||||||
|
amount = Math.max(amount, 0);
|
||||||
|
}
|
||||||
|
|
||||||
if (!p.getController().confirmPayment(part, Localizer.getInstance().getMessage("lblDoYouWantPayNLife", String.valueOf(amount)) + orString, sourceAbility)) {
|
if (!p.getController().confirmPayment(part, Localizer.getInstance().getMessage("lblDoYouWantPayNLife", String.valueOf(amount)) + orString, sourceAbility)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user