From b11e2a0fe9b48e85e691939635d6b8bb35a661fa Mon Sep 17 00:00:00 2001 From: jeffwadsworth Date: Fri, 7 Feb 2020 08:52:04 -0600 Subject: [PATCH] - refactor some cards and an effect --- Mage.Sets/src/mage/cards/c/Conspiracy.java | 20 ++++------------ Mage.Sets/src/mage/cards/n/NecroticOoze.java | 17 ++----------- Mage.Sets/src/mage/cards/o/Opalescence.java | 18 ++++++-------- .../src/mage/cards/s/StarfieldOfNyx.java | 24 +++++++------------ Mage.Sets/src/mage/cards/y/YixlidJailer.java | 2 ++ .../continuous/BecomesCreatureAllEffect.java | 2 ++ 6 files changed, 25 insertions(+), 58 deletions(-) diff --git a/Mage.Sets/src/mage/cards/c/Conspiracy.java b/Mage.Sets/src/mage/cards/c/Conspiracy.java index 31fa110701..4c34b8c5bc 100644 --- a/Mage.Sets/src/mage/cards/c/Conspiracy.java +++ b/Mage.Sets/src/mage/cards/c/Conspiracy.java @@ -19,11 +19,7 @@ import mage.players.Player; import mage.util.SubTypeList; import java.util.Iterator; import java.util.List; -import java.util.Set; import java.util.UUID; -import java.util.stream.Collectors; -import mage.abilities.effects.ContinuousEffect; -import mage.abilities.effects.Effect; /** * @author bunchOfDevs @@ -58,6 +54,8 @@ public final class Conspiracy extends CardImpl { staticText = "Creatures you control are the chosen type. The same is " + "true for creature spells you control and creature cards " + "you own that aren't on the battlefield."; + + this.dependendToTypes.add(DependencyType.BecomeCreature); // Opalescence and Starfield of Nyx } public ConspiracyEffect(final ConspiracyEffect effect) { @@ -148,7 +146,8 @@ public final class Conspiracy extends CardImpl { } private void setChosenSubtype(SubTypeList subtype, SubType choice) { - if (subtype.size() != 1 || !subtype.contains(choice)) { + if (subtype.size() != 1 + || !subtype.contains(choice)) { subtype.clear(); subtype.add(choice); } @@ -163,16 +162,5 @@ public final class Conspiracy extends CardImpl { public boolean hasLayer(Layer layer) { return layer == Layer.TypeChangingEffects_4; } - - @Override - public Set isDependentTo(List allEffectsInLayer) { - // the dependent classes needs to be an enclosed class for dependent check of continuous effects - return allEffectsInLayer.stream() - .filter(effect - -> mage.cards.s.StarfieldOfNyx.class.equals(effect.getClass().getEnclosingClass()) - || mage.cards.o.Opalescence.class.equals(effect.getClass().getEnclosingClass())) - .map(Effect::getId) - .collect(Collectors.toSet()); - } } } diff --git a/Mage.Sets/src/mage/cards/n/NecroticOoze.java b/Mage.Sets/src/mage/cards/n/NecroticOoze.java index ba6b653aad..0a6a84ad86 100644 --- a/Mage.Sets/src/mage/cards/n/NecroticOoze.java +++ b/Mage.Sets/src/mage/cards/n/NecroticOoze.java @@ -1,16 +1,11 @@ package mage.cards.n; -import java.util.List; -import java.util.Set; import java.util.UUID; -import java.util.stream.Collectors; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.ActivatedAbility; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.effects.ContinuousEffect; import mage.abilities.effects.ContinuousEffectImpl; -import mage.abilities.effects.Effect; import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.CardSetInfo; @@ -52,6 +47,8 @@ public final class NecroticOoze extends CardImpl { Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility); staticText = "As long as {this} is on the battlefield, " + "it has all activated abilities of all creature cards in all graveyards"; + + this.dependendToTypes.add(DependencyType.AddingAbility); // Yixlid Jailer } public NecroticOozeEffect(final NecroticOozeEffect effect) { @@ -88,16 +85,6 @@ public final class NecroticOoze extends CardImpl { public NecroticOozeEffect copy() { return new NecroticOozeEffect(this); } - - @Override - public Set isDependentTo(List allEffectsInLayer) { - // the dependent classes needs to be an enclosed class for dependent check of continuous effects - return allEffectsInLayer.stream() - .filter(effect -> mage.cards.y.YixlidJailer.class.equals(effect.getClass().getEnclosingClass())) - .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 7d6d9d25be..33b905ff53 100644 --- a/Mage.Sets/src/mage/cards/o/Opalescence.java +++ b/Mage.Sets/src/mage/cards/o/Opalescence.java @@ -57,6 +57,11 @@ public final class Opalescence extends CardImpl { super(Duration.WhileOnBattlefield, Outcome.BecomeCreature); staticText = "Each other non-Aura enchantment is a creature in addition to its other " + "types and has base power and base toughness each equal to its converted mana cost"; + + this.dependendToTypes.add(DependencyType.EnchantmentAddingRemoving); // Enchanted Evening + this.dependendToTypes.add(DependencyType.AuraAddingRemoving); // Cloudform + + this.dependencyTypes.add(DependencyType.BecomeCreature); // Conspiracy } public OpalescenceEffect(final OpalescenceEffect effect) { @@ -70,7 +75,8 @@ public final class Opalescence extends CardImpl { @Override public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) { - for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { + for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, + source.getControllerId(), source.getSourceId(), game)) { switch (layer) { case TypeChangingEffects_4: if (sublayer == SubLayer.NA) { @@ -102,15 +108,5 @@ public final class Opalescence extends CardImpl { return layer == Layer.PTChangingEffects_7 || layer == Layer.TypeChangingEffects_4; } - - @Override - public Set isDependentTo(List allEffectsInLayer) { - // the dependent classes needs to be an enclosed class for dependent check of continuous effects - return allEffectsInLayer.stream() - .filter(effect -> effect.getDependencyTypes().contains(DependencyType.EnchantmentAddingRemoving) - || effect.getDependencyTypes().contains(DependencyType.AuraAddingRemoving)) // Cloudform - .map(Effect::getId) - .collect(Collectors.toSet()); - } } } diff --git a/Mage.Sets/src/mage/cards/s/StarfieldOfNyx.java b/Mage.Sets/src/mage/cards/s/StarfieldOfNyx.java index bf8bbbc532..670d6a37fa 100644 --- a/Mage.Sets/src/mage/cards/s/StarfieldOfNyx.java +++ b/Mage.Sets/src/mage/cards/s/StarfieldOfNyx.java @@ -1,15 +1,11 @@ package mage.cards.s; -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; 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; @@ -33,7 +29,8 @@ public final class StarfieldOfNyx extends CardImpl { + "each other non-Aura enchantment you control is a creature in addition to its other types " + "and has base power and base toughness each equal to its converted mana cost."; - private static final FilterCard filterGraveyardEnchantment = new FilterCard("enchantment card from your graveyard"); + private static final FilterCard filterGraveyardEnchantment + = new FilterCard("enchantment card from your graveyard"); private static final FilterEnchantmentPermanent filterEnchantmentYouControl = new FilterEnchantmentPermanent("enchantment you control"); @@ -88,6 +85,11 @@ public final class StarfieldOfNyx extends CardImpl { staticText = "Each other non-Aura enchantment you control is a creature " + "in addition to its other types and has base power and " + "toughness each equal to its converted mana cost"; + + this.dependendToTypes.add(DependencyType.EnchantmentAddingRemoving); // Enchanted Evening + this.dependendToTypes.add(DependencyType.AuraAddingRemoving); // Cloudform + + this.dependencyTypes.add(DependencyType.BecomeCreature); // Conspiracy } public StarfieldOfNyxEffect(final StarfieldOfNyxEffect effect) { @@ -104,7 +106,7 @@ public final class StarfieldOfNyx extends CardImpl { filter.add(CardType.ENCHANTMENT.getPredicate()); filter.add(Predicates.not(SubType.AURA.getPredicate())); filter.add(AnotherPredicate.instance); - if (game.getState().getBattlefield().getActivePermanents(filter2, + if (game.getState().getBattlefield().getActivePermanents(filter2, source.getControllerId(), source.getSourceId(), game).size() > 4) { for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { @@ -144,15 +146,5 @@ public final class StarfieldOfNyx extends CardImpl { return layer == Layer.PTChangingEffects_7 || layer == Layer.TypeChangingEffects_4; } - - @Override - public Set isDependentTo(List allEffectsInLayer) { - // the dependent classes needs to be an enclosed class for dependent check of continuous effects - return allEffectsInLayer.stream() - .filter(effect -> effect.getDependencyTypes().contains(DependencyType.EnchantmentAddingRemoving) - || effect.getDependencyTypes().contains(DependencyType.AuraAddingRemoving)) // Cloudform - .map(Effect::getId) - .collect(Collectors.toSet()); - } } } diff --git a/Mage.Sets/src/mage/cards/y/YixlidJailer.java b/Mage.Sets/src/mage/cards/y/YixlidJailer.java index 2ead346b1d..c7220d32da 100644 --- a/Mage.Sets/src/mage/cards/y/YixlidJailer.java +++ b/Mage.Sets/src/mage/cards/y/YixlidJailer.java @@ -44,6 +44,8 @@ public final class YixlidJailer extends CardImpl { YixlidJailerEffect() { super(Duration.WhileOnBattlefield, Outcome.LoseAbility); staticText = "Cards in graveyards lose all abilities."; + + this.dependencyTypes.add(DependencyType.AddingAbility); // Necrotic Ooze } YixlidJailerEffect(final YixlidJailerEffect effect) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureAllEffect.java index cec74cbc6a..66d103472c 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureAllEffect.java @@ -44,6 +44,8 @@ public class BecomesCreatureAllEffect extends ContinuousEffectImpl { this.loseColor = loseColor; this.loseName = loseName; this.loseTypes = loseTypes; + + this.dependencyTypes.add(DependencyType.BecomeCreature); } public BecomesCreatureAllEffect(final BecomesCreatureAllEffect effect) {