From 8e3b610a0c0cc1284d9b10b712d21856e36dc30a Mon Sep 17 00:00:00 2001 From: Oleg Agafonov <jaydi85@gmail.com> Date: Tue, 9 Jan 2018 19:27:25 +0400 Subject: [PATCH 01/34] Tests: fixed performance problem (x20 speed up, no need to call full garbage collector manually) --- Mage.Client/src/main/java/mage/client/cards/CardGrid.java | 1 - .../java/org/mage/plugins/card/images/DownloadPictures.java | 2 +- .../mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/Mage.Client/src/main/java/mage/client/cards/CardGrid.java b/Mage.Client/src/main/java/mage/client/cards/CardGrid.java index fe918f797d..8f2f2fa9e0 100644 --- a/Mage.Client/src/main/java/mage/client/cards/CardGrid.java +++ b/Mage.Client/src/main/java/mage/client/cards/CardGrid.java @@ -122,7 +122,6 @@ public class CardGrid extends javax.swing.JLayeredPane implements MouseListener, addCard(card, bigCard, gameId, drawImage); } } - // System.gc(); drawCards(sortSetting); this.setVisible(true); } diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/images/DownloadPictures.java b/Mage.Client/src/main/java/org/mage/plugins/card/images/DownloadPictures.java index 08e350a213..26ce8adc73 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/images/DownloadPictures.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/images/DownloadPictures.java @@ -648,7 +648,7 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab logger.fatal("Couldn't unmount zip files", e); JOptionPane.showMessageDialog(null, "Couldn't unmount zip files", "Error", JOptionPane.ERROR_MESSAGE); } finally { - System.gc(); + // } closeButton.setText("Close"); updateCardsToDownload(jComboBoxSet.getSelectedItem().toString()); diff --git a/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java b/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java index 537d8b1842..ba66640d75 100644 --- a/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java +++ b/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java @@ -116,7 +116,6 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement if (currentGame != null) { logger.debug("Resetting previous game and creating new one!"); currentGame = null; - System.gc(); } currentGame = createNewGameAndPlayers(); From 79c18d28e2ba09af42568070ec8aa68bbfd246c6 Mon Sep 17 00:00:00 2001 From: ciaccona007 <sgmbogus@gmail.com> Date: Tue, 9 Jan 2018 12:40:39 -0800 Subject: [PATCH 02/34] Implement Chicken Egg --- Mage.Sets/src/mage/cards/c/ChickenEgg.java | 77 +++++++++++++++++++ Mage.Sets/src/mage/sets/Unglued.java | 1 + .../src/main/java/mage/constants/SubType.java | 2 + .../permanent/token/GiantChickenToken.java | 18 +++++ 4 files changed, 98 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/c/ChickenEgg.java create mode 100644 Mage/src/main/java/mage/game/permanent/token/GiantChickenToken.java diff --git a/Mage.Sets/src/mage/cards/c/ChickenEgg.java b/Mage.Sets/src/mage/cards/c/ChickenEgg.java new file mode 100644 index 0000000000..e25ee82fc7 --- /dev/null +++ b/Mage.Sets/src/mage/cards/c/ChickenEgg.java @@ -0,0 +1,77 @@ +package mage.cards.c; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.effects.common.SacrificeSourceEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.constants.TargetController; +import mage.game.Game; +import mage.game.permanent.token.GiantChickenToken; +import mage.players.Player; + +import java.util.UUID; + +/** + * + * @author ciaccona007 + */ + +public class ChickenEgg extends CardImpl { + + public ChickenEgg(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{R}"); + + this.subtype.add(SubType.EGG); + this.power = new MageInt(0); + this.toughness = new MageInt(1); + + // At the beginning of your upkeep, roll a six-sided die. If you roll a 6, sacrifice Chicken Egg and create a 4/4 red Giant Chicken creature token. + this.addAbility(new BeginningOfUpkeepTriggeredAbility(new ChickenEggEffect(), TargetController.YOU, false)); + } + + public ChickenEgg(final ChickenEgg card) { + super(card); + } + + @Override + public ChickenEgg copy() { + return new ChickenEgg(this); + } +} + +class ChickenEggEffect extends OneShotEffect { + + ChickenEggEffect() { + super(Outcome.Benefit); + this.staticText = "roll a six-sided die. If you roll a 6, sacrifice {this} and create a 4/4 red Giant Chicken creature token"; + } + + ChickenEggEffect(final ChickenEggEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + int result = controller.rollDice(game, 6); + if (result == 6) { + new SacrificeSourceEffect().apply(game, source); + return (new CreateTokenEffect(new GiantChickenToken(), 1)).apply(game, source); + } + } + return false; + } + + @Override + public ChickenEggEffect copy() { + return new ChickenEggEffect(this); + } +} diff --git a/Mage.Sets/src/mage/sets/Unglued.java b/Mage.Sets/src/mage/sets/Unglued.java index 824c1b65b8..7c83ce1e06 100644 --- a/Mage.Sets/src/mage/sets/Unglued.java +++ b/Mage.Sets/src/mage/sets/Unglued.java @@ -20,6 +20,7 @@ public class Unglued extends ExpansionSet { private Unglued() { super("Unglued", "UGL", ExpansionSet.buildDate(1998, 8, 11), SetType.JOKESET); + cards.add(new SetCardInfo("Chicken Egg", 41, Rarity.COMMON, mage.cards.c.ChickenEgg.class)); cards.add(new SetCardInfo("Forest", 88, Rarity.LAND, mage.cards.basiclands.Forest.class, new CardGraphicInfo(FrameStyle.UGL_FULL_ART_BASIC, false))); cards.add(new SetCardInfo("Island", 85, Rarity.LAND, mage.cards.basiclands.Island.class, new CardGraphicInfo(FrameStyle.UGL_FULL_ART_BASIC, false))); cards.add(new SetCardInfo("Mountain", 87, Rarity.LAND, mage.cards.basiclands.Mountain.class, new CardGraphicInfo(FrameStyle.UGL_FULL_ART_BASIC, false))); diff --git a/Mage/src/main/java/mage/constants/SubType.java b/Mage/src/main/java/mage/constants/SubType.java index 276dcfd189..ddbb44d31f 100644 --- a/Mage/src/main/java/mage/constants/SubType.java +++ b/Mage/src/main/java/mage/constants/SubType.java @@ -85,6 +85,7 @@ public enum SubType { CENTAUR("Centaur", SubTypeSet.CreatureType), CEREAN("Cerean", SubTypeSet.CreatureType, true), // Star Wars CEPHALID("Cephalid", SubTypeSet.CreatureType), + CHICKEN("Chicken", SubTypeSet.CreatureType), CHIMERA("Chimera", SubTypeSet.CreatureType), CHISS("Chiss", SubTypeSet.CreatureType, true), CITIZEN("Citizen", SubTypeSet.CreatureType), @@ -114,6 +115,7 @@ public enum SubType { DWARF("Dwarf", SubTypeSet.CreatureType), // E EFREET("Efreet", SubTypeSet.CreatureType), + EGG("Egg", SubTypeSet.CreatureType), ELDER("Elder", SubTypeSet.CreatureType), ELDRAZI("Eldrazi", SubTypeSet.CreatureType), ELEMENTAL("Elemental", SubTypeSet.CreatureType), diff --git a/Mage/src/main/java/mage/game/permanent/token/GiantChickenToken.java b/Mage/src/main/java/mage/game/permanent/token/GiantChickenToken.java new file mode 100644 index 0000000000..71d93e91af --- /dev/null +++ b/Mage/src/main/java/mage/game/permanent/token/GiantChickenToken.java @@ -0,0 +1,18 @@ +package mage.game.permanent.token; + +import mage.MageInt; +import mage.constants.CardType; +import mage.constants.SubType; + +public class GiantChickenToken extends Token { + + public GiantChickenToken() { + super("Giant Chicken", "4/4 red Giant Chicken creature token"); + cardType.add(CardType.CREATURE); + color.setRed(true); + subtype.add(SubType.GIANT); + subtype.add(SubType.CHICKEN); + power = new MageInt(4); + toughness = new MageInt(4); + } +} From 3e87a50b4d5197023f24a0169b242dae6f493639 Mon Sep 17 00:00:00 2001 From: ciaccona007 <sgmbogus@gmail.com> Date: Tue, 9 Jan 2018 13:25:46 -0800 Subject: [PATCH 03/34] Implement Krazy Kow --- Mage.Sets/src/mage/cards/c/ChickenEgg.java | 27 +++++ Mage.Sets/src/mage/cards/k/KrazyKow.java | 102 ++++++++++++++++++ Mage.Sets/src/mage/sets/Unglued.java | 1 + .../src/main/java/mage/constants/SubType.java | 3 +- .../permanent/token/GiantChickenToken.java | 32 ++++++ 5 files changed, 164 insertions(+), 1 deletion(-) create mode 100644 Mage.Sets/src/mage/cards/k/KrazyKow.java diff --git a/Mage.Sets/src/mage/cards/c/ChickenEgg.java b/Mage.Sets/src/mage/cards/c/ChickenEgg.java index e25ee82fc7..8f09a83c9a 100644 --- a/Mage.Sets/src/mage/cards/c/ChickenEgg.java +++ b/Mage.Sets/src/mage/cards/c/ChickenEgg.java @@ -1,3 +1,30 @@ +/* + * 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.c; import mage.MageInt; diff --git a/Mage.Sets/src/mage/cards/k/KrazyKow.java b/Mage.Sets/src/mage/cards/k/KrazyKow.java new file mode 100644 index 0000000000..3fa78b45e2 --- /dev/null +++ b/Mage.Sets/src/mage/cards/k/KrazyKow.java @@ -0,0 +1,102 @@ +/* + * 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.k; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.DamageEverythingEffect; +import mage.abilities.effects.common.SacrificeSourceEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.constants.TargetController; +import mage.game.Game; +import mage.players.Player; + +import java.util.UUID; + +/** + * + * @author ciaccona007 + */ + +public class KrazyKow extends CardImpl { + + public KrazyKow(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{R}"); + + this.subtype.add(SubType.COW); + this.power = new MageInt(3); + this.toughness = new MageInt(3); + + // At the beginning of your upkeep, roll a six-sided die. If you a roll a 1, sacrifice Krazy Kow and it deals 3 damage to each creature and each player. + this.addAbility(new BeginningOfUpkeepTriggeredAbility(new KrazyKowEffect(), TargetController.YOU, false)); + } + + public KrazyKow(final KrazyKow card) { + super(card); + } + + @Override + public KrazyKow copy() { + return new KrazyKow(this); + } +} + +class KrazyKowEffect extends OneShotEffect { + KrazyKowEffect() { + super(Outcome.Benefit); + this.staticText = "roll a six-sided die. If you roll a 1, sacrifice {this} and it deals 3 damage to each creature and each player"; + } + + KrazyKowEffect(final KrazyKowEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + int result = controller.rollDice(game, 6); + if (result == 1) { + new SacrificeSourceEffect().apply(game, source); + return new DamageEverythingEffect(3).apply(game, source); + } + } + return false; + } + + @Override + public KrazyKowEffect copy() { + return new KrazyKowEffect(this); + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/Unglued.java b/Mage.Sets/src/mage/sets/Unglued.java index 7c83ce1e06..55d5cd1764 100644 --- a/Mage.Sets/src/mage/sets/Unglued.java +++ b/Mage.Sets/src/mage/sets/Unglued.java @@ -21,6 +21,7 @@ public class Unglued extends ExpansionSet { private Unglued() { super("Unglued", "UGL", ExpansionSet.buildDate(1998, 8, 11), SetType.JOKESET); cards.add(new SetCardInfo("Chicken Egg", 41, Rarity.COMMON, mage.cards.c.ChickenEgg.class)); + cards.add(new SetCardInfo("Krazy Kow", 48, Rarity.COMMON, mage.cards.k.KrazyKow.class)); cards.add(new SetCardInfo("Forest", 88, Rarity.LAND, mage.cards.basiclands.Forest.class, new CardGraphicInfo(FrameStyle.UGL_FULL_ART_BASIC, false))); cards.add(new SetCardInfo("Island", 85, Rarity.LAND, mage.cards.basiclands.Island.class, new CardGraphicInfo(FrameStyle.UGL_FULL_ART_BASIC, false))); cards.add(new SetCardInfo("Mountain", 87, Rarity.LAND, mage.cards.basiclands.Mountain.class, new CardGraphicInfo(FrameStyle.UGL_FULL_ART_BASIC, false))); diff --git a/Mage/src/main/java/mage/constants/SubType.java b/Mage/src/main/java/mage/constants/SubType.java index ddbb44d31f..51a4b58ae2 100644 --- a/Mage/src/main/java/mage/constants/SubType.java +++ b/Mage/src/main/java/mage/constants/SubType.java @@ -85,13 +85,14 @@ public enum SubType { CENTAUR("Centaur", SubTypeSet.CreatureType), CEREAN("Cerean", SubTypeSet.CreatureType, true), // Star Wars CEPHALID("Cephalid", SubTypeSet.CreatureType), - CHICKEN("Chicken", SubTypeSet.CreatureType), + CHICKEN("Chicken", SubTypeSet.CreatureType), // Unglued CHIMERA("Chimera", SubTypeSet.CreatureType), CHISS("Chiss", SubTypeSet.CreatureType, true), CITIZEN("Citizen", SubTypeSet.CreatureType), CLERIC("Cleric", SubTypeSet.CreatureType), COCKATRICE("Cockatrice", SubTypeSet.CreatureType), CONSTRUCT("Construct", SubTypeSet.CreatureType), + COW("Cow", SubTypeSet.CreatureType), // Unglued COWARD("Coward", SubTypeSet.CreatureType), CRAB("Crab", SubTypeSet.CreatureType), CROCODILE("Crocodile", SubTypeSet.CreatureType), diff --git a/Mage/src/main/java/mage/game/permanent/token/GiantChickenToken.java b/Mage/src/main/java/mage/game/permanent/token/GiantChickenToken.java index 71d93e91af..8b814efdc0 100644 --- a/Mage/src/main/java/mage/game/permanent/token/GiantChickenToken.java +++ b/Mage/src/main/java/mage/game/permanent/token/GiantChickenToken.java @@ -1,9 +1,41 @@ +/* + * 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.MageInt; import mage.constants.CardType; import mage.constants.SubType; +/** + * + * @author ciaccona007 + */ + public class GiantChickenToken extends Token { public GiantChickenToken() { From 5db12db371ba56d2199a559472f651a9ca10342c Mon Sep 17 00:00:00 2001 From: ciaccona007 <sgmbogus@gmail.com> Date: Tue, 9 Jan 2018 13:58:23 -0800 Subject: [PATCH 04/34] Implement Growth Spurt --- Mage.Sets/src/mage/cards/g/GrowthSpurt.java | 99 +++++++++++++++++++++ Mage.Sets/src/mage/sets/Unglued.java | 1 + 2 files changed, 100 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/g/GrowthSpurt.java diff --git a/Mage.Sets/src/mage/cards/g/GrowthSpurt.java b/Mage.Sets/src/mage/cards/g/GrowthSpurt.java new file mode 100644 index 0000000000..1e27dd000e --- /dev/null +++ b/Mage.Sets/src/mage/cards/g/GrowthSpurt.java @@ -0,0 +1,99 @@ +/* + * 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 mage.abilities.Ability; +import mage.abilities.effects.ContinuousEffect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.continuous.BoostTargetEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.common.TargetCreaturePermanent; +import mage.target.targetpointer.FixedTarget; + +import java.util.UUID; + +/** + * + * @author ciaccona007 + */ +public class GrowthSpurt extends CardImpl { + + public GrowthSpurt(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{G}"); + + this.getSpellAbility().addTarget(new TargetCreaturePermanent()); + this.getSpellAbility().addEffect(new GrowthSpurtEffect()); + } + + public GrowthSpurt(final GrowthSpurt card) { + super(card); + } + + @Override + public GrowthSpurt copy() { + return new GrowthSpurt(this); + } +} + +class GrowthSpurtEffect extends OneShotEffect { + GrowthSpurtEffect() { + super(Outcome.BoostCreature); + this.staticText = "todo"; //TODO + } + + GrowthSpurtEffect(final GrowthSpurtEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + int result = controller.rollDice(game, 6); + Permanent permanent = game.getPermanent(source.getFirstTarget()); + if (permanent != null) { + ContinuousEffect effect = new BoostTargetEffect(result, result, Duration.EndOfTurn); + effect.setTargetPointer(new FixedTarget(permanent, game)); + game.addEffect(effect, source); + } + } + return false; + } + + public GrowthSpurtEffect copy() { + return new GrowthSpurtEffect(this); + } +} diff --git a/Mage.Sets/src/mage/sets/Unglued.java b/Mage.Sets/src/mage/sets/Unglued.java index 55d5cd1764..47058990f1 100644 --- a/Mage.Sets/src/mage/sets/Unglued.java +++ b/Mage.Sets/src/mage/sets/Unglued.java @@ -22,6 +22,7 @@ public class Unglued extends ExpansionSet { super("Unglued", "UGL", ExpansionSet.buildDate(1998, 8, 11), SetType.JOKESET); cards.add(new SetCardInfo("Chicken Egg", 41, Rarity.COMMON, mage.cards.c.ChickenEgg.class)); cards.add(new SetCardInfo("Krazy Kow", 48, Rarity.COMMON, mage.cards.k.KrazyKow.class)); + cards.add(new SetCardInfo("Growth Spurt", 61, Rarity.COMMON, mage.cards.g.GrowthSpurt.class)); cards.add(new SetCardInfo("Forest", 88, Rarity.LAND, mage.cards.basiclands.Forest.class, new CardGraphicInfo(FrameStyle.UGL_FULL_ART_BASIC, false))); cards.add(new SetCardInfo("Island", 85, Rarity.LAND, mage.cards.basiclands.Island.class, new CardGraphicInfo(FrameStyle.UGL_FULL_ART_BASIC, false))); cards.add(new SetCardInfo("Mountain", 87, Rarity.LAND, mage.cards.basiclands.Mountain.class, new CardGraphicInfo(FrameStyle.UGL_FULL_ART_BASIC, false))); From d9b14acec717000a37b60d4d93074658c952fdbd Mon Sep 17 00:00:00 2001 From: ciaccona007 <ciaccona007@users.noreply.github.com> Date: Tue, 9 Jan 2018 14:59:13 -0700 Subject: [PATCH 05/34] Implement Growth Spurt (#4386) --- Mage.Sets/src/mage/cards/g/GrowthSpurt.java | 99 +++++++++++++++++++++ Mage.Sets/src/mage/sets/Unglued.java | 1 + 2 files changed, 100 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/g/GrowthSpurt.java diff --git a/Mage.Sets/src/mage/cards/g/GrowthSpurt.java b/Mage.Sets/src/mage/cards/g/GrowthSpurt.java new file mode 100644 index 0000000000..1e27dd000e --- /dev/null +++ b/Mage.Sets/src/mage/cards/g/GrowthSpurt.java @@ -0,0 +1,99 @@ +/* + * 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 mage.abilities.Ability; +import mage.abilities.effects.ContinuousEffect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.continuous.BoostTargetEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.common.TargetCreaturePermanent; +import mage.target.targetpointer.FixedTarget; + +import java.util.UUID; + +/** + * + * @author ciaccona007 + */ +public class GrowthSpurt extends CardImpl { + + public GrowthSpurt(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{G}"); + + this.getSpellAbility().addTarget(new TargetCreaturePermanent()); + this.getSpellAbility().addEffect(new GrowthSpurtEffect()); + } + + public GrowthSpurt(final GrowthSpurt card) { + super(card); + } + + @Override + public GrowthSpurt copy() { + return new GrowthSpurt(this); + } +} + +class GrowthSpurtEffect extends OneShotEffect { + GrowthSpurtEffect() { + super(Outcome.BoostCreature); + this.staticText = "todo"; //TODO + } + + GrowthSpurtEffect(final GrowthSpurtEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + int result = controller.rollDice(game, 6); + Permanent permanent = game.getPermanent(source.getFirstTarget()); + if (permanent != null) { + ContinuousEffect effect = new BoostTargetEffect(result, result, Duration.EndOfTurn); + effect.setTargetPointer(new FixedTarget(permanent, game)); + game.addEffect(effect, source); + } + } + return false; + } + + public GrowthSpurtEffect copy() { + return new GrowthSpurtEffect(this); + } +} diff --git a/Mage.Sets/src/mage/sets/Unglued.java b/Mage.Sets/src/mage/sets/Unglued.java index 55d5cd1764..47058990f1 100644 --- a/Mage.Sets/src/mage/sets/Unglued.java +++ b/Mage.Sets/src/mage/sets/Unglued.java @@ -22,6 +22,7 @@ public class Unglued extends ExpansionSet { super("Unglued", "UGL", ExpansionSet.buildDate(1998, 8, 11), SetType.JOKESET); cards.add(new SetCardInfo("Chicken Egg", 41, Rarity.COMMON, mage.cards.c.ChickenEgg.class)); cards.add(new SetCardInfo("Krazy Kow", 48, Rarity.COMMON, mage.cards.k.KrazyKow.class)); + cards.add(new SetCardInfo("Growth Spurt", 61, Rarity.COMMON, mage.cards.g.GrowthSpurt.class)); cards.add(new SetCardInfo("Forest", 88, Rarity.LAND, mage.cards.basiclands.Forest.class, new CardGraphicInfo(FrameStyle.UGL_FULL_ART_BASIC, false))); cards.add(new SetCardInfo("Island", 85, Rarity.LAND, mage.cards.basiclands.Island.class, new CardGraphicInfo(FrameStyle.UGL_FULL_ART_BASIC, false))); cards.add(new SetCardInfo("Mountain", 87, Rarity.LAND, mage.cards.basiclands.Mountain.class, new CardGraphicInfo(FrameStyle.UGL_FULL_ART_BASIC, false))); From 470bb69a7e9a2e751773c30ac5bcd34f7cc02f5c Mon Sep 17 00:00:00 2001 From: ciaccona007 <sgmbogus@gmail.com> Date: Tue, 9 Jan 2018 14:14:34 -0800 Subject: [PATCH 06/34] Implement Timmy, Power Gamer --- .../src/mage/cards/t/TimmyPowerGamer.java | 76 +++++++++++++++++++ Mage.Sets/src/mage/sets/Unglued.java | 1 + .../src/main/java/mage/constants/SubType.java | 1 + 3 files changed, 78 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/t/TimmyPowerGamer.java diff --git a/Mage.Sets/src/mage/cards/t/TimmyPowerGamer.java b/Mage.Sets/src/mage/cards/t/TimmyPowerGamer.java new file mode 100644 index 0000000000..84b635f6b2 --- /dev/null +++ b/Mage.Sets/src/mage/cards/t/TimmyPowerGamer.java @@ -0,0 +1,76 @@ +/* + * 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.t; + +import mage.MageInt; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.PutPermanentOnBattlefieldEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.constants.SuperType; +import mage.constants.Zone; +import mage.filter.common.FilterCreatureCard; + +import java.util.UUID; + +/** + * + * @author ciaccona007 + */ +public class TimmyPowerGamer extends CardImpl { + + public TimmyPowerGamer(UUID ownerId, CardSetInfo setInfo) { + super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{G}{G}"); + + this.supertype.add(SuperType.LEGENDARY); + + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.GAMER); + + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // {4}: You may put a creature card from your hand onto the battlefield. + SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, + new PutPermanentOnBattlefieldEffect(new FilterCreatureCard("a creature card")), + new ManaCostsImpl("{4}")); + this.addAbility(ability); + } + + public TimmyPowerGamer(final TimmyPowerGamer card) { + super(card); + } + + @Override + public TimmyPowerGamer copy() { + return new TimmyPowerGamer(this); + } +} diff --git a/Mage.Sets/src/mage/sets/Unglued.java b/Mage.Sets/src/mage/sets/Unglued.java index 47058990f1..f2d3d12902 100644 --- a/Mage.Sets/src/mage/sets/Unglued.java +++ b/Mage.Sets/src/mage/sets/Unglued.java @@ -23,6 +23,7 @@ public class Unglued extends ExpansionSet { cards.add(new SetCardInfo("Chicken Egg", 41, Rarity.COMMON, mage.cards.c.ChickenEgg.class)); cards.add(new SetCardInfo("Krazy Kow", 48, Rarity.COMMON, mage.cards.k.KrazyKow.class)); cards.add(new SetCardInfo("Growth Spurt", 61, Rarity.COMMON, mage.cards.g.GrowthSpurt.class)); + cards.add(new SetCardInfo("Timmy, Power Gamer", 68, Rarity.RARE, mage.cards.t.TimmyPowerGamer.class)); cards.add(new SetCardInfo("Forest", 88, Rarity.LAND, mage.cards.basiclands.Forest.class, new CardGraphicInfo(FrameStyle.UGL_FULL_ART_BASIC, false))); cards.add(new SetCardInfo("Island", 85, Rarity.LAND, mage.cards.basiclands.Island.class, new CardGraphicInfo(FrameStyle.UGL_FULL_ART_BASIC, false))); cards.add(new SetCardInfo("Mountain", 87, Rarity.LAND, mage.cards.basiclands.Mountain.class, new CardGraphicInfo(FrameStyle.UGL_FULL_ART_BASIC, false))); diff --git a/Mage/src/main/java/mage/constants/SubType.java b/Mage/src/main/java/mage/constants/SubType.java index 51a4b58ae2..a893adab28 100644 --- a/Mage/src/main/java/mage/constants/SubType.java +++ b/Mage/src/main/java/mage/constants/SubType.java @@ -134,6 +134,7 @@ public enum SubType { FROG("Frog", SubTypeSet.CreatureType), FUNGUS("Fungus", SubTypeSet.CreatureType), // G + GAMER("Gamer", SubTypeSet.CreatureType), // Un-sets GAMORREAN("Gamorrean", SubTypeSet.CreatureType, true), // Star Wars GAND("Gand", SubTypeSet.CreatureType, true), // Star Wars GARGOYLE("Gargoyle", SubTypeSet.CreatureType), From 77d90c5997ecc1c22c82a5f3b083364c270ecf36 Mon Sep 17 00:00:00 2001 From: ciaccona007 <sgmbogus@gmail.com> Date: Tue, 9 Jan 2018 16:25:20 -0800 Subject: [PATCH 07/34] Implement Poultrygeist --- Mage.Sets/src/mage/cards/p/Poultrygeist.java | 111 +++++++++++++++++++ Mage.Sets/src/mage/sets/Unglued.java | 1 + 2 files changed, 112 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/p/Poultrygeist.java diff --git a/Mage.Sets/src/mage/cards/p/Poultrygeist.java b/Mage.Sets/src/mage/cards/p/Poultrygeist.java new file mode 100644 index 0000000000..838d241545 --- /dev/null +++ b/Mage.Sets/src/mage/cards/p/Poultrygeist.java @@ -0,0 +1,111 @@ +/* + * 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.p; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.DiesCreatureTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.counters.CounterType; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; + +import java.util.UUID; + +/** + * + * @author ciaccona007 + */ +public class Poultrygeist extends CardImpl { + + public Poultrygeist(UUID ownerId, CardSetInfo setInfo) { + super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{B}"); + this.subtype.add(SubType.CHICKEN); + + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // Whenever a creature dies, you may roll a six-sided die. If you roll a 1, sacrifice Poultrygeist. Otherwise, put a +1/+1 counter on Poultrygeist. + Ability ability = new DiesCreatureTriggeredAbility(new PoultrygeistEffect(), true); + this.addAbility(ability); + } + + public Poultrygeist(final Poultrygeist card) { + super(card); + } + + @Override + public Poultrygeist copy() { + return new Poultrygeist(this); + } +} + +class PoultrygeistEffect extends OneShotEffect { + + PoultrygeistEffect() { + super(Outcome.BoostCreature); + this.staticText = "roll a six-sided die. If you roll a 1, sacrifice {this}. Otherwise, put a +1/+1 counter on {this}"; + } + + PoultrygeistEffect(final PoultrygeistEffect ability) { + super(ability); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + int result = controller.rollDice(game, 6); + Permanent permanent = game.getPermanent(source.getSourceId()); + if (permanent != null) { + if (result == 1) { + return permanent.sacrifice(source.getSourceId(), game); + } else { + return new AddCountersSourceEffect(CounterType.P1P1.createInstance()).apply(game, source); + } + } + } + return false; + } + + @Override + public PoultrygeistEffect copy() { + return new PoultrygeistEffect(this); + } +} diff --git a/Mage.Sets/src/mage/sets/Unglued.java b/Mage.Sets/src/mage/sets/Unglued.java index f2d3d12902..cc63178106 100644 --- a/Mage.Sets/src/mage/sets/Unglued.java +++ b/Mage.Sets/src/mage/sets/Unglued.java @@ -20,6 +20,7 @@ public class Unglued extends ExpansionSet { private Unglued() { super("Unglued", "UGL", ExpansionSet.buildDate(1998, 8, 11), SetType.JOKESET); + cards.add(new SetCardInfo("Poultrygeist", 37, Rarity.COMMON, mage.cards.p.Poultrygeist.class)); cards.add(new SetCardInfo("Chicken Egg", 41, Rarity.COMMON, mage.cards.c.ChickenEgg.class)); cards.add(new SetCardInfo("Krazy Kow", 48, Rarity.COMMON, mage.cards.k.KrazyKow.class)); cards.add(new SetCardInfo("Growth Spurt", 61, Rarity.COMMON, mage.cards.g.GrowthSpurt.class)); From 408b0af7f1420d3ee3d96ccf460637058271a38b Mon Sep 17 00:00:00 2001 From: ciaccona007 <ciaccona007@users.noreply.github.com> Date: Tue, 9 Jan 2018 16:31:16 -0800 Subject: [PATCH 08/34] Implement Poultrygeist --- Mage.Sets/src/mage/cards/p/Poultrygeist.java | 111 +++++++++++++++++++ Mage.Sets/src/mage/sets/Unglued.java | 1 + 2 files changed, 112 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/p/Poultrygeist.java diff --git a/Mage.Sets/src/mage/cards/p/Poultrygeist.java b/Mage.Sets/src/mage/cards/p/Poultrygeist.java new file mode 100644 index 0000000000..838d241545 --- /dev/null +++ b/Mage.Sets/src/mage/cards/p/Poultrygeist.java @@ -0,0 +1,111 @@ +/* + * 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.p; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.DiesCreatureTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.counters.CounterType; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; + +import java.util.UUID; + +/** + * + * @author ciaccona007 + */ +public class Poultrygeist extends CardImpl { + + public Poultrygeist(UUID ownerId, CardSetInfo setInfo) { + super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{B}"); + this.subtype.add(SubType.CHICKEN); + + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // Whenever a creature dies, you may roll a six-sided die. If you roll a 1, sacrifice Poultrygeist. Otherwise, put a +1/+1 counter on Poultrygeist. + Ability ability = new DiesCreatureTriggeredAbility(new PoultrygeistEffect(), true); + this.addAbility(ability); + } + + public Poultrygeist(final Poultrygeist card) { + super(card); + } + + @Override + public Poultrygeist copy() { + return new Poultrygeist(this); + } +} + +class PoultrygeistEffect extends OneShotEffect { + + PoultrygeistEffect() { + super(Outcome.BoostCreature); + this.staticText = "roll a six-sided die. If you roll a 1, sacrifice {this}. Otherwise, put a +1/+1 counter on {this}"; + } + + PoultrygeistEffect(final PoultrygeistEffect ability) { + super(ability); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + int result = controller.rollDice(game, 6); + Permanent permanent = game.getPermanent(source.getSourceId()); + if (permanent != null) { + if (result == 1) { + return permanent.sacrifice(source.getSourceId(), game); + } else { + return new AddCountersSourceEffect(CounterType.P1P1.createInstance()).apply(game, source); + } + } + } + return false; + } + + @Override + public PoultrygeistEffect copy() { + return new PoultrygeistEffect(this); + } +} diff --git a/Mage.Sets/src/mage/sets/Unglued.java b/Mage.Sets/src/mage/sets/Unglued.java index f2d3d12902..cc63178106 100644 --- a/Mage.Sets/src/mage/sets/Unglued.java +++ b/Mage.Sets/src/mage/sets/Unglued.java @@ -20,6 +20,7 @@ public class Unglued extends ExpansionSet { private Unglued() { super("Unglued", "UGL", ExpansionSet.buildDate(1998, 8, 11), SetType.JOKESET); + cards.add(new SetCardInfo("Poultrygeist", 37, Rarity.COMMON, mage.cards.p.Poultrygeist.class)); cards.add(new SetCardInfo("Chicken Egg", 41, Rarity.COMMON, mage.cards.c.ChickenEgg.class)); cards.add(new SetCardInfo("Krazy Kow", 48, Rarity.COMMON, mage.cards.k.KrazyKow.class)); cards.add(new SetCardInfo("Growth Spurt", 61, Rarity.COMMON, mage.cards.g.GrowthSpurt.class)); From c7c8ee390d6f26b174077a09ccaa7459604675e0 Mon Sep 17 00:00:00 2001 From: ciaccona007 <ciaccona007@users.noreply.github.com> Date: Tue, 9 Jan 2018 19:13:00 -0800 Subject: [PATCH 09/34] Fix RIX land rarity --- Mage.Sets/src/mage/sets/RivalsOfIxalan.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Mage.Sets/src/mage/sets/RivalsOfIxalan.java b/Mage.Sets/src/mage/sets/RivalsOfIxalan.java index 9e0eb91a34..3589deae5b 100644 --- a/Mage.Sets/src/mage/sets/RivalsOfIxalan.java +++ b/Mage.Sets/src/mage/sets/RivalsOfIxalan.java @@ -120,7 +120,7 @@ public class RivalsOfIxalan extends ExpansionSet { cards.add(new SetCardInfo("Forerunner of the Empire", 102, Rarity.UNCOMMON, mage.cards.f.ForerunnerOfTheEmpire.class)); cards.add(new SetCardInfo("Forerunner of the Heralds", 129, Rarity.UNCOMMON, mage.cards.f.ForerunnerOfTheHeralds.class)); cards.add(new SetCardInfo("Forerunner of the Legion", 9, Rarity.UNCOMMON, mage.cards.f.ForerunnerOfTheLegion.class)); - cards.add(new SetCardInfo("Forest", 196, Rarity.COMMON, mage.cards.basiclands.Forest.class)); + cards.add(new SetCardInfo("Forest", 196, Rarity.LAND, mage.cards.basiclands.Forest.class)); cards.add(new SetCardInfo("Form of the Dinosaur", 103, Rarity.RARE, mage.cards.f.FormOfTheDinosaur.class)); cards.add(new SetCardInfo("Forsaken Sanctuary", 187, Rarity.UNCOMMON, mage.cards.f.ForsakenSanctuary.class)); cards.add(new SetCardInfo("Foul Orchard", 188, Rarity.UNCOMMON, mage.cards.f.FoulOrchard.class)); @@ -143,7 +143,7 @@ public class RivalsOfIxalan extends ExpansionSet { cards.add(new SetCardInfo("Impale", 76, Rarity.COMMON, mage.cards.i.Impale.class)); cards.add(new SetCardInfo("Imperial Ceratops", 10, Rarity.UNCOMMON, mage.cards.i.ImperialCeratops.class)); cards.add(new SetCardInfo("Induced Amnesia", 40, Rarity.RARE, mage.cards.i.InducedAmnesia.class)); - cards.add(new SetCardInfo("Island", 193, Rarity.COMMON, mage.cards.basiclands.Island.class)); + cards.add(new SetCardInfo("Island", 193, Rarity.LAND, mage.cards.basiclands.Island.class)); cards.add(new SetCardInfo("Jade Bearer", 134, Rarity.COMMON, mage.cards.j.JadeBearer.class)); cards.add(new SetCardInfo("Jadecraft Artisan", 135, Rarity.COMMON, mage.cards.j.JadecraftArtisan.class)); cards.add(new SetCardInfo("Jadelight Ranger", 136, Rarity.RARE, mage.cards.j.JadelightRanger.class)); @@ -166,7 +166,7 @@ public class RivalsOfIxalan extends ExpansionSet { cards.add(new SetCardInfo("Mist-Cloaked Herald", 43, Rarity.COMMON, mage.cards.m.MistCloakedHerald.class)); cards.add(new SetCardInfo("Moment of Craving", 79, Rarity.COMMON, mage.cards.m.MomentOfCraving.class)); cards.add(new SetCardInfo("Moment of Triumph", 15, Rarity.COMMON, mage.cards.m.MomentOfTriumph.class)); - cards.add(new SetCardInfo("Mountain", 195, Rarity.COMMON, mage.cards.basiclands.Mountain.class)); + cards.add(new SetCardInfo("Mountain", 195, Rarity.LAND, mage.cards.basiclands.Mountain.class)); cards.add(new SetCardInfo("Mutiny", 106, Rarity.COMMON, mage.cards.m.Mutiny.class)); cards.add(new SetCardInfo("Naturalize", 139, Rarity.COMMON, mage.cards.n.Naturalize.class)); cards.add(new SetCardInfo("Needletooth Raptor", 107, Rarity.UNCOMMON, mage.cards.n.NeedletoothRaptor.class)); @@ -182,7 +182,7 @@ public class RivalsOfIxalan extends ExpansionSet { cards.add(new SetCardInfo("Path of Mettle", "165a", Rarity.RARE, mage.cards.p.PathOfMettle.class)); cards.add(new SetCardInfo("Pirate's Pillage", 109, Rarity.UNCOMMON, mage.cards.p.PiratesPillage.class)); cards.add(new SetCardInfo("Pitiless Plunderer", 81, Rarity.UNCOMMON, mage.cards.p.PitilessPlunderer.class)); - cards.add(new SetCardInfo("Plains", 192, Rarity.COMMON, mage.cards.basiclands.Plains.class)); + cards.add(new SetCardInfo("Plains", 192, Rarity.LAND, mage.cards.basiclands.Plains.class)); cards.add(new SetCardInfo("Plummet", 143, Rarity.COMMON, mage.cards.p.Plummet.class)); cards.add(new SetCardInfo("Polyraptor", 144, Rarity.MYTHIC, mage.cards.p.Polyraptor.class)); cards.add(new SetCardInfo("Pride of Conquerors", 17, Rarity.UNCOMMON, mage.cards.p.PrideOfConquerors.class)); @@ -236,7 +236,7 @@ public class RivalsOfIxalan extends ExpansionSet { cards.add(new SetCardInfo("Sun-Crested Pterodon", 27, Rarity.COMMON, mage.cards.s.SunCrestedPterodon.class)); cards.add(new SetCardInfo("Swab Goblin", 203, Rarity.COMMON, mage.cards.s.SwabGoblin.class)); cards.add(new SetCardInfo("Swaggering Corsair", 119, Rarity.COMMON, mage.cards.s.SwaggeringCorsair.class)); - cards.add(new SetCardInfo("Swamp", 194, Rarity.COMMON, mage.cards.basiclands.Swamp.class)); + cards.add(new SetCardInfo("Swamp", 194, Rarity.LAND, mage.cards.basiclands.Swamp.class)); cards.add(new SetCardInfo("Swift Warden", 146, Rarity.UNCOMMON, mage.cards.s.SwiftWarden.class)); cards.add(new SetCardInfo("Sworn Guardian", 58, Rarity.COMMON, mage.cards.s.SwornGuardian.class)); cards.add(new SetCardInfo("Temple Altisaur", 28, Rarity.RARE, mage.cards.t.TempleAltisaur.class)); From 9598ffa16b3df39cdb3b4ffc0da4883abc5cb1e1 Mon Sep 17 00:00:00 2001 From: spjspj <spjspj4@gmail.com> Date: Wed, 10 Jan 2018 20:02:37 +1100 Subject: [PATCH 10/34] Add Jack-in-the-Mox + Jumbo Imp (UGL) --- Mage.Sets/src/mage/cards/j/JackInTheMox.java | 119 +++++++++++++ Mage.Sets/src/mage/cards/j/JumboImp.java | 177 +++++++++++++++++++ Mage.Sets/src/mage/sets/Unglued.java | 11 +- 3 files changed, 303 insertions(+), 4 deletions(-) create mode 100644 Mage.Sets/src/mage/cards/j/JackInTheMox.java create mode 100644 Mage.Sets/src/mage/cards/j/JumboImp.java diff --git a/Mage.Sets/src/mage/cards/j/JackInTheMox.java b/Mage.Sets/src/mage/cards/j/JackInTheMox.java new file mode 100644 index 0000000000..b1bef7d425 --- /dev/null +++ b/Mage.Sets/src/mage/cards/j/JackInTheMox.java @@ -0,0 +1,119 @@ +/* + * 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.j; + +import java.util.UUID; +import mage.Mana; +import mage.abilities.Ability; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.effects.common.ManaEffect; +import mage.abilities.mana.SimpleManaAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; + +/** + * + * @author spjspj + */ +public class JackInTheMox extends CardImpl { + + public JackInTheMox(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{0}"); + + // {T}: Roll a six-sided die. This ability has the indicated effect. + // 1 - Sacrifice Jack-in-the-Mox and you lose 5 life. + // 2 - Add {W} to your mana pool. + // 3 - Add {U} to your mana pool. + // 4 - Add {B} to your mana pool. + // 5 - Add {R} to your mana pool. + // 6 - Add {G} to your mana pool. + Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new JackInTheMoxManaEffect(), new TapSourceCost()); + this.addAbility(ability); + } + + public JackInTheMox(final JackInTheMox card) { + super(card); + } + + @Override + public JackInTheMox copy() { + return new JackInTheMox(this); + } +} + +class JackInTheMoxManaEffect extends ManaEffect { + + JackInTheMoxManaEffect() { + super(); + staticText = "Roll a six-sided die. If result is 1 - Sacrifice {this} and you lose 5 life. 2 - Add {W} 3 - Add {U} 4 - Add {B} 5 - Add {R} 6 - Add {G} to your mana pool"; + } + + JackInTheMoxManaEffect(final JackInTheMoxManaEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + Permanent permanent = game.getPermanent(source.getSourceId()); + if (controller != null && permanent != null) { + int amount = controller.rollDice(game, 6); + if (amount == 1) { + permanent.sacrifice(source.getSourceId(), game); + controller.loseLife(5, game, false); + } else if (amount == 2) { + controller.getManaPool().addMana(Mana.WhiteMana(1), game, source); + } else if (amount == 3) { + controller.getManaPool().addMana(Mana.BlueMana(1), game, source); + } else if (amount == 4) { + controller.getManaPool().addMana(Mana.BlackMana(1), game, source); + } else if (amount == 5) { + controller.getManaPool().addMana(Mana.RedMana(1), game, source); + } else if (amount == 6) { + controller.getManaPool().addMana(Mana.GreenMana(1), game, source); + } + return true; + } + return false; + } + + @Override + public JackInTheMoxManaEffect copy() { + return new JackInTheMoxManaEffect(this); + } + + @Override + public Mana getMana(Game game, Ability source) { + return null; + } +} diff --git a/Mage.Sets/src/mage/cards/j/JumboImp.java b/Mage.Sets/src/mage/cards/j/JumboImp.java new file mode 100644 index 0000000000..bd7f5ef02f --- /dev/null +++ b/Mage.Sets/src/mage/cards/j/JumboImp.java @@ -0,0 +1,177 @@ +/* + * 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.j; + +import java.util.ArrayList; +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.BeginningOfEndStepTriggeredAbility; +import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; +import mage.abilities.common.EntersBattlefieldAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.EntersBattlefieldWithXCountersEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.constants.TargetController; +import mage.constants.Zone; +import mage.counters.Counter; +import mage.counters.CounterType; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; + +/** + * + * @author spjspj + */ +public class JumboImp extends CardImpl { + + public JumboImp(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}"); + + this.subtype.add(SubType.IMP); + this.power = new MageInt(0); + this.toughness = new MageInt(0); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // As Jumbo Imp enters the battlefield, roll a six-sided die. Jumbo Imp enters the battlefield with a number of +1/+1 counters on it equal to the result. + this.addAbility(new EntersBattlefieldAbility(new JumboImpEffect(new Counter("P1P1")))); + + // At the beginning of your upkeep, roll a six-sided die and put a number of +1/+1 counters on Jumbo Imp equal to the result. + Ability ability2 = new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new JumboImpAddCountersEffect(), TargetController.YOU, false); + this.addAbility(ability2); + + // At the beginning of your end step, roll a six-sided die and remove a number of +1/+1 counters from Jumbo Imp equal to the result. + Ability ability3 = new BeginningOfEndStepTriggeredAbility(Zone.BATTLEFIELD, new JumboImpRemoveCountersEffect(), TargetController.YOU, null, false); + this.addAbility(ability3); + } + + public JumboImp(final JumboImp card) { + super(card); + } + + @Override + public JumboImp copy() { + return new JumboImp(this); + } +} + +class JumboImpEffect extends EntersBattlefieldWithXCountersEffect { + + public JumboImpEffect(Counter counter) { + super(counter); + } + + public JumboImpEffect(EntersBattlefieldWithXCountersEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + Permanent permanent = game.getPermanentEntering(source.getSourceId()); + if (controller != null && permanent != null) { + int amount = controller.rollDice(game, 6); + ArrayList<UUID> appliedEffects = (ArrayList<UUID>) this.getValue("appldiedEffects"); // the basic event is the EntersBattlefieldEvent, so use already applied replacement effects from that event + permanent.addCounters(CounterType.P1P1.createInstance(amount), source, game, appliedEffects); + return super.apply(game, source); + } + return false; + } + + @Override + public EntersBattlefieldWithXCountersEffect copy() { + return new JumboImpEffect(this); + } + +} + +class JumboImpAddCountersEffect extends OneShotEffect { + + public JumboImpAddCountersEffect() { + super(Outcome.Benefit); + this.staticText = "roll a six-sided die and put a number of +1/+1 counters on {this} equal to the result"; + } + + public JumboImpAddCountersEffect(final JumboImpAddCountersEffect effect) { + super(effect); + } + + @Override + public JumboImpAddCountersEffect copy() { + return new JumboImpAddCountersEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + Permanent permanent = game.getPermanent(source.getSourceId()); + if (controller != null && permanent != null) { + int amount = controller.rollDice(game, 6); + permanent.addCounters(CounterType.P1P1.createInstance(amount), source, game); + return true; + } + return false; + } +} + +class JumboImpRemoveCountersEffect extends OneShotEffect { + + public JumboImpRemoveCountersEffect() { + super(Outcome.Detriment); + this.staticText = "roll a six-sided die and remove a number of +1/+1 counters on {this} equal to the result"; + } + + public JumboImpRemoveCountersEffect(final JumboImpRemoveCountersEffect effect) { + super(effect); + } + + @Override + public JumboImpRemoveCountersEffect copy() { + return new JumboImpRemoveCountersEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + Permanent permanent = game.getPermanent(source.getSourceId()); + if (controller != null && permanent != null) { + int amount = controller.rollDice(game, 6); + permanent.removeCounters(CounterType.P1P1.createInstance(amount), game); + return true; + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/Unglued.java b/Mage.Sets/src/mage/sets/Unglued.java index cc63178106..ec858d5289 100644 --- a/Mage.Sets/src/mage/sets/Unglued.java +++ b/Mage.Sets/src/mage/sets/Unglued.java @@ -20,15 +20,18 @@ public class Unglued extends ExpansionSet { private Unglued() { super("Unglued", "UGL", ExpansionSet.buildDate(1998, 8, 11), SetType.JOKESET); - cards.add(new SetCardInfo("Poultrygeist", 37, Rarity.COMMON, mage.cards.p.Poultrygeist.class)); + cards.add(new SetCardInfo("Chicken Egg", 41, Rarity.COMMON, mage.cards.c.ChickenEgg.class)); - cards.add(new SetCardInfo("Krazy Kow", 48, Rarity.COMMON, mage.cards.k.KrazyKow.class)); - cards.add(new SetCardInfo("Growth Spurt", 61, Rarity.COMMON, mage.cards.g.GrowthSpurt.class)); - cards.add(new SetCardInfo("Timmy, Power Gamer", 68, Rarity.RARE, mage.cards.t.TimmyPowerGamer.class)); cards.add(new SetCardInfo("Forest", 88, Rarity.LAND, mage.cards.basiclands.Forest.class, new CardGraphicInfo(FrameStyle.UGL_FULL_ART_BASIC, false))); + cards.add(new SetCardInfo("Growth Spurt", 61, Rarity.COMMON, mage.cards.g.GrowthSpurt.class)); cards.add(new SetCardInfo("Island", 85, Rarity.LAND, mage.cards.basiclands.Island.class, new CardGraphicInfo(FrameStyle.UGL_FULL_ART_BASIC, false))); + cards.add(new SetCardInfo("Jack-in-the-Mox", 75, Rarity.RARE, mage.cards.j.JackInTheMox.class)); + cards.add(new SetCardInfo("Jumbo Imp", 34, Rarity.UNCOMMON, mage.cards.j.JumboImp.class)); + cards.add(new SetCardInfo("Krazy Kow", 48, Rarity.COMMON, mage.cards.k.KrazyKow.class)); cards.add(new SetCardInfo("Mountain", 87, Rarity.LAND, mage.cards.basiclands.Mountain.class, new CardGraphicInfo(FrameStyle.UGL_FULL_ART_BASIC, false))); cards.add(new SetCardInfo("Plains", 84, Rarity.LAND, mage.cards.basiclands.Plains.class, new CardGraphicInfo(FrameStyle.UGL_FULL_ART_BASIC, false))); + cards.add(new SetCardInfo("Poultrygeist", 37, Rarity.COMMON, mage.cards.p.Poultrygeist.class)); cards.add(new SetCardInfo("Swamp", 86, Rarity.LAND, mage.cards.basiclands.Swamp.class, new CardGraphicInfo(FrameStyle.UGL_FULL_ART_BASIC, false))); + cards.add(new SetCardInfo("Timmy, Power Gamer", 68, Rarity.RARE, mage.cards.t.TimmyPowerGamer.class)); } } From da69ee88164b59566a455c5b61612b9f51ada602 Mon Sep 17 00:00:00 2001 From: spjspj <spjspj4@gmail.com> Date: Thu, 11 Jan 2018 00:12:05 +1100 Subject: [PATCH 11/34] Add Chicken a la King (UGL) --- .../src/mage/cards/c/ChickenALaKing.java | 135 ++++++++++++++++++ Mage.Sets/src/mage/sets/Unglued.java | 1 + Utils/mtg-cards-data.txt | 46 +++++- 3 files changed, 181 insertions(+), 1 deletion(-) create mode 100644 Mage.Sets/src/mage/cards/c/ChickenALaKing.java diff --git a/Mage.Sets/src/mage/cards/c/ChickenALaKing.java b/Mage.Sets/src/mage/cards/c/ChickenALaKing.java new file mode 100644 index 0000000000..e12636431f --- /dev/null +++ b/Mage.Sets/src/mage/cards/c/ChickenALaKing.java @@ -0,0 +1,135 @@ +/* + * 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.c; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.TapTargetCost; +import mage.abilities.effects.common.RollDiceEffect; +import mage.abilities.effects.common.counter.AddCountersAllEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.constants.Zone; +import mage.counters.CounterType; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.filter.predicate.permanent.TappedPredicate; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.target.common.TargetControlledPermanent; + +/** + * + * @author spjspj + */ +public class ChickenALaKing extends CardImpl { + + private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("untapped Chicken you control"); + + static { + filter.add(Predicates.not(new TappedPredicate())); + filter.add(new SubtypePredicate(SubType.CHICKEN)); + } + + public ChickenALaKing(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}{U}"); + + this.subtype.add(SubType.CHICKEN); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // Whenever a 6 is rolled on a six-sided die, put a +1/+1 counter on each Chicken. + this.addAbility(new ChickenALaKingTriggeredAbility()); + + // Tap an untapped Chicken you control: Roll a six-sided die. + this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new RollDiceEffect(null, Outcome.Benefit, 6), new TapTargetCost(new TargetControlledPermanent(1, 1, filter, false)))); + } + + public ChickenALaKing(final ChickenALaKing card) { + super(card); + } + + @Override + public ChickenALaKing copy() { + return new ChickenALaKing(this); + } +} + +class ChickenALaKingTriggeredAbility extends TriggeredAbilityImpl { + + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("each Chicken"); + + static { + filter.add(new SubtypePredicate(SubType.CHICKEN)); + } + + public ChickenALaKingTriggeredAbility() { + super(Zone.BATTLEFIELD, new AddCountersAllEffect(CounterType.P1P1.createInstance(), filter)); + } + + public ChickenALaKingTriggeredAbility(final ChickenALaKingTriggeredAbility ability) { + super(ability); + } + + @Override + public ChickenALaKingTriggeredAbility copy() { + return new ChickenALaKingTriggeredAbility(this); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.DICE_ROLLED; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (this.getControllerId().equals(event.getPlayerId()) && event.getFlag()) { + // event.getData holds the num of sides of the die to roll + String data = event.getData(); + if (data != null) { + int numSides = Integer.parseInt(data); + if (event.getAmount() == 6 && numSides == 6) { + return true; + } + } + } + return false; + } + + @Override + public String getRule() { + return "Whenever a 6 is rolled on a six-sided die, put a +1/+1 counter on each Chicken"; + } +} diff --git a/Mage.Sets/src/mage/sets/Unglued.java b/Mage.Sets/src/mage/sets/Unglued.java index ec858d5289..9e33d2e77c 100644 --- a/Mage.Sets/src/mage/sets/Unglued.java +++ b/Mage.Sets/src/mage/sets/Unglued.java @@ -22,6 +22,7 @@ public class Unglued extends ExpansionSet { super("Unglued", "UGL", ExpansionSet.buildDate(1998, 8, 11), SetType.JOKESET); cards.add(new SetCardInfo("Chicken Egg", 41, Rarity.COMMON, mage.cards.c.ChickenEgg.class)); + cards.add(new SetCardInfo("Chicken a la King", 17, Rarity.RARE, mage.cards.c.ChickenALaKing.class)); cards.add(new SetCardInfo("Forest", 88, Rarity.LAND, mage.cards.basiclands.Forest.class, new CardGraphicInfo(FrameStyle.UGL_FULL_ART_BASIC, false))); cards.add(new SetCardInfo("Growth Spurt", 61, Rarity.COMMON, mage.cards.g.GrowthSpurt.class)); cards.add(new SetCardInfo("Island", 85, Rarity.LAND, mage.cards.basiclands.Island.class, new CardGraphicInfo(FrameStyle.UGL_FULL_ART_BASIC, false))); diff --git a/Utils/mtg-cards-data.txt b/Utils/mtg-cards-data.txt index f9e2c86284..1eb98fc23c 100644 --- a/Utils/mtg-cards-data.txt +++ b/Utils/mtg-cards-data.txt @@ -32970,7 +32970,7 @@ Willing Test Subject|Unstable|126|C|{2}{G}|Creature- Spider Monkey Scientist|2|2 Garbage Elemental|Unstable|82|U|{4}{R}|Creature - Elemental|3|2|Battle cry <i>(Whenever this creature attacks, each other attacking creature gets +1/+0 until end of turn.)</i>$When Garbage Elemental enters the battlefield, roll two six-sided dice. Create a number of 1/1 red Goblin creature tokens equal to the difference between those results.| Oddly Uneven|Unstable|15|R|{3}{W}{W}|Sorcery|||Choose one --$* Destroy each creature with an odd number of words in its name. (Hyphenated words are one word.)$* Destroy each creature with an even number of words in its name.| capital offense|Unstable|52|C|{2}{B}{B}|Instant|||target creature gets -x/-x until end of turn, where x is the number of times a capital letter appears in its rules text. (ignore reminder text and flavor text.) -Very Cryptic Command|Unstable|49|R|{1}{U}{U}{U}|Instant|||Choose two - Return target permanent to its controller�s hand.; Draw two cards, then discard a card.; Change the target of target spell with a single target.; Turn over target nontoken creature.| +Very Cryptic Command|Unstable|49|R|{1}{U}{U}{U}|Instant|||Choose two - Return target permanent to its controller's hand.; Draw two cards, then discard a card.; Change the target of target spell with a single target.; Turn over target nontoken creature.| Master of Waves|Duel Decks: Merfolk vs. Goblins|1|M|{3}{U}|Creature - Merfolk Wizard|2|1|Protection from red$Elemental creatures you control get +1/+1.$When Master of Waves enters the battlefield, create a number of 1/0 blue Elemental creature tokens equal to your devotion to blue. <i>(Each {U} in the mana costs of permanents you control counts toward your devotion to blue.)</i>| Aquitect's Will|Duel Decks: Merfolk vs. Goblins|2|C|{U}|Tribal Sorcery - Merfolk|||Put a flood counter on target land. That land is an Island in addition to its other types for as long as it has a flood counter on it. If you control a Merfolk, draw a card.| Claustrophobia|Duel Decks: Merfolk vs. Goblins|3|C|{1}{U}{U}|Enchantment - Aura|||Enchant creature$When Claustrophobia enters the battlefield, tap enchanted creature.$Enchanted creature doesn't untap during its controller's untap step.| @@ -33030,3 +33030,47 @@ Blighted Gorge|Duel Decks: Merfolk vs. Goblins|58|U||Land|||{tap}: Add {C} to yo Forgotten Cave|Duel Decks: Merfolk vs. Goblins|59|C||Land|||Forgotten Cave enters the battlefield tapped.${tap}: Add {R} to your mana pool.$Cycling {R} <i>({R}, Discard this card: Draw a card.)</i>| Mountain|Duel Decks: Merfolk vs. Goblins|60|L||Basic Land - Mountain|||| Mountain|Duel Decks: Merfolk vs. Goblins|61|L||Basic Land - Mountain|||| +The Cheese Stands Alone|Unglued|2|R|{4}{W}{W}|Enchantment|||When you control no permanents other than The Cheese Stands Alone and have no cards in hand, you win the game.| +Lexivore|Unglued|7|U|{3}{W}|Creature - Beast|2|3| Whenever Lexivore deals damage to a player, destroy target permanent other than Lexivore with the most lines of text in its text box. (If two or more cards are tied, target any one of them.)| +Miss Demeanor|Unglued|10|U|{3}{W}|Creature - Lady of Proper Etiquette|3|1| Flying, first strike At the beginning of each other player's upkeep, you may compliment that player on his or her game play. If you don't, sacrifice Miss Demeanor.| +Once More with Feeling|Unglued|11|R|{W}{W}{W}{W}|Sorcery|||Exile all permanents and all cards from all graveyards. Each player shuffles his or her hand into his or her library, then draws seven cards. Each player's life total becomes 10. Exile Once More with Feeling. DCI ruling - A deck can have only one card named Once More with Feeling.| +Checks and Balances|Unglued|16|U|{2}{U}|Enchantment|||Cast Checks and Balances only if there are three or more players in the game. Whenever a player casts a spell, each of that player's opponents may discard a card. If they do, counter that spell.| +Chicken a la King|Unglued|17|R|{1}{U}{U}|Creature - Chicken|2|2| Whenever a 6 is rolled on a six-sided die, put a +1/+1 counter on each Chicken. (You may roll dice only when instructed to.) Tap an untapped Chicken you control: Roll a six-sided die.| +Clambassadors|Unglued|18|C|{3}{U}|Creature - Clamfolk|4|4| Whenever Clambassadors deals damage to a player, choose an artifact, creature, or land you control. That player gains control of that permanent.| +Clam-I-Am|Unglued|19|C|{2}{U}|Creature - Clamfolk|2|2| If you roll a 3 on a six-sided die, you may reroll that die.| +Denied!|Unglued|22|C|{U}|Instant|||Choose a card name, then target spell's controller reveals his or her hand. If a card with the chosen name is revealed this way, counter that spell.| +Fowl Play|Unglued|24|C|{2}{U}|Enchantment - Aura|||Enchant creature Enchanted creature is a Chicken with base power and toughness 1/1 and loses all abilities.| +Free-for-All|Unglued|25|R|{3}{U}|Enchantment|||When Free-for-All enters the battlefield, exile all creatures face down. At the beginning of each player's upkeep, that player chooses a card exiled with Free-for-All at random and puts it onto the battlefield. When Free-for-All leaves the battlefield, put all cards exiled with it into their owners' graveyards.| +Psychic Network|Unglued|26|R|{U}|Enchantment|||Each player plays with the top card of his or her library held against his or her forehead, revealed to each other player.| +Deadhead|Unglued|30|C|{3}{B}|Creature - Zombie|3|3| {0}: Return Deadhead from your graveyard to the battlefield. Activate this ability only if an opponent isn't touching his or her hand (of cards).| +Jumbo Imp|Unglued|34|U|{2}{B}|Creature - Imp|0|0| Flying$As Jumbo Imp enters the battlefield, roll a six-sided die. Jumbo Imp enters the battlefield with a number of +1/+1 counters on it equal to the result.$At the beginning of your upkeep, roll a six-sided die and put a number of +1/+1 counters on Jumbo Imp equal to the result. At the beginning of your end step, roll a six-sided die and remove a number of +1/+1 counters from Jumbo Imp equal to the result.| +Organ Harvest|Unglued|35|C|{B}|Sorcery|||Your team may sacrifice any number of creatures. For each creature sacrificed this way, you add {B}{B} to your mana pool.| +Poultrygeist|Unglued|37|C|{2}{B}|Creature - Chicken|1|1| Flying Whenever a creature dies, you may roll a six-sided die. If you roll a 1, sacrifice Poultrygeist. Otherwise, put a +1/+1 counter on Poultrygeist.| +Temp of the Damned|Unglued|38|C|{2}{B}|Creature - Zombie|3|3| As Temp of the Damned enters the battlefield, roll a six-sided die. Temp of the Damned enters the battlefield with a number of funk counters on it equal to the result. At the beginning of your upkeep, remove a funk counter from Temp of the Damned. If you can't, sacrifice it.| +Burning Cinder Fury of Crimson Chaos Fire|Unglued|40|R|{3}{R}|Enchantment|||Whenever any player taps a permanent, that player choose one of his or her opponents. The chosen player gains control of that permanent at the beginning of the next end step. At the beginning of each player's end step, if that player didn't tap any nonland permanents that turn, Burning Cinder Fury of Crimson Chaos Fire deals 3 damage to that player.| +Chicken Egg|Unglued|41|R|{1}{R}|Creature - Egg|0|1| At the beginning of your upkeep, roll a six-sided die. If you roll a 6, sacrifice Chicken Egg and create a 4/4 red Giant Chicken creature token.| +Goblin Bookie|Unglued|43|C|{R}|Creature - Goblin|1|1| {R}, {T}: Reflip any coin or reroll any die. (Activate this ability only any time it makes sense.)| +Goblin Bowling Team|Unglued|44|C|{3}{R}|Creature - Goblin|1|1| If Goblin Bowling Team would deal damage to a creature or player, it deals that much damage plus the result of a six-sided die roll to that creature or player instead.| +Goblin Tutor|Unglued|45|U|{R}|Instant|||Roll a six-sided die. If you roll a 1, Goblin Tutor has no effect. Otherwise, search your library for the indicated card, reveal it, put it into your hand, then shuffle your library. 2 - A card named Goblin Tutor 3 - An enchantment card 4 - An artifact card 5 - A creature card 6 - An instant or sorcery card| +Jalum Grifter|Unglued|47|R|{3}{R}{R}|Legendary Creature - Devil|3|5| {1}{R}, {T}: Shuffle Jalum Grifter and two lands you control face down. Target opponent chooses one of those cards. Turn the cards face up. If the opponent chose Jalum Grifter, sacrifice it. Otherwise, destroy target permanent.| +Krazy Kow|Unglued|48|C|{3}{R}|Creature - Cow|3|3| At the beginning of your upkeep, roll a six-sided die. If you a roll a 1, sacrifice Krazy Kow and it deals 3 damage to each creature and each player.| +Ricochet|Unglued|50|U|{R}|Enchantment|||Whenever a player casts a spell that targets a single player, each player rolls a six-sided die. Change the target of that spell to the player with the lowest result. Reroll to break ties, if necessary.| +Spark Fiend|Unglued|51|R|{4}{R}|Creature - Beast, When Spark Fiend enters the battlefield, roll two six-sided dice. If you rolled 2, 3, or 12, sacrifice Spark Fiend. If you rolled 7 or 11, don't roll dice for Spark Fiend during any of your following upkeeps. If you rolled any other total, note that total. At the beginning of your upkeep, roll two six-sided dice. If you rolled 7, sacrifice Spark Fiend. If you roll the noted total, don't roll dice for Spark Fiend during any of your following upkeeps. Otherwise, do nothing.| +Strategy, Schmategy|Unglued|52|R|{1}{R}|Sorcery|||Roll a six-sided die. Strategy, Schmategy has the indicated effect. 1 - Do nothing. 2 - Destroy all artifacts. 3 - Destroy all lands. 4 - Strategy, Schmategy deals 3 damage to each creature and each player. 5 - Each player discards his or her hand and draws seven cards. 6 - Repeat this process two more times.| +The Ultimate Nightmare of Wizards of the Coast Customer Service|Unglued|53|U|{X}{Y}{Z}{R}{R}|Sorcery|||The Ultimate Nightmare of Wizards of the Coast® Customer Service deals X damage to each of Y target creatures and Z target players.| +Elvish Impersonators|Unglued|56|C|{3}{G}|Creature - Elves, */*, As Elvish Impersonators enters the battlefield, roll a six-sided die twice. Its base power becomes the first result and its base toughness becomes the second result.| +Flock of Rabid Sheep|Unglued|57|U|{X}{G}{G}|Sorcery|||Flip X coins. For each flip you win, create a 2/2 green Sheep creature token named Rabid Sheep.| +Free-Range Chicken|Unglued|58|C|{3}{G}|Creature - Chicken|3|3| {1}{G}: Roll two six-sided dice. If both results are the same, Free-Range Chicken gets +X/+X until end of turn, where X is that result. If the total of those results is equal to any other total you have rolled this turn for Free-Range Chicken, sacrifice it. (For example, if you roll two 3s, Free-Range Chicken gets +3/+3. If you roll a total of 6 for Free-Range Chicken later that turn, sacrifice it.)| +Gerrymandering|Unglued|59|U|{2}{G}|Sorcery|||Exile all lands. Give each player a number of those cards chosen at random equal to the number of those cards the player controlled. Each player returns those cards to the battlefield under that player's control.| +Growth Spurt|Unglued|61|C|{1}{G}|Instant|||Roll a six-sided die. Target creature gets +X/+X until end of turn, where X is the result.| +Hungry Hungry Heifer|Unglued|63|U|{2}{G}|Creature - Cow|3|3| At the beginning of your upkeep, you may remove a counter from a permanent you control. If you don't, sacrifice Hungry Hungry Heifer.| +Incoming!|Unglued|64|R|{4}{G}{G}{G}{G}|Sorcery|||Each player searches his or her library for any number of artifact, creature, enchantment, and/or land cards, puts them onto the battlefield, then shuffles his or her library.| +Team Spirit|Unglued|67|C|{2}{G}|Instant|||Creatures target player's team controls get +1/+1 until end of turn.| +Timmy, Power Gamer|Unglued|68|R|{2}{G}{G}|Legendary Creature - Human Gamer|1|1| {4}: You may put a creature card from your hand onto the battlefield.| +Giant Fan|Unglued|74|R|{4}|Artifact|||{2}, {T}: Move a counter from one permanent onto another. If the second permanent refers to any kind of counter, the moved counter becomes one of those counters. Otherwise, it becomes a +1/+1 counter.| +Jack-in-the-Mox|Unglued|75|R|{0}|Artifact|||{T}: Roll a six-sided die. This ability has the indicated effect. 1 - Sacrifice Jack-in-the-Mox and you lose 5 life. 2 - Add {W} to your mana pool. 3 - Add {U} to your mana pool. 4 - Add {B} to your mana pool. 5 - Add {R} to your mana pool. 6 - Add {G} to your mana pool.| +Paper Tiger|Unglued|78|C|{4}|Artifact Creature - Cat|4|3| Creatures named Rock Lobster can't attack or block.| +Rock Lobster|Unglued|79|C|{4}|Artifact Creature - Lobster|4|3| Creatures named Scissors Lizard can't attack or block.| +Scissors Lizard|Unglued|80|C|{4}|Artifact Creature - Lizard|4|3| Creatures named Paper Tiger can't attack or block.| +Spatula of the Ages|Unglued|81|U|{4}|Artifact|||{4}, {T}, Sacrifice Spatula of the Ages: You may put a silver-bordered permanent card from your hand onto the battlefield.| +Urza's Science Fair Project|Unglued|83|U|{6}|Artifact Creature - Construct|4|4| {2}: Roll a six-sided die. Urza's Science Fair Project gets the indicated result. 1 - It gets -2/-2 until end of turn. 2 - Prevent all combat damage it would deal this turn. 3 - It gains vigilance until end of turn. 4 - It gains first strike until end of turn. 5 - It gains flying until end of turn. 6 - It gets +2/+2 until end of turn.| From 79bdd2ca8fc3a70f98b3fddb023ab30d8ba53a70 Mon Sep 17 00:00:00 2001 From: Oleg Agafonov <jaydi85@gmail.com> Date: Wed, 10 Jan 2018 20:53:25 +0400 Subject: [PATCH 12/34] Tests: fixed server load test for simple connection and game starting --- Mage.Tests/src/test/java/org/mage/test/load/LoadTest.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Mage.Tests/src/test/java/org/mage/test/load/LoadTest.java b/Mage.Tests/src/test/java/org/mage/test/load/LoadTest.java index ce2f5670ee..240064072b 100644 --- a/Mage.Tests/src/test/java/org/mage/test/load/LoadTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/load/LoadTest.java @@ -8,6 +8,7 @@ import mage.cards.decks.DeckCardLists; import mage.cards.repository.CardInfo; import mage.cards.repository.CardRepository; import mage.constants.ColoredManaSymbol; +import mage.constants.MatchTimeLimit; import mage.constants.MultiplayerAttackOption; import mage.constants.RangeOfInfluence; import mage.game.match.MatchOptions; @@ -275,6 +276,7 @@ public class LoadTest { options.setAttackOption(MultiplayerAttackOption.MULTIPLE); options.setRange(RangeOfInfluence.ALL); options.setWinsNeeded(1); + options.setMatchTimeLimit(MatchTimeLimit.MIN__15); return options; } From 4f38939fc1f9acb15b749c14aa2d73fc39e65f60 Mon Sep 17 00:00:00 2001 From: Administrator <Administrator@172.16.58.12> Date: Wed, 10 Jan 2018 11:56:51 -0600 Subject: [PATCH 13/34] - Fixed Pride of Conquerors. --- Mage.Sets/src/mage/cards/p/PrideOfConquerors.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Mage.Sets/src/mage/cards/p/PrideOfConquerors.java b/Mage.Sets/src/mage/cards/p/PrideOfConquerors.java index d3c701e329..21e9f0bc53 100644 --- a/Mage.Sets/src/mage/cards/p/PrideOfConquerors.java +++ b/Mage.Sets/src/mage/cards/p/PrideOfConquerors.java @@ -31,7 +31,6 @@ import java.util.UUID; import mage.abilities.condition.common.CitysBlessingCondition; import mage.abilities.decorator.ConditionalContinuousEffect; import mage.abilities.effects.common.continuous.BoostControlledEffect; -import mage.abilities.effects.common.continuous.BoostTargetEffect; import mage.abilities.effects.keyword.AscendEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; @@ -52,7 +51,7 @@ public class PrideOfConquerors extends CardImpl { // Creatures you control get +1/+1 until end of turn. If you have the city's blessing, those creatures get +2/+2 until end of turn instead. this.getSpellAbility().addEffect(new ConditionalContinuousEffect(new BoostControlledEffect(2, 2, Duration.EndOfTurn), - new BoostTargetEffect(1, 1, Duration.EndOfTurn), CitysBlessingCondition.instance, + new BoostControlledEffect(1, 1, Duration.EndOfTurn), CitysBlessingCondition.instance, "Creatures you control get +1/+1 until end of turn. If you have the city's blessing, those creatures get +2/+2 until end of turn instead")); } From 56c615a66f14b11fa2a357c90749e2f252e25f61 Mon Sep 17 00:00:00 2001 From: Zzooouhh <Zzooouhh@users.noreply.github.com> Date: Wed, 10 Jan 2018 18:09:09 +0000 Subject: [PATCH 14/34] Prohibit fix --- Mage.Sets/src/mage/cards/p/Prohibit.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Mage.Sets/src/mage/cards/p/Prohibit.java b/Mage.Sets/src/mage/cards/p/Prohibit.java index 1fe9390078..3ae6ee0beb 100644 --- a/Mage.Sets/src/mage/cards/p/Prohibit.java +++ b/Mage.Sets/src/mage/cards/p/Prohibit.java @@ -31,7 +31,6 @@ import java.util.UUID; import mage.abilities.Ability; import mage.abilities.condition.common.KickedCondition; import mage.abilities.effects.OneShotEffect; -import mage.abilities.effects.common.CounterTargetEffect; import mage.abilities.keyword.KickerAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; @@ -55,7 +54,7 @@ public class Prohibit extends CardImpl { this.addAbility(new KickerAbility("{2}")); // Counter target spell if its converted mana cost is 2 or less. If Prohibit was kicked, counter that spell if its converted mana cost is 4 or less instead. - this.getSpellAbility().addEffect(new CounterTargetEffect()); + this.getSpellAbility().addEffect(new ProhibitEffect()); this.getSpellAbility().addTarget(new TargetSpell()); } @@ -69,20 +68,20 @@ public class Prohibit extends CardImpl { } } -class OverloadEffect extends OneShotEffect { +class ProhibitEffect extends OneShotEffect { - OverloadEffect() { + ProhibitEffect() { super(Outcome.DestroyPermanent); this.staticText = "Counter target spell if its converted mana cost is 2 or less. If {this} was kicked, counter that spell if its converted mana cost is 4 or less instead."; } - OverloadEffect(final OverloadEffect effect) { + ProhibitEffect(final ProhibitEffect effect) { super(effect); } @Override - public OverloadEffect copy() { - return new OverloadEffect(this); + public ProhibitEffect copy() { + return new ProhibitEffect(this); } @Override From 8f9356533d45bf32ff45f58a07905183fa3b8a61 Mon Sep 17 00:00:00 2001 From: Zzooouhh <Zzooouhh@users.noreply.github.com> Date: Wed, 10 Jan 2018 19:44:48 +0000 Subject: [PATCH 15/34] Fixed undoing individual blocker declarations for multi-blockers One more #4172 fix --- .../main/java/mage/game/combat/Combat.java | 199 +++++++++++++++++- 1 file changed, 193 insertions(+), 6 deletions(-) diff --git a/Mage/src/main/java/mage/game/combat/Combat.java b/Mage/src/main/java/mage/game/combat/Combat.java index 159f950b76..ea592fb47b 100644 --- a/Mage/src/main/java/mage/game/combat/Combat.java +++ b/Mage/src/main/java/mage/game/combat/Combat.java @@ -678,6 +678,82 @@ public class Combat implements Serializable, Copyable<Combat> { potentialBlockers.add(creature.getId()); } } + // check the mustBlockAllAttackers requirement (Blaze of Glory) ------------------------------- + if (effect.mustBlockAllAttackers(game)) { + Set<UUID> attackersToBlock = new HashSet<>(); + // check that it can block at least one of the attackers + // and no restictions prevent this + boolean mayBlock = false; + for (UUID attackingCreatureId : getAttackers()) { + if (creature.canBlock(attackingCreatureId, game)) { + Permanent attackingCreature = game.getPermanent(attackingCreatureId); + if (attackingCreature != null) { + // check if the attacker is already blocked by a max of blockers, so blocker can't block it also + if (attackingCreature.getMaxBlockedBy() != 0) { // 0 = no restriction about the number of possible blockers + int alreadyBlockingCreatures = 0; + for (CombatGroup group : getGroups()) { + if (group.getAttackers().contains(attackingCreatureId)) { + alreadyBlockingCreatures = group.getBlockers().size(); + break; + } + } + if (attackingCreature.getMaxBlockedBy() <= alreadyBlockingCreatures) { + // Attacker can't be blocked by more blockers so check next attacker + continue; + } + } + // check restrictions of the creature to block that prevent it can be blocked + + if (attackingCreature.getMinBlockedBy() > 1) { + // TODO: check if enough possible blockers are available, if true, mayBlock can be set to true + + } else { + attackersToBlock.add(attackingCreatureId); + } + } + } + } + //~ // remove creatures already blocked by affected creature + //~ for (CombatGroup group : getBlockingGroups()) { + //~ if (group.getAttackers().contains(attackingCreatureId)) { + //~ for (UUID attackingCreatureId : group.getAttackers()) { + //~ CombatGroup attackersGroup = findGroup(attackingCreatureId); + //~ if (attackersGroup != null) { + //~ if (attackersGroup.getBlockers().contains(creature.getId())) { + //~ attackersToBlock.remove(attackingCreatureId); + //~ } + //~ } + //~ } + //~ } + //~ } + if (!attackersToBlock.isEmpty()) { + if (attackersToBlock.size() > creature.getBlocking()) { + mayBlock = true; + } + } + // if so inform human player or set block for AI player + if (mayBlock) { + if (controller.isHuman()) { + if (!game.isSimulation()) { + game.informPlayer(controller, "Creature should block all attackers it's able to this turn: " + creature.getIdName()); + } + } else { + Player defender = game.getPlayer(creature.getControllerId()); + if (defender != null) { + for (UUID attackingCreatureId : getAttackers()) { + if (creature.canBlock(attackingCreatureId, game)) { + // ??? + if (attackersToBlock.contains(attackingCreatureId)) { + //~ defender.declareBlocker(defender.getId(), creature.getId(), attackingCreatureId, game); + addBlockingGroup(creature.getId(), creature.getId(), defender.getId(), game); + } + } + } + } + } + return false; + } + } } } @@ -701,8 +777,8 @@ public class Combat implements Serializable, Copyable<Combat> { } } - // check the mustBlockAny requirement ---------------------------------------- - if (effect.mustBlockAny(game)) { + // check the mustBlockAny requirement ---------------------------------------- (and mustBlockAllAttackers for AI) + if (effect.mustBlockAny(game) || effect.mustBlockAllAttackers(game)) { // check that it can block at least one of the attackers // and no restictions prevent this boolean mayBlock = false; @@ -740,15 +816,28 @@ public class Combat implements Serializable, Copyable<Combat> { if (mayBlock) { if (controller.isHuman()) { if (!game.isSimulation()) { - game.informPlayer(controller, "Creature should block this turn: " + creature.getIdName()); + if (!effect.mustBlockAllAttackers(game)) { + game.informPlayer(controller, "Creature should block this turn: " + creature.getIdName()); + } else { + game.informPlayer(controller, "Creature should block all attackers it's able to this turn: " + creature.getIdName()); + } } } else { Player defender = game.getPlayer(creature.getControllerId()); if (defender != null) { for (UUID attackingCreatureId : getAttackers()) { if (creature.canBlock(attackingCreatureId, game)) { - defender.declareBlocker(defender.getId(), creature.getId(), attackingCreatureId, game); - break; + if (!effect.mustBlockAllAttackers(game)) { + defender.declareBlocker(defender.getId(), creature.getId(), attackingCreatureId, game); + break; + } else { + // this might be buggy with additional restriction effects + if (creature.getBlocking() == 0) { + defender.declareBlocker(defender.getId(), creature.getId(), attackingCreatureId, game); + } else { + addBlockingGroup(creature.getId(), creature.getId(), defender.getId(), game); + } + } } } } @@ -756,6 +845,82 @@ public class Combat implements Serializable, Copyable<Combat> { return false; } } + /* + // check the mustBlockAllAttackers requirement ------------------------------- + if (effect.mustBlockAllAttackers(game)) { + Set<UUID> attackersToBlock = new HashSet<>(); + // check that it can block at least one of the attackers + // and no restictions prevent this + boolean mayBlock = false; + for (UUID attackingCreatureId : getAttackers()) { + if (creature.canBlock(attackingCreatureId, game)) { + Permanent attackingCreature = game.getPermanent(attackingCreatureId); + if (attackingCreature != null) { + // check if the attacker is already blocked by a max of blockers, so blocker can't block it also + if (attackingCreature.getMaxBlockedBy() != 0) { // 0 = no restriction about the number of possible blockers + int alreadyBlockingCreatures = 0; + for (CombatGroup group : getGroups()) { + if (group.getAttackers().contains(attackingCreatureId)) { + alreadyBlockingCreatures = group.getBlockers().size(); + break; + } + } + if (attackingCreature.getMaxBlockedBy() <= alreadyBlockingCreatures) { + // Attacker can't be blocked by more blockers so check next attacker + continue; + } + } + // check restrictions of the creature to block that prevent it can be blocked + + if (attackingCreature.getMinBlockedBy() > 1) { + // TODO: check if enough possible blockers are available, if true, mayBlock can be set to true + + } else { + attackersToBlock.add(attackingCreatureId); + } + } + } + } + if (!attackersToBlock.isEmpty()) { + //~ CombatGroup group = findGroupOfBlocker(creature.getId()); + //~ if (group == null) { + //~ mayBlock = true; + //~ } else { + //~ for (UUID attackingCreatureId : attackersToBlock) { + //~ if (!group.getAttackers().contains(attackingCreatureId)) { + //~ mayBlock = true; + //~ break; + //~ } + //~ } + game.informPlayers(attackersToBlock.size() + " and " + creature.getBlocking()); + if (attackersToBlock.size() > creature.getBlocking()) { + mayBlock = true; + } + //~ } + } + // if so inform human player or set block for AI player + if (mayBlock) { + if (controller.isHuman()) { + if (!game.isSimulation()) { + game.informPlayer(controller, "Creature should block all attackers if able this turn: " + creature.getIdName()); + } + } else { + Player defender = game.getPlayer(creature.getControllerId()); + if (defender != null) { + for (UUID attackingCreatureId : getAttackers()) { + if (creature.canBlock(attackingCreatureId, game)) { + // ??? + if (attackersToBlock.contains(attackingCreatureId)) { + defender.declareBlocker(defender.getId(), creature.getId(), attackingCreatureId, game); + } + } + } + } + } + return false; + } + } + */ } } @@ -1180,6 +1345,7 @@ public class Combat implements Serializable, Copyable<Combat> { //TODO: handle banding blockingGroups.get(blockerId).attackers.add(attackerId); } + // "blocker.setBlocking(blocker.getBlocking() + 1)" is handled by the attacking combat group } } @@ -1392,6 +1558,7 @@ public class Combat implements Serializable, Copyable<Combat> { } public void removeBlockerGromGroup(UUID blockerId, CombatGroup groupToUnblock, Game game) { + // Manual player action for undoing one declared blocker (used for multi-blocker creatures) Permanent creature = game.getPermanent(blockerId); if (creature != null) { for (CombatGroup group : groups) { @@ -1404,7 +1571,26 @@ public class Combat implements Serializable, Copyable<Combat> { if (creature.getBlocking() > 0) { creature.setBlocking(creature.getBlocking() - 1); } else { - throw new UnsupportedOperationException("Tryinging creature to unblock, but blocking number value of creature < 1"); + throw new UnsupportedOperationException("Trying to unblock creature, but blocking number value of creature < 1"); + } + boolean canRemove = false; + for (CombatGroup blockGroup : getBlockingGroups()) { + if (blockGroup.blockers.contains(blockerId)) { + for (UUID attackerId : group.getAttackers()) { + blockGroup.attackers.remove(attackerId); + blockGroup.attackerOrder.remove(attackerId); + } + if (creature.getBlocking() == 0) { + blockGroup.blockers.remove(blockerId); + blockGroup.attackerOrder.clear(); + } + } + if (blockGroup.blockers.isEmpty()) { + canRemove = true; + } + } + if (canRemove) { + blockingGroups.remove(blockerId); } } } @@ -1412,6 +1598,7 @@ public class Combat implements Serializable, Copyable<Combat> { } public void removeBlocker(UUID blockerId, Game game) { + // Manual player action for undoing all declared blockers (used for single-blocker creatures and multi-blockers exceeding blocking limit) for (CombatGroup group : groups) { if (group.blockers.contains(blockerId)) { group.blockers.remove(blockerId); From a38ec84581e9399ddbbcd308f6b4c16ae31d75a2 Mon Sep 17 00:00:00 2001 From: Zzooouhh <Zzooouhh@users.noreply.github.com> Date: Wed, 10 Jan 2018 19:49:15 +0000 Subject: [PATCH 16/34] Removed slipped beta Blaze of Glory code in case it could break something, as it's still buggy --- .../main/java/mage/game/combat/Combat.java | 175 +----------------- 1 file changed, 5 insertions(+), 170 deletions(-) diff --git a/Mage/src/main/java/mage/game/combat/Combat.java b/Mage/src/main/java/mage/game/combat/Combat.java index ea592fb47b..f6a76d8aef 100644 --- a/Mage/src/main/java/mage/game/combat/Combat.java +++ b/Mage/src/main/java/mage/game/combat/Combat.java @@ -678,82 +678,6 @@ public class Combat implements Serializable, Copyable<Combat> { potentialBlockers.add(creature.getId()); } } - // check the mustBlockAllAttackers requirement (Blaze of Glory) ------------------------------- - if (effect.mustBlockAllAttackers(game)) { - Set<UUID> attackersToBlock = new HashSet<>(); - // check that it can block at least one of the attackers - // and no restictions prevent this - boolean mayBlock = false; - for (UUID attackingCreatureId : getAttackers()) { - if (creature.canBlock(attackingCreatureId, game)) { - Permanent attackingCreature = game.getPermanent(attackingCreatureId); - if (attackingCreature != null) { - // check if the attacker is already blocked by a max of blockers, so blocker can't block it also - if (attackingCreature.getMaxBlockedBy() != 0) { // 0 = no restriction about the number of possible blockers - int alreadyBlockingCreatures = 0; - for (CombatGroup group : getGroups()) { - if (group.getAttackers().contains(attackingCreatureId)) { - alreadyBlockingCreatures = group.getBlockers().size(); - break; - } - } - if (attackingCreature.getMaxBlockedBy() <= alreadyBlockingCreatures) { - // Attacker can't be blocked by more blockers so check next attacker - continue; - } - } - // check restrictions of the creature to block that prevent it can be blocked - - if (attackingCreature.getMinBlockedBy() > 1) { - // TODO: check if enough possible blockers are available, if true, mayBlock can be set to true - - } else { - attackersToBlock.add(attackingCreatureId); - } - } - } - } - //~ // remove creatures already blocked by affected creature - //~ for (CombatGroup group : getBlockingGroups()) { - //~ if (group.getAttackers().contains(attackingCreatureId)) { - //~ for (UUID attackingCreatureId : group.getAttackers()) { - //~ CombatGroup attackersGroup = findGroup(attackingCreatureId); - //~ if (attackersGroup != null) { - //~ if (attackersGroup.getBlockers().contains(creature.getId())) { - //~ attackersToBlock.remove(attackingCreatureId); - //~ } - //~ } - //~ } - //~ } - //~ } - if (!attackersToBlock.isEmpty()) { - if (attackersToBlock.size() > creature.getBlocking()) { - mayBlock = true; - } - } - // if so inform human player or set block for AI player - if (mayBlock) { - if (controller.isHuman()) { - if (!game.isSimulation()) { - game.informPlayer(controller, "Creature should block all attackers it's able to this turn: " + creature.getIdName()); - } - } else { - Player defender = game.getPlayer(creature.getControllerId()); - if (defender != null) { - for (UUID attackingCreatureId : getAttackers()) { - if (creature.canBlock(attackingCreatureId, game)) { - // ??? - if (attackersToBlock.contains(attackingCreatureId)) { - //~ defender.declareBlocker(defender.getId(), creature.getId(), attackingCreatureId, game); - addBlockingGroup(creature.getId(), creature.getId(), defender.getId(), game); - } - } - } - } - } - return false; - } - } } } @@ -777,8 +701,8 @@ public class Combat implements Serializable, Copyable<Combat> { } } - // check the mustBlockAny requirement ---------------------------------------- (and mustBlockAllAttackers for AI) - if (effect.mustBlockAny(game) || effect.mustBlockAllAttackers(game)) { + // check the mustBlockAny requirement ---------------------------------------- + if (effect.mustBlockAny(game)) { // check that it can block at least one of the attackers // and no restictions prevent this boolean mayBlock = false; @@ -816,28 +740,15 @@ public class Combat implements Serializable, Copyable<Combat> { if (mayBlock) { if (controller.isHuman()) { if (!game.isSimulation()) { - if (!effect.mustBlockAllAttackers(game)) { - game.informPlayer(controller, "Creature should block this turn: " + creature.getIdName()); - } else { - game.informPlayer(controller, "Creature should block all attackers it's able to this turn: " + creature.getIdName()); - } + game.informPlayer(controller, "Creature should block this turn: " + creature.getIdName()); } } else { Player defender = game.getPlayer(creature.getControllerId()); if (defender != null) { for (UUID attackingCreatureId : getAttackers()) { if (creature.canBlock(attackingCreatureId, game)) { - if (!effect.mustBlockAllAttackers(game)) { - defender.declareBlocker(defender.getId(), creature.getId(), attackingCreatureId, game); - break; - } else { - // this might be buggy with additional restriction effects - if (creature.getBlocking() == 0) { - defender.declareBlocker(defender.getId(), creature.getId(), attackingCreatureId, game); - } else { - addBlockingGroup(creature.getId(), creature.getId(), defender.getId(), game); - } - } + defender.declareBlocker(defender.getId(), creature.getId(), attackingCreatureId, game); + break; } } } @@ -845,82 +756,6 @@ public class Combat implements Serializable, Copyable<Combat> { return false; } } - /* - // check the mustBlockAllAttackers requirement ------------------------------- - if (effect.mustBlockAllAttackers(game)) { - Set<UUID> attackersToBlock = new HashSet<>(); - // check that it can block at least one of the attackers - // and no restictions prevent this - boolean mayBlock = false; - for (UUID attackingCreatureId : getAttackers()) { - if (creature.canBlock(attackingCreatureId, game)) { - Permanent attackingCreature = game.getPermanent(attackingCreatureId); - if (attackingCreature != null) { - // check if the attacker is already blocked by a max of blockers, so blocker can't block it also - if (attackingCreature.getMaxBlockedBy() != 0) { // 0 = no restriction about the number of possible blockers - int alreadyBlockingCreatures = 0; - for (CombatGroup group : getGroups()) { - if (group.getAttackers().contains(attackingCreatureId)) { - alreadyBlockingCreatures = group.getBlockers().size(); - break; - } - } - if (attackingCreature.getMaxBlockedBy() <= alreadyBlockingCreatures) { - // Attacker can't be blocked by more blockers so check next attacker - continue; - } - } - // check restrictions of the creature to block that prevent it can be blocked - - if (attackingCreature.getMinBlockedBy() > 1) { - // TODO: check if enough possible blockers are available, if true, mayBlock can be set to true - - } else { - attackersToBlock.add(attackingCreatureId); - } - } - } - } - if (!attackersToBlock.isEmpty()) { - //~ CombatGroup group = findGroupOfBlocker(creature.getId()); - //~ if (group == null) { - //~ mayBlock = true; - //~ } else { - //~ for (UUID attackingCreatureId : attackersToBlock) { - //~ if (!group.getAttackers().contains(attackingCreatureId)) { - //~ mayBlock = true; - //~ break; - //~ } - //~ } - game.informPlayers(attackersToBlock.size() + " and " + creature.getBlocking()); - if (attackersToBlock.size() > creature.getBlocking()) { - mayBlock = true; - } - //~ } - } - // if so inform human player or set block for AI player - if (mayBlock) { - if (controller.isHuman()) { - if (!game.isSimulation()) { - game.informPlayer(controller, "Creature should block all attackers if able this turn: " + creature.getIdName()); - } - } else { - Player defender = game.getPlayer(creature.getControllerId()); - if (defender != null) { - for (UUID attackingCreatureId : getAttackers()) { - if (creature.canBlock(attackingCreatureId, game)) { - // ??? - if (attackersToBlock.contains(attackingCreatureId)) { - defender.declareBlocker(defender.getId(), creature.getId(), attackingCreatureId, game); - } - } - } - } - } - return false; - } - } - */ } } From 2685d9f8b4740b4743ccf74aa337c3569b6c93a9 Mon Sep 17 00:00:00 2001 From: LevelX2 <ludwig.hirth@online.de> Date: Thu, 11 Jan 2018 06:12:27 +0100 Subject: [PATCH 17/34] Fixed some possible null pointer exceptions (found in server log). Market Festival, Kindred Summons, Profane Processions, New Blood, Kindred Charge , Bishop of Binding, Metzal Tower of Triumph, Chrome Mox --- .../src/mage/cards/b/BishopOfBinding.java | 8 +++++--- Mage.Sets/src/mage/cards/c/ChromeMox.java | 9 ++++++++- Mage.Sets/src/mage/cards/k/KindredCharge.java | 12 ++++++++---- .../src/mage/cards/k/KindredSummons.java | 19 ++++++++++++------- .../src/mage/cards/m/MarketFestival.java | 11 +++++------ .../mage/cards/m/MetzaliTowerOfTriumph.java | 8 +++++--- Mage.Sets/src/mage/cards/n/NewBlood.java | 8 +++----- .../src/mage/cards/p/ProfaneProcession.java | 2 +- ...tureEntersBattlefieldTriggeredAbility.java | 16 ++++++++-------- .../mage/game/permanent/PermanentImpl.java | 7 +++++++ 10 files changed, 62 insertions(+), 38 deletions(-) diff --git a/Mage.Sets/src/mage/cards/b/BishopOfBinding.java b/Mage.Sets/src/mage/cards/b/BishopOfBinding.java index 903d923eab..ea0b73fdd7 100644 --- a/Mage.Sets/src/mage/cards/b/BishopOfBinding.java +++ b/Mage.Sets/src/mage/cards/b/BishopOfBinding.java @@ -132,9 +132,11 @@ class BishopOfBindingExiledCardsPowerCount implements DynamicValue { @Override public int calculate(Game game, Ability sourceAbility, Effect effect) { ExileZone exileZone = game.getExile().getExileZone(CardUtil.getExileZoneId(game, sourceAbility.getSourceId(), sourceAbility.getSourceObjectZoneChangeCounter())); - Card exiledCard = exileZone.getRandom(game); - if (exiledCard != null) { - return exiledCard.getPower().getValue(); + if (exileZone != null) { + Card exiledCard = exileZone.getRandom(game); + if (exiledCard != null) { + return exiledCard.getPower().getValue(); + } } return 0; } diff --git a/Mage.Sets/src/mage/cards/c/ChromeMox.java b/Mage.Sets/src/mage/cards/c/ChromeMox.java index 292d9cd2a5..8358706f9b 100644 --- a/Mage.Sets/src/mage/cards/c/ChromeMox.java +++ b/Mage.Sets/src/mage/cards/c/ChromeMox.java @@ -182,7 +182,14 @@ class ChromeMoxManaEffect extends ManaEffect { if (choice.getChoices().size() == 1) { choice.setChoice(choice.getChoices().iterator().next()); } else { - player.choose(outcome, choice, game); + while (!player.choose(outcome, choice, game)) { + if (!player.canRespond()) { + return false; + } + } + if (choice.getChoice() == null) { + return false; + } } switch (choice.getChoice()) { case "Black": diff --git a/Mage.Sets/src/mage/cards/k/KindredCharge.java b/Mage.Sets/src/mage/cards/k/KindredCharge.java index 46ef8164c3..fda4299dfb 100644 --- a/Mage.Sets/src/mage/cards/k/KindredCharge.java +++ b/Mage.Sets/src/mage/cards/k/KindredCharge.java @@ -34,10 +34,10 @@ import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbil import mage.abilities.effects.Effect; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.ChooseCreatureTypeEffect; +import mage.abilities.effects.common.CreateTokenCopyTargetEffect; +import mage.abilities.effects.common.ExileTargetEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.abilities.effects.common.ExileTargetEffect; -import mage.abilities.effects.common.CreateTokenCopyTargetEffect; import mage.constants.CardType; import mage.constants.Outcome; import mage.constants.SubType; @@ -57,7 +57,7 @@ public class KindredCharge extends CardImpl { public KindredCharge(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{R}{R}"); - // Choose a creature type. For each creature you control of the chosen type, create a token that's a copy of that creature. + // Choose a creature type. For each creature you control of the chosen type, create a token that's a copy of that creature. // Those tokens gain haste. Exile them at the beginning of the next end step. this.getSpellAbility().addEffect(new ChooseCreatureTypeEffect(Outcome.Copy)); this.getSpellAbility().addEffect(new KindredChargeEffect()); @@ -95,7 +95,11 @@ class KindredChargeEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); MageObject sourceObject = game.getObject(source.getSourceId()); if (controller != null && sourceObject != null) { - String creatureType = game.getState().getValue(sourceObject.getId() + "_type").toString(); + Object object = game.getState().getValue(sourceObject.getId() + "_type"); + if (object == null) { + return false; + } + String creatureType = object.toString(); FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("creature you control of the chosen type"); filter.add(new SubtypePredicate(SubType.byDescription(creatureType))); for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, controller.getId(), game)) { diff --git a/Mage.Sets/src/mage/cards/k/KindredSummons.java b/Mage.Sets/src/mage/cards/k/KindredSummons.java index a34f76dc97..5adea87222 100644 --- a/Mage.Sets/src/mage/cards/k/KindredSummons.java +++ b/Mage.Sets/src/mage/cards/k/KindredSummons.java @@ -34,9 +34,9 @@ import mage.MageObject; import mage.abilities.Ability; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.ChooseCreatureTypeEffect; +import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.cards.Card; import mage.cards.Cards; import mage.cards.CardsImpl; import mage.constants.CardType; @@ -48,6 +48,7 @@ import mage.filter.common.FilterCreatureCard; import mage.filter.predicate.mageobject.SubtypePredicate; import mage.game.Game; import mage.players.Player; + /** * * @author Saga @@ -55,10 +56,10 @@ import mage.players.Player; public class KindredSummons extends CardImpl { public KindredSummons(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{5}{G}{G}"); + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{5}{G}{G}"); - // Choose a creature type. Reveal cards from the top of your library until you reveal X creature cards of the chosen type, - // where X is the number of creatures you control of that type. Put those cards onto the battlefield, + // Choose a creature type. Reveal cards from the top of your library until you reveal X creature cards of the chosen type, + // where X is the number of creatures you control of that type. Put those cards onto the battlefield, // then shuffle the rest of the revealed cards into your library. this.getSpellAbility().addEffect(new ChooseCreatureTypeEffect(Outcome.PutCreatureInPlay)); this.getSpellAbility().addEffect(new KindredSummonsEffect()); @@ -78,8 +79,8 @@ class KindredSummonsEffect extends OneShotEffect { public KindredSummonsEffect() { super(Outcome.PutCreatureInPlay); - this.staticText = "Reveal cards from the top of your library until you reveal X creature cards of the chosen type, " + - "where X is the number of creatures you control of that type. Put those cards onto the battlefield, " + this.staticText = "Reveal cards from the top of your library until you reveal X creature cards of the chosen type, " + + "where X is the number of creatures you control of that type. Put those cards onto the battlefield, " + "then shuffle the rest of the revealed cards into your library"; } @@ -97,7 +98,11 @@ class KindredSummonsEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); MageObject sourceObject = source.getSourceObject(game); if (controller != null && sourceObject != null) { - String creatureType = game.getState().getValue(sourceObject.getId() + "_type").toString(); + Object object = game.getState().getValue(sourceObject.getId() + "_type"); + if (object == null) { + return false; + } + String creatureType = object.toString(); FilterControlledCreaturePermanent filterPermanent = new FilterControlledCreaturePermanent("creature you control of the chosen type"); filterPermanent.add(new SubtypePredicate(SubType.byDescription(creatureType))); int numberOfCards = game.getBattlefield().countAll(filterPermanent, source.getControllerId(), game); diff --git a/Mage.Sets/src/mage/cards/m/MarketFestival.java b/Mage.Sets/src/mage/cards/m/MarketFestival.java index c8f0680272..930a9adb43 100644 --- a/Mage.Sets/src/mage/cards/m/MarketFestival.java +++ b/Mage.Sets/src/mage/cards/m/MarketFestival.java @@ -39,8 +39,8 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.choices.ChoiceColor; import mage.constants.CardType; -import mage.constants.SubType; import mage.constants.Outcome; +import mage.constants.SubType; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; @@ -57,10 +57,9 @@ import mage.target.common.TargetLandPermanent; public class MarketFestival extends CardImpl { public MarketFestival(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{3}{G}"); + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{G}"); this.subtype.add(SubType.AURA); - // Enchant land TargetPermanent auraTarget = new TargetLandPermanent(); this.getSpellAbility().addTarget(auraTarget); @@ -108,14 +107,12 @@ class MarketFestivalTriggeredAbility extends TriggeredManaAbility { return enchantment != null && event.getSourceId().equals(enchantment.getAttachedTo()); } - @Override public String getRule() { return "Whenever enchanted land is tapped for mana, its controller adds two mana in any combination of colors to his or her mana pool <i>(in addition to the mana the land produces)</i>."; } } - class MarketFestivalManaEffect extends ManaEffect { public MarketFestivalManaEffect() { @@ -152,7 +149,9 @@ class MarketFestivalManaEffect extends ManaEffect { return false; } } - + if (choiceColor.getChoice() == null) { // Possible after reconnect? + return false; + } choiceColor.increaseMana(mana); } checkToFirePossibleEvents(mana, game, source); diff --git a/Mage.Sets/src/mage/cards/m/MetzaliTowerOfTriumph.java b/Mage.Sets/src/mage/cards/m/MetzaliTowerOfTriumph.java index b22efae84d..b060d0513c 100644 --- a/Mage.Sets/src/mage/cards/m/MetzaliTowerOfTriumph.java +++ b/Mage.Sets/src/mage/cards/m/MetzaliTowerOfTriumph.java @@ -126,9 +126,11 @@ class MetzaliTowerOfTriumphEffect extends OneShotEffect { available.add(permanent); } } - Permanent permanent = available.get(RandomUtil.nextInt(available.size())); - if (permanent != null) { - permanent.destroy(source.getSourceId(), game, false); + if (!available.isEmpty()) { + Permanent permanent = available.get(RandomUtil.nextInt(available.size())); + if (permanent != null) { + permanent.destroy(source.getSourceId(), game, false); + } } return true; } diff --git a/Mage.Sets/src/mage/cards/n/NewBlood.java b/Mage.Sets/src/mage/cards/n/NewBlood.java index a6f3905c73..e65704f83e 100644 --- a/Mage.Sets/src/mage/cards/n/NewBlood.java +++ b/Mage.Sets/src/mage/cards/n/NewBlood.java @@ -27,6 +27,7 @@ */ package mage.cards.n; +import java.util.UUID; import mage.MageObject; import mage.abilities.Ability; import mage.abilities.Mode; @@ -52,10 +53,6 @@ import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetCreaturePermanent; import mage.target.targetpointer.FixedTarget; -import java.util.LinkedHashSet; -import java.util.UUID; -import java.util.stream.Collectors; - /** * * @author LevelX2 @@ -124,7 +121,7 @@ class NewBloodEffect extends OneShotEffect { class ChangeCreatureTypeTargetEffect extends ContinuousEffectImpl { private SubType fromSubType; - private SubType toSubType; + private final SubType toSubType; public ChangeCreatureTypeTargetEffect(SubType fromSubType, SubType toSubType, Duration duration) { super(duration, Layer.TextChangingEffects_3, SubLayer.NA, Outcome.Benefit); @@ -153,6 +150,7 @@ class ChangeCreatureTypeTargetEffect extends ContinuousEffectImpl { } } if (typeChoice.getChoice() == null) { + discard(); return; } fromSubType = SubType.byDescription(typeChoice.getChoice()); diff --git a/Mage.Sets/src/mage/cards/p/ProfaneProcession.java b/Mage.Sets/src/mage/cards/p/ProfaneProcession.java index be2b250fcf..bafe4c068d 100644 --- a/Mage.Sets/src/mage/cards/p/ProfaneProcession.java +++ b/Mage.Sets/src/mage/cards/p/ProfaneProcession.java @@ -105,7 +105,7 @@ class ProfaneProcessionEffect extends OneShotEffect { new ExileTargetEffect(exileId, sourceObject.getIdName()).setTargetPointer(targetPointer).apply(game, source); game.applyEffects(); ExileZone exileZone = game.getExile().getExileZone(exileId); - if (exileZone.size() > 2) { + if (exileZone != null && exileZone.size() > 2) { new TransformSourceEffect(true).apply(game, source); } return true; diff --git a/Mage/src/main/java/mage/abilities/common/CreatureEntersBattlefieldTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/CreatureEntersBattlefieldTriggeredAbility.java index 3f9f31d2bf..85b39c3a7d 100644 --- a/Mage/src/main/java/mage/abilities/common/CreatureEntersBattlefieldTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/common/CreatureEntersBattlefieldTriggeredAbility.java @@ -27,11 +27,12 @@ */ package mage.abilities.common; -import mage.constants.Zone; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.Effect; +import mage.constants.Zone; import mage.filter.common.FilterCreaturePermanent; import mage.game.Game; +import mage.game.events.EntersTheBattlefieldEvent; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; @@ -51,7 +52,7 @@ public class CreatureEntersBattlefieldTriggeredAbility extends TriggeredAbilityI /** * optional = false<br> * opponentController = false - * + * * @param effect */ public CreatureEntersBattlefieldTriggeredAbility(Effect effect) { @@ -60,7 +61,7 @@ public class CreatureEntersBattlefieldTriggeredAbility extends TriggeredAbilityI /** * opponentController = false - * + * * @param effect * @param optional */ @@ -69,7 +70,7 @@ public class CreatureEntersBattlefieldTriggeredAbility extends TriggeredAbilityI } /** - * + * * @param effect * @param optional * @param opponentController @@ -78,7 +79,7 @@ public class CreatureEntersBattlefieldTriggeredAbility extends TriggeredAbilityI this(Zone.BATTLEFIELD, effect, optional, opponentController); } - + /** * @param zone * @param effect @@ -104,7 +105,6 @@ public class CreatureEntersBattlefieldTriggeredAbility extends TriggeredAbilityI } } - public CreatureEntersBattlefieldTriggeredAbility(CreatureEntersBattlefieldTriggeredAbility ability) { super(ability); this.opponentController = ability.opponentController; @@ -118,7 +118,7 @@ public class CreatureEntersBattlefieldTriggeredAbility extends TriggeredAbilityI @Override public boolean checkTrigger(GameEvent event, Game game) { - Permanent permanent = game.getPermanent(event.getTargetId()); + Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget(); if (filter.match(permanent, sourceId, controllerId, game) && (permanent.getControllerId().equals(this.controllerId) ^ opponentController)) { if (!this.getTargets().isEmpty()) { @@ -137,7 +137,7 @@ public class CreatureEntersBattlefieldTriggeredAbility extends TriggeredAbilityI @Override public String getRule() { - return "Whenever a " + filter.getMessage() +" enters the battlefield under " + return "Whenever a " + filter.getMessage() + " enters the battlefield under " + (opponentController ? "an opponent's control, " : "your control, ") + super.getRule(); } diff --git a/Mage/src/main/java/mage/game/permanent/PermanentImpl.java b/Mage/src/main/java/mage/game/permanent/PermanentImpl.java index b97a5af04d..37111ccd77 100644 --- a/Mage/src/main/java/mage/game/permanent/PermanentImpl.java +++ b/Mage/src/main/java/mage/game/permanent/PermanentImpl.java @@ -60,12 +60,15 @@ import mage.target.TargetCard; import mage.util.CardUtil; import mage.util.GameLog; import mage.util.ThreadLocalStringBuilder; +import org.apache.log4j.Logger; /** * @author BetaSteward_at_googlemail.com */ public abstract class PermanentImpl extends CardImpl implements Permanent { + private static final Logger logger = Logger.getLogger(PermanentImpl.class); + public class MarkedDamageInfo { public MarkedDamageInfo(Counter counter, MageObject sourceObject) { @@ -699,6 +702,10 @@ public abstract class PermanentImpl extends CardImpl implements Permanent { } } } + if (getSpellAbility() == null) { + logger.info("FATAL : no spell ability for attach to permanent: " + getName()); + return; + } if (!getSpellAbility().getTargets().isEmpty() && (getSpellAbility().getTargets().get(0) instanceof TargetCard)) { Card attachedToCard = game.getCard(this.getAttachedTo()); if (attachedToCard != null) { From 4c9ed95662f936c8859d6f5c1767e22cd1baeef1 Mon Sep 17 00:00:00 2001 From: LevelX2 <ludwig.hirth@online.de> Date: Thu, 11 Jan 2018 07:14:49 +0100 Subject: [PATCH 18/34] Xmage 1.4.26V11d --- .../src/main/java/mage/utils/MageVersion.java | 2 +- Mage.Sets/src/mage/cards/a/AuraGraft.java | 13 +++++++------ .../java/mage/cards/repository/CardRepository.java | 2 +- Mage/src/main/java/mage/game/combat/Combat.java | 3 +-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Mage.Common/src/main/java/mage/utils/MageVersion.java b/Mage.Common/src/main/java/mage/utils/MageVersion.java index 4a6adeb7dc..749041fff5 100644 --- a/Mage.Common/src/main/java/mage/utils/MageVersion.java +++ b/Mage.Common/src/main/java/mage/utils/MageVersion.java @@ -41,7 +41,7 @@ public class MageVersion implements Serializable, Comparable<MageVersion> { public final static int MAGE_VERSION_MAJOR = 1; public final static int MAGE_VERSION_MINOR = 4; public final static int MAGE_VERSION_PATCH = 26; - public final static String MAGE_VERSION_MINOR_PATCH = "V11c"; + public final static String MAGE_VERSION_MINOR_PATCH = "V11d"; public final static String MAGE_VERSION_INFO = ""; private final int major; diff --git a/Mage.Sets/src/mage/cards/a/AuraGraft.java b/Mage.Sets/src/mage/cards/a/AuraGraft.java index 80970884c7..09cc30a020 100644 --- a/Mage.Sets/src/mage/cards/a/AuraGraft.java +++ b/Mage.Sets/src/mage/cards/a/AuraGraft.java @@ -57,7 +57,7 @@ import mage.util.TargetAddress; public class AuraGraft extends CardImpl { public AuraGraft(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{1}{U}"); + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{U}"); // Gain control of target Aura that's attached to a permanent. Attach it to another permanent it can enchant. FilterPermanent filter = new FilterPermanent("Aura that's attached to a permanent"); @@ -81,7 +81,6 @@ public class AuraGraft extends CardImpl { } } - class AttachedToPermanentPredicate implements ObjectPlayerPredicate<ObjectPlayer<Permanent>> { public AttachedToPermanentPredicate() { @@ -95,6 +94,7 @@ class AttachedToPermanentPredicate implements ObjectPlayerPredicate<ObjectPlayer } class PermanentCanBeAttachedToPredicate implements ObjectPlayerPredicate<ObjectPlayer<Permanent>> { + protected Permanent aura; public PermanentCanBeAttachedToPredicate(Permanent aura) { @@ -102,6 +102,7 @@ class PermanentCanBeAttachedToPredicate implements ObjectPlayerPredicate<ObjectP this.aura = aura; } + @Override public boolean apply(ObjectPlayer<Permanent> input, Game game) { Permanent potentialAttachment = input.getObject(); for (TargetAddress addr : TargetAddress.walk(aura)) { @@ -130,7 +131,7 @@ class MoveTargetAuraEffect extends OneShotEffect { } @Override - public boolean apply(Game game, Ability source){ + public boolean apply(Game game, Ability source) { Permanent enchantment = game.getPermanent(targetPointer.getFirst(game, source)); if (enchantment == null) { return false; @@ -150,10 +151,10 @@ class MoveTargetAuraEffect extends OneShotEffect { Target target = new TargetPermanent(filter); target.setNotTarget(true); if (target.canChoose(oldAttachment.getId(), controller.getId(), game) - && controller.choose(outcome, target, oldAttachment.getId(), game)) { + && controller.choose(outcome, target, oldAttachment.getId(), game)) { Permanent newAttachment = game.getPermanent(target.getFirstTarget()); - if (newAttachment != null && - oldAttachment.removeAttachment(enchantment.getId(), game)) { + if (newAttachment != null + && oldAttachment.removeAttachment(enchantment.getId(), game)) { newAttachment.addAttachment(enchantment.getId(), game); game.informPlayers(enchantment.getLogName() + " was unattached from " + oldAttachment.getLogName() + " and attached to " + newAttachment.getLogName()); return true; diff --git a/Mage/src/main/java/mage/cards/repository/CardRepository.java b/Mage/src/main/java/mage/cards/repository/CardRepository.java index db9f2bf33f..857fd8e6b4 100644 --- a/Mage/src/main/java/mage/cards/repository/CardRepository.java +++ b/Mage/src/main/java/mage/cards/repository/CardRepository.java @@ -58,7 +58,7 @@ public enum CardRepository { // raise this if db structure was changed private static final long CARD_DB_VERSION = 51; // raise this if new cards were added to the server - private static final long CARD_CONTENT_VERSION = 99; + private static final long CARD_CONTENT_VERSION = 100; private Dao<CardInfo, Object> cardDao; private Set<String> classNames; diff --git a/Mage/src/main/java/mage/game/combat/Combat.java b/Mage/src/main/java/mage/game/combat/Combat.java index f6a76d8aef..617a29c50c 100644 --- a/Mage/src/main/java/mage/game/combat/Combat.java +++ b/Mage/src/main/java/mage/game/combat/Combat.java @@ -38,7 +38,6 @@ import mage.abilities.keyword.special.JohanVigilanceAbility; import mage.constants.Outcome; import mage.constants.Zone; import mage.filter.StaticFilters; -import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.common.FilterCreatureForCombatBlock; import mage.filter.common.FilterCreaturePermanent; import mage.game.Game; @@ -655,7 +654,7 @@ public class Combat implements Serializable, Copyable<Combat> { Map<UUID, Set<UUID>> mustBeBlockedByAtLeastOne = new HashMap<>(); // check mustBlock requirements of creatures from opponents of attacking player - for (Permanent creature : game.getBattlefield().getActivePermanents(new FilterControlledCreaturePermanent(), player.getId(), game)) { + for (Permanent creature : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURES_CONTROLLED, player.getId(), game)) { // creature is controlled by an opponent of the attacker if (opponents.contains(creature.getControllerId())) { From 96e6a917b40e14bc81f7deac206d13b89a0b20bd Mon Sep 17 00:00:00 2001 From: spjspj <spjspj4@gmail.com> Date: Thu, 11 Jan 2018 17:43:33 +1100 Subject: [PATCH 19/34] Add 3 cards (UGL) --- Mage.Sets/src/mage/cards/f/FowlPlay.java | 92 +++++++++++++ Mage.Sets/src/mage/cards/g/GoblinTutor.java | 125 ++++++++++++++++++ .../src/mage/cards/h/HungryHungryHeifer.java | 116 ++++++++++++++++ Mage.Sets/src/mage/sets/Unglued.java | 3 + .../effects/common/DoIfCostPaid.java | 13 +- .../src/main/java/mage/constants/SubType.java | 6 +- 6 files changed, 347 insertions(+), 8 deletions(-) create mode 100644 Mage.Sets/src/mage/cards/f/FowlPlay.java create mode 100644 Mage.Sets/src/mage/cards/g/GoblinTutor.java create mode 100644 Mage.Sets/src/mage/cards/h/HungryHungryHeifer.java diff --git a/Mage.Sets/src/mage/cards/f/FowlPlay.java b/Mage.Sets/src/mage/cards/f/FowlPlay.java new file mode 100644 index 0000000000..1493f8fcda --- /dev/null +++ b/Mage.Sets/src/mage/cards/f/FowlPlay.java @@ -0,0 +1,92 @@ +/* + * 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.f; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.continuous.BecomesCreatureAttachedEffect; +import mage.constants.Outcome; +import mage.target.TargetPermanent; +import mage.abilities.keyword.EnchantAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.SubType; +import mage.constants.Zone; +import mage.game.permanent.token.Token; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author spjspj + */ +public class FowlPlay extends CardImpl { + + public FowlPlay(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{U}"); + + this.subtype.add(SubType.AURA); + + // Enchant creature + TargetPermanent auraTarget = new TargetCreaturePermanent(); + this.getSpellAbility().addTarget(auraTarget); + this.getSpellAbility().addEffect(new AttachEffect(Outcome.AddAbility)); + Ability ability = new EnchantAbility(auraTarget.getTargetName()); + this.addAbility(ability); + + // Enchanted creature is a Chicken with base power and toughness 1/1 and loses all abilities. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, + new BecomesCreatureAttachedEffect(new FowlPlayToken(), + "Enchanted creature is a Chicken with base power and toughness 1/1 and loses all abilities", + Duration.WhileOnBattlefield, BecomesCreatureAttachedEffect.LoseType.ABILITIES_SUBTYPE_AND_PT))); + } + + public FowlPlay(final FowlPlay card) { + super(card); + } + + @Override + public FowlPlay copy() { + return new FowlPlay(this); + } +} + +class FowlPlayToken extends Token { + + public FowlPlayToken() { + super("Chicken", "a Chicken with base power and toughness 1/1 with no abilities"); + cardType.add(CardType.CREATURE); + subtype.add(SubType.CHICKEN); + power = new MageInt(1); + toughness = new MageInt(1); + } +} diff --git a/Mage.Sets/src/mage/cards/g/GoblinTutor.java b/Mage.Sets/src/mage/cards/g/GoblinTutor.java new file mode 100644 index 0000000000..bb6a135605 --- /dev/null +++ b/Mage.Sets/src/mage/cards/g/GoblinTutor.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.cards.g; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.effects.Effect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.filter.FilterCard; +import mage.filter.common.FilterArtifactCard; +import mage.filter.common.FilterCreatureCard; +import mage.filter.common.FilterEnchantmentCard; +import mage.filter.common.FilterInstantOrSorceryCard; +import mage.filter.predicate.mageobject.NamePredicate; +import mage.game.Game; +import mage.players.Player; +import mage.target.common.TargetCardInLibrary; + +/** + * + * @author spjspj + */ +public class GoblinTutor extends CardImpl { + + public GoblinTutor(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{R}"); + + // Roll a six-sided die. If you roll a 1, Goblin Tutor has no effect. Otherwise, search your library for the indicated card, reveal it, put it into your hand, then shuffle your library. 2 - A card named Goblin Tutor 3 - An enchantment card 4 - An artifact card 5 - A creature card 6 - An instant or sorcery card + this.getSpellAbility().addEffect(new GoblinTutorEffect()); + } + + public GoblinTutor(final GoblinTutor card) { + super(card); + } + + @Override + public GoblinTutor copy() { + return new GoblinTutor(this); + } +} + +class GoblinTutorEffect extends OneShotEffect { + + private static final FilterCard filter = new FilterCard("card named Goblin Tutor"); + + static { + filter.add(new NamePredicate("Goblin Tutor")); + } + + public GoblinTutorEffect() { + super(Outcome.PutCreatureInPlay); + this.staticText = "Roll a six-sided die. If you roll a 1, {this} has no effect. Otherwise, search your library for the indicated card, reveal it, put it into your hand, then shuffle your library. 2 - A card named Goblin Tutor 3 - An enchantment card 4 - An artifact card 5 - A creature card 6 - An instant or sorcery card"; + } + + public GoblinTutorEffect(final GoblinTutorEffect effect) { + super(effect); + } + + @Override + public GoblinTutorEffect copy() { + return new GoblinTutorEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + int amount = controller.rollDice(game, 6); + + Effect effect = null; + // 2 - A card named Goblin Tutor + // 3 - An enchantment card + // 4 - An artifact card + // 5 - A creature card + // 6 - An instant or sorcery card + if (amount == 2) { + effect = new SearchLibraryPutInHandEffect(new TargetCardInLibrary(0, 1, filter), true); + } else if (amount == 3) { + effect = new SearchLibraryPutInHandEffect(new TargetCardInLibrary(0, 1, new FilterEnchantmentCard()), true); + } else if (amount == 4) { + effect = new SearchLibraryPutInHandEffect(new TargetCardInLibrary(0, 1, new FilterArtifactCard()), true); + } else if (amount == 5) { + effect = new SearchLibraryPutInHandEffect(new TargetCardInLibrary(0, 1, new FilterCreatureCard()), true); + } else if (amount == 6) { + effect = new SearchLibraryPutInHandEffect(new TargetCardInLibrary(0, 1, new FilterInstantOrSorceryCard()), true); + } + + if (effect != null) { + effect.apply(game, source); + return true; + } + } + return false; + } +} diff --git a/Mage.Sets/src/mage/cards/h/HungryHungryHeifer.java b/Mage.Sets/src/mage/cards/h/HungryHungryHeifer.java new file mode 100644 index 0000000000..40ffa92a0b --- /dev/null +++ b/Mage.Sets/src/mage/cards/h/HungryHungryHeifer.java @@ -0,0 +1,116 @@ +/* + * 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.h; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; +import mage.abilities.costs.common.RemoveCounterCost; +import mage.abilities.effects.OneShotEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.constants.TargetController; +import mage.constants.Zone; +import mage.filter.common.FilterControlledPermanent; +import mage.filter.predicate.permanent.CounterPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.common.TargetControlledPermanent; + +/** + * + * @author spjspj + */ +public class HungryHungryHeifer extends CardImpl { + + public HungryHungryHeifer(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{G}"); + + this.subtype.add(SubType.COW); + this.power = new MageInt(3); + this.toughness = new MageInt(3); + + // At the beginning of your upkeep, you may remove a counter from a permanent you control. If you don't, sacrifice Hungry Hungry Heifer. + this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new HungryHungryHeiferEffect(), TargetController.YOU, false, false)); + } + + public HungryHungryHeifer(final HungryHungryHeifer card) { + super(card); + } + + @Override + public HungryHungryHeifer copy() { + return new HungryHungryHeifer(this); + } +} + +class HungryHungryHeiferEffect extends OneShotEffect { + + private static final FilterControlledPermanent filter = new FilterControlledPermanent("a permanent you control with a counter on it"); + + static { + filter.add(new CounterPredicate(null)); + } + + public HungryHungryHeiferEffect() { + super(Outcome.Sacrifice); + this.staticText = "you may remove a counter from a permanent you control. If you don't, sacrifice {this}"; + } + + public HungryHungryHeiferEffect(final HungryHungryHeiferEffect effect) { + super(effect); + } + + @Override + public HungryHungryHeiferEffect copy() { + return new HungryHungryHeiferEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + Permanent sourceObject = (Permanent) source.getSourceObjectIfItStillExists(game); + if (sourceObject != null && controller != null) { + if (controller.chooseUse(outcome, "Remove a counter from a permanent you control?", source, game)) { + TargetControlledPermanent target = new TargetControlledPermanent(1, 1, filter, true); + RemoveCounterCost cost = new RemoveCounterCost(target); + if (cost.pay(null, game, source.getSourceId(), controller.getId(), true)) { + return true; + } + } + sourceObject.sacrifice(source.getSourceId(), game); + return true; + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/Unglued.java b/Mage.Sets/src/mage/sets/Unglued.java index 9e33d2e77c..e6b503616b 100644 --- a/Mage.Sets/src/mage/sets/Unglued.java +++ b/Mage.Sets/src/mage/sets/Unglued.java @@ -24,7 +24,10 @@ public class Unglued extends ExpansionSet { cards.add(new SetCardInfo("Chicken Egg", 41, Rarity.COMMON, mage.cards.c.ChickenEgg.class)); cards.add(new SetCardInfo("Chicken a la King", 17, Rarity.RARE, mage.cards.c.ChickenALaKing.class)); cards.add(new SetCardInfo("Forest", 88, Rarity.LAND, mage.cards.basiclands.Forest.class, new CardGraphicInfo(FrameStyle.UGL_FULL_ART_BASIC, false))); + cards.add(new SetCardInfo("Fowl Play", 24, Rarity.COMMON, mage.cards.f.FowlPlay.class)); + cards.add(new SetCardInfo("Goblin Tutor", 45, Rarity.UNCOMMON, mage.cards.g.GoblinTutor.class)); cards.add(new SetCardInfo("Growth Spurt", 61, Rarity.COMMON, mage.cards.g.GrowthSpurt.class)); + cards.add(new SetCardInfo("Hungry Hungry Heifer", 63, Rarity.UNCOMMON, mage.cards.h.HungryHungryHeifer.class)); cards.add(new SetCardInfo("Island", 85, Rarity.LAND, mage.cards.basiclands.Island.class, new CardGraphicInfo(FrameStyle.UGL_FULL_ART_BASIC, false))); cards.add(new SetCardInfo("Jack-in-the-Mox", 75, Rarity.RARE, mage.cards.j.JackInTheMox.class)); cards.add(new SetCardInfo("Jumbo Imp", 34, Rarity.UNCOMMON, mage.cards.j.JumboImp.class)); diff --git a/Mage/src/main/java/mage/abilities/effects/common/DoIfCostPaid.java b/Mage/src/main/java/mage/abilities/effects/common/DoIfCostPaid.java index c264b34e9d..bba8baab7f 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DoIfCostPaid.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DoIfCostPaid.java @@ -36,7 +36,9 @@ public class DoIfCostPaid extends OneShotEffect { public DoIfCostPaid(Effect effect, Cost cost, String chooseUseText, boolean optional) { super(Outcome.Benefit); - this.executingEffects.add(effect); + if (effect != null) { + this.executingEffects.add(effect); + } this.cost = cost; this.chooseUseText = chooseUseText; this.optional = optional; @@ -74,10 +76,9 @@ public class DoIfCostPaid extends OneShotEffect { message = CardUtil.replaceSourceName(message, mageObject.getLogName()); boolean result = true; if (cost.canPay(source, source.getSourceId(), player.getId(), game) - && (!optional || player.chooseUse(executingEffects.get(0).getOutcome(), message, source, game))) { + && executingEffects.size() > 0 && (!optional || player.chooseUse(executingEffects.get(0).getOutcome(), message, source, game))) { cost.clearPaid(); if (cost.pay(source, game, source.getSourceId(), player.getId(), false)) { - game.applyEffects(); // To end effects e.g. of sacrificed permanents for (Effect effect : executingEffects) { effect.setTargetPointer(this.targetPointer); if (effect instanceof OneShotEffect) { @@ -87,7 +88,8 @@ public class DoIfCostPaid extends OneShotEffect { } } player.resetStoredBookmark(game); // otherwise you can e.g. undo card drawn with Mentor of the Meek - } else if (!otherwiseEffects.isEmpty()) { + } + else if (!otherwiseEffects.isEmpty()) { for (Effect effect : otherwiseEffects) { effect.setTargetPointer(this.targetPointer); if (effect instanceof OneShotEffect) { @@ -97,7 +99,8 @@ public class DoIfCostPaid extends OneShotEffect { } } } - } else if (!otherwiseEffects.isEmpty()) { + } + else if (!otherwiseEffects.isEmpty()) { for (Effect effect : otherwiseEffects) { effect.setTargetPointer(this.targetPointer); if (effect instanceof OneShotEffect) { diff --git a/Mage/src/main/java/mage/constants/SubType.java b/Mage/src/main/java/mage/constants/SubType.java index a893adab28..8ff379718b 100644 --- a/Mage/src/main/java/mage/constants/SubType.java +++ b/Mage/src/main/java/mage/constants/SubType.java @@ -85,14 +85,14 @@ public enum SubType { CENTAUR("Centaur", SubTypeSet.CreatureType), CEREAN("Cerean", SubTypeSet.CreatureType, true), // Star Wars CEPHALID("Cephalid", SubTypeSet.CreatureType), - CHICKEN("Chicken", SubTypeSet.CreatureType), // Unglued + CHICKEN("Chicken", SubTypeSet.CreatureType, true), // Unglued CHIMERA("Chimera", SubTypeSet.CreatureType), CHISS("Chiss", SubTypeSet.CreatureType, true), CITIZEN("Citizen", SubTypeSet.CreatureType), CLERIC("Cleric", SubTypeSet.CreatureType), COCKATRICE("Cockatrice", SubTypeSet.CreatureType), CONSTRUCT("Construct", SubTypeSet.CreatureType), - COW("Cow", SubTypeSet.CreatureType), // Unglued + COW("Cow", SubTypeSet.CreatureType, true), // Unglued COWARD("Coward", SubTypeSet.CreatureType), CRAB("Crab", SubTypeSet.CreatureType), CROCODILE("Crocodile", SubTypeSet.CreatureType), @@ -134,7 +134,7 @@ public enum SubType { FROG("Frog", SubTypeSet.CreatureType), FUNGUS("Fungus", SubTypeSet.CreatureType), // G - GAMER("Gamer", SubTypeSet.CreatureType), // Un-sets + GAMER("Gamer", SubTypeSet.CreatureType, true), // Un-sets GAMORREAN("Gamorrean", SubTypeSet.CreatureType, true), // Star Wars GAND("Gand", SubTypeSet.CreatureType, true), // Star Wars GARGOYLE("Gargoyle", SubTypeSet.CreatureType), From 78ac82a2d70da71182db1f9884e41153f17a2e0f Mon Sep 17 00:00:00 2001 From: LevelX2 <ludwig.hirth@online.de> Date: Thu, 11 Jan 2018 12:54:09 +0100 Subject: [PATCH 20/34] * See Red - Fixed that it was wrongly sacrificed (fixes #4395). --- Mage.Sets/src/mage/cards/s/SeeRed.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Mage.Sets/src/mage/cards/s/SeeRed.java b/Mage.Sets/src/mage/cards/s/SeeRed.java index 8c827575e1..7f5ec234b6 100644 --- a/Mage.Sets/src/mage/cards/s/SeeRed.java +++ b/Mage.Sets/src/mage/cards/s/SeeRed.java @@ -52,6 +52,7 @@ import mage.constants.TargetController; import mage.constants.Zone; import mage.target.TargetPermanent; import mage.target.common.TargetCreaturePermanent; +import mage.watchers.common.AttackedThisTurnWatcher; /** * @@ -82,7 +83,7 @@ public class SeeRed extends CardImpl { this.addAbility(new ConditionalTriggeredAbility( new AtTheBeginOfNextEndStepDelayedTriggeredAbility(Zone.BATTLEFIELD, new SacrificeSourceEffect(), TargetController.YOU), new InvertCondition(ControllerAttackedThisTurnCondition.instance), - "At the beginning of your end step, if you didn't attack with a creature this turn, sacrifice {this}.")); + "At the beginning of your end step, if you didn't attack with a creature this turn, sacrifice {this}."), new AttackedThisTurnWatcher()); } public SeeRed(final SeeRed card) { From 63cb9979420e7c1814d3d5cb672da0cfe1d2063d Mon Sep 17 00:00:00 2001 From: spjspj <spjspj4@gmail.com> Date: Thu, 11 Jan 2018 23:42:52 +1100 Subject: [PATCH 21/34] Add 5 cards (UGL) --- Mage.Sets/src/mage/cards/i/Incoming.java | 121 ++++++++++++++++++ Mage.Sets/src/mage/cards/p/PaperTiger.java | 74 +++++++++++ Mage.Sets/src/mage/cards/r/RockLobster.java | 74 +++++++++++ .../src/mage/cards/s/ScissorsLizard.java | 74 +++++++++++ .../mage/cards/t/TheCheeseStandsAlone.java | 118 +++++++++++++++++ Mage.Sets/src/mage/sets/Unglued.java | 5 + 6 files changed, 466 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/i/Incoming.java create mode 100644 Mage.Sets/src/mage/cards/p/PaperTiger.java create mode 100644 Mage.Sets/src/mage/cards/r/RockLobster.java create mode 100644 Mage.Sets/src/mage/cards/s/ScissorsLizard.java create mode 100644 Mage.Sets/src/mage/cards/t/TheCheeseStandsAlone.java diff --git a/Mage.Sets/src/mage/cards/i/Incoming.java b/Mage.Sets/src/mage/cards/i/Incoming.java new file mode 100644 index 0000000000..801a6c2472 --- /dev/null +++ b/Mage.Sets/src/mage/cards/i/Incoming.java @@ -0,0 +1,121 @@ +/* + * 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.i; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.filter.FilterCard; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.game.Game; +import mage.players.Player; +import mage.target.common.TargetCardInLibrary; + +/** + * + * @author spjspj + */ +public class Incoming extends CardImpl { + + public Incoming(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{G}{G}{G}{G}"); + + // Each player searches his or her library for any number of artifact, creature, enchantment, and/or land cards, puts them onto the battlefield, then shuffles his or her library. + this.getSpellAbility().addEffect(new IncomingEffect()); + } + + public Incoming(final Incoming card) { + super(card); + } + + @Override + public Incoming copy() { + return new Incoming(this); + } +} + +class IncomingEffect extends OneShotEffect { + + private static final FilterCard filter = new FilterCard("artifact, creature, enchantment, and/or land cards"); + + static { + filter.add(Predicates.or( + new CardTypePredicate(CardType.ARTIFACT), + new CardTypePredicate(CardType.CREATURE), + new CardTypePredicate(CardType.ENCHANTMENT), + new CardTypePredicate(CardType.LAND))); + } + + public IncomingEffect() { + super(Outcome.Detriment); + this.staticText = "Each player searches his or her library for any number of artifact, creature, enchantment, and/or land cards, puts them onto the battlefield, then shuffles his or her library"; + } + + public IncomingEffect(final IncomingEffect effect) { + super(effect); + } + + @Override + public IncomingEffect copy() { + return new IncomingEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { + Player player = game.getPlayer(playerId); + if (player != null) { + TargetCardInLibrary target = new TargetCardInLibrary(0, Integer.MAX_VALUE, filter); + if (player.searchLibrary(target, game)) { + for (UUID cardId : target.getTargets()) { + Card card = player.getLibrary().getCard(cardId, game); + if (card != null) { + card.putOntoBattlefield(game, Zone.LIBRARY, source.getSourceId(), player.getId(), true); + } + + } + player.shuffleLibrary(source, game); + } + } + } + // prevent undo + controller.resetStoredBookmark(game); + return true; + } + return false; + } +} diff --git a/Mage.Sets/src/mage/cards/p/PaperTiger.java b/Mage.Sets/src/mage/cards/p/PaperTiger.java new file mode 100644 index 0000000000..000fd9a900 --- /dev/null +++ b/Mage.Sets/src/mage/cards/p/PaperTiger.java @@ -0,0 +1,74 @@ +/* + * 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.p; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.common.combat.CantAttackBlockAllEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.SubType; +import mage.constants.Zone; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.mageobject.NamePredicate; + +/** + * + * @author spjspj + */ +public class PaperTiger extends CardImpl { + + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creatures named Rock Lobster"); + + static { + filter.add(new NamePredicate("Rock Lobster")); + } + + public PaperTiger(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{4}"); + + this.subtype.add(SubType.CAT); + this.power = new MageInt(4); + this.toughness = new MageInt(3); + + // Creatures named Rock Lobster can't attack or block. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantAttackBlockAllEffect(Duration.WhileOnBattlefield, filter))); + } + + public PaperTiger(final PaperTiger card) { + super(card); + } + + @Override + public PaperTiger copy() { + return new PaperTiger(this); + } +} diff --git a/Mage.Sets/src/mage/cards/r/RockLobster.java b/Mage.Sets/src/mage/cards/r/RockLobster.java new file mode 100644 index 0000000000..a33decf378 --- /dev/null +++ b/Mage.Sets/src/mage/cards/r/RockLobster.java @@ -0,0 +1,74 @@ +/* + * 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.r; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.common.combat.CantAttackBlockAllEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.SubType; +import mage.constants.Zone; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.mageobject.NamePredicate; + +/** + * + * @author spjspj + */ +public class RockLobster extends CardImpl { + + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creatures named Scissors Lizard"); + + static { + filter.add(new NamePredicate("Scissors Lizard")); + } + + public RockLobster(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{4}"); + + this.subtype.add(SubType.LOBSTER); + this.power = new MageInt(4); + this.toughness = new MageInt(3); + + // Creatures named Scissors Lizard can't attack or block. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantAttackBlockAllEffect(Duration.WhileOnBattlefield, filter))); + } + + public RockLobster(final RockLobster card) { + super(card); + } + + @Override + public RockLobster copy() { + return new RockLobster(this); + } +} diff --git a/Mage.Sets/src/mage/cards/s/ScissorsLizard.java b/Mage.Sets/src/mage/cards/s/ScissorsLizard.java new file mode 100644 index 0000000000..2bc3a78a85 --- /dev/null +++ b/Mage.Sets/src/mage/cards/s/ScissorsLizard.java @@ -0,0 +1,74 @@ +/* + * 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.s; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.common.combat.CantAttackBlockAllEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.SubType; +import mage.constants.Zone; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.mageobject.NamePredicate; + +/** + * + * @author spjspj + */ +public class ScissorsLizard extends CardImpl { + + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creatures named Paper Tiger"); + + static { + filter.add(new NamePredicate("Paper Tiger")); + } + + public ScissorsLizard(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{4}"); + + this.subtype.add(SubType.LIZARD); + this.power = new MageInt(4); + this.toughness = new MageInt(3); + + // Creatures named Paper Tiger can't attack or block. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantAttackBlockAllEffect(Duration.WhileOnBattlefield, filter))); + } + + public ScissorsLizard(final ScissorsLizard card) { + super(card); + } + + @Override + public ScissorsLizard copy() { + return new ScissorsLizard(this); + } +} diff --git a/Mage.Sets/src/mage/cards/t/TheCheeseStandsAlone.java b/Mage.Sets/src/mage/cards/t/TheCheeseStandsAlone.java new file mode 100644 index 0000000000..2f8b7b80c7 --- /dev/null +++ b/Mage.Sets/src/mage/cards/t/TheCheeseStandsAlone.java @@ -0,0 +1,118 @@ +/* + * 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.t; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; +import mage.abilities.effects.ContinuousRuleModifyingEffectImpl; +import mage.abilities.effects.common.WinGameSourceControllerEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.filter.common.FilterControlledPermanent; +import mage.filter.predicate.mageobject.NamePredicate; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.players.Player; + +/** + * + * @author spjspj + */ +public class TheCheeseStandsAlone extends CardImpl { + + public TheCheeseStandsAlone(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{4}{W}{W}"); + + // When you control no permanents other than The Cheese Stands Alone and have no cards in hand, you win the game. + Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new CheeseStandsAloneContinuousEffect()); + this.addAbility(ability); + } + + public TheCheeseStandsAlone(final TheCheeseStandsAlone card) { + super(card); + } + + @Override + public TheCheeseStandsAlone copy() { + return new TheCheeseStandsAlone(this); + } +} + +class CheeseStandsAloneContinuousEffect extends ContinuousRuleModifyingEffectImpl { + + private static final FilterControlledPermanent filter = new FilterControlledPermanent(); + + private boolean wonAlready = false; + static { + filter.add(new NamePredicate("The Cheese Stands Alone")); + } + + public CheeseStandsAloneContinuousEffect() { + super(Duration.EndOfGame, Outcome.Benefit, false, false); + staticText = "When you control no permanents other than {this} and have no cards in hand, you win the game"; + } + + public CheeseStandsAloneContinuousEffect(final CheeseStandsAloneContinuousEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + return true; + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + if (controller.getHand().isEmpty()) { + int numberPerms = new PermanentsOnBattlefieldCount(new FilterControlledPermanent()).calculate(game, source, this); + if (numberPerms == 1) { + if (game.getBattlefield().contains(filter, source.getControllerId(), 1, game)) { + if (!wonAlready) { + wonAlready = true; + controller.won(game); + } + } + } + } + } + return false; + } + + @Override + public CheeseStandsAloneContinuousEffect copy() { + return new CheeseStandsAloneContinuousEffect(this); + } +} diff --git a/Mage.Sets/src/mage/sets/Unglued.java b/Mage.Sets/src/mage/sets/Unglued.java index e6b503616b..f871f4e32e 100644 --- a/Mage.Sets/src/mage/sets/Unglued.java +++ b/Mage.Sets/src/mage/sets/Unglued.java @@ -28,14 +28,19 @@ public class Unglued extends ExpansionSet { cards.add(new SetCardInfo("Goblin Tutor", 45, Rarity.UNCOMMON, mage.cards.g.GoblinTutor.class)); cards.add(new SetCardInfo("Growth Spurt", 61, Rarity.COMMON, mage.cards.g.GrowthSpurt.class)); cards.add(new SetCardInfo("Hungry Hungry Heifer", 63, Rarity.UNCOMMON, mage.cards.h.HungryHungryHeifer.class)); + cards.add(new SetCardInfo("Incoming!", 64, Rarity.RARE, mage.cards.i.Incoming.class)); cards.add(new SetCardInfo("Island", 85, Rarity.LAND, mage.cards.basiclands.Island.class, new CardGraphicInfo(FrameStyle.UGL_FULL_ART_BASIC, false))); cards.add(new SetCardInfo("Jack-in-the-Mox", 75, Rarity.RARE, mage.cards.j.JackInTheMox.class)); cards.add(new SetCardInfo("Jumbo Imp", 34, Rarity.UNCOMMON, mage.cards.j.JumboImp.class)); cards.add(new SetCardInfo("Krazy Kow", 48, Rarity.COMMON, mage.cards.k.KrazyKow.class)); cards.add(new SetCardInfo("Mountain", 87, Rarity.LAND, mage.cards.basiclands.Mountain.class, new CardGraphicInfo(FrameStyle.UGL_FULL_ART_BASIC, false))); + cards.add(new SetCardInfo("Paper Tiger", 78, Rarity.COMMON, mage.cards.p.PaperTiger.class)); cards.add(new SetCardInfo("Plains", 84, Rarity.LAND, mage.cards.basiclands.Plains.class, new CardGraphicInfo(FrameStyle.UGL_FULL_ART_BASIC, false))); cards.add(new SetCardInfo("Poultrygeist", 37, Rarity.COMMON, mage.cards.p.Poultrygeist.class)); + cards.add(new SetCardInfo("Rock Lobster", 79, Rarity.COMMON, mage.cards.r.RockLobster.class)); + cards.add(new SetCardInfo("Scissors Lizard", 80, Rarity.COMMON, mage.cards.s.ScissorsLizard.class)); cards.add(new SetCardInfo("Swamp", 86, Rarity.LAND, mage.cards.basiclands.Swamp.class, new CardGraphicInfo(FrameStyle.UGL_FULL_ART_BASIC, false))); + cards.add(new SetCardInfo("The Cheese Stands Alone", 2, Rarity.RARE, mage.cards.t.TheCheeseStandsAlone.class)); cards.add(new SetCardInfo("Timmy, Power Gamer", 68, Rarity.RARE, mage.cards.t.TimmyPowerGamer.class)); } } From d9bcfa3f31b78af63358fc3c19191f6fddaa251b Mon Sep 17 00:00:00 2001 From: spjspj <spjspj4@gmail.com> Date: Thu, 11 Jan 2018 23:55:37 +1100 Subject: [PATCH 22/34] Add 5 cards (UGL) --- Mage/src/main/java/mage/constants/SubType.java | 1 + 1 file changed, 1 insertion(+) diff --git a/Mage/src/main/java/mage/constants/SubType.java b/Mage/src/main/java/mage/constants/SubType.java index 8ff379718b..e700b9d4f9 100644 --- a/Mage/src/main/java/mage/constants/SubType.java +++ b/Mage/src/main/java/mage/constants/SubType.java @@ -198,6 +198,7 @@ public enum SubType { LHURGOYF("Lhurgoyf", SubTypeSet.CreatureType), LICID("Licid", SubTypeSet.CreatureType), LIZARD("Lizard", SubTypeSet.CreatureType), + LOBSTER("Lobster", SubTypeSet.CreatureType, true), // Unglued // M MANTELLIAN("Mantellian", SubTypeSet.CreatureType, true), // Star Wars MANTICORE("Manticore", SubTypeSet.CreatureType), From 0ba2375ac13de879d5d99bd3be887b5812ba8b9a Mon Sep 17 00:00:00 2001 From: Oleg Agafonov <jaydi85@gmail.com> Date: Thu, 11 Jan 2018 20:37:38 +0400 Subject: [PATCH 23/34] Tests: * added new checks for basic land types/rarity in mage-verify; * fixed tests for UGL cards in mage-verify (wrong json data) --- .../java/mage/verify/VerifyCardDataTest.java | 61 ++++++++++++++++++- 1 file changed, 59 insertions(+), 2 deletions(-) diff --git a/Mage.Verify/src/test/java/mage/verify/VerifyCardDataTest.java b/Mage.Verify/src/test/java/mage/verify/VerifyCardDataTest.java index a915fb1f09..a3df908f98 100644 --- a/Mage.Verify/src/test/java/mage/verify/VerifyCardDataTest.java +++ b/Mage.Verify/src/test/java/mage/verify/VerifyCardDataTest.java @@ -4,6 +4,8 @@ import mage.ObjectColor; import mage.cards.*; import mage.cards.basiclands.BasicLand; import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.SuperType; import org.junit.Assert; import org.junit.Test; @@ -30,6 +32,12 @@ public class VerifyCardDataTest { static { // skip lists for checks (example: unstable cards with same name may have different stats) + // TODO: mtgjson have wrong data for UGL + // remove after fixed + // https://github.com/mtgjson/mtgjson/issues/531 + // https://github.com/mtgjson/mtgjson/issues/534 + // https://github.com/mtgjson/mtgjson/issues/535 + // power-toughness skipListCreate("PT"); skipListAddName("PT", "Garbage Elemental"); // UST @@ -37,19 +45,25 @@ public class VerifyCardDataTest { // color skipListCreate("COLOR"); - //skipListAddName("COLOR", "Ulrich, Uncontested Alpha"); // gatherer is missing the color indicator on one card and json has wrong data (16.12.2017: not actual) // cost skipListCreate("COST"); // supertype skipListCreate("SUPERTYPE"); + skipListAddName("SUPERTYPE", "Timmy, Power Gamer"); // UGL, mtgjson error // type skipListCreate("TYPE"); + skipListAddName("TYPE", "Fowl Play"); // UGL, mtgjson error // subtype skipListCreate("SUBTYPE"); + skipListAddName("SUBTYPE", "Timmy, Power Gamer"); // UGL, mtgjson error + skipListAddName("SUBTYPE", "Fowl Play"); // UGL, mtgjson error + skipListAddName("SUBTYPE", "Paper Tiger"); // UGL, mtgjson error + skipListAddName("SUBTYPE", "Rock Lobster"); // UGL, mtgjson error + skipListAddName("SUBTYPE", "Scissors Lizard"); // UGL, mtgjson error // number skipListCreate("NUMBER"); @@ -76,7 +90,7 @@ public class VerifyCardDataTest { private void fail(Card card, String category, String message) { failed++; - System.out.println("Error: (" + category + ") " + message + " for " + card.getName()); + System.out.println("Error: (" + category + ") " + message + " for " + card.getName() + " (" + card.getExpansionSetCode() + ")"); } private int failed = 0; @@ -280,6 +294,7 @@ public class VerifyCardDataTest { checkTypes(card, ref); checkColors(card, ref); //checkNumbers(card, ref); // TODO: load data from allsets.json and check it (allcards.json do not have card numbers) + checkBasicLands(card, ref); } private void checkColors(Card card, JsonCard ref) { @@ -393,6 +408,48 @@ public class VerifyCardDataTest { } } + private boolean isBasicLandName(String name) { + + String checkName = name; + if (name.startsWith("Snow-Covered ")) { + // snow lands is basic lands too + checkName = name.replace("Snow-Covered ", ""); + } + + return checkName.equals("Island") || + checkName.equals("Forest") || + checkName.equals("Swamp") || + checkName.equals("Plains") || + checkName.equals("Mountain") || + checkName.equals("Wastes"); + } + + private void checkBasicLands(Card card, JsonCard ref) { + + // basic lands must have Rarity.LAND and SuperType.BASIC + // other cards can't have that stats + + if (isBasicLandName(card.getName())) { + // lands + if (card.getRarity() != Rarity.LAND) { + fail(card, "rarity", "basic land must be Rarity.LAND"); + } + + if (!card.getSuperType().contains(SuperType.BASIC)) { + fail(card, "supertype", "basic land must be SuperType.BASIC"); + } + } else { + // non lands + if (card.getRarity() == Rarity.LAND) { + fail(card, "rarity", "only basic land can be Rarity.LAND"); + } + + if (card.getSuperType().contains(SuperType.BASIC)) { + fail(card, "supertype", "only basic land can be SuperType.BASIC"); + } + } + } + private String join(Iterable<?> items) { StringBuilder result = new StringBuilder(); for (Object item : items) { From 3632d7afe3c3c1cfc6e0c84fee72295067e1dc4f Mon Sep 17 00:00:00 2001 From: Oleg Agafonov <jaydi85@gmail.com> Date: Thu, 11 Jan 2018 20:46:39 +0400 Subject: [PATCH 24/34] Fixed 27 wrong land types (can't see or too many in boosters): * e.g. Urza's lands counts as basic; * Arabian Nights: x1 * Coldsnap: x5 * Ice Age: x5 * Masters Edition IV: x12 * Oath of the Gatewatch: x4 --- Mage.Sets/src/mage/sets/ArabianNights.java | 2 +- Mage.Sets/src/mage/sets/Coldsnap.java | 10 ++++---- Mage.Sets/src/mage/sets/IceAge.java | 10 ++++---- Mage.Sets/src/mage/sets/MastersEditionIV.java | 24 +++++++++---------- .../src/mage/sets/OathOfTheGatewatch.java | 8 +++---- 5 files changed, 27 insertions(+), 27 deletions(-) diff --git a/Mage.Sets/src/mage/sets/ArabianNights.java b/Mage.Sets/src/mage/sets/ArabianNights.java index eb76776430..ea52d56edc 100644 --- a/Mage.Sets/src/mage/sets/ArabianNights.java +++ b/Mage.Sets/src/mage/sets/ArabianNights.java @@ -119,7 +119,7 @@ public class ArabianNights extends ExpansionSet { cards.add(new SetCardInfo("Mijae Djinn", 51, Rarity.RARE, mage.cards.m.MijaeDjinn.class)); cards.add(new SetCardInfo("Moorish Cavalry", 62, Rarity.COMMON, mage.cards.m.MoorishCavalry.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Moorish Cavalry", 63, Rarity.COMMON, mage.cards.m.MoorishCavalry.class, NON_FULL_USE_VARIOUS)); - cards.add(new SetCardInfo("Mountain", 91, Rarity.COMMON, mage.cards.basiclands.Mountain.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Mountain", 91, Rarity.LAND, mage.cards.basiclands.Mountain.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Nafs Asp", 36, Rarity.COMMON, NafsAsp.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Nafs Asp", 37, Rarity.COMMON, NafsAsp.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Oasis", 92, Rarity.UNCOMMON, mage.cards.o.Oasis.class)); diff --git a/Mage.Sets/src/mage/sets/Coldsnap.java b/Mage.Sets/src/mage/sets/Coldsnap.java index fd5daa98b1..e66a4aeb68 100644 --- a/Mage.Sets/src/mage/sets/Coldsnap.java +++ b/Mage.Sets/src/mage/sets/Coldsnap.java @@ -170,11 +170,11 @@ public class Coldsnap extends ExpansionSet { cards.add(new SetCardInfo("Sheltering Ancient", 121, Rarity.UNCOMMON, mage.cards.s.ShelteringAncient.class)); cards.add(new SetCardInfo("Simian Brawler", 122, Rarity.COMMON, mage.cards.s.SimianBrawler.class)); cards.add(new SetCardInfo("Skred", 97, Rarity.COMMON, mage.cards.s.Skred.class)); - cards.add(new SetCardInfo("Snow-Covered Forest", 155, Rarity.COMMON, mage.cards.s.SnowCoveredForest.class)); - cards.add(new SetCardInfo("Snow-Covered Island", 152, Rarity.COMMON, mage.cards.s.SnowCoveredIsland.class)); - cards.add(new SetCardInfo("Snow-Covered Mountain", 154, Rarity.COMMON, mage.cards.s.SnowCoveredMountain.class)); - cards.add(new SetCardInfo("Snow-Covered Plains", 151, Rarity.COMMON, mage.cards.s.SnowCoveredPlains.class)); - cards.add(new SetCardInfo("Snow-Covered Swamp", 153, Rarity.COMMON, mage.cards.s.SnowCoveredSwamp.class)); + cards.add(new SetCardInfo("Snow-Covered Forest", 155, Rarity.LAND, mage.cards.s.SnowCoveredForest.class)); + cards.add(new SetCardInfo("Snow-Covered Island", 152, Rarity.LAND, mage.cards.s.SnowCoveredIsland.class)); + cards.add(new SetCardInfo("Snow-Covered Mountain", 154, Rarity.LAND, mage.cards.s.SnowCoveredMountain.class)); + cards.add(new SetCardInfo("Snow-Covered Plains", 151, Rarity.LAND, mage.cards.s.SnowCoveredPlains.class)); + cards.add(new SetCardInfo("Snow-Covered Swamp", 153, Rarity.LAND, mage.cards.s.SnowCoveredSwamp.class)); cards.add(new SetCardInfo("Soul Spike", 70, Rarity.RARE, mage.cards.s.SoulSpike.class)); cards.add(new SetCardInfo("Sound the Call", 123, Rarity.COMMON, mage.cards.s.SoundTheCall.class)); cards.add(new SetCardInfo("Squall Drifter", 17, Rarity.COMMON, mage.cards.s.SquallDrifter.class)); diff --git a/Mage.Sets/src/mage/sets/IceAge.java b/Mage.Sets/src/mage/sets/IceAge.java index 1e47953dc1..ed0abad511 100644 --- a/Mage.Sets/src/mage/sets/IceAge.java +++ b/Mage.Sets/src/mage/sets/IceAge.java @@ -287,11 +287,11 @@ public class IceAge extends ExpansionSet { cards.add(new SetCardInfo("Skeleton Ship", 379, Rarity.RARE, mage.cards.s.SkeletonShip.class)); cards.add(new SetCardInfo("Skull Catapult", 311, Rarity.UNCOMMON, mage.cards.s.SkullCatapult.class)); cards.add(new SetCardInfo("Snow Fortress", 312, Rarity.RARE, mage.cards.s.SnowFortress.class)); - cards.add(new SetCardInfo("Snow-Covered Forest", 347, Rarity.COMMON, mage.cards.s.SnowCoveredForest.class)); - cards.add(new SetCardInfo("Snow-Covered Island", 348, Rarity.COMMON, mage.cards.s.SnowCoveredIsland.class)); - cards.add(new SetCardInfo("Snow-Covered Mountain", 349, Rarity.COMMON, mage.cards.s.SnowCoveredMountain.class)); - cards.add(new SetCardInfo("Snow-Covered Plains", 350, Rarity.COMMON, mage.cards.s.SnowCoveredPlains.class)); - cards.add(new SetCardInfo("Snow-Covered Swamp", 351, Rarity.COMMON, mage.cards.s.SnowCoveredSwamp.class)); + cards.add(new SetCardInfo("Snow-Covered Forest", 347, Rarity.LAND, mage.cards.s.SnowCoveredForest.class)); + cards.add(new SetCardInfo("Snow-Covered Island", 348, Rarity.LAND, mage.cards.s.SnowCoveredIsland.class)); + cards.add(new SetCardInfo("Snow-Covered Mountain", 349, Rarity.LAND, mage.cards.s.SnowCoveredMountain.class)); + cards.add(new SetCardInfo("Snow-Covered Plains", 350, Rarity.LAND, mage.cards.s.SnowCoveredPlains.class)); + cards.add(new SetCardInfo("Snow-Covered Swamp", 351, Rarity.LAND, mage.cards.s.SnowCoveredSwamp.class)); cards.add(new SetCardInfo("Snow Hound", 277, Rarity.UNCOMMON, mage.cards.s.SnowHound.class)); cards.add(new SetCardInfo("Soldevi Golem", 313, Rarity.RARE, mage.cards.s.SoldeviGolem.class)); cards.add(new SetCardInfo("Soldevi Machinist", 102, Rarity.UNCOMMON, mage.cards.s.SoldeviMachinist.class)); diff --git a/Mage.Sets/src/mage/sets/MastersEditionIV.java b/Mage.Sets/src/mage/sets/MastersEditionIV.java index 9357961a62..10af1532ce 100644 --- a/Mage.Sets/src/mage/sets/MastersEditionIV.java +++ b/Mage.Sets/src/mage/sets/MastersEditionIV.java @@ -279,19 +279,19 @@ public class MastersEditionIV extends ExpansionSet { cards.add(new SetCardInfo("Two-Headed Giant of Foriys", 139, Rarity.UNCOMMON, mage.cards.t.TwoHeadedGiantOfForiys.class)); cards.add(new SetCardInfo("Underground Sea", 256, Rarity.RARE, mage.cards.u.UndergroundSea.class)); cards.add(new SetCardInfo("Urza's Chalice", 236, Rarity.COMMON, mage.cards.u.UrzasChalice.class)); - cards.add(new SetCardInfo("Urza's Mine", "257a", Rarity.LAND, mage.cards.u.UrzasMine.class, NON_FULL_USE_VARIOUS)); - cards.add(new SetCardInfo("Urza's Mine", "257b", Rarity.LAND, mage.cards.u.UrzasMine.class, NON_FULL_USE_VARIOUS)); - cards.add(new SetCardInfo("Urza's Mine", "257c", Rarity.LAND, mage.cards.u.UrzasMine.class, NON_FULL_USE_VARIOUS)); - cards.add(new SetCardInfo("Urza's Mine", "257d", Rarity.LAND, mage.cards.u.UrzasMine.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Urza's Mine", "257a", Rarity.COMMON, mage.cards.u.UrzasMine.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Urza's Mine", "257b", Rarity.COMMON, mage.cards.u.UrzasMine.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Urza's Mine", "257c", Rarity.COMMON, mage.cards.u.UrzasMine.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Urza's Mine", "257d", Rarity.COMMON, mage.cards.u.UrzasMine.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Urza's Miter", 237, Rarity.RARE, mage.cards.u.UrzasMiter.class)); - cards.add(new SetCardInfo("Urza's Power Plant", "258a", Rarity.LAND, mage.cards.u.UrzasPowerPlant.class, NON_FULL_USE_VARIOUS)); - cards.add(new SetCardInfo("Urza's Power Plant", "258b", Rarity.LAND, mage.cards.u.UrzasPowerPlant.class, NON_FULL_USE_VARIOUS)); - cards.add(new SetCardInfo("Urza's Power Plant", "258c", Rarity.LAND, mage.cards.u.UrzasPowerPlant.class, NON_FULL_USE_VARIOUS)); - cards.add(new SetCardInfo("Urza's Power Plant", "258d", Rarity.LAND, mage.cards.u.UrzasPowerPlant.class, NON_FULL_USE_VARIOUS)); - cards.add(new SetCardInfo("Urza's Tower", "259a", Rarity.LAND, mage.cards.u.UrzasTower.class, NON_FULL_USE_VARIOUS)); - cards.add(new SetCardInfo("Urza's Tower", "259b", Rarity.LAND, mage.cards.u.UrzasTower.class, NON_FULL_USE_VARIOUS)); - cards.add(new SetCardInfo("Urza's Tower", "259c", Rarity.LAND, mage.cards.u.UrzasTower.class, NON_FULL_USE_VARIOUS)); - cards.add(new SetCardInfo("Urza's Tower", "259d", Rarity.LAND, mage.cards.u.UrzasTower.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Urza's Power Plant", "258a", Rarity.COMMON, mage.cards.u.UrzasPowerPlant.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Urza's Power Plant", "258b", Rarity.COMMON, mage.cards.u.UrzasPowerPlant.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Urza's Power Plant", "258c", Rarity.COMMON, mage.cards.u.UrzasPowerPlant.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Urza's Power Plant", "258d", Rarity.COMMON, mage.cards.u.UrzasPowerPlant.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Urza's Tower", "259a", Rarity.COMMON, mage.cards.u.UrzasTower.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Urza's Tower", "259b", Rarity.COMMON, mage.cards.u.UrzasTower.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Urza's Tower", "259c", Rarity.COMMON, mage.cards.u.UrzasTower.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Urza's Tower", "259d", Rarity.COMMON, mage.cards.u.UrzasTower.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Veteran Bodyguard", 32, Rarity.RARE, mage.cards.v.VeteranBodyguard.class)); cards.add(new SetCardInfo("Vibrating Sphere", 238, Rarity.RARE, mage.cards.v.VibratingSphere.class)); cards.add(new SetCardInfo("Volcanic Island", 260, Rarity.RARE, mage.cards.v.VolcanicIsland.class)); diff --git a/Mage.Sets/src/mage/sets/OathOfTheGatewatch.java b/Mage.Sets/src/mage/sets/OathOfTheGatewatch.java index 7f6dec55f6..30fe536acc 100644 --- a/Mage.Sets/src/mage/sets/OathOfTheGatewatch.java +++ b/Mage.Sets/src/mage/sets/OathOfTheGatewatch.java @@ -218,10 +218,10 @@ public class OathOfTheGatewatch extends ExpansionSet { cards.add(new SetCardInfo("Wandering Fumarole", 182, Rarity.RARE, mage.cards.w.WanderingFumarole.class)); cards.add(new SetCardInfo("Warden of Geometries", 11, Rarity.COMMON, mage.cards.w.WardenOfGeometries.class)); cards.add(new SetCardInfo("Warping Wail", 12, Rarity.UNCOMMON, mage.cards.w.WarpingWail.class)); - cards.add(new SetCardInfo("Wastes", "183a", Rarity.COMMON, Wastes.class, NON_FULL_USE_VARIOUS)); - cards.add(new SetCardInfo("Wastes", "183b", Rarity.COMMON, Wastes.class, FULL_ART_BFZ_VARIOUS)); - cards.add(new SetCardInfo("Wastes", "184a", Rarity.COMMON, Wastes.class, NON_FULL_USE_VARIOUS)); - cards.add(new SetCardInfo("Wastes", "184b", Rarity.COMMON, Wastes.class, FULL_ART_BFZ_VARIOUS)); + cards.add(new SetCardInfo("Wastes", "183a", Rarity.LAND, Wastes.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Wastes", "183b", Rarity.LAND, Wastes.class, FULL_ART_BFZ_VARIOUS)); + cards.add(new SetCardInfo("Wastes", "184a", Rarity.LAND, Wastes.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Wastes", "184b", Rarity.LAND, Wastes.class, FULL_ART_BFZ_VARIOUS)); cards.add(new SetCardInfo("Weapons Trainer", 160, Rarity.UNCOMMON, mage.cards.w.WeaponsTrainer.class)); cards.add(new SetCardInfo("Witness the End", 82, Rarity.COMMON, mage.cards.w.WitnessTheEnd.class)); cards.add(new SetCardInfo("World Breaker", 126, Rarity.MYTHIC, mage.cards.w.WorldBreaker.class)); From 25072be3062ef8d54bb4bde191c103ba0530c9a2 Mon Sep 17 00:00:00 2001 From: Oleg Agafonov <jaydi85@gmail.com> Date: Thu, 11 Jan 2018 20:56:24 +0400 Subject: [PATCH 25/34] * Expel from Orazca - Fixed wrong name --- Mage.Sets/src/mage/sets/RivalsOfIxalan.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mage.Sets/src/mage/sets/RivalsOfIxalan.java b/Mage.Sets/src/mage/sets/RivalsOfIxalan.java index 3589deae5b..a6497d7d6f 100644 --- a/Mage.Sets/src/mage/sets/RivalsOfIxalan.java +++ b/Mage.Sets/src/mage/sets/RivalsOfIxalan.java @@ -110,7 +110,7 @@ public class RivalsOfIxalan extends ExpansionSet { cards.add(new SetCardInfo("Etali, Primal Storm", 100, Rarity.RARE, mage.cards.e.EtaliPrimalStorm.class)); cards.add(new SetCardInfo("Everdawn Champion", 6, Rarity.UNCOMMON, mage.cards.e.EverdawnChampion.class)); cards.add(new SetCardInfo("Evolving Wilds", 186, Rarity.COMMON, mage.cards.e.EvolvingWilds.class)); - cards.add(new SetCardInfo("Expel From Orazca", 37, Rarity.UNCOMMON, mage.cards.e.ExpelFromOrazca.class)); + cards.add(new SetCardInfo("Expel from Orazca", 37, Rarity.UNCOMMON, mage.cards.e.ExpelFromOrazca.class)); cards.add(new SetCardInfo("Exultant Skymarcher", 7, Rarity.COMMON, mage.cards.e.ExultantSkymarcher.class)); cards.add(new SetCardInfo("Famished Paladin", 8, Rarity.UNCOMMON, mage.cards.f.FamishedPaladin.class)); cards.add(new SetCardInfo("Fanatical Firebrand", 101, Rarity.COMMON, mage.cards.f.FanaticalFirebrand.class)); From 50a906072e0b2c1087021206f4241f14e164c864 Mon Sep 17 00:00:00 2001 From: Oleg Agafonov <jaydi85@gmail.com> Date: Thu, 11 Jan 2018 21:03:11 +0400 Subject: [PATCH 26/34] * HASCON Promo 2017 - Fixed image downloading for Grimlock cards --- Mage.Sets/src/mage/sets/HasconPromo2017.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Mage.Sets/src/mage/sets/HasconPromo2017.java b/Mage.Sets/src/mage/sets/HasconPromo2017.java index 6ceec640ac..f1392050cf 100644 --- a/Mage.Sets/src/mage/sets/HasconPromo2017.java +++ b/Mage.Sets/src/mage/sets/HasconPromo2017.java @@ -45,8 +45,8 @@ public class HasconPromo2017 extends ExpansionSet { private HasconPromo2017() { super("HASCON Promo 2017", "H17", ExpansionSet.buildDate(2017, 9, 8), SetType.JOKESET); - cards.add(new ExpansionSet.SetCardInfo("Grimlock, Dinobot Leader", 1, Rarity.MYTHIC, mage.cards.g.GrimlockDinobotLeader.class)); - cards.add(new ExpansionSet.SetCardInfo("Grimlock, Ferocious King", 1, Rarity.MYTHIC, mage.cards.g.GrimlockFerociousKing.class)); + cards.add(new ExpansionSet.SetCardInfo("Grimlock, Dinobot Leader", "1a", Rarity.MYTHIC, mage.cards.g.GrimlockDinobotLeader.class)); + cards.add(new ExpansionSet.SetCardInfo("Grimlock, Ferocious King", "1b", Rarity.MYTHIC, mage.cards.g.GrimlockFerociousKing.class)); cards.add(new ExpansionSet.SetCardInfo("Sword of Dungeons & Dragons", 3, Rarity.MYTHIC, mage.cards.s.SwordOfDungeonsAndDragons.class)); } } From ca46a8872aae478a93f6d99ba6118ef08c087caf Mon Sep 17 00:00:00 2001 From: Zzooouhh <Zzooouhh@users.noreply.github.com> Date: Thu, 11 Jan 2018 17:53:32 +0000 Subject: [PATCH 27/34] Moved PermanentInListPredicate to common predicates --- .../permanent/PermanentInListPredicate.java | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 Mage/src/main/java/mage/filter/predicate/permanent/PermanentInListPredicate.java diff --git a/Mage/src/main/java/mage/filter/predicate/permanent/PermanentInListPredicate.java b/Mage/src/main/java/mage/filter/predicate/permanent/PermanentInListPredicate.java new file mode 100644 index 0000000000..cd70834eca --- /dev/null +++ b/Mage/src/main/java/mage/filter/predicate/permanent/PermanentInListPredicate.java @@ -0,0 +1,51 @@ +/* + * 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.filter.predicate.permanent; + +import java.util.List; +import mage.filter.predicate.Predicate; +import mage.game.Game; +import mage.game.permanent.Permanent; + +/** + * + * @author L_J + */ +public class PermanentInListPredicate implements Predicate<Permanent> { + + private final List<Permanent> permanents; + + public PermanentInListPredicate(List<Permanent> permanents) { + this.permanents = permanents; + } + + @Override + public boolean apply(Permanent input, Game game) { + return permanents.contains(input); + } +} From 3b7ca8b0f6858325d28c87876ed03041be7b83ee Mon Sep 17 00:00:00 2001 From: Zzooouhh <Zzooouhh@users.noreply.github.com> Date: Thu, 11 Jan 2018 17:58:14 +0000 Subject: [PATCH 28/34] Implemented Camouflage --- Mage.Sets/src/mage/cards/c/Camouflage.java | 227 +++++++++++++++++++++ 1 file changed, 227 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/c/Camouflage.java diff --git a/Mage.Sets/src/mage/cards/c/Camouflage.java b/Mage.Sets/src/mage/cards/c/Camouflage.java new file mode 100644 index 0000000000..d7cc8a7419 --- /dev/null +++ b/Mage.Sets/src/mage/cards/c/Camouflage.java @@ -0,0 +1,227 @@ +/* + * 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.c; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.CastOnlyDuringPhaseStepSourceAbility; +import mage.abilities.condition.common.MyTurnCondition; +import mage.abilities.effects.ContinuousRuleModifyingEffectImpl; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.PhaseStep; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.permanent.PermanentInListPredicate; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.common.FilterCreaturePermanent; +import mage.game.Game; +import mage.game.combat.CombatGroup; +import mage.game.events.GameEvent; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.Target; +import mage.target.common.TargetControlledCreaturePermanent; +import mage.util.RandomUtil; + +/** + * + * @author L_J + */ +public class Camouflage extends CardImpl { + + public Camouflage(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{G}"); + + // Cast Camouflage only during your declare attackers step. + this.addAbility(new CastOnlyDuringPhaseStepSourceAbility(null, PhaseStep.DECLARE_ATTACKERS, MyTurnCondition.instance, "Cast {this} only during your declare attackers step")); + + // This turn, instead of declaring blockers, each defending player chooses any number of creatures he or she controls and divides them into a number of piles equal to the number of attacking creatures for whom that player is the defending player. Creatures he or she controls that can block additional creatures may likewise be put into additional piles. Assign each pile to a different one of those attacking creatures at random. Each creature in a pile that can block the creature that pile is assigned to does so. (Piles can be empty.) + this.getSpellAbility().addEffect(new CamouflageEffect()); + } + + public Camouflage(final Camouflage card) { + super(card); + } + + @Override + public Camouflage copy() { + return new Camouflage(this); + } +} + +class CamouflageEffect extends ContinuousRuleModifyingEffectImpl { + + public CamouflageEffect() { + super(Duration.EndOfTurn, Outcome.Benefit, false, false); + staticText = "This turn, instead of declaring blockers, each defending player chooses any number of creatures he or she controls and divides them into a number of piles equal to the number of attacking creatures for whom that player is the defending player. Creatures he or she controls that can block additional creatures may likewise be put into additional piles. Assign each pile to a different one of those attacking creatures at random. Each creature in a pile that can block the creature that pile is assigned to does so"; + } + + public CamouflageEffect(final CamouflageEffect effect) { + super(effect); + } + + @Override + public CamouflageEffect copy() { + return new CamouflageEffect(this); + } + + @Override + public boolean checksEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.DECLARING_BLOCKERS; + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + Map<UUID, List<List<Permanent>>> masterMap = new HashMap<>(); + // Each defending player chooses any number of creatures he or she controls + // and divides them into a number of piles equal to the number of attacking creatures for whom that player is the defending player (piles can be empty) + for (UUID defenderId : game.getCombat().getPlayerDefenders(game)) { + Player defender = game.getPlayer(defenderId); + if (defender != null) { + List<List<Permanent>> masterList = new ArrayList<>(); + int attackerCount = 0; + for (CombatGroup combatGroup : game.getCombat().getGroups()) { + if (combatGroup.getDefendingPlayerId().equals(defenderId)) { + attackerCount += combatGroup.getAttackers().size(); + } + } + // This shouldn't be necessary, but just in case + for (Permanent permanent : game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), defenderId, game)) { + permanent.setBlocking(0); + } + + boolean declinedChoice = false; + while (masterList.size() < attackerCount) { + List<Permanent> newPile = new ArrayList<>(); + if (!declinedChoice) { + FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("creatures you control not yet assigned to a pile"); + for (List<Permanent> list : masterList) { + // Creatures he or she controls that can block additional creatures may likewise be put into additional piles. + // (This temporarily manipulates Blocking values to "test" how many blockers the creature has still left to assign) + List<Permanent> spentBlockers = new ArrayList<>(); + for (Permanent possibleBlocker : list) { + if (possibleBlocker.getMaxBlocks() != 0 && possibleBlocker.getBlocking() >= possibleBlocker.getMaxBlocks()) { + spentBlockers.add(possibleBlocker); + } + } + filter.add(Predicates.not(new PermanentInListPredicate(spentBlockers))); + } + if (defender.chooseUse(Outcome.Neutral, "Make a new blocker pile? If not, all remaining piles stay empty. (remaining piles: " + (attackerCount - masterList.size()) + ')', source, game)) { + Target target = new TargetControlledCreaturePermanent(0, Integer.MAX_VALUE, filter, true); + if (target.canChoose(source.getSourceId(), defenderId, game)) { + if (defender.chooseTarget(Outcome.Neutral, target, source, game)) { + for (UUID creatureId : target.getTargets()) { + Permanent creature = game.getPermanent(creatureId); + if (creature != null) { + creature.setBlocking(creature.getBlocking() + 1); + newPile.add(creature); + } + } + } + } + } else { + declinedChoice = true; + } + } + masterList.add(newPile); + + StringBuilder sb = new StringBuilder("Blocker pile of ").append(defender.getLogName()).append(" (no. " + masterList.size() + "): "); + int i = 0; + for (Permanent permanent : newPile) { + i++; + sb.append(permanent.getLogName()); + if (i < newPile.size()) { + sb.append(", "); + } + } + game.informPlayers(sb.toString()); + } + // Clear all test Blocking values before assigning piles + for (Permanent permanent : game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), defenderId, game)) { + permanent.setBlocking(0); + } + masterMap.put(defenderId, masterList); + } + } + // Assign each pile to a different one of those attacking creatures at random. Each creature in a pile that can block the creature that pile is assigned to does so + if (!masterMap.isEmpty()) { + for (UUID playerId : masterMap.keySet()) { + List<Permanent> available = new ArrayList<>(); + for (CombatGroup combatGroup : game.getCombat().getGroups()) { + if (combatGroup.getDefendingPlayerId().equals(playerId)) { + for (UUID attackerId : combatGroup.getAttackers()) { + Permanent permanent = game.getPermanent(attackerId); + if (permanent != null && permanent.isCreature()) { + available.add(permanent); + } + } + } + } + + List<List<Permanent>> allPiles = masterMap.get(playerId); + for (List<Permanent> pile : allPiles) { + if (available.isEmpty()) { + break; + } + int randomAttacker = RandomUtil.nextInt(available.size()); + Permanent attacker = available.get(randomAttacker); + if (attacker != null) { + available.remove(randomAttacker); + for (Permanent blocker : pile) { + CombatGroup group = game.getCombat().findGroup(attacker.getId()); + if (group != null) { + if (blocker.canBlock(attacker.getId(), game) && (blocker.getMaxBlocks() == 0 || group.getAttackers().size() <= blocker.getMaxBlocks())) { + boolean notYetBlocked = group.getBlockers().isEmpty(); + group.addBlockerToGroup(blocker.getId(), blocker.getControllerId(), game); + game.getCombat().addBlockingGroup(blocker.getId(), attacker.getId(), blocker.getControllerId(), game); + if (notYetBlocked) { + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.CREATURE_BLOCKED, attacker.getId(), null)); + } + // TODO: find an alternate event solution for multi-blockers (as per issue #4285), this will work fine for single blocker creatures though + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.BLOCKER_DECLARED, attacker.getId(), blocker.getId(), blocker.getControllerId())); + } + } + } + } + } + } + } + return true; + } + return false; + } +} From fe3829fca1368e731408beede617e8a69961117c Mon Sep 17 00:00:00 2001 From: Zzooouhh <Zzooouhh@users.noreply.github.com> Date: Thu, 11 Jan 2018 18:00:34 +0000 Subject: [PATCH 29/34] Implemented Camouflage --- Mage.Sets/src/mage/sets/LimitedEditionAlpha.java | 1 + 1 file changed, 1 insertion(+) diff --git a/Mage.Sets/src/mage/sets/LimitedEditionAlpha.java b/Mage.Sets/src/mage/sets/LimitedEditionAlpha.java index f0e7f85908..020c9da561 100644 --- a/Mage.Sets/src/mage/sets/LimitedEditionAlpha.java +++ b/Mage.Sets/src/mage/sets/LimitedEditionAlpha.java @@ -49,6 +49,7 @@ public class LimitedEditionAlpha extends ExpansionSet { cards.add(new SetCardInfo("Bog Wraith", 4, Rarity.UNCOMMON, mage.cards.b.BogWraith.class)); cards.add(new SetCardInfo("Braingeyser", 51, Rarity.RARE, mage.cards.b.Braingeyser.class)); cards.add(new SetCardInfo("Burrowing", 139, Rarity.UNCOMMON, mage.cards.b.Burrowing.class)); + cards.add(new SetCardInfo("Camouflage", 96, Rarity.UNCOMMON, mage.cards.c.Camouflage.class)); cards.add(new SetCardInfo("Castle", 193, Rarity.UNCOMMON, mage.cards.c.Castle.class)); cards.add(new SetCardInfo("Celestial Prism", 234, Rarity.UNCOMMON, mage.cards.c.CelestialPrism.class)); cards.add(new SetCardInfo("Channel", 97, Rarity.UNCOMMON, mage.cards.c.Channel.class)); From 93b8b91a1ad7fbe1710c53cd1b9257ddab6ff432 Mon Sep 17 00:00:00 2001 From: Zzooouhh <Zzooouhh@users.noreply.github.com> Date: Thu, 11 Jan 2018 18:00:51 +0000 Subject: [PATCH 30/34] Implemented Camouflage --- Mage.Sets/src/mage/sets/LimitedEditionBeta.java | 1 + 1 file changed, 1 insertion(+) diff --git a/Mage.Sets/src/mage/sets/LimitedEditionBeta.java b/Mage.Sets/src/mage/sets/LimitedEditionBeta.java index 8ba3eaf2dc..c02e0a923e 100644 --- a/Mage.Sets/src/mage/sets/LimitedEditionBeta.java +++ b/Mage.Sets/src/mage/sets/LimitedEditionBeta.java @@ -49,6 +49,7 @@ public class LimitedEditionBeta extends ExpansionSet { cards.add(new SetCardInfo("Bog Wraith", 96, Rarity.UNCOMMON, mage.cards.b.BogWraith.class)); cards.add(new SetCardInfo("Braingeyser", 51, Rarity.RARE, mage.cards.b.Braingeyser.class)); cards.add(new SetCardInfo("Burrowing", 139, Rarity.UNCOMMON, mage.cards.b.Burrowing.class)); + cards.add(new SetCardInfo("Camouflage", 188, Rarity.UNCOMMON, mage.cards.c.Camouflage.class)); cards.add(new SetCardInfo("Castle", 9, Rarity.UNCOMMON, mage.cards.c.Castle.class)); cards.add(new SetCardInfo("Celestial Prism", 235, Rarity.UNCOMMON, mage.cards.c.CelestialPrism.class)); cards.add(new SetCardInfo("Channel", 189, Rarity.UNCOMMON, mage.cards.c.Channel.class)); From 9e4ebfabadfe0fcda17302fa938604ff2d536593 Mon Sep 17 00:00:00 2001 From: Zzooouhh <Zzooouhh@users.noreply.github.com> Date: Thu, 11 Jan 2018 18:01:14 +0000 Subject: [PATCH 31/34] Implemented Camouflage --- Mage.Sets/src/mage/sets/UnlimitedEdition.java | 1 + 1 file changed, 1 insertion(+) diff --git a/Mage.Sets/src/mage/sets/UnlimitedEdition.java b/Mage.Sets/src/mage/sets/UnlimitedEdition.java index 872c6232f4..597123b77e 100644 --- a/Mage.Sets/src/mage/sets/UnlimitedEdition.java +++ b/Mage.Sets/src/mage/sets/UnlimitedEdition.java @@ -49,6 +49,7 @@ public class UnlimitedEdition extends ExpansionSet { cards.add(new SetCardInfo("Bog Wraith", 4, Rarity.UNCOMMON, mage.cards.b.BogWraith.class)); cards.add(new SetCardInfo("Braingeyser", 51, Rarity.RARE, mage.cards.b.Braingeyser.class)); cards.add(new SetCardInfo("Burrowing", 139, Rarity.UNCOMMON, mage.cards.b.Burrowing.class)); + cards.add(new SetCardInfo("Camouflage", 96, Rarity.UNCOMMON, mage.cards.c.Camouflage.class)); cards.add(new SetCardInfo("Castle", 193, Rarity.UNCOMMON, mage.cards.c.Castle.class)); cards.add(new SetCardInfo("Celestial Prism", 235, Rarity.UNCOMMON, mage.cards.c.CelestialPrism.class)); cards.add(new SetCardInfo("Channel", 97, Rarity.UNCOMMON, mage.cards.c.Channel.class)); From 83a26a00073b6fec18f50e688385a37d39b5e99d Mon Sep 17 00:00:00 2001 From: Zzooouhh <Zzooouhh@users.noreply.github.com> Date: Thu, 11 Jan 2018 18:22:35 +0000 Subject: [PATCH 32/34] Moved PermanentInListPredicate to common predicates --- Mage.Sets/src/mage/cards/b/BalduvianWarlord.java | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/Mage.Sets/src/mage/cards/b/BalduvianWarlord.java b/Mage.Sets/src/mage/cards/b/BalduvianWarlord.java index 2da4a8907d..7620a427d2 100644 --- a/Mage.Sets/src/mage/cards/b/BalduvianWarlord.java +++ b/Mage.Sets/src/mage/cards/b/BalduvianWarlord.java @@ -48,7 +48,7 @@ import mage.constants.PhaseStep; import mage.constants.Zone; import mage.filter.common.FilterAttackingCreature; import mage.filter.common.FilterBlockingCreature; -import mage.filter.predicate.Predicate; +import mage.filter.predicate.permanent.PermanentInListPredicate; import mage.game.Game; import mage.game.combat.CombatGroup; import mage.game.events.GameEvent; @@ -177,17 +177,3 @@ class BalduvianWarlordUnblockEffect extends OneShotEffect { return false; } } - -class PermanentInListPredicate implements Predicate<Permanent> { - - private final List<Permanent> permanents; - - public PermanentInListPredicate(List<Permanent> permanents) { - this.permanents = permanents; - } - - @Override - public boolean apply(Permanent input, Game game) { - return permanents.contains(input); - } -} From 709b45f9429548f31a8a4fc0682c079cdca53d84 Mon Sep 17 00:00:00 2001 From: Zzooouhh <Zzooouhh@users.noreply.github.com> Date: Thu, 11 Jan 2018 18:23:05 +0000 Subject: [PATCH 33/34] Moved PermanentInListPredicate to common predicates --- Mage.Sets/src/mage/cards/f/FalseOrders.java | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/Mage.Sets/src/mage/cards/f/FalseOrders.java b/Mage.Sets/src/mage/cards/f/FalseOrders.java index f8ab78aba4..39c6091ffb 100644 --- a/Mage.Sets/src/mage/cards/f/FalseOrders.java +++ b/Mage.Sets/src/mage/cards/f/FalseOrders.java @@ -45,8 +45,8 @@ import mage.filter.FilterPermanent; import mage.filter.common.FilterAttackingCreature; import mage.filter.predicate.ObjectPlayer; import mage.filter.predicate.ObjectPlayerPredicate; -import mage.filter.predicate.Predicate; import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.predicate.permanent.PermanentInListPredicate; import mage.game.Controllable; import mage.game.Game; import mage.game.combat.CombatGroup; @@ -192,17 +192,3 @@ class FalseOrdersUnblockEffect extends OneShotEffect { return false; } } - -class PermanentInListPredicate implements Predicate<Permanent> { - - private final List<Permanent> permanents; - - public PermanentInListPredicate(List<Permanent> permanents) { - this.permanents = permanents; - } - - @Override - public boolean apply(Permanent input, Game game) { - return permanents.contains(input); - } -} From a77706a756de1f04ca727ba583ca416390fdf52a Mon Sep 17 00:00:00 2001 From: Zzooouhh <Zzooouhh@users.noreply.github.com> Date: Thu, 11 Jan 2018 18:23:30 +0000 Subject: [PATCH 34/34] Moved PermanentInListPredicate to common predicates --- Mage.Sets/src/mage/cards/r/RagingRiver.java | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/Mage.Sets/src/mage/cards/r/RagingRiver.java b/Mage.Sets/src/mage/cards/r/RagingRiver.java index 7ea9bc47b3..fa4ef5f1db 100644 --- a/Mage.Sets/src/mage/cards/r/RagingRiver.java +++ b/Mage.Sets/src/mage/cards/r/RagingRiver.java @@ -43,9 +43,9 @@ import mage.constants.Duration; import mage.constants.Outcome; import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.common.FilterCreaturePermanent; -import mage.filter.predicate.Predicate; import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.AbilityPredicate; +import mage.filter.predicate.permanent.PermanentInListPredicate; import mage.game.Game; import mage.game.combat.CombatGroup; import mage.game.permanent.Permanent; @@ -194,17 +194,3 @@ class RagingRiverEffect extends OneShotEffect { return false; } } - -class PermanentInListPredicate implements Predicate<Permanent> { - - private final List<Permanent> permanents; - - public PermanentInListPredicate(List<Permanent> permanents) { - this.permanents = permanents; - } - - @Override - public boolean apply(Permanent input, Game game) { - return permanents.contains(input); - } -}