From 1452e101288cc5004962043557f247d041d84e3d Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Thu, 19 Oct 2017 07:34:46 -0400 Subject: [PATCH] Implemented Waylay --- Mage.Sets/src/mage/cards/w/Waylay.java | 103 ++++++++++++++++++ Mage.Sets/src/mage/sets/UrzasSaga.java | 1 + .../game/permanent/token/WaylayToken.java | 48 ++++++++ 3 files changed, 152 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/w/Waylay.java create mode 100644 Mage/src/main/java/mage/game/permanent/token/WaylayToken.java diff --git a/Mage.Sets/src/mage/cards/w/Waylay.java b/Mage.Sets/src/mage/cards/w/Waylay.java new file mode 100644 index 00000000000..795197e9294 --- /dev/null +++ b/Mage.Sets/src/mage/cards/w/Waylay.java @@ -0,0 +1,103 @@ +/* + * 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.w; + +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.delayed.AtTheBeginOfNextCleanupDelayedTriggeredAbility; +import mage.abilities.effects.Effect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.ExileTargetEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.game.permanent.token.Token; +import mage.game.permanent.token.WaylayToken; +import mage.target.targetpointer.FixedTargets; + +/** + * + * @author TheElk801 + */ +public class Waylay extends CardImpl { + + public Waylay(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{W}"); + + // Create three 2/2 white Knight creature tokens. Exile them at the beginning of the next cleanup step. + this.getSpellAbility().addEffect(new WaylayEffect()); + } + + public Waylay(final Waylay card) { + super(card); + } + + @Override + public Waylay copy() { + return new Waylay(this); + } +} + +class WaylayEffect extends OneShotEffect { + + public WaylayEffect() { + super(Outcome.PutCreatureInPlay); + this.staticText = "Create three 2/2 white Knight creature tokens. Exile them at the beginning of the next cleanup step."; + } + + public WaylayEffect(final WaylayEffect effect) { + super(effect); + } + + @Override + public WaylayEffect copy() { + return new WaylayEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Token token = new WaylayToken(); + token.putOntoBattlefield(3, game, source.getSourceId(), source.getControllerId()); + List toExile = new ArrayList<>(); + for (UUID tokenId : token.getLastAddedTokenIds()) { + Permanent tokenPermanent = game.getPermanent(tokenId); + if (tokenPermanent != null) { + toExile.add(tokenPermanent); + } + } + Effect effect = new ExileTargetEffect(); + effect.setTargetPointer(new FixedTargets(toExile, game)); + game.addDelayedTriggeredAbility(new AtTheBeginOfNextCleanupDelayedTriggeredAbility(effect), source); + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/UrzasSaga.java b/Mage.Sets/src/mage/sets/UrzasSaga.java index 3968d93c04e..e6c428107ea 100644 --- a/Mage.Sets/src/mage/sets/UrzasSaga.java +++ b/Mage.Sets/src/mage/sets/UrzasSaga.java @@ -362,6 +362,7 @@ public class UrzasSaga extends ExpansionSet { cards.add(new SetCardInfo("Vug Lizard", 227, Rarity.UNCOMMON, mage.cards.v.VugLizard.class)); cards.add(new SetCardInfo("War Dance", 282, Rarity.UNCOMMON, mage.cards.w.WarDance.class)); cards.add(new SetCardInfo("Wall of Junk", 315, Rarity.UNCOMMON, mage.cards.w.WallOfJunk.class)); + cards.add(new SetCardInfo("Waylay", 56, Rarity.UNCOMMON, mage.cards.w.Waylay.class)); cards.add(new SetCardInfo("Western Paladin", 168, Rarity.RARE, mage.cards.w.WesternPaladin.class)); cards.add(new SetCardInfo("Whetstone", 316, Rarity.RARE, mage.cards.w.Whetstone.class)); cards.add(new SetCardInfo("Whirlwind", 283, Rarity.RARE, mage.cards.w.Whirlwind.class)); diff --git a/Mage/src/main/java/mage/game/permanent/token/WaylayToken.java b/Mage/src/main/java/mage/game/permanent/token/WaylayToken.java new file mode 100644 index 00000000000..47942f2c6a5 --- /dev/null +++ b/Mage/src/main/java/mage/game/permanent/token/WaylayToken.java @@ -0,0 +1,48 @@ +/* +* 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.game.permanent.token; + +import mage.constants.CardType; +import mage.constants.SubType; +import mage.MageInt; + +/** + * + * @author spjspj + */ +public class WaylayToken extends Token { + + public WaylayToken() { + super("Knight", "2/2 white Knight creature token"); + cardType.add(CardType.CREATURE); + color.setWhite(true); + subtype.add(SubType.KNIGHT); + power = new MageInt(2); + toughness = new MageInt(2); + } +}