small complexity rewrite

This commit is contained in:
Ingmar Goudt 2019-07-11 15:44:46 +02:00
parent d9ace1b66f
commit b704618f32
2 changed files with 8 additions and 15 deletions

View file

@ -35,14 +35,10 @@ public enum GetKickerXValue implements DynamicValue {
// search that kicker used X value
KickerAbility kickerAbility = (KickerAbility) ability;
boolean haveVarCost = false;
for (OptionalAdditionalCost cost : kickerAbility.getKickerCosts()) {
List<VariableCost> varCosts = ((OptionalAdditionalCostImpl) cost).getVariableCosts();
if (!varCosts.isEmpty()) {
haveVarCost = true;
break;
}
}
boolean haveVarCost = kickerAbility.getKickerCosts()
.stream()
.anyMatch(varCost -> !((OptionalAdditionalCostImpl) varCost).getVariableCosts().isEmpty());
if (haveVarCost) {
int kickedCount = ((KickerAbility) ability).getKickedCounter(game, source);