From d3751af0db909e757bc3778752ab0fc40125b339 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Sun, 15 Nov 2015 11:10:52 +0100 Subject: [PATCH] [C15] Added Skullwinder and Ezuri's Predation. --- .../sets/commander2015/EzurisPredation.java | 126 ++++++++++++++++++ .../sets/commander2015/SandstoneOracle.java | 24 ++-- .../mage/sets/commander2015/Skullwinder.java | 125 +++++++++++++++++ .../mage/sets/zendikar/BalothCageTrap.java | 2 - .../game/permanent/token/BeastToken2.java | 61 +++++---- 5 files changed, 295 insertions(+), 43 deletions(-) create mode 100644 Mage.Sets/src/mage/sets/commander2015/EzurisPredation.java create mode 100644 Mage.Sets/src/mage/sets/commander2015/Skullwinder.java diff --git a/Mage.Sets/src/mage/sets/commander2015/EzurisPredation.java b/Mage.Sets/src/mage/sets/commander2015/EzurisPredation.java new file mode 100644 index 00000000000..3cf34bdbca4 --- /dev/null +++ b/Mage.Sets/src/mage/sets/commander2015/EzurisPredation.java @@ -0,0 +1,126 @@ +/* + * 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.sets.commander2015; + +import java.util.List; +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.TargetController; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.permanent.ControllerPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.game.permanent.token.BeastToken2; +import mage.players.Player; + +/** + * + * @author LevelX2 + */ +public class EzurisPredation extends CardImpl { + + public EzurisPredation(UUID ownerId) { + super(ownerId, 36, "Ezuri's Predation", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{5}{G}{G}{G}"); + this.expansionSetCode = "C15"; + + // For each creature your opponents control, put a 4/4 green Beast creature token onto the battlefield. Each of those Beasts fights a different one of those creatures. + this.getSpellAbility().addEffect(new EzurisPredationEffect()); + } + + public EzurisPredation(final EzurisPredation card) { + super(card); + } + + @Override + public EzurisPredation copy() { + return new EzurisPredation(this); + } +} + +class EzurisPredationEffect extends OneShotEffect { + + public EzurisPredationEffect() { + super(Outcome.PutCreatureInPlay); + this.staticText = "For each creature your opponents control, put a 4/4 green Beast creature token onto the battlefield. Each of those Beasts fights a different one of those creatures"; + } + + public EzurisPredationEffect(final EzurisPredationEffect effect) { + super(effect); + } + + @Override + public EzurisPredationEffect copy() { + return new EzurisPredationEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + /* + * Players can't cast spells or activate any abilities in between the + * Beasts entering the battlefield and fighting the other creatures. + * Ifthe Beasts entering the battlefield cause any abilities to trigger, + * those abilities will be put onto the stack after Ezuri's Predation is + * finished resolving. + * You choose which Beast is fighting which creature + * an opponent controls. Each of the "fights" happens at the same time. + * If Ezuri's Predation creates more than one token for any given + * creature (due to an effect such as the one Doubling Season creates), + * the extra tokens won't fight any creature. + */ + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + FilterCreaturePermanent filterCreature = new FilterCreaturePermanent(); + filterCreature.add(new ControllerPredicate(TargetController.OPPONENT)); + List creaturesOfOpponents = game.getBattlefield().getActivePermanents(filterCreature, source.getControllerId(), source.getSourceId(), game); + if (!creaturesOfOpponents.isEmpty()) { + CreateTokenEffect effect = new CreateTokenEffect(new BeastToken2(), creaturesOfOpponents.size()); + effect.apply(game, source); + for (UUID tokenId : effect.getLastAddedTokenIds()) { + Permanent token = game.getPermanent(tokenId); + if (token != null) { + if (creaturesOfOpponents.isEmpty()) { + break; + } + Permanent opponentCreature = creaturesOfOpponents.iterator().next(); + creaturesOfOpponents.remove(opponentCreature); + token.fight(opponentCreature, source, game); + game.informPlayers(token.getLogName() + " fights " + opponentCreature.getLogName()); + } + } + } + return true; + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/commander2015/SandstoneOracle.java b/Mage.Sets/src/mage/sets/commander2015/SandstoneOracle.java index d667dc70ce8..8aa6105dd79 100644 --- a/Mage.Sets/src/mage/sets/commander2015/SandstoneOracle.java +++ b/Mage.Sets/src/mage/sets/commander2015/SandstoneOracle.java @@ -29,6 +29,7 @@ package mage.sets.commander2015; import java.util.UUID; import mage.MageInt; +import mage.MageObject; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.effects.OneShotEffect; @@ -56,7 +57,7 @@ public class SandstoneOracle extends CardImpl { // Flying this.addAbility(FlyingAbility.getInstance()); - + // When Sandstone Oracle enters the battlefield, choose an opponent. If that player has more cards in hand that you, draw cards equal to the difference. this.addAbility(new EntersBattlefieldTriggeredAbility(new SandstoneOracleEffect())); } @@ -72,32 +73,35 @@ public class SandstoneOracle extends CardImpl { } class SandstoneOracleEffect extends OneShotEffect { - + SandstoneOracleEffect() { super(Outcome.DrawCard); this.staticText = "choose an opponent. If that player has more cards in hand that you, draw cards equal to the difference"; } - + SandstoneOracleEffect(final SandstoneOracleEffect effect) { super(effect); } - + @Override public SandstoneOracleEffect copy() { return new SandstoneOracleEffect(this); } - + @Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); - if (controller != null) { + MageObject sourceObject = source.getSourceObject(game); + if (controller != null && sourceObject != null) { TargetOpponent target = new TargetOpponent(true); if (controller.choose(Outcome.DrawCard, target, source.getSourceId(), game)) { Player opponent = game.getPlayer(target.getFirstTarget()); - game.informPlayers("Sandstone Oracle: " + controller.getLogName() + " has chosen " + opponent.getLogName()); - int cardsDiff = opponent.getHand().size() - controller.getHand().size(); - if (cardsDiff > 0) { - controller.drawCards(cardsDiff, game); + if (opponent != null) { + game.informPlayers(sourceObject.getLogName() + ": " + controller.getLogName() + " has chosen " + opponent.getLogName()); + int cardsDiff = opponent.getHand().size() - controller.getHand().size(); + if (cardsDiff > 0) { + controller.drawCards(cardsDiff, game); + } } } return true; diff --git a/Mage.Sets/src/mage/sets/commander2015/Skullwinder.java b/Mage.Sets/src/mage/sets/commander2015/Skullwinder.java new file mode 100644 index 00000000000..b098242ec27 --- /dev/null +++ b/Mage.Sets/src/mage/sets/commander2015/Skullwinder.java @@ -0,0 +1,125 @@ +/* + * 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.sets.commander2015; + +import java.util.UUID; +import mage.MageInt; +import mage.MageObject; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.ReturnFromGraveyardToHandTargetEffect; +import mage.abilities.keyword.DeathtouchAbility; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.FilterCard; +import mage.game.Game; +import mage.players.Player; +import mage.target.common.TargetCardInYourGraveyard; +import mage.target.common.TargetOpponent; + +/** + * + * @author LevelX2 + */ +public class Skullwinder extends CardImpl { + + public Skullwinder(UUID ownerId) { + super(ownerId, 39, "Skullwinder", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{2}{G}"); + this.expansionSetCode = "C15"; + this.subtype.add("Snake"); + this.power = new MageInt(1); + this.toughness = new MageInt(3); + + // Deathtouch + this.addAbility(DeathtouchAbility.getInstance()); + + // When Skullwinder enters the battlefield, return target card from your graveyard to your hand, then choose an opponent. That player returns a card from his or her graveyard to his or her hand. + Ability ability = new EntersBattlefieldTriggeredAbility(new ReturnFromGraveyardToHandTargetEffect()); + ability.addTarget(new TargetCardInYourGraveyard()); + ability.addEffect(new SkullwinderEffect()); + this.addAbility(ability); + } + + public Skullwinder(final Skullwinder card) { + super(card); + } + + @Override + public Skullwinder copy() { + return new Skullwinder(this); + } +} + +class SkullwinderEffect extends OneShotEffect { + + public SkullwinderEffect() { + super(Outcome.Benefit); + this.staticText = ", then choose an opponent. That player returns a card from his or her graveyard to his or her hand"; + } + + public SkullwinderEffect(final SkullwinderEffect effect) { + super(effect); + } + + @Override + public SkullwinderEffect copy() { + return new SkullwinderEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + MageObject sourceObject = source.getSourceObject(game); + if (controller != null && sourceObject != null) { + TargetOpponent targetOpponent = new TargetOpponent(true); + if (controller.choose(Outcome.Detriment, targetOpponent, source.getSourceId(), game)) { + Player opponent = game.getPlayer(targetOpponent.getFirstTarget()); + if (opponent != null) { + game.informPlayers(sourceObject.getLogName() + ": " + controller.getLogName() + " has chosen " + opponent.getLogName()); + // That player returns a card from his or her graveyard to his or her hand + TargetCardInYourGraveyard targetCard = new TargetCardInYourGraveyard(new FilterCard("a card from your graveyard to return to your hand")); + targetCard.setNotTarget(true); + if (opponent.choose(outcome, targetCard, source.getSourceId(), game)) { + Card card = game.getCard(targetCard.getFirstTarget()); + if (card != null) { + opponent.moveCards(card, Zone.HAND, source, game); + } + } + } + } + return true; + } + return false; + + } +} diff --git a/Mage.Sets/src/mage/sets/zendikar/BalothCageTrap.java b/Mage.Sets/src/mage/sets/zendikar/BalothCageTrap.java index 74f2f9c663f..492af7f4d46 100644 --- a/Mage.Sets/src/mage/sets/zendikar/BalothCageTrap.java +++ b/Mage.Sets/src/mage/sets/zendikar/BalothCageTrap.java @@ -28,7 +28,6 @@ package mage.sets.zendikar; import java.util.UUID; -import mage.ObjectColor; import mage.abilities.Ability; import mage.abilities.costs.AlternativeCostImpl; import mage.abilities.costs.mana.ManaCostsImpl; @@ -54,7 +53,6 @@ public class BalothCageTrap extends CardImpl { this.expansionSetCode = "ZEN"; this.subtype.add("Trap"); - // If an opponent had an artifact enter the battlefield under his or her control this turn, you may pay {1}{G} rather than pay Baloth Cage Trap's mana cost. this.getSpellAbility().addAlternativeCost(new BalothCageTrapAlternativeCost()); this.getSpellAbility().addWatcher(new BalothCageTrapWatcher()); diff --git a/Mage/src/mage/game/permanent/token/BeastToken2.java b/Mage/src/mage/game/permanent/token/BeastToken2.java index 57b22f20eb1..4304707b4e2 100644 --- a/Mage/src/mage/game/permanent/token/BeastToken2.java +++ b/Mage/src/mage/game/permanent/token/BeastToken2.java @@ -1,36 +1,35 @@ /* -* 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. -*/ - + * 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 java.util.Arrays; -import mage.constants.CardType; import mage.MageInt; +import mage.constants.CardType; /** * @@ -45,7 +44,7 @@ public class BeastToken2 extends Token { subtype.add("Beast"); power = new MageInt(4); toughness = new MageInt(4); - availableImageSetCodes.addAll(Arrays.asList("ZEN", "C14", "DDD")); + availableImageSetCodes.addAll(Arrays.asList("ZEN", "C14", "DDD", "C15")); } public BeastToken2(final BeastToken2 token) { @@ -53,14 +52,14 @@ public class BeastToken2 extends Token { } @Override - public BeastToken2 copy() { + public BeastToken2 copy() { return new BeastToken2(this); } @Override public void setExpansionSetCodeForImage(String code) { super.setExpansionSetCodeForImage(code); - if(getOriginalExpansionSetCode().equals("C14") || getOriginalExpansionSetCode().equals("DDD")) { + if (getOriginalExpansionSetCode().equals("C14") || getOriginalExpansionSetCode().equals("DDD")) { this.setTokenType(2); } }