* Doubling Cube - Added support for possible mana calculation (related to #6698).

This commit is contained in:
LevelX2 2020-08-18 00:22:53 +02:00
parent 27db13605e
commit c48331f216
15 changed files with 379 additions and 79 deletions

View file

@ -12,6 +12,7 @@ import org.apache.log4j.Logger;
import java.util.*;
import java.util.stream.Collectors;
import mage.abilities.mana.ManaAbility;
/**
* @param <T>
@ -185,6 +186,13 @@ public class AbilitiesImpl<T extends Ability> extends ArrayList<T> implements Ab
return zonedAbilities;
}
@Override
public boolean hasPoolDependantAbilities() {
return stream()
.anyMatch(ability -> ability.getAbilityType() == AbilityType.MANA
&& ((ManaAbility) ability).isPoolDependant());
}
@Override
public Abilities<ProtectionAbility> getProtectionAbilities() {
return stream()
@ -224,7 +232,7 @@ public class AbilitiesImpl<T extends Ability> extends ArrayList<T> implements Ab
@Override
public boolean contains(T ability) {
for (Iterator<T> iterator = this.iterator(); iterator.hasNext(); ) { // simple loop can cause java.util.ConcurrentModificationException
for (Iterator<T> iterator = this.iterator(); iterator.hasNext();) { // simple loop can cause java.util.ConcurrentModificationException
T test = iterator.next();
// Checking also by getRule() without other restrictions is a problem when a triggered ability will be copied to a permanent that had the same ability
// already before the copy. Because then it keeps the triggered ability twice and it triggers twice.