From d7fc52daea33325c38f703f6393eebc351c46d14 Mon Sep 17 00:00:00 2001 From: xenohedron Date: Mon, 22 May 2023 01:28:50 -0400 Subject: [PATCH] Fix Haunted Plate Mail --- .../src/mage/cards/h/HauntedPlateMail.java | 2 +- .../BecomesCreatureSourceEffect.java | 20 +++++++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/Mage.Sets/src/mage/cards/h/HauntedPlateMail.java b/Mage.Sets/src/mage/cards/h/HauntedPlateMail.java index af1820c275..24b0a0a82b 100644 --- a/Mage.Sets/src/mage/cards/h/HauntedPlateMail.java +++ b/Mage.Sets/src/mage/cards/h/HauntedPlateMail.java @@ -37,7 +37,7 @@ public final class HauntedPlateMail extends CardImpl { // {0}: Until end of turn, Haunted Plate Mail becomes a 4/4 Spirit artifact creature that's no longer an Equipment. Activate this ability only if you control no creatures. Ability ability = new ConditionalActivatedAbility( Zone.BATTLEFIELD, - new BecomesCreatureSourceEffect(new HauntedPlateMailToken(), CardType.ARTIFACT, Duration.EndOfTurn), + new BecomesCreatureSourceEffect(new HauntedPlateMailToken(), CardType.ARTIFACT, Duration.EndOfTurn).andNotEquipment(true), new ManaCostsImpl<>("{0}"), new PermanentsOnTheBattlefieldCondition(StaticFilters.FILTER_PERMANENT_CREATURE, ComparisonType.EQUAL_TO, 0), "{0}: Until end of turn, Haunted Plate Mail becomes a 4/4 Spirit artifact creature that's no longer an Equipment. Activate only if you control no creatures."); 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 8887578786..d9ff87243e 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 @@ -12,7 +12,7 @@ import mage.game.permanent.Permanent; import mage.game.permanent.token.Token; /** - * @author BetaSteward_at_googlemail.com + * @author BetaSteward_at_googlemail.com, xenohedron */ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements SourceEffect { @@ -40,11 +40,12 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements protected Token token; protected CardType retainType; // if null, loses previous types protected boolean loseAbilities = false; + protected boolean loseEquipmentType = 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 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 * @param retainType If null, permanent loses its previous types, otherwise retains types with appropriate text @@ -65,6 +66,7 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements this.token = effect.token.copy(); this.retainType = effect.retainType; this.loseAbilities = effect.loseAbilities; + this.loseEquipmentType = effect.loseEquipmentType; if (effect.power != null) { this.power = effect.power.copy(); } @@ -111,6 +113,9 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements for (CardType cardType : token.getCardType(game)) { permanent.addCardType(game, cardType); } + if (loseEquipmentType) { + permanent.removeSubType(game, SubType.EQUIPMENT); + } if (retainType == CardType.CREATURE || retainType == CardType.ARTIFACT) { permanent.removeAllCreatureTypes(game); } @@ -163,14 +168,21 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements } /** - * Source loses all other abilities as part of the effect - * Note: need to set text manually + * Source loses all other abilities as part of the effect. Need to set text elsewhere. */ public BecomesCreatureSourceEffect andLoseAbilities(boolean loseAbilities) { this.loseAbilities = loseAbilities; return this; } + /** + * Source loses Equipment subtype as part of the effect. Need to set text manually. + */ + public BecomesCreatureSourceEffect andNotEquipment(boolean notEquipment) { + this.loseEquipmentType = notEquipment; + return this; + } + public BecomesCreatureSourceEffect withDurationRuleAtStart(boolean durationRuleAtStart) { this.durationRuleAtStart = durationRuleAtStart; setText();