forked from External/mage
loop to streams
This commit is contained in:
parent
6eba170e3c
commit
a167122459
10 changed files with 38 additions and 81 deletions
|
|
@ -6,7 +6,6 @@ import mage.abilities.costs.common.SacrificeTargetCost;
|
|||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
* @author LevelX2
|
||||
|
|
@ -18,11 +17,8 @@ public class SacrificeCostCreaturesPower implements DynamicValue {
|
|||
for (Cost cost : sourceAbility.getCosts()) {
|
||||
if (cost instanceof SacrificeTargetCost) {
|
||||
SacrificeTargetCost sacrificeCost = (SacrificeTargetCost) cost;
|
||||
int powerSum = 0;
|
||||
for (Permanent permanent : sacrificeCost.getPermanents()) {
|
||||
powerSum += permanent.getPower().getValue();
|
||||
}
|
||||
return powerSum;
|
||||
return sacrificeCost.getPermanents()
|
||||
.stream().mapToInt(p -> p.getPower().getValue()).sum();
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue