From 357d1873dbde15485b71d91426576a22dfb07166 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Tue, 7 Apr 2020 19:19:10 -0400 Subject: [PATCH] Implemented Bonder's Ornament --- .../src/mage/cards/b/BondersOrnament.java | 80 +++++++++++++++++++ .../src/mage/sets/Commander2020Edition.java | 1 + 2 files changed, 81 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/b/BondersOrnament.java diff --git a/Mage.Sets/src/mage/cards/b/BondersOrnament.java b/Mage.Sets/src/mage/cards/b/BondersOrnament.java new file mode 100644 index 0000000000..3918686f69 --- /dev/null +++ b/Mage.Sets/src/mage/cards/b/BondersOrnament.java @@ -0,0 +1,80 @@ +package mage.cards.b; + +import mage.MageObject; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.costs.mana.GenericManaCost; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.mana.AnyColorManaAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.game.Game; +import mage.players.Player; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class BondersOrnament extends CardImpl { + + public BondersOrnament(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}"); + + // {T}: Add one mana of any color. + this.addAbility(new AnyColorManaAbility()); + + // {4}, {T}: Each player who controls a permanent named Bonder's Ornament draws a card. + Ability ability = new SimpleActivatedAbility(new BondersOrnamentEffect(), new GenericManaCost(4)); + ability.addCost(new TapSourceCost()); + this.addAbility(ability); + } + + private BondersOrnament(final BondersOrnament card) { + super(card); + } + + @Override + public BondersOrnament copy() { + return new BondersOrnament(this); + } +} + +class BondersOrnamentEffect extends OneShotEffect { + + BondersOrnamentEffect() { + super(Outcome.Benefit); + staticText = "Each player who controls a permanent named Bonder's Ornament draws a card."; + } + + private BondersOrnamentEffect(final BondersOrnamentEffect effect) { + super(effect); + } + + @Override + public BondersOrnamentEffect copy() { + return new BondersOrnamentEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + continue; + } + if (game.getBattlefield() + .getAllActivePermanents(playerId) + .stream() + .map(MageObject::getName) + .noneMatch("Bonder's Ornament"::equals)) { + continue; + } + player.drawCards(1, game); + } + return true; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/Commander2020Edition.java b/Mage.Sets/src/mage/sets/Commander2020Edition.java index 426bced951..acfec018ac 100644 --- a/Mage.Sets/src/mage/sets/Commander2020Edition.java +++ b/Mage.Sets/src/mage/sets/Commander2020Edition.java @@ -62,6 +62,7 @@ public final class Commander2020Edition extends ExpansionSet { cards.add(new SetCardInfo("Arcane Signet", 237, Rarity.COMMON, mage.cards.a.ArcaneSignet.class)); cards.add(new SetCardInfo("Astral Drift", 76, Rarity.RARE, mage.cards.a.AstralDrift.class)); cards.add(new SetCardInfo("Avenging Huntbonder", 22, Rarity.RARE, mage.cards.a.AvengingHuntbonder.class)); + cards.add(new SetCardInfo("Bonder's Ornament", 67, Rarity.COMMON, mage.cards.b.BondersOrnament.class)); cards.add(new SetCardInfo("Boneyard Mycodrax", 40, Rarity.RARE, mage.cards.b.BoneyardMycodrax.class)); cards.add(new SetCardInfo("Brallin, Skyshark Rider", 4, Rarity.MYTHIC, mage.cards.b.BrallinSkysharkRider.class)); cards.add(new SetCardInfo("Call the Coppercoats", 23, Rarity.RARE, mage.cards.c.CallTheCoppercoats.class));