From 9c20dd3bfc24bcff5934acd8d0150a971dba40e2 Mon Sep 17 00:00:00 2001 From: xenohedron Date: Mon, 22 May 2023 20:57:08 -0400 Subject: [PATCH] Change the abilities to layer 7b where they belong --- Mage.Sets/src/mage/cards/c/ChimericMass.java | 9 +++---- .../mage/cards/s/SvogthosTheRestlessTomb.java | 8 ++----- .../BecomesCreatureSourceEffect.java | 24 +------------------ 3 files changed, 6 insertions(+), 35 deletions(-) diff --git a/Mage.Sets/src/mage/cards/c/ChimericMass.java b/Mage.Sets/src/mage/cards/c/ChimericMass.java index 0804fe8f73..9774cf4794 100644 --- a/Mage.Sets/src/mage/cards/c/ChimericMass.java +++ b/Mage.Sets/src/mage/cards/c/ChimericMass.java @@ -13,10 +13,7 @@ import mage.abilities.effects.common.continuous.BecomesCreatureSourceEffect; import mage.abilities.effects.common.continuous.SetBasePowerToughnessSourceEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.CardType; -import mage.constants.SubType; -import mage.constants.Duration; -import mage.constants.Zone; +import mage.constants.*; import mage.counters.CounterType; import mage.game.permanent.token.custom.CreatureToken; @@ -32,12 +29,12 @@ public final class ChimericMass extends CardImpl { this.addAbility(new EntersBattlefieldAbility(new EntersBattlefieldWithXCountersEffect(CounterType.CHARGE.createInstance()))); // {1}: Until end of turn, Chimeric Mass becomes a Construct artifact creature with "This creature's power and toughness are each equal to the number of charge counters on it." - // set to character defining to prevent setting P/T again to 0 becuase already set by CDA of the token + CountersSourceCount count = new CountersSourceCount(CounterType.CHARGE); this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureSourceEffect( new CreatureToken(0, 0, "Construct artifact creature with \"This creature's power and toughness are each equal to the number of charge counters on it.\"") .withType(CardType.ARTIFACT) .withSubType(SubType.CONSTRUCT) - .withAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SetBasePowerToughnessSourceEffect(new CountersSourceCount(CounterType.CHARGE)))), + .withAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SetBasePowerToughnessSourceEffect(count, count, Duration.WhileOnBattlefield, SubLayer.SetPT_7b))), CardType.ARTIFACT, Duration.EndOfTurn).withDurationRuleAtStart(true), new GenericManaCost(1))); } diff --git a/Mage.Sets/src/mage/cards/s/SvogthosTheRestlessTomb.java b/Mage.Sets/src/mage/cards/s/SvogthosTheRestlessTomb.java index ed91929a20..59d9ca960d 100644 --- a/Mage.Sets/src/mage/cards/s/SvogthosTheRestlessTomb.java +++ b/Mage.Sets/src/mage/cards/s/SvogthosTheRestlessTomb.java @@ -13,10 +13,7 @@ import mage.abilities.effects.common.continuous.SetBasePowerToughnessSourceEffec import mage.abilities.mana.ColorlessManaAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.CardType; -import mage.constants.SubType; -import mage.constants.Duration; -import mage.constants.Zone; +import mage.constants.*; import mage.filter.common.FilterCreatureCard; import mage.game.permanent.token.TokenImpl; @@ -32,7 +29,6 @@ public final class SvogthosTheRestlessTomb extends CardImpl { // {tap}: Add {C}. this.addAbility(new ColorlessManaAbility()); // {3}{B}{G}: Until end of turn, Svogthos, the Restless Tomb becomes a black and green Plant Zombie creature with "This creature's power and toughness are each equal to the number of creature cards in your graveyard." It's still a land. - // set to character defining to prevent setting P/T again to 0 becuase already set by CDA of the token Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureSourceEffect(new SvogthosToken(), CardType.LAND, Duration.EndOfTurn).withDurationRuleAtStart(true), new ManaCostsImpl<>("{3}{B}{G}")); this.addAbility(ability); } @@ -59,7 +55,7 @@ class SvogthosToken extends TokenImpl { power = new MageInt(0); toughness = new MageInt(0); CardsInControllerGraveyardCount count = new CardsInControllerGraveyardCount(new FilterCreatureCard("creature cards")); - this.addAbility(new SimpleStaticAbility(Zone.ALL, new SetBasePowerToughnessSourceEffect(count))); + this.addAbility(new SimpleStaticAbility(Zone.ALL, new SetBasePowerToughnessSourceEffect(count, count, Duration.WhileOnBattlefield, SubLayer.SetPT_7b))); } public SvogthosToken(final SvogthosToken token) { super(token); diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureSourceEffect.java index d9ff87243e..7e396e9b5b 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureSourceEffect.java @@ -3,9 +3,7 @@ package mage.abilities.effects.common.continuous; import mage.MageObjectReference; import mage.abilities.Ability; import mage.abilities.dynamicvalue.DynamicValue; -import mage.abilities.effects.ContinuousEffect; import mage.abilities.effects.ContinuousEffectImpl; -import mage.abilities.effects.Effect; import mage.constants.*; import mage.game.Game; import mage.game.permanent.Permanent; @@ -44,7 +42,6 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements protected DynamicValue power = null; protected DynamicValue toughness = null; protected boolean durationRuleAtStart; // put duration rule at the start of the rules text rather than the end - protected boolean hasCDA; // used when becoming a creature with an ability that sets P/T in layer 7a /** * @param token Token as blueprint for creature to become @@ -56,7 +53,6 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements this.token = token; this.retainType = retainType; this.durationRuleAtStart = (retainType == CardType.PLANESWALKER || retainType == CardType.CREATURE); - this.hasCDA = checkTokenCDA(); setText(); this.addDependencyType(DependencyType.BecomeCreature); } @@ -74,7 +70,6 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements this.toughness = effect.toughness.copy(); } this.durationRuleAtStart = effect.durationRuleAtStart; - this.hasCDA = effect.hasCDA; } @Override @@ -138,7 +133,7 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements break; case PTChangingEffects_7: - if ((sublayer == SubLayer.SetPT_7b) && !hasCDA) { + if (sublayer == SubLayer.SetPT_7b) { if (power != null) { permanent.getPower().setModifiedBaseValue(power.calculate(game, source, this)); // check all other becomes to use calculate? } else if (token.getPower() != null) { @@ -226,21 +221,4 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements || layer == Layer.TypeChangingEffects_4; } - /** - * Check whether the token contains a characteristic-defining ability in layer 7a. - * If it does, then need to not overwrite P/T in layer 7b. - * (It might not really be a CDA, but applied as one for consistency with the effect type.) - * @return true if the token has an ability with an effect in layer 7a - */ - private boolean checkTokenCDA() { - for (Ability ability : token.getAbilities()) { - for (Effect effect : ability.getEffects()) { - if (effect instanceof ContinuousEffect && ((ContinuousEffect) effect).getSublayer() == SubLayer.CharacteristicDefining_7a) { - return true; - } - } - } - return false; - } - }