Merge branch 'fixAllCounters' into 'master'

Fix SubCounter<All abilities not working

See merge request core-developers/forge!3652
This commit is contained in:
Hans Mackowiak
2021-01-27 08:08:51 +00:00

View File

@@ -140,7 +140,13 @@ public class CostRemoveCounter extends CostPart {
final Card source = ability.getHostCard();
final String type = this.getType();
final Integer amount = this.convertAmount();
final Integer amount;
if (getAmount().equals("All")) {
amount = source.getCounters(cntrs);
}
else {
amount = this.convertAmount();
}
if (this.payCostFromSource()) {
return (amount == null) || ((source.getCounters(cntrs) - amount) >= 0);
}
@@ -170,7 +176,14 @@ public class CostRemoveCounter extends CostPart {
Card source = ability.getHostCard();
int removed = 0;
int toRemove = AbilityUtils.calculateAmount(source, getAmount(), ability);
final int toRemove;
if (getAmount().equals("All")) {
toRemove = source.getCounters(counter);
}
else {
toRemove = AbilityUtils.calculateAmount(source, getAmount(), ability);
}
// for this cost, the list should be only one
for (Card c : decision.cards) {
removed += toRemove;