[VOW] Implemented Groom's Finery

This commit is contained in:
Evan Kranzler 2021-11-02 09:12:35 -04:00
parent 4caa92ea69
commit fb38ee9b8d
3 changed files with 105 additions and 8 deletions

View file

@ -0,0 +1,89 @@
package mage.cards.g;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.Condition;
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
import mage.abilities.decorator.ConditionalContinuousEffect;
import mage.abilities.effects.common.continuous.BoostEquippedEffect;
import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect;
import mage.abilities.hint.ConditionHint;
import mage.abilities.hint.Hint;
import mage.abilities.keyword.DeathtouchAbility;
import mage.abilities.keyword.EquipAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.AttachmentType;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterEquipmentPermanent;
import mage.filter.predicate.ObjectSourcePlayer;
import mage.filter.predicate.ObjectSourcePlayerPredicate;
import mage.filter.predicate.mageobject.NamePredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class GroomsFinery extends CardImpl {
private static final FilterPermanent filter = new FilterEquipmentPermanent();
static {
filter.add(new NamePredicate("Bride's Gown"));
filter.add(GroomsFineryPredicate.instance);
}
private static final Condition condition = new PermanentsOnTheBattlefieldCondition(filter, false);
private static final Hint hint = new ConditionHint(
condition, "An Equipment named Bride's Gown is attached to a creature you control"
);
public GroomsFinery(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{1}{B}");
this.subtype.add(SubType.EQUIPMENT);
// Equipped creature gets +2/+0. It gets an additional +0/+2 and has deathtouch as long as an Equipment named Bride's Gown is attached to a creature you control.
Ability ability = new SimpleStaticAbility(new BoostEquippedEffect(2, 0));
ability.addEffect(new ConditionalContinuousEffect(
new BoostEquippedEffect(0, 2),
condition, "It gets an additional +0/+2"
));
ability.addEffect(new ConditionalContinuousEffect(
new GainAbilityAttachedEffect(
DeathtouchAbility.getInstance(), AttachmentType.EQUIPMENT
), condition, "and has deathtouch as long as an Equipment " +
"named Bride's Gown is attached to a creature you control"
));
this.addAbility(ability.addHint(hint));
// Equip {2}
this.addAbility(new EquipAbility(2));
}
private GroomsFinery(final GroomsFinery card) {
super(card);
}
@Override
public GroomsFinery copy() {
return new GroomsFinery(this);
}
}
enum GroomsFineryPredicate implements ObjectSourcePlayerPredicate<Permanent> {
instance;
@Override
public boolean apply(ObjectSourcePlayer<Permanent> input, Game game) {
Permanent permanent = game.getPermanent(input.getObject().getAttachedTo());
return permanent != null
&& permanent.isCreature(game)
&& permanent.isControlledBy(input.getPlayerId());
}
}

View file

@ -61,6 +61,7 @@ public final class InnistradCrimsonVow extends ExpansionSet {
cards.add(new SetCardInfo("Gluttonous Guest", 114, Rarity.COMMON, mage.cards.g.GluttonousGuest.class));
cards.add(new SetCardInfo("Gnarled Grovestrider", 198, Rarity.UNCOMMON, mage.cards.g.GnarledGrovestrider.class));
cards.add(new SetCardInfo("Grolnok, the Omnivore", 238, Rarity.RARE, mage.cards.g.GrolnokTheOmnivore.class));
cards.add(new SetCardInfo("Groom's Finery", 117, Rarity.UNCOMMON, mage.cards.g.GroomsFinery.class));
cards.add(new SetCardInfo("Gryff Rider", 15, Rarity.COMMON, mage.cards.g.GryffRider.class));
cards.add(new SetCardInfo("Halana and Alena, Partners", 239, Rarity.RARE, mage.cards.h.HalanaAndAlenaPartners.class));
cards.add(new SetCardInfo("Hallowed Haunting", 17, Rarity.MYTHIC, mage.cards.h.HallowedHaunting.class));

View file

@ -1,4 +1,3 @@
package mage.abilities.condition.common;
import mage.abilities.Ability;
@ -19,11 +18,11 @@ import mage.game.Game;
*/
public class PermanentsOnTheBattlefieldCondition implements Condition {
private FilterPermanent filter;
private Condition condition;
private ComparisonType type;
private int count;
private boolean onlyControlled;
private final FilterPermanent filter;
private final Condition condition;
private final ComparisonType type;
private final int count;
private final boolean onlyControlled;
/**
* Applies a filter and delegates creation to
@ -33,7 +32,11 @@ public class PermanentsOnTheBattlefieldCondition implements Condition {
* @param filter
*/
public PermanentsOnTheBattlefieldCondition(FilterPermanent filter) {
this(filter, ComparisonType.MORE_THAN, 0);
this(filter, true);
}
public PermanentsOnTheBattlefieldCondition(FilterPermanent filter, boolean onlyControlled) {
this(filter, ComparisonType.MORE_THAN, 0, onlyControlled);
}
/**
@ -55,6 +58,7 @@ public class PermanentsOnTheBattlefieldCondition implements Condition {
this.type = type;
this.count = count;
this.onlyControlled = onlyControlled;
this.condition = null;
}
/**
@ -69,7 +73,10 @@ public class PermanentsOnTheBattlefieldCondition implements Condition {
* @param conditionToDecorate
*/
public PermanentsOnTheBattlefieldCondition(FilterPermanent filter, ComparisonType type, int count, Condition conditionToDecorate) {
this(filter, type, count);
this.filter = filter;
this.type = type;
this.count = count;
this.onlyControlled = true;
this.condition = conditionToDecorate;
}