From 11eeabd7be04d2c59bf7dbca5ee230ed2a56a429 Mon Sep 17 00:00:00 2001 From: spjspj Date: Thu, 3 Nov 2016 00:40:09 +1100 Subject: [PATCH] spjspj - Goblin Spymaster (C16) --- .../src/mage/cards/g/GoblinSpymaster.java | 131 ++++++++++++++++++ Mage.Sets/src/mage/sets/Commander2016.java | 1 + 2 files changed, 132 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/g/GoblinSpymaster.java diff --git a/Mage.Sets/src/mage/cards/g/GoblinSpymaster.java b/Mage.Sets/src/mage/cards/g/GoblinSpymaster.java new file mode 100644 index 00000000000..80b8afcdfe9 --- /dev/null +++ b/Mage.Sets/src/mage/cards/g/GoblinSpymaster.java @@ -0,0 +1,131 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.cards.g; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.BeginningOfEndStepTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.Effect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.combat.AttacksIfAbleAllEffect; +import mage.abilities.keyword.FirstStrikeAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.TargetController; +import mage.constants.Zone; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.permanent.ControllerPredicate; +import mage.game.Game; +import mage.game.permanent.token.Token; +import mage.players.Player; + +/** + * + * @author spjspj + */ +public class GoblinSpymaster extends CardImpl { + + public GoblinSpymaster(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R}"); + + this.subtype.add("Goblin"); + this.subtype.add("Rogue"); + this.power = new MageInt(2); + this.toughness = new MageInt(1); + + // First strike + this.addAbility(FirstStrikeAbility.getInstance()); + + // At the beginning of each opponent's end step, that player creates a 1/1 red Goblin creature token with "Creatures you control attack each combat if able." + this.addAbility(new BeginningOfEndStepTriggeredAbility(Zone.BATTLEFIELD, new SpyMasterGoblinCreateTokenEffect(), TargetController.OPPONENT, null, false)); + } + + public GoblinSpymaster(final GoblinSpymaster card) { + super(card); + } + + @Override + public GoblinSpymaster copy() { + return new GoblinSpymaster(this); + } +} + +class SpyMasterGoblinCreateTokenEffect extends OneShotEffect { + + public SpyMasterGoblinCreateTokenEffect() { + super(Outcome.Detriment); + this.staticText = "that player creates a 1/1 red Goblin creature token with \"Creatures you control attack each combat if able.\""; + } + + public SpyMasterGoblinCreateTokenEffect(final SpyMasterGoblinCreateTokenEffect effect) { + super(effect); + } + + @Override + public SpyMasterGoblinCreateTokenEffect copy() { + return new SpyMasterGoblinCreateTokenEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(game.getActivePlayerId()); + + if (player != null) { + Token token = new SpyMasterGoblinToken(); + token.putOntoBattlefield(1, game, source.getSourceId(), player.getId()); + } + + return true; + } +} + +class SpyMasterGoblinToken extends Token { + + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Creatures you control"); + + static { + filter.add(new ControllerPredicate(TargetController.YOU)); + } + + SpyMasterGoblinToken() { + super("Goblin", "1/1 red Goblin creature token with \"Creatures you control attack each combat if able.\""); + cardType.add(CardType.CREATURE); + color.setRed(true); + subtype.add("Goblin"); + power = new MageInt(1); + toughness = new MageInt(1); + + Effect effect = new AttacksIfAbleAllEffect(filter, Duration.WhileOnBattlefield, true); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect)); + } +} diff --git a/Mage.Sets/src/mage/sets/Commander2016.java b/Mage.Sets/src/mage/sets/Commander2016.java index 5628c8891f3..735d9d7514f 100644 --- a/Mage.Sets/src/mage/sets/Commander2016.java +++ b/Mage.Sets/src/mage/sets/Commander2016.java @@ -170,6 +170,7 @@ public class Commander2016 extends ExpansionSet { cards.add(new SetCardInfo("Ghave, Guru of Spores", 200, Rarity.MYTHIC, mage.cards.g.GhaveGuruOfSpores.class)); cards.add(new SetCardInfo("Ghostly Prison", 66, Rarity.UNCOMMON, mage.cards.g.GhostlyPrison.class)); cards.add(new SetCardInfo("Glint-Eye Nephilim", 201, Rarity.RARE, mage.cards.g.GlintEyeNephilim.class)); + cards.add(new SetCardInfo("Goblin Spymaster", 19, Rarity.RARE, mage.cards.g.GoblinSpymaster.class)); cards.add(new SetCardInfo("Godo, Bandit Warlord", 125, Rarity.RARE, mage.cards.g.GodoBanditWarlord.class)); cards.add(new SetCardInfo("Golgari Rot Farm", 298, Rarity.UNCOMMON, mage.cards.g.GolgariRotFarm.class)); cards.add(new SetCardInfo("Golgari Signet", 255, Rarity.COMMON, mage.cards.g.GolgariSignet.class));