From 00ca915581f264fb6595bc037f2449d18a98d74e Mon Sep 17 00:00:00 2001 From: xenohedron Date: Sun, 21 May 2023 22:38:54 -0400 Subject: [PATCH] Move loseAbilities out of constructor --- .../src/mage/cards/c/ChromiumTheMutable.java | 5 ++--- .../mage/cards/m/MonumentToPerfection.java | 8 ++++---- .../BecomesCreatureSourceEffect.java | 19 +++++++++++++------ 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/Mage.Sets/src/mage/cards/c/ChromiumTheMutable.java b/Mage.Sets/src/mage/cards/c/ChromiumTheMutable.java index a1d9d732675..fcd121d5f3f 100644 --- a/Mage.Sets/src/mage/cards/c/ChromiumTheMutable.java +++ b/Mage.Sets/src/mage/cards/c/ChromiumTheMutable.java @@ -46,9 +46,8 @@ public final class ChromiumTheMutable extends CardImpl { // Discard a card: Until end of turn, Chromium, the Mutable becomes a Human with base power and toughness 1/1, loses all abilities, and gains hexproof. It can't be blocked this turn. Ability ability = new SimpleActivatedAbility( new BecomesCreatureSourceEffect( - new ChromiumTheMutableToken(), null, Duration.EndOfTurn, - false, true - ).setText("Until end of turn, {this} becomes " + new ChromiumTheMutableToken(), null, Duration.EndOfTurn + ).andLoseAbilities(true).setText("Until end of turn, {this} becomes " + "a Human with base power and toughness 1/1, " + "loses all abilities, and gains hexproof"), new DiscardCardCost() diff --git a/Mage.Sets/src/mage/cards/m/MonumentToPerfection.java b/Mage.Sets/src/mage/cards/m/MonumentToPerfection.java index 50942de3a07..761f2bb2927 100644 --- a/Mage.Sets/src/mage/cards/m/MonumentToPerfection.java +++ b/Mage.Sets/src/mage/cards/m/MonumentToPerfection.java @@ -2,6 +2,7 @@ package mage.cards.m; import java.util.UUID; +import mage.MageObject; import mage.abilities.Ability; import mage.abilities.common.ActivateIfConditionActivatedAbility; import mage.abilities.common.SimpleActivatedAbility; @@ -62,9 +63,8 @@ public final class MonumentToPerfection extends CardImpl { ).withType(CardType.ARTIFACT) .withAbility(IndestructibleAbility.getInstance()) .withAbility(new ToxicAbility(9)), - null, Duration.Custom, true, - true - ), new GenericManaCost(3), MonumentToPerfectionCondition.instance + "", Duration.Custom + ).andLoseAbilities(true), new GenericManaCost(3), MonumentToPerfectionCondition.instance ).addHint(MonumentToPerfectionValue.getHint())); } @@ -100,7 +100,7 @@ enum MonumentToPerfectionValue implements DynamicValue { .getBattlefield() .getActivePermanents(filter, sourceAbility.getControllerId(), game) .stream() - .map(permanent -> permanent.getName()) + .map(MageObject::getName) .filter(s -> s.length() > 0) .distinct() .mapToInt(x -> 1) 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 ac37ea075a3..fcf14762fdc 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 @@ -40,7 +40,7 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements protected Token token; protected String theyAreStillType; protected boolean losePreviousTypes; - protected boolean loseAbilities; + protected boolean loseAbilities = false; 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 @@ -53,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); + this(token, theyAreStillType, duration, false); } /** @@ -62,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); + this(token, "", duration, true); } /** @@ -70,14 +70,12 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements * @param theyAreStillType String for rules text generation * @param duration Duration for the effect * @param losePreviousTypes if true, permanent loses its previous types - * @param loseAbilities if true, permanent loses its other abilities */ - public BecomesCreatureSourceEffect(Token token, String theyAreStillType, Duration duration, boolean losePreviousTypes, boolean loseAbilities) { + public BecomesCreatureSourceEffect(Token token, String theyAreStillType, Duration duration, boolean losePreviousTypes) { super(duration, Outcome.BecomeCreature); this.token = token; this.theyAreStillType = theyAreStillType; this.losePreviousTypes = losePreviousTypes; - this.loseAbilities = loseAbilities; this.durationRuleAtStart = (theyAreStillType != null && theyAreStillType.contains("planeswalker")); setText(); this.hasCDA = checkTokenCDA(); @@ -189,6 +187,15 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements return this; } + /** + * Source loses all other abilities as part of the effect + * Note: need to set text manually + */ + public BecomesCreatureSourceEffect andLoseAbilities(boolean loseAbilities) { + this.loseAbilities = loseAbilities; + return this; + } + public BecomesCreatureSourceEffect withDurationRuleAtStart(boolean durationRuleAtStart) { this.durationRuleAtStart = durationRuleAtStart; setText();