[MID] Implemented Geistflame Reservoir

This commit is contained in:
Evan Kranzler 2021-09-09 20:00:38 -04:00
parent eef6160a4c
commit 03dfa50f23
4 changed files with 72 additions and 12 deletions

View file

@ -62,12 +62,7 @@ public class RemoveVariableCountersSourceCost extends VariableCostImpl {
@Override
public int getMaxValue(Ability source, Game game) {
int maxValue = 0;
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent != null) {
maxValue = permanent.getCounters(game).getCount(counterName);
}
return maxValue;
return permanent != null ? permanent.getCounters(game).getCount(counterName) : 0;
}
}

View file

@ -1,4 +1,3 @@
package mage.abilities.dynamicvalue.common;
import mage.abilities.Ability;
@ -15,11 +14,12 @@ public enum GetXValue implements DynamicValue {
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
int amount = 0;
for (VariableCost cost : sourceAbility.getCosts().getVariableCosts()) {
amount += cost.getAmount();
}
return amount;
return sourceAbility
.getCosts()
.getVariableCosts()
.stream()
.mapToInt(VariableCost::getAmount)
.sum();
}
@Override