From 610c7d746274a25a2f64e5cdfa20c33019017e7a Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Tue, 27 May 2014 13:58:21 +0200 Subject: [PATCH] Added the missing Winds of Change cards (Portal). --- .../mage/sets/fifthedition/WindsOfChange.java | 110 ++++++++++++++++++ .../sets/fourthedition/WindsOfChange.java | 52 +++++++++ .../src/mage/sets/legends/WindsOfChange.java | 54 +++++++++ .../sets/planechase2012/WhirlpoolWarrior.java | 5 +- .../src/mage/sets/portal/WindsOfChange.java | 104 ++++++++--------- .../sets/scarsofmirrodin/MoltenPsyche.java | 16 ++- 6 files changed, 283 insertions(+), 58 deletions(-) create mode 100644 Mage.Sets/src/mage/sets/fifthedition/WindsOfChange.java create mode 100644 Mage.Sets/src/mage/sets/fourthedition/WindsOfChange.java create mode 100644 Mage.Sets/src/mage/sets/legends/WindsOfChange.java diff --git a/Mage.Sets/src/mage/sets/fifthedition/WindsOfChange.java b/Mage.Sets/src/mage/sets/fifthedition/WindsOfChange.java new file mode 100644 index 00000000000..de25e571f70 --- /dev/null +++ b/Mage.Sets/src/mage/sets/fifthedition/WindsOfChange.java @@ -0,0 +1,110 @@ +/* + * 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.fifthedition; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +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.game.Game; +import mage.players.Player; + +/** + * + * @author LevelX2 + */ +public class WindsOfChange extends CardImpl { + + public WindsOfChange(UUID ownerId) { + super(ownerId, 275, "Winds of Change", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{R}"); + this.expansionSetCode = "5ED"; + + this.color.setRed(true); + + // Each player shuffles the cards from his or her hand into his or her library, then draws that many cards. + this.getSpellAbility().addEffect(new WindsOfChangeEffect()); + } + + public WindsOfChange(final WindsOfChange card) { + super(card); + } + + @Override + public WindsOfChange copy() { + return new WindsOfChange(this); + } +} + +class WindsOfChangeEffect extends OneShotEffect { + + public WindsOfChangeEffect() { + super(Outcome.Benefit); + this.staticText = "Each player shuffles the cards from his or her hand into his or her library, then draws that many cards"; + } + + public WindsOfChangeEffect(final WindsOfChangeEffect effect) { + super(effect); + } + + @Override + public WindsOfChangeEffect copy() { + return new WindsOfChangeEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + for (UUID playerId : controller.getInRange()) { + Player player = game.getPlayer(playerId); + if (player != null) { + int cardsHand = player.getHand().size(); + if (cardsHand > 0){ + for (UUID cardId: player.getHand()) { + Card card = game.getCard(cardId); + if (card != null) { + player.removeFromHand(card, game); + card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, true); + } + } + game.informPlayers(player.getName() + " shuffles the cards from his or her hand into his or her library"); + player.shuffleLibrary(game); + player.drawCards(cardsHand, game); + } + } + } + return true; + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/fourthedition/WindsOfChange.java b/Mage.Sets/src/mage/sets/fourthedition/WindsOfChange.java new file mode 100644 index 00000000000..dbac1d629be --- /dev/null +++ b/Mage.Sets/src/mage/sets/fourthedition/WindsOfChange.java @@ -0,0 +1,52 @@ +/* + * 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.fourthedition; + +import java.util.UUID; + +/** + * + * @author LevelX2 + */ +public class WindsOfChange extends mage.sets.fifthedition.WindsOfChange { + + public WindsOfChange(UUID ownerId) { + super(ownerId); + this.cardNumber = 250; + this.expansionSetCode = "4ED"; + } + + public WindsOfChange(final WindsOfChange card) { + super(card); + } + + @Override + public WindsOfChange copy() { + return new WindsOfChange(this); + } +} diff --git a/Mage.Sets/src/mage/sets/legends/WindsOfChange.java b/Mage.Sets/src/mage/sets/legends/WindsOfChange.java new file mode 100644 index 00000000000..0a2736c742b --- /dev/null +++ b/Mage.Sets/src/mage/sets/legends/WindsOfChange.java @@ -0,0 +1,54 @@ +/* + * 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.legends; + +import java.util.UUID; +import mage.constants.Rarity; + +/** + * + * @author LevelX2 + */ +public class WindsOfChange extends mage.sets.fifthedition.WindsOfChange { + + public WindsOfChange(UUID ownerId) { + super(ownerId); + this.cardNumber = 169; + this.expansionSetCode = "LEG"; + this.rarity = Rarity.UNCOMMON; + } + + public WindsOfChange(final WindsOfChange card) { + super(card); + } + + @Override + public WindsOfChange copy() { + return new WindsOfChange(this); + } +} diff --git a/Mage.Sets/src/mage/sets/planechase2012/WhirlpoolWarrior.java b/Mage.Sets/src/mage/sets/planechase2012/WhirlpoolWarrior.java index a3d52f29f49..e9a280d2ffb 100644 --- a/Mage.Sets/src/mage/sets/planechase2012/WhirlpoolWarrior.java +++ b/Mage.Sets/src/mage/sets/planechase2012/WhirlpoolWarrior.java @@ -148,10 +148,11 @@ class WhirlpoolWarriorActivatedEffect extends OneShotEffect { Player player = game.getPlayer(playerId); if (player != null) { int count = player.getHand().size(); - player.getLibrary().addAll(player.getHand().getCards(game), game); + for (UUID cardId: player.getHand()) { + Card card = game.getCard(cardId); + if (card != null) { + player.removeFromHand(card, game); + card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, true); + } + } + game.informPlayers(player.getName() + " shuffles the cards from his or her hand into his or her library"); player.shuffleLibrary(game); - player.getHand().clear(); player.drawCards(count, game); if (MetalcraftCondition.getInstance().apply(game, source) && !playerId.equals(source.getControllerId())) { MoltenPsycheWatcher watcher = (MoltenPsycheWatcher) game.getState().getWatchers().get("CardsDrawn"); @@ -110,7 +118,7 @@ class MoltenPsycheEffect extends OneShotEffect { class MoltenPsycheWatcher extends WatcherImpl { - private Map draws = new HashMap(); + private final Map draws = new HashMap<>(); public MoltenPsycheWatcher() { super("CardsDrawn", WatcherScope.GAME); @@ -152,4 +160,4 @@ class MoltenPsycheWatcher extends WatcherImpl { return new MoltenPsycheWatcher(this); } -} \ No newline at end of file +}