diff --git a/Mage.Sets/src/mage/cards/c/Conversion.java b/Mage.Sets/src/mage/cards/c/Conversion.java index 34b8a20880..3204856e19 100644 --- a/Mage.Sets/src/mage/cards/c/Conversion.java +++ b/Mage.Sets/src/mage/cards/c/Conversion.java @@ -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 isDependentTo(List allEffectsInLayer) { // the dependent classes needs to be an enclosed class for dependent check of continuous effects - Set 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()); + } } diff --git a/Mage.Sets/src/mage/cards/o/Opalescence.java b/Mage.Sets/src/mage/cards/o/Opalescence.java index 28807d38ba..20c65786b1 100644 --- a/Mage.Sets/src/mage/cards/o/Opalescence.java +++ b/Mage.Sets/src/mage/cards/o/Opalescence.java @@ -138,13 +138,10 @@ class OpalescenceEffect extends ContinuousEffectImpl { @Override public Set isDependentTo(List allEffectsInLayer) { - Set dependentTo = null; + Set 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()); } } diff --git a/Mage.Sets/src/mage/cards/s/StarfieldOfNyx.java b/Mage.Sets/src/mage/cards/s/StarfieldOfNyx.java index 75d9ffb756..c1fedb67e5 100644 --- a/Mage.Sets/src/mage/cards/s/StarfieldOfNyx.java +++ b/Mage.Sets/src/mage/cards/s/StarfieldOfNyx.java @@ -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 isDependentTo(List allEffectsInLayer) { - Set 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()); + } }