diff --git a/Mage.Sets/src/mage/cards/m/MaskOfGriselbrand.java b/Mage.Sets/src/mage/cards/m/MaskOfGriselbrand.java new file mode 100644 index 0000000000..94c5aad730 --- /dev/null +++ b/Mage.Sets/src/mage/cards/m/MaskOfGriselbrand.java @@ -0,0 +1,90 @@ +package mage.cards.m; + +import java.util.UUID; + +import mage.abilities.Ability; +import mage.abilities.common.DiesAttachedTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.Cost; +import mage.abilities.costs.common.PayLifeCost; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect; +import mage.abilities.keyword.EquipAbility; +import mage.abilities.keyword.FlyingAbility; +import mage.abilities.keyword.LifelinkAbility; +import mage.constants.*; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; + +/** + * + * @author weirddan455 + */ +public final class MaskOfGriselbrand extends CardImpl { + + public MaskOfGriselbrand(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{1}{B}{B}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.EQUIPMENT); + + // Equipped creature has flying and lifelink. + Ability ability = new SimpleStaticAbility(new GainAbilityAttachedEffect(FlyingAbility.getInstance(), AttachmentType.EQUIPMENT)); + ability.addEffect(new GainAbilityAttachedEffect(LifelinkAbility.getInstance(), AttachmentType.EQUIPMENT).setText("and lifelink")); + this.addAbility(ability); + + // Whenever equipped creature dies, you may pay X life, where X is its power. If you do, draw X cards. + this.addAbility(new DiesAttachedTriggeredAbility(new MaskOfGriselbrandEffect(), "equipped creature")); + + // Equip {3} + this.addAbility(new EquipAbility(3)); + } + + private MaskOfGriselbrand(final MaskOfGriselbrand card) { + super(card); + } + + @Override + public MaskOfGriselbrand copy() { + return new MaskOfGriselbrand(this); + } +} + +class MaskOfGriselbrandEffect extends OneShotEffect { + + public MaskOfGriselbrandEffect() { + super(Outcome.DrawCard); + staticText = "you may pay X life, where X is its power. If you do, draw X cards"; + } + + private MaskOfGriselbrandEffect(final MaskOfGriselbrandEffect effect) { + super(effect); + } + + @Override + public MaskOfGriselbrandEffect copy() { + return new MaskOfGriselbrandEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + Permanent permanent = (Permanent) getValue("attachedTo"); + if (controller == null || permanent == null) { + return false; + } + int xValue = permanent.getPower().getValue(); + Cost cost = new PayLifeCost(xValue); + if (cost.canPay(source, source, source.getControllerId(), game) + && controller.chooseUse( + outcome, "Pay " + xValue + " life? If you do, draw " + + xValue + " cards.", source, game + ) && cost.pay(source, game, source, source.getControllerId(), false)) { + controller.drawCards(xValue, source, game); + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/InnistradMidnightHunt.java b/Mage.Sets/src/mage/sets/InnistradMidnightHunt.java index 44e424b406..0896d7882f 100644 --- a/Mage.Sets/src/mage/sets/InnistradMidnightHunt.java +++ b/Mage.Sets/src/mage/sets/InnistradMidnightHunt.java @@ -126,6 +126,7 @@ public final class InnistradMidnightHunt extends ExpansionSet { cards.add(new SetCardInfo("Lord of the Ulvenwald", 231, Rarity.UNCOMMON, mage.cards.l.LordOfTheUlvenwald.class)); cards.add(new SetCardInfo("Loyal Gryff", 26, Rarity.UNCOMMON, mage.cards.l.LoyalGryff.class)); cards.add(new SetCardInfo("Lunar Frenzy", 147, Rarity.UNCOMMON, mage.cards.l.LunarFrenzy.class)); + cards.add(new SetCardInfo("Mask of Griselbrand", 111, Rarity.RARE, mage.cards.m.MaskOfGriselbrand.class)); cards.add(new SetCardInfo("Might of the Old Ways", 189, Rarity.COMMON, mage.cards.m.MightOfTheOldWays.class)); cards.add(new SetCardInfo("Moonsilver Key", 255, Rarity.UNCOMMON, mage.cards.m.MoonsilverKey.class)); cards.add(new SetCardInfo("Morbid Opportunist", 113, Rarity.UNCOMMON, mage.cards.m.MorbidOpportunist.class));