This commit is contained in:
ingmargoudt 2017-03-01 17:56:47 +01:00
parent d966c82019
commit fb09aeb0a8
3 changed files with 13 additions and 26 deletions

View file

@ -33,6 +33,7 @@ import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.SacrificeSourceUnlessPaysEffect;
import mage.abilities.mana.WhiteManaAbility;
import mage.cards.CardImpl;
@ -46,6 +47,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import java.util.stream.Collectors;
/**
*
@ -121,17 +123,11 @@ public class Conversion extends CardImpl {
@Override
public Set<UUID> isDependentTo(List<ContinuousEffect> allEffectsInLayer) {
// the dependent classes needs to be an enclosed class for dependent check of continuous effects
Set<UUID> dependentTo = null;
for (ContinuousEffect effect : allEffectsInLayer) {
// http://www.mtgsalvation.com/forums/magic-fundamentals/magic-rulings/magic-rulings-archives/286046-conversion-magus-of-the-moon
if (effect.getDependencyTypes().contains(DependencyType.BecomeMountain)) {
if (dependentTo == null) {
dependentTo = new HashSet<>();
}
dependentTo.add(effect.getId());
}
}
return dependentTo;
return allEffectsInLayer.stream()
.filter(effect->effect.getDependencyTypes().contains(DependencyType.BecomeMountain))
.map(Effect::getId)
.collect(Collectors.toSet());
}
}

View file

@ -138,13 +138,10 @@ class OpalescenceEffect extends ContinuousEffectImpl {
@Override
public Set<UUID> isDependentTo(List<ContinuousEffect> allEffectsInLayer) {
Set<UUID> dependentTo = null;
Set<UUID> dependentTo = new HashSet<>();
for (ContinuousEffect effect : allEffectsInLayer) {
for (DependencyType dependencyType : effect.getDependencyTypes()) {
if (checkDependencyTypes.contains(dependencyType)) {
if (dependentTo == null) {
dependentTo = new HashSet<>();
}
dependentTo.add(effect.getId());
}
}

View file

@ -31,6 +31,8 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import java.util.stream.Collectors;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
@ -38,6 +40,7 @@ import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
import mage.abilities.decorator.ConditionalContinuousEffect;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
@ -166,16 +169,7 @@ class StarfieldOfNyxEffect extends ContinuousEffectImpl {
@Override
public Set<UUID> isDependentTo(List<ContinuousEffect> allEffectsInLayer) {
Set<UUID> dependentTo = null;
for (ContinuousEffect effect : allEffectsInLayer) {
// http://www.slightlymagic.net/forum/viewtopic.php?f=70&t=17664&start=30#p185513
if (effect.getDependencyTypes().contains(DependencyType.AuraAddingRemoving)) {
if (dependentTo == null) {
dependentTo = new HashSet<>();
}
dependentTo.add(effect.getId());
}
}
return dependentTo;
return allEffectsInLayer.stream().filter(effect->effect.getDependencyTypes().contains(DependencyType.AuraAddingRemoving)).map(Effect::getId).collect(Collectors.toSet());
}
}