Refactor: Actually use DependencyType.BecomeNonbasicLand where it's needed.

This commit is contained in:
Grath 2025-08-24 15:16:52 -04:00 committed by GitHub
commit ae7e6a9c10
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
25 changed files with 78 additions and 25 deletions

View file

@ -14,7 +14,6 @@ import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.common.FilterControlledPermanent;
import mage.game.permanent.token.custom.CreatureToken;
import mage.target.common.TargetControlledPermanent;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
@ -42,7 +41,11 @@ public final class AmbushCommander extends CardImpl {
ContinuousEffect effect = new BecomesCreatureAllEffect(
new CreatureToken(1, 1, "1/1 green Elf creatures").withColor("G").withSubType(SubType.ELF),
"lands", filter2, Duration.WhileOnBattlefield, true);
effect.getDependencyTypes().add(DependencyType.BecomeForest);
effect.addDependedToType(DependencyType.BecomeForest);
effect.addDependedToType(DependencyType.BecomeIsland);
effect.addDependedToType(DependencyType.BecomeMountain);
effect.addDependedToType(DependencyType.BecomePlains);
effect.addDependedToType(DependencyType.BecomeSwamp);
this.addAbility(new SimpleStaticAbility(effect));
// {1}{G}, Sacrifice an Elf: Target creature gets +3/+3 until end of turn.

View file

@ -64,6 +64,7 @@ class AshayaSoulOfTheWildEffect extends ContinuousEffectImpl {
staticText = "Nontoken creatures you control are Forest lands in addition to their other types";
this.dependendToTypes.add(DependencyType.BecomeCreature);
this.dependencyTypes.add(DependencyType.BecomeForest);
this.dependencyTypes.add(DependencyType.BecomeNonbasicLand);
}
private AshayaSoulOfTheWildEffect(final AshayaSoulOfTheWildEffect effect) {

View file

@ -63,6 +63,8 @@ class CelestialDawnToPlainsEffect extends ContinuousEffectImpl {
CelestialDawnToPlainsEffect() {
super(Duration.WhileOnBattlefield, Outcome.Detriment);
this.staticText = "Lands you control are Plains";
this.dependendToTypes.add(DependencyType.BecomeNonbasicLand);
this.dependencyTypes.add(DependencyType.BecomePlains);
}
private CelestialDawnToPlainsEffect(final CelestialDawnToPlainsEffect effect) {
@ -126,7 +128,7 @@ class CelestialDawnToWhiteEffect extends ContinuousEffectImpl {
}
}
// Exile
for (Card card : game.getExile().getAllCards(game)) {
for (Card card : game.getExile().getAllCardsByRange(game, controller.getId())) {
if (card.isOwnedBy(controller.getId())) {
setColor(card.getColor(game), game);
}

View file

@ -3,13 +3,14 @@ package mage.cards.c;
import java.util.UUID;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.common.continuous.GainAbilityControlledEffect;
import mage.abilities.mana.AnyColorManaAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.DependencyType;
import mage.constants.Duration;
import mage.constants.Zone;
import mage.filter.StaticFilters;
/**
@ -21,7 +22,10 @@ public final class ChromaticLantern extends CardImpl {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{3}");
// Lands you control have "{T}: Add one mana of any color."
this.addAbility(new SimpleStaticAbility(new GainAbilityControlledEffect(new AnyColorManaAbility(), Duration.WhileOnBattlefield, StaticFilters.FILTER_LANDS, false)));
ContinuousEffect effect = new GainAbilityControlledEffect(new AnyColorManaAbility(), Duration.WhileOnBattlefield, StaticFilters.FILTER_LANDS, false);
effect.getDependedToTypes().add(DependencyType.BecomeNonbasicLand);
this.addAbility(new SimpleStaticAbility(effect));
// {T}: Add one mana of any color.
this.addAbility(new AnyColorManaAbility());

View file

@ -54,6 +54,12 @@ public final class Conversion extends CardImpl {
ConversionEffect() {
super(Duration.WhileOnBattlefield, Outcome.Detriment);
this.staticText = "All Mountains are Plains";
this.dependendToTypes.add(DependencyType.BecomeForest);
this.dependendToTypes.add(DependencyType.BecomeIsland);
this.dependendToTypes.add(DependencyType.BecomeMountain);
this.dependendToTypes.add(DependencyType.BecomePlains);
this.dependendToTypes.add(DependencyType.BecomeSwamp);
this.dependencyTypes.add(DependencyType.BecomePlains);
}
private ConversionEffect(final ConversionEffect effect) {

View file

@ -5,6 +5,7 @@ import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.GainLifeEffect;
@ -45,10 +46,12 @@ public final class DuneChanter extends CardImpl {
this.addAbility(new SimpleStaticAbility(new DuneChanterContinuousEffect()));
// Lands you control have "{T}: Add one mana of any color."
this.addAbility(new SimpleStaticAbility(new GainAbilityControlledEffect(
ContinuousEffect effect = new GainAbilityControlledEffect(
new AnyColorManaAbility(), Duration.WhileOnBattlefield,
StaticFilters.FILTER_LANDS, false
)));
);
effect.getDependedToTypes().add(DependencyType.BecomeNonbasicLand);
this.addAbility(new SimpleStaticAbility(effect));
// {T}: Mill two cards. You gain 1 life for each land card milled this way.
this.addAbility(new SimpleActivatedAbility(new DuneChanterEffect(), new TapSourceCost()));
@ -76,6 +79,7 @@ class DuneChanterContinuousEffect extends ContinuousEffectImpl {
public DuneChanterContinuousEffect() {
super(Duration.WhileOnBattlefield, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.Benefit);
staticText = "Lands you control and land cards you own that aren't on the battlefield are Deserts in addition to their other types";
dependendToTypes.add(DependencyType.BecomeNonbasicLand);
}
private DuneChanterContinuousEffect(final DuneChanterContinuousEffect effect) {

View file

@ -45,6 +45,7 @@ class EncroachingMycosynthEffect extends ContinuousEffectImpl {
super(Duration.WhileOnBattlefield, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.Benefit);
staticText = "Nonland permanents you control are artifacts in addition to their other types. " +
"The same is true for permanent spells you control and nonland permanent cards you own that aren't on the battlefield";
this.dependendToTypes.add(DependencyType.BecomeNonbasicLand);
this.dependencyTypes.add(DependencyType.ArtifactAddingRemoving); // March of the Machines
}

View file

@ -51,6 +51,12 @@ public final class Glaciers extends CardImpl {
GlaciersEffect() {
super(Duration.WhileOnBattlefield, Outcome.Detriment);
this.staticText = "All Mountains are Plains";
this.dependendToTypes.add(DependencyType.BecomeForest);
this.dependendToTypes.add(DependencyType.BecomeIsland);
this.dependendToTypes.add(DependencyType.BecomeMountain);
this.dependendToTypes.add(DependencyType.BecomePlains);
this.dependendToTypes.add(DependencyType.BecomeSwamp);
this.dependencyTypes.add(DependencyType.BecomePlains);
}
private GlaciersEffect(final GlaciersEffect effect) {

View file

@ -54,6 +54,7 @@ class HarbingerOfTheSeasEffect extends ContinuousEffectImpl {
HarbingerOfTheSeasEffect() {
super(Duration.WhileOnBattlefield, Outcome.Detriment);
this.staticText = "Nonbasic lands are Islands";
dependendToTypes.add(DependencyType.BecomeNonbasicLand);
dependencyTypes.add(DependencyType.BecomeIsland);
}

View file

@ -27,11 +27,12 @@ public final class KormusBell extends CardImpl {
new CreatureToken(1, 1, "1/1 black creatures").withColor("B"),
"lands", filter,
Duration.WhileOnBattlefield, true);
effect.addDependedToType(DependencyType.BecomeSwamp); // TODO: are these dependencies correct/complete?
effect.addDependedToType(DependencyType.BecomeIsland);
effect.addDependedToType(DependencyType.BecomeNonbasicLand);
effect.addDependedToType(DependencyType.BecomeForest);
effect.addDependedToType(DependencyType.BecomeIsland);
effect.addDependedToType(DependencyType.BecomeMountain);
effect.addDependedToType(DependencyType.BecomePlains);
effect.addDependedToType(DependencyType.BecomeSwamp);
this.addAbility(new SimpleStaticAbility(effect));
}

View file

@ -3,7 +3,6 @@ package mage.cards.l;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.keyword.LeylineAbility;
@ -47,6 +46,7 @@ class SetSupertypeAllEffect extends ContinuousEffectImpl {
public SetSupertypeAllEffect() {
super(Duration.WhileOnBattlefield, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.Detriment);
this.staticText = "All nonland permanents are legendary";
this.dependendToTypes.add(DependencyType.BecomeNonbasicLand);
}
private SetSupertypeAllEffect(final SetSupertypeAllEffect effect) {

View file

@ -50,6 +50,7 @@ class LeylineOfTheGuildpactEffect extends ContinuousEffectImpl {
LeylineOfTheGuildpactEffect() {
super(Duration.WhileOnBattlefield, Layer.ColorChangingEffects_5, SubLayer.NA, Outcome.Benefit);
staticText = "each nonland permanent you control is all colors";
dependendToTypes.add(DependencyType.BecomeNonbasicLand);
}
private LeylineOfTheGuildpactEffect(final LeylineOfTheGuildpactEffect effect) {

View file

@ -50,7 +50,12 @@ class LifeAndLimbEffect extends ContinuousEffectImpl {
super(Duration.WhileOnBattlefield, Outcome.Neutral);
staticText = "All Forests and all Saprolings are 1/1 green Saproling creatures and Forest lands in addition to their other types";
this.dependendToTypes.add(DependencyType.BecomeNonbasicLand);
this.dependendToTypes.add(DependencyType.BecomeForest);
this.dependendToTypes.add(DependencyType.BecomeIsland);
this.dependendToTypes.add(DependencyType.BecomeMountain);
this.dependendToTypes.add(DependencyType.BecomePlains);
this.dependendToTypes.add(DependencyType.BecomeSwamp);
this.dependendToTypes.add(DependencyType.BecomeCreature);
}

View file

@ -26,7 +26,12 @@ public final class LivingLands extends CardImpl {
ContinuousEffect effect = new BecomesCreatureAllEffect(
new CreatureToken(1, 1, "1/1 creatures"),
"lands", filter, Duration.WhileOnBattlefield, false);
effect.getDependencyTypes().add(DependencyType.BecomeForest); // TODO: are these dependencies correct/complete?
effect.getDependedToTypes().add(DependencyType.BecomeNonbasicLand);
effect.addDependedToType(DependencyType.BecomeForest);
effect.addDependedToType(DependencyType.BecomeIsland);
effect.addDependedToType(DependencyType.BecomeMountain);
effect.addDependedToType(DependencyType.BecomePlains);
effect.addDependedToType(DependencyType.BecomeSwamp);
this.addAbility(new SimpleStaticAbility(effect));
}

View file

@ -2,13 +2,11 @@ package mage.cards.l;
import java.util.UUID;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.common.continuous.BecomesCreatureAllEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SuperType;
import mage.constants.Zone;
import mage.constants.*;
import mage.filter.common.FilterLandPermanent;
import mage.game.permanent.token.custom.CreatureToken;
@ -25,9 +23,11 @@ public final class LivingPlane extends CardImpl {
this.supertype.add(SuperType.WORLD);
// All lands are 1/1 creatures that are still lands.
this.addAbility(new SimpleStaticAbility(new BecomesCreatureAllEffect(
ContinuousEffect effect = new BecomesCreatureAllEffect(
new CreatureToken(1, 1, "1/1 creatures"),
"lands", filter, Duration.WhileOnBattlefield, false)));
"lands", filter, Duration.WhileOnBattlefield, false);
effect.getDependedToTypes().add(DependencyType.BecomeNonbasicLand);
this.addAbility(new SimpleStaticAbility(effect));
}
private LivingPlane(final LivingPlane card) {

View file

@ -54,6 +54,7 @@ class MagusOfTheMoonEffect extends ContinuousEffectImpl {
MagusOfTheMoonEffect() {
super(Duration.WhileOnBattlefield, Outcome.Detriment);
this.staticText = "Nonbasic lands are Mountains";
dependendToTypes.add(DependencyType.BecomeNonbasicLand);
dependencyTypes.add(DependencyType.BecomeMountain);
}

View file

@ -39,6 +39,7 @@ class MeltingEffect extends ContinuousEffectImpl {
MeltingEffect() {
super(Duration.WhileOnBattlefield, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.Detriment);
this.staticText = "All lands are no longer snow";
this.dependendToTypes.add(DependencyType.BecomeNonbasicLand);
}
private MeltingEffect(final MeltingEffect effect) {

View file

@ -3,12 +3,14 @@ package mage.cards.n;
import mage.ObjectColor;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.common.ReturnToHandChosenControlledPermanentEffect;
import mage.abilities.effects.common.continuous.BecomesCreatureAllEffect;
import mage.abilities.keyword.FirstStrikeAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.DependencyType;
import mage.constants.Duration;
import mage.filter.StaticFilters;
import mage.filter.common.FilterControlledEnchantmentPermanent;
@ -37,12 +39,14 @@ public final class NaturalEmergence extends CardImpl {
this.addAbility(new EntersBattlefieldTriggeredAbility(new ReturnToHandChosenControlledPermanentEffect(filter), false));
// Lands you control are 2/2 creatures with first strike. They're still lands.
this.addAbility(new SimpleStaticAbility(new BecomesCreatureAllEffect(
ContinuousEffect effect = new BecomesCreatureAllEffect(
new CreatureToken(
2, 2, "2/2 creatures with first strike"
).withAbility(FirstStrikeAbility.getInstance()), "lands",
StaticFilters.FILTER_CONTROLLED_PERMANENT_LANDS, Duration.WhileOnBattlefield, false
)));
);
effect.getDependedToTypes().add(DependencyType.BecomeNonbasicLand);
this.addAbility(new SimpleStaticAbility(effect));
}
private NaturalEmergence(final NaturalEmergence card) {

View file

@ -2,12 +2,13 @@ package mage.cards.n;
import java.util.UUID;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.common.continuous.BecomesCreatureAllEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.DependencyType;
import mage.constants.Duration;
import mage.constants.Zone;
import mage.filter.common.FilterLandPermanent;
import mage.game.permanent.token.custom.CreatureToken;
@ -24,9 +25,11 @@ public final class NaturesRevolt extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{G}{G}");
// All lands are 2/2 creatures that are still lands.
this.addAbility(new SimpleStaticAbility(new BecomesCreatureAllEffect(
ContinuousEffect effect = new BecomesCreatureAllEffect(
new CreatureToken(2, 2, "2/2 creatures"),
"lands", filter, Duration.WhileOnBattlefield, false)));
"lands", filter, Duration.WhileOnBattlefield, false);
effect.getDependedToTypes().add(DependencyType.BecomeNonbasicLand);
this.addAbility(new SimpleStaticAbility(effect));
}
private NaturesRevolt(final NaturesRevolt card) {

View file

@ -51,6 +51,7 @@ class RealmwrightEffect extends ContinuousEffectImpl {
RealmwrightEffect() {
super(Duration.WhileOnBattlefield, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.Neutral);
staticText = "Lands you control are the chosen type in addition to their other types";
dependendToTypes.add(DependencyType.BecomeNonbasicLand);
}
private RealmwrightEffect(final RealmwrightEffect effect) {

View file

@ -47,6 +47,7 @@ class RootpathPurifierEffect extends ContinuousEffectImpl {
RootpathPurifierEffect() {
super(Duration.WhileOnBattlefield, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.Benefit);
staticText = "lands you control and land cards in your library are basic";
dependendToTypes.add(DependencyType.BecomeNonbasicLand);
}
private RootpathPurifierEffect(final RootpathPurifierEffect effect) {

View file

@ -50,6 +50,7 @@ class BecomesColorlessForestLandEffect extends ContinuousEffectImpl {
BecomesColorlessForestLandEffect() {
super(Duration.WhileOnBattlefield, Outcome.Detriment);
this.staticText = "Enchanted permanent is a colorless Forest land";
dependencyTypes.add(DependencyType.BecomeNonbasicLand);
dependencyTypes.add(DependencyType.BecomeForest);
}

View file

@ -63,6 +63,8 @@ class TophTheFirstMetalbenderEffect extends ContinuousEffectImpl {
TophTheFirstMetalbenderEffect() {
super(Duration.WhileOnBattlefield, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.Benefit);
staticText = "nontoken artifacts you control are lands in addition to their other types";
this.dependendToTypes.add(DependencyType.ArtifactAddingRemoving);
this.dependencyTypes.add(DependencyType.BecomeNonbasicLand);
}
private TophTheFirstMetalbenderEffect(final TophTheFirstMetalbenderEffect effect) {

View file

@ -20,6 +20,7 @@ public class AddBasicLandTypeAllLandsEffect extends ContinuousEffectImpl {
this.subType = subType;
this.staticText = "Each land is " + subType.getIndefiniteArticle() + " "
+ subType.getDescription() + " in addition to its other land types";
this.dependendToTypes.add(DependencyType.BecomeNonbasicLand);
switch (subType) {
case PLAINS:
this.dependencyTypes.add(DependencyType.BecomePlains);

View file

@ -8,9 +8,6 @@ import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
import java.util.ArrayList;
import java.util.List;
/**
* @author TheElk801
*/
@ -27,6 +24,7 @@ public class BecomesAllBasicsControlledEffect extends ContinuousEffectImpl {
public BecomesAllBasicsControlledEffect() {
super(Duration.WhileOnBattlefield, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.Detriment);
this.staticText = "Lands you control are every basic land type in addition to their other types";
dependendToTypes.add(DependencyType.BecomeNonbasicLand);
dependencyTypes.add(DependencyType.BecomeMountain);
dependencyTypes.add(DependencyType.BecomeForest);
dependencyTypes.add(DependencyType.BecomeSwamp);