- refactor some cards and an effect

This commit is contained in:
jeffwadsworth 2020-02-07 08:52:04 -06:00
parent d6c2f031d0
commit b11e2a0fe9
6 changed files with 25 additions and 58 deletions

View file

@ -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<UUID> isDependentTo(List<ContinuousEffect> 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());
}
}
}

View file

@ -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<UUID> isDependentTo(List<ContinuousEffect> 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());
}
}
}

View file

@ -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<UUID> isDependentTo(List<ContinuousEffect> 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());
}
}
}

View file

@ -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<UUID> isDependentTo(List<ContinuousEffect> 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());
}
}
}

View file

@ -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) {

View file

@ -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) {