diff --git a/Mage.Sets/src/mage/cards/c/ChimericMass.java b/Mage.Sets/src/mage/cards/c/ChimericMass.java index 943346d25c7..b1cc5fc7ed9 100644 --- a/Mage.Sets/src/mage/cards/c/ChimericMass.java +++ b/Mage.Sets/src/mage/cards/c/ChimericMass.java @@ -38,7 +38,7 @@ public final class ChimericMass extends CardImpl { .withType(CardType.ARTIFACT) .withSubType(SubType.CONSTRUCT) .withAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SetBasePowerToughnessSourceEffect(new CountersSourceCount(CounterType.CHARGE)))), - "", Duration.EndOfTurn, false, false, true).withDurationRuleAtStart(true), new GenericManaCost(1))); + "", Duration.EndOfTurn).withDurationRuleAtStart(true), new GenericManaCost(1))); } private ChimericMass(final ChimericMass card) { diff --git a/Mage.Sets/src/mage/cards/c/ChromiumTheMutable.java b/Mage.Sets/src/mage/cards/c/ChromiumTheMutable.java index 115ebbbdbcc..a1d9d732675 100644 --- a/Mage.Sets/src/mage/cards/c/ChromiumTheMutable.java +++ b/Mage.Sets/src/mage/cards/c/ChromiumTheMutable.java @@ -47,7 +47,7 @@ public final class ChromiumTheMutable extends CardImpl { Ability ability = new SimpleActivatedAbility( new BecomesCreatureSourceEffect( new ChromiumTheMutableToken(), null, Duration.EndOfTurn, - false, true, false + false, true ).setText("Until end of turn, {this} becomes " + "a Human with base power and toughness 1/1, " + "loses all abilities, and gains hexproof"), diff --git a/Mage.Sets/src/mage/cards/e/EbonyFly.java b/Mage.Sets/src/mage/cards/e/EbonyFly.java index 86a7baa0107..96747be164c 100644 --- a/Mage.Sets/src/mage/cards/e/EbonyFly.java +++ b/Mage.Sets/src/mage/cards/e/EbonyFly.java @@ -103,7 +103,7 @@ class EbonyFlyEffect extends OneShotEffect { new CreatureToken(result, result) .withType(CardType.ARTIFACT) .withAbility(FlyingAbility.getInstance()), - "", Duration.EndOfTurn, false, false, false + "", Duration.EndOfTurn ), source); return true; } diff --git a/Mage.Sets/src/mage/cards/m/MonumentToPerfection.java b/Mage.Sets/src/mage/cards/m/MonumentToPerfection.java index 8f7671c8ce7..50942de3a07 100644 --- a/Mage.Sets/src/mage/cards/m/MonumentToPerfection.java +++ b/Mage.Sets/src/mage/cards/m/MonumentToPerfection.java @@ -63,7 +63,7 @@ public final class MonumentToPerfection extends CardImpl { .withAbility(IndestructibleAbility.getInstance()) .withAbility(new ToxicAbility(9)), null, Duration.Custom, true, - true, false + true ), new GenericManaCost(3), MonumentToPerfectionCondition.instance ).addHint(MonumentToPerfectionValue.getHint())); } diff --git a/Mage.Sets/src/mage/cards/s/SvogthosTheRestlessTomb.java b/Mage.Sets/src/mage/cards/s/SvogthosTheRestlessTomb.java index a8606fcae5b..fb32fe12b4d 100644 --- a/Mage.Sets/src/mage/cards/s/SvogthosTheRestlessTomb.java +++ b/Mage.Sets/src/mage/cards/s/SvogthosTheRestlessTomb.java @@ -33,7 +33,7 @@ public final class SvogthosTheRestlessTomb extends CardImpl { 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(), "land", Duration.EndOfTurn, false, false, true).withDurationRuleAtStart(true), new ManaCostsImpl<>("{3}{B}{G}")); + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureSourceEffect(new SvogthosToken(), "land", Duration.EndOfTurn).withDurationRuleAtStart(true), new ManaCostsImpl<>("{3}{B}{G}")); this.addAbility(ability); } 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 9d7c6e89cc6..ac37ea075a3 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,7 +3,9 @@ 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; @@ -42,6 +44,7 @@ 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; /** * Becomes a creature retaining its previous types @@ -50,7 +53,7 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements * @param duration Duration for the effect */ public BecomesCreatureSourceEffect(Token token, String theyAreStillType, Duration duration) { - this(token, theyAreStillType, duration, false, false, false); + this(token, theyAreStillType, duration, false, false); } /** @@ -59,7 +62,7 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements * @param duration Duration for the effect */ public BecomesCreatureSourceEffect(Token token, Duration duration) { - this(token, "", duration, true, false, false); + this(token, "", duration, true, false); } /** @@ -68,17 +71,16 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements * @param duration Duration for the effect * @param losePreviousTypes if true, permanent loses its previous types * @param loseAbilities if true, permanent loses its other abilities - * @param characterDefining if true, effect applies on layer 7a (it probably shouldn't) */ - public BecomesCreatureSourceEffect(Token token, String theyAreStillType, Duration duration, boolean losePreviousTypes, boolean loseAbilities, boolean characterDefining) { + public BecomesCreatureSourceEffect(Token token, String theyAreStillType, Duration duration, boolean losePreviousTypes, boolean loseAbilities) { super(duration, Outcome.BecomeCreature); - this.characterDefining = characterDefining; this.token = token; this.theyAreStillType = theyAreStillType; this.losePreviousTypes = losePreviousTypes; this.loseAbilities = loseAbilities; this.durationRuleAtStart = (theyAreStillType != null && theyAreStillType.contains("planeswalker")); setText(); + this.hasCDA = checkTokenCDA(); this.addDependencyType(DependencyType.BecomeCreature); } @@ -96,6 +98,7 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements this.toughness = effect.toughness.copy(); } this.durationRuleAtStart = effect.durationRuleAtStart; + this.hasCDA = effect.hasCDA; } @Override @@ -157,8 +160,7 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements break; case PTChangingEffects_7: - if ((sublayer == SubLayer.CharacteristicDefining_7a && isCharacterDefining()) - || (sublayer == SubLayer.SetPT_7b && !isCharacterDefining())) { + if ((sublayer == SubLayer.SetPT_7b) && !hasCDA) { if (power != null) { permanent.getPower().setModifiedBaseValue(power.calculate(game, source, this)); // check all other becomes to use calculate? } else if (token.getPower() != null) { @@ -227,4 +229,20 @@ 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. + * @return true if the token has a characteristic-defining ability + */ + 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; + } + }