loop to streams

This commit is contained in:
igoudt 2017-07-08 10:57:36 +02:00
parent 6eba170e3c
commit a167122459
10 changed files with 38 additions and 81 deletions

View file

@ -18,11 +18,7 @@ public class DiscardCostCardConvertedMana implements DynamicValue {
for (Cost cost : sourceAbility.getCosts()) {
if (cost instanceof DiscardTargetCost) {
DiscardTargetCost discardCost = (DiscardTargetCost) cost;
int cmc = 0;
for (Card card : discardCost.getCards()) {
cmc += card.getConvertedManaCost();
}
return cmc;
return discardCost.getCards().stream().mapToInt(Card::getConvertedManaCost).sum();
}
}
return 0;