Fix Haunted Plate Mail

This commit is contained in:
xenohedron 2023-05-22 01:28:50 -04:00
parent 515672bb53
commit d7fc52daea
2 changed files with 17 additions and 5 deletions

View file

@ -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.");

View file

@ -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,6 +40,7 @@ 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
@ -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();