forked from External/mage
Improved ability outcome processing;
This commit is contained in:
parent
ab10ee10c9
commit
89394ffe0a
20 changed files with 227 additions and 100 deletions
|
|
@ -1,8 +1,5 @@
|
|||
|
||||
package mage.abilities;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import mage.abilities.common.ZoneChangeTriggeredAbility;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.keyword.ProtectionAbility;
|
||||
|
|
@ -13,6 +10,9 @@ import mage.game.Game;
|
|||
import mage.util.ThreadLocalStringBuilder;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @param <T>
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
|
|
@ -220,7 +220,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.
|
||||
|
|
@ -273,7 +273,7 @@ public class AbilitiesImpl<T extends Ability> extends ArrayList<T> implements Ab
|
|||
|
||||
@Override
|
||||
public int getOutcomeTotal() {
|
||||
return stream().mapToInt(ability -> ability.getEffects().getOutcomeTotal()).sum();
|
||||
return stream().mapToInt(ability -> ability.getEffects().getOutcomeScore(ability)).sum();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue