From 493b4ad65c38a6602ce106ba7e8014170c7fff47 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sun, 17 Sep 2017 17:07:00 -0400 Subject: [PATCH 1/7] Implemented Strongarm Tactics --- .../src/mage/cards/s/StrongarmTactics.java | 124 ++++++++++++++++++ Mage.Sets/src/mage/sets/Onslaught.java | 1 + 2 files changed, 125 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/s/StrongarmTactics.java diff --git a/Mage.Sets/src/mage/cards/s/StrongarmTactics.java b/Mage.Sets/src/mage/cards/s/StrongarmTactics.java new file mode 100644 index 00000000000..8cf580d96a1 --- /dev/null +++ b/Mage.Sets/src/mage/cards/s/StrongarmTactics.java @@ -0,0 +1,124 @@ +/* + * 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.HashMap; +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.cards.Cards; +import mage.cards.CardsImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.filter.FilterCard; +import mage.game.Game; +import mage.players.Player; +import mage.target.Target; +import mage.target.common.TargetDiscard; + +/** + * + * @author TheElk801 + */ +public class StrongarmTactics extends CardImpl { + + public StrongarmTactics(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{B}"); + + // Each player discards a card. Then each player who didn't discard a creature card this way loses 4 life. + this.getSpellAbility().addEffect(new StrongarmTacticsEffect()); + } + + public StrongarmTactics(final StrongarmTactics card) { + super(card); + } + + @Override + public StrongarmTactics copy() { + return new StrongarmTactics(this); + } +} + +class StrongarmTacticsEffect extends OneShotEffect { + + StrongarmTacticsEffect() { + super(Outcome.Discard); + this.staticText = "Each player discards a card. Then each player who didn't discard a creature card this way loses 4 life."; + } + + StrongarmTacticsEffect(final StrongarmTacticsEffect effect) { + super(effect); + } + + @Override + public StrongarmTacticsEffect copy() { + return new StrongarmTacticsEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + // Store for each player the cards to discard, that's important because all discard shall happen at the same time + HashMap cardsToDiscard = new HashMap<>(); + if (controller != null) { + // choose cards to discard + for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { + Player player = game.getPlayer(playerId); + if (player != null) { + int numberOfCardsToDiscard = Math.min(1, player.getHand().size()); + Cards cards = new CardsImpl(); + Target target = new TargetDiscard(numberOfCardsToDiscard, numberOfCardsToDiscard, new FilterCard(), playerId); + player.chooseTarget(outcome, target, source, game); + cards.addAll(target.getTargets()); + cardsToDiscard.put(playerId, cards); + } + } + // discard all choosen cards + for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { + Player player = game.getPlayer(playerId); + if (player != null) { + Cards cardsPlayer = cardsToDiscard.get(playerId); + if (cardsPlayer != null) { + for (UUID cardId : cardsPlayer) { + Card card = game.getCard(cardId); + if (card != null) { + if (!(player.discard(card, source, game) && card.isCreature())) { + player.loseLife(4, game, false); + } + } + } + } + } + } + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/Onslaught.java b/Mage.Sets/src/mage/sets/Onslaught.java index 493fbb2b48b..b38d6a752e9 100644 --- a/Mage.Sets/src/mage/sets/Onslaught.java +++ b/Mage.Sets/src/mage/sets/Onslaught.java @@ -276,6 +276,7 @@ public class Onslaught extends ExpansionSet { cards.add(new SetCardInfo("Starlit Sanctum", 325, Rarity.UNCOMMON, mage.cards.s.StarlitSanctum.class)); cards.add(new SetCardInfo("Starstorm", 238, Rarity.RARE, mage.cards.s.Starstorm.class)); cards.add(new SetCardInfo("Steely Resolve", 286, Rarity.RARE, mage.cards.s.SteelyResolve.class)); + cards.add(new SetCardInfo("Strongarm Tactics", 173, Rarity.RARE, mage.cards.s.StrongarmTactics.class)); cards.add(new SetCardInfo("Sunfire Balm", 56, Rarity.UNCOMMON, mage.cards.s.SunfireBalm.class)); cards.add(new SetCardInfo("Supreme Inquisitor", 117, Rarity.RARE, mage.cards.s.SupremeInquisitor.class)); cards.add(new SetCardInfo("Swamp", 339, Rarity.LAND, mage.cards.basiclands.Swamp.class, NON_FULL_USE_VARIOUS)); From 1311cf52bbc950bc061bb5a92a51ecb372986381 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sun, 17 Sep 2017 18:02:54 -0400 Subject: [PATCH 2/7] Implemented Teferi's Veil --- Mage.Sets/src/mage/cards/t/TeferisVeil.java | 63 +++++++++++++++++++++ Mage.Sets/src/mage/sets/Weatherlight.java | 1 + 2 files changed, 64 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/t/TeferisVeil.java diff --git a/Mage.Sets/src/mage/cards/t/TeferisVeil.java b/Mage.Sets/src/mage/cards/t/TeferisVeil.java new file mode 100644 index 00000000000..58ff55d718a --- /dev/null +++ b/Mage.Sets/src/mage/cards/t/TeferisVeil.java @@ -0,0 +1,63 @@ +/* + * 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.common.AttacksCreatureYouControlTriggeredAbility; +import mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect; +import mage.abilities.effects.common.PhaseOutTargetEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; + +/** + * + * @author TheElk801 + */ +public class TeferisVeil extends CardImpl { + + public TeferisVeil(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{U}"); + + // Whenever a creature you control attacks, it phases out at end of combat. + Effect effect = new CreateDelayedTriggeredAbilityEffect(new AtTheEndOfCombatDelayedTriggeredAbility(new PhaseOutTargetEffect("it", false))); + effect.setText("it phases out at end of combat"); + this.addAbility(new AttacksCreatureYouControlTriggeredAbility(effect, false, true)); + } + + public TeferisVeil(final TeferisVeil card) { + super(card); + } + + @Override + public TeferisVeil copy() { + return new TeferisVeil(this); + } +} diff --git a/Mage.Sets/src/mage/sets/Weatherlight.java b/Mage.Sets/src/mage/sets/Weatherlight.java index b3a5344f6a6..a27842ad076 100644 --- a/Mage.Sets/src/mage/sets/Weatherlight.java +++ b/Mage.Sets/src/mage/sets/Weatherlight.java @@ -178,6 +178,7 @@ public class Weatherlight extends ExpansionSet { cards.add(new SetCardInfo("Straw Golem", 158, Rarity.UNCOMMON, mage.cards.s.StrawGolem.class)); cards.add(new SetCardInfo("Striped Bears", 82, Rarity.COMMON, mage.cards.s.StripedBears.class)); cards.add(new SetCardInfo("Tariff", 144, Rarity.RARE, mage.cards.t.Tariff.class)); + cards.add(new SetCardInfo("Teferi's Veil", 53, Rarity.UNCOMMON, mage.cards.t.TeferisVeil.class)); cards.add(new SetCardInfo("Tendrils of Despair", 25, Rarity.COMMON, mage.cards.t.TendrilsOfDespair.class)); cards.add(new SetCardInfo("Thunderbolt", 115, Rarity.COMMON, mage.cards.t.Thunderbolt.class)); cards.add(new SetCardInfo("Thundermare", 116, Rarity.RARE, mage.cards.t.Thundermare.class)); From 473834b1da5a72d6f85b7c922247d5edc4279b0b Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sun, 17 Sep 2017 18:11:50 -0400 Subject: [PATCH 3/7] updated Cyclonic Rift --- Mage.Sets/src/mage/cards/c/CyclonicRift.java | 44 +++----------------- 1 file changed, 6 insertions(+), 38 deletions(-) diff --git a/Mage.Sets/src/mage/cards/c/CyclonicRift.java b/Mage.Sets/src/mage/cards/c/CyclonicRift.java index b9c1262408a..826f7606dcd 100644 --- a/Mage.Sets/src/mage/cards/c/CyclonicRift.java +++ b/Mage.Sets/src/mage/cards/c/CyclonicRift.java @@ -28,21 +28,17 @@ package mage.cards.c; import java.util.UUID; -import mage.abilities.Ability; import mage.abilities.costs.mana.ManaCostsImpl; -import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.ReturnToHandFromBattlefieldAllEffect; import mage.abilities.effects.common.ReturnToHandTargetEffect; import mage.abilities.keyword.OverloadAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.Outcome; import mage.constants.TargetController; -import mage.constants.Zone; import mage.filter.common.FilterNonlandPermanent; import mage.filter.predicate.permanent.ControllerPredicate; -import mage.game.Game; -import mage.game.permanent.Permanent; import mage.target.common.TargetNonlandPermanent; /** @@ -58,14 +54,16 @@ public class CyclonicRift extends CardImpl { } public CyclonicRift(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{1}{U}"); + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{U}"); // Return target nonland permanent you don't control to its owner's hand. this.getSpellAbility().addTarget(new TargetNonlandPermanent(filter)); this.getSpellAbility().addEffect(new ReturnToHandTargetEffect()); // Overload {6}{U} (You may cast this spell for its overload cost. If you do, change its text by replacing all instances of "target" with "each.") - this.addAbility(new OverloadAbility(this, new CyclonicRiftEffect(), new ManaCostsImpl("{6}{U}"))); + Effect effect = new ReturnToHandFromBattlefieldAllEffect(filter); + effect.setText("Return each nonland permanent you don't control to its owner's hand"); + this.addAbility(new OverloadAbility(this, effect, new ManaCostsImpl("{6}{U}"))); } public CyclonicRift(final CyclonicRift card) { @@ -77,33 +75,3 @@ public class CyclonicRift extends CardImpl { return new CyclonicRift(this); } } - -class CyclonicRiftEffect extends OneShotEffect { - - private static final FilterNonlandPermanent filter = new FilterNonlandPermanent(); - - public CyclonicRiftEffect() { - super(Outcome.ReturnToHand); - staticText = "Return each nonland permanent you don't control to its owner's hand"; - } - - public CyclonicRiftEffect(final CyclonicRiftEffect effect) { - super(effect); - } - - @Override - public boolean apply(Game game, Ability source) { - for (Permanent creature : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { - if (!creature.getControllerId().equals(source.getControllerId())) { - creature.moveToZone(Zone.HAND, source.getSourceId(), game, true); - } - - } - return true; - } - - @Override - public CyclonicRiftEffect copy() { - return new CyclonicRiftEffect(this); - } -} From 5a6ae913ecda3015b8f7e19d9d6d2f846cb8a639 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sun, 17 Sep 2017 18:40:18 -0400 Subject: [PATCH 4/7] Implemented Reborn Hero --- Mage.Sets/src/mage/cards/r/RebornHero.java | 91 ++++++++++++++++++++++ Mage.Sets/src/mage/sets/Torment.java | 1 + 2 files changed, 92 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/r/RebornHero.java diff --git a/Mage.Sets/src/mage/cards/r/RebornHero.java b/Mage.Sets/src/mage/cards/r/RebornHero.java new file mode 100644 index 00000000000..36bbc8221fa --- /dev/null +++ b/Mage.Sets/src/mage/cards/r/RebornHero.java @@ -0,0 +1,91 @@ +/* + * 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.Ability; +import mage.abilities.common.DiesTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.condition.common.CardsInControllerGraveCondition; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.decorator.ConditionalContinuousEffect; +import mage.abilities.effects.common.DoIfCostPaid; +import mage.abilities.effects.common.ReturnSourceFromGraveyardToBattlefieldEffect; +import mage.abilities.effects.common.continuous.GainAbilitySourceEffect; +import mage.constants.SubType; +import mage.abilities.keyword.VigilanceAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.AbilityWord; +import mage.constants.CardType; +import mage.constants.Zone; + +/** + * + * @author TheElk801 + */ +public class RebornHero extends CardImpl { + + public RebornHero(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{W}"); + + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.SOLDIER); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // Vigilance + this.addAbility(VigilanceAbility.getInstance()); + + // Threshold - As long as seven or more cards are in your graveyard, Reborn Hero has "When Reborn Hero dies, you may pay {W}{W}. If you do, return Reborn Hero to the battlefield under your control." + Ability ability = new SimpleStaticAbility( + Zone.BATTLEFIELD, + new ConditionalContinuousEffect( + new GainAbilitySourceEffect(new DiesTriggeredAbility(new DoIfCostPaid( + new ReturnSourceFromGraveyardToBattlefieldEffect(), new ManaCostsImpl("{W}{W}") + ))), + new CardsInControllerGraveCondition(7), + "As long as seven or more cards are in your graveyard, " + + "{this} has \"When {this} dies, you may pay {W}{W}. " + + "If you do, return {this} to the battlefield under your control.\"" + ) + ); + ability.setAbilityWord(AbilityWord.THRESHOLD); + this.addAbility(ability); + } + + public RebornHero(final RebornHero card) { + super(card); + } + + @Override + public RebornHero copy() { + return new RebornHero(this); + } +} diff --git a/Mage.Sets/src/mage/sets/Torment.java b/Mage.Sets/src/mage/sets/Torment.java index 3a579e84d10..7ece361cda9 100644 --- a/Mage.Sets/src/mage/sets/Torment.java +++ b/Mage.Sets/src/mage/sets/Torment.java @@ -151,6 +151,7 @@ public class Torment extends ExpansionSet { cards.add(new SetCardInfo("Pyromania", 112, Rarity.UNCOMMON, mage.cards.p.Pyromania.class)); cards.add(new SetCardInfo("Radiate", 113, Rarity.RARE, mage.cards.r.Radiate.class)); cards.add(new SetCardInfo("Rancid Earth", 78, Rarity.COMMON, mage.cards.r.RancidEarth.class)); + cards.add(new SetCardInfo("Reborn Hero", 14, Rarity.RARE, mage.cards.r.RebornHero.class)); cards.add(new SetCardInfo("Restless Dreams", 79, Rarity.COMMON, mage.cards.r.RestlessDreams.class)); cards.add(new SetCardInfo("Sengir Vampire", 80, Rarity.RARE, mage.cards.s.SengirVampire.class)); cards.add(new SetCardInfo("Seton's Scout", 138, Rarity.UNCOMMON, mage.cards.s.SetonsScout.class)); From 6ab143c1236b30f5e488a6577af1839167a67439 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sun, 17 Sep 2017 18:55:06 -0400 Subject: [PATCH 5/7] Implemented Mine Layer --- Mage.Sets/src/mage/cards/m/MineLayer.java | 121 ++++++++++++++++++ Mage.Sets/src/mage/sets/Odyssey.java | 1 + .../main/java/mage/counters/CounterType.java | 1 + 3 files changed, 123 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/m/MineLayer.java diff --git a/Mage.Sets/src/mage/cards/m/MineLayer.java b/Mage.Sets/src/mage/cards/m/MineLayer.java new file mode 100644 index 00000000000..1c2342f6294 --- /dev/null +++ b/Mage.Sets/src/mage/cards/m/MineLayer.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.m; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.BecomesTappedTriggeredAbility; +import mage.abilities.common.LeavesBattlefieldTriggeredAbility; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.DestroyTargetEffect; +import mage.abilities.effects.common.counter.AddCountersTargetEffect; +import mage.constants.SubType; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.counters.CounterType; +import mage.filter.common.FilterLandPermanent; +import mage.filter.predicate.permanent.CounterPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.common.TargetLandPermanent; + +/** + * + * @author TheElk801 + */ +public class MineLayer extends CardImpl { + + private static final FilterLandPermanent filter = new FilterLandPermanent("land with a mine counter on it"); + + static { + filter.add(new CounterPredicate(CounterType.MINE)); + } + + public MineLayer(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{R}"); + + this.subtype.add(SubType.DWARF); + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // {1}{R}, {tap}: Put a mine counter on target land. + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersTargetEffect(CounterType.MINE.createInstance()), new TapSourceCost()); + ability.addCost(new ManaCostsImpl("{1}{R}")); + ability.addTarget(new TargetLandPermanent()); + this.addAbility(ability); + + // Whenever a land with a mine counter on it becomes tapped, destroy it. + this.addAbility(new BecomesTappedTriggeredAbility(new DestroyTargetEffect().setText("destroy that land"), false, filter, true)); + + // When Mine Layer leaves the battlefield, remove all mine counters from all lands. + this.addAbility(new LeavesBattlefieldTriggeredAbility(new RemoveAllMineCountersEffect(), false)); + } + + public MineLayer(final MineLayer card) { + super(card); + } + + @Override + public MineLayer copy() { + return new MineLayer(this); + } +} + +class RemoveAllMineCountersEffect extends OneShotEffect { + + public RemoveAllMineCountersEffect() { + super(Outcome.Neutral); + this.staticText = "remove all mine counters from all lands"; + } + + public RemoveAllMineCountersEffect(final RemoveAllMineCountersEffect effect) { + super(effect); + } + + @Override + public RemoveAllMineCountersEffect copy() { + return new RemoveAllMineCountersEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + for (Permanent permanent : game.getBattlefield().getAllActivePermanents(CardType.LAND)) { + if (permanent != null) { + permanent.getCounters(game).removeAllCounters(CounterType.MINE); + } + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/Odyssey.java b/Mage.Sets/src/mage/sets/Odyssey.java index e5a06110704..fdc27640f42 100644 --- a/Mage.Sets/src/mage/sets/Odyssey.java +++ b/Mage.Sets/src/mage/sets/Odyssey.java @@ -214,6 +214,7 @@ public class Odyssey extends ExpansionSet { cards.add(new SetCardInfo("Metamorphic Wurm", 250, Rarity.UNCOMMON, mage.cards.m.MetamorphicWurm.class)); cards.add(new SetCardInfo("Millikin", 302, Rarity.UNCOMMON, mage.cards.m.Millikin.class)); cards.add(new SetCardInfo("Mindslicer", 149, Rarity.RARE, mage.cards.m.Mindslicer.class)); + cards.add(new SetCardInfo("Mine Layer", 205, Rarity.RARE, mage.cards.m.MineLayer.class)); cards.add(new SetCardInfo("Minotaur Explorer", 206, Rarity.UNCOMMON, mage.cards.m.MinotaurExplorer.class)); cards.add(new SetCardInfo("Mirari", 303, Rarity.RARE, mage.cards.m.Mirari.class)); cards.add(new SetCardInfo("Molten Influence", 207, Rarity.RARE, mage.cards.m.MoltenInfluence.class)); diff --git a/Mage/src/main/java/mage/counters/CounterType.java b/Mage/src/main/java/mage/counters/CounterType.java index 51057ed86bb..cc7ff45b3e1 100644 --- a/Mage/src/main/java/mage/counters/CounterType.java +++ b/Mage/src/main/java/mage/counters/CounterType.java @@ -87,6 +87,7 @@ public enum CounterType { M1M1(new BoostCounter(-1, -1).name), M2M1(new BoostCounter(-2, -1).name), M2M2(new BoostCounter(-2, -2).name), + MINE("mine"), MINING("mining"), MIRE("mire"), MUSTER("muster"), From 1819c6e8a8e6dab68507ec01476cc1b40e3e6671 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sun, 17 Sep 2017 19:56:59 -0400 Subject: [PATCH 6/7] Implemented Game Preserve --- .../src/mage/cards/d/DuskmantleSeer.java | 11 +- Mage.Sets/src/mage/cards/g/GamePreserve.java | 113 ++++++++++++++++++ Mage.Sets/src/mage/sets/MercadianMasques.java | 1 + 3 files changed, 120 insertions(+), 5 deletions(-) create mode 100644 Mage.Sets/src/mage/cards/g/GamePreserve.java diff --git a/Mage.Sets/src/mage/cards/d/DuskmantleSeer.java b/Mage.Sets/src/mage/cards/d/DuskmantleSeer.java index 2f1783b3258..6fd7248a7e7 100644 --- a/Mage.Sets/src/mage/cards/d/DuskmantleSeer.java +++ b/Mage.Sets/src/mage/cards/d/DuskmantleSeer.java @@ -40,6 +40,7 @@ import mage.constants.Outcome; import mage.constants.TargetController; import mage.constants.Zone; import mage.game.Game; +import mage.game.permanent.Permanent; import mage.players.Player; /** @@ -49,7 +50,7 @@ import mage.players.Player; public class DuskmantleSeer extends CardImpl { public DuskmantleSeer(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{U}{B}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U}{B}"); this.subtype.add(SubType.VAMPIRE); this.subtype.add(SubType.WIZARD); @@ -91,15 +92,15 @@ class DuskmantleSeerEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - Card sourceCard = game.getCard(source.getSourceId()); + Permanent sourceCard = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (sourceCard == null) { return false; } - for (Player player: game.getPlayers().values()) { - if(player.getLibrary().hasCards()){ + for (Player player : game.getPlayers().values()) { + if (player.getLibrary().hasCards()) { Card card = player.getLibrary().removeFromTop(game); if (card != null) { - Cards cards = new CardsImpl(); + Cards cards = new CardsImpl(); cards.add(card); player.revealCards(sourceCard.getName() + ": Revealed by " + player.getName(), cards, game); player.loseLife(card.getConvertedManaCost(), game, false); diff --git a/Mage.Sets/src/mage/cards/g/GamePreserve.java b/Mage.Sets/src/mage/cards/g/GamePreserve.java new file mode 100644 index 00000000000..300ed6a40a6 --- /dev/null +++ b/Mage.Sets/src/mage/cards/g/GamePreserve.java @@ -0,0 +1,113 @@ +/* + * 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.common.BeginningOfUpkeepTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.cards.Cards; +import mage.cards.CardsImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.TargetController; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; + +/** + * + * @author TheElk801 + */ +public class GamePreserve extends CardImpl { + + public GamePreserve(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{G}"); + + // At the beginning of your upkeep, each player reveals the top card of his or her library. If all cards revealed this way are creature cards, put those cards onto the battlefield under their owners' control. + this.addAbility(new BeginningOfUpkeepTriggeredAbility(new DuskmarEffect(), TargetController.YOU, false)); + } + + public GamePreserve(final GamePreserve card) { + super(card); + } + + @Override + public GamePreserve copy() { + return new GamePreserve(this); + } +} + +class DuskmarEffect extends OneShotEffect { + + public DuskmarEffect() { + super(Outcome.Detriment); + this.staticText = "each player reveals the top card of his or her library. If all cards revealed this way are creature cards, put those cards onto the battlefield under their owners' control"; + } + + public DuskmarEffect(final DuskmarEffect effect) { + super(effect); + } + + @Override + public DuskmarEffect copy() { + return new DuskmarEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent sourceCard = game.getPermanentOrLKIBattlefield(source.getSourceId()); + if (sourceCard == null) { + return false; + } + boolean putToPlay = true; + Cards cards = new CardsImpl(); + for (Player player : game.getPlayers().values()) { + if (player.getLibrary().hasCards()) { + Card card = player.getLibrary().removeFromTop(game); + if (card != null) { + cards.add(card); + if (!card.isCreature()) { + putToPlay = false; + } + player.revealCards(sourceCard.getName() + ": Revealed by " + player.getName(), cards, game); + } + } else { + putToPlay = false; + } + } + if (putToPlay) { + game.getPlayers().values().iterator().next().moveCards(cards.getCards(game), Zone.BATTLEFIELD, source, game, false, false, true, null); + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/MercadianMasques.java b/Mage.Sets/src/mage/sets/MercadianMasques.java index 8fb42c57ac8..c759f2889e7 100644 --- a/Mage.Sets/src/mage/sets/MercadianMasques.java +++ b/Mage.Sets/src/mage/sets/MercadianMasques.java @@ -151,6 +151,7 @@ public class MercadianMasques extends ExpansionSet { cards.add(new SetCardInfo("Fountain Watch", 19, Rarity.RARE, mage.cards.f.FountainWatch.class)); cards.add(new SetCardInfo("Fresh Volunteers", 20, Rarity.COMMON, mage.cards.f.FreshVolunteers.class)); cards.add(new SetCardInfo("Furious Assault", 191, Rarity.COMMON, mage.cards.f.FuriousAssault.class)); + cards.add(new SetCardInfo("Game Preserve", 248, Rarity.RARE, mage.cards.g.GamePreserve.class)); cards.add(new SetCardInfo("Gerrard's Irregulars", 192, Rarity.COMMON, mage.cards.g.GerrardsIrregulars.class)); cards.add(new SetCardInfo("Ghoul's Feast", 137, Rarity.UNCOMMON, mage.cards.g.GhoulsFeast.class)); cards.add(new SetCardInfo("Giant Caterpillar", 249, Rarity.COMMON, mage.cards.g.GiantCaterpillar.class)); From 356737075a8af9596db5ec1db76f59cffa484528 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sun, 17 Sep 2017 19:57:54 -0400 Subject: [PATCH 7/7] Revert "Skulk is now singleton" This reverts commit 6ca03a339a41bbbfcbd8ee806e9c332ca87160d1. --- .../src/mage/cards/b/BehindTheScenes.java | 2 +- .../src/mage/cards/f/FarbogRevenant.java | 2 +- Mage.Sets/src/mage/cards/f/Fogwalker.java | 2 +- .../src/mage/cards/f/ForgottenCreation.java | 2 +- .../src/mage/cards/f/FurtiveHomunculus.java | 2 +- .../src/mage/cards/o/OdricLunarchMarshal.java | 4 ++-- .../src/mage/cards/p/PaleRiderOfTrostad.java | 2 +- .../src/mage/cards/p/PersistentNightmare.java | 2 +- Mage.Sets/src/mage/cards/r/RancidRats.java | 2 +- Mage.Sets/src/mage/cards/s/SkeletonKey.java | 2 +- .../src/mage/cards/u/UninvitedGeist.java | 2 +- .../src/mage/cards/v/VampireCutthroat.java | 2 +- .../src/mage/cards/w/WharfInfiltrator.java | 2 +- .../abilities/add/GainAbilitiesTest.java | 22 ++++++++--------- .../mage/abilities/keyword/SkulkAbility.java | 24 +++++++------------ Utils/keywords.txt | 2 +- 16 files changed, 35 insertions(+), 41 deletions(-) diff --git a/Mage.Sets/src/mage/cards/b/BehindTheScenes.java b/Mage.Sets/src/mage/cards/b/BehindTheScenes.java index 49aca371a86..2433120f344 100644 --- a/Mage.Sets/src/mage/cards/b/BehindTheScenes.java +++ b/Mage.Sets/src/mage/cards/b/BehindTheScenes.java @@ -52,7 +52,7 @@ public class BehindTheScenes extends CardImpl { // Creatures you control have skulk. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, - new GainAbilityControlledEffect(SkulkAbility.getInstance(), Duration.WhileOnBattlefield, FILTER_PERMANENT_CREATURES))); + new GainAbilityControlledEffect(new SkulkAbility(), Duration.WhileOnBattlefield, FILTER_PERMANENT_CREATURES))); // {4}{W}: Creatures you control get +1/+1 until end of turn. this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, diff --git a/Mage.Sets/src/mage/cards/f/FarbogRevenant.java b/Mage.Sets/src/mage/cards/f/FarbogRevenant.java index 6e4a727a08b..3bdfb80d93c 100644 --- a/Mage.Sets/src/mage/cards/f/FarbogRevenant.java +++ b/Mage.Sets/src/mage/cards/f/FarbogRevenant.java @@ -49,7 +49,7 @@ public class FarbogRevenant extends CardImpl { this.toughness = new MageInt(3); // Skulk - this.addAbility(SkulkAbility.getInstance()); + this.addAbility(new SkulkAbility()); // Lifelink this.addAbility(LifelinkAbility.getInstance()); diff --git a/Mage.Sets/src/mage/cards/f/Fogwalker.java b/Mage.Sets/src/mage/cards/f/Fogwalker.java index 5ae28940207..eaf42be950e 100644 --- a/Mage.Sets/src/mage/cards/f/Fogwalker.java +++ b/Mage.Sets/src/mage/cards/f/Fogwalker.java @@ -60,7 +60,7 @@ public class Fogwalker extends CardImpl { this.toughness = new MageInt(3); // Skulk - this.addAbility(SkulkAbility.getInstance()); + this.addAbility(new SkulkAbility()); // When Fogwalker enters the battlefield, target creature an opponent controls doesn't untap during it controler's next untap step. EntersBattlefieldTriggeredAbility ability = new EntersBattlefieldTriggeredAbility(new DontUntapInControllersNextUntapStepTargetEffect()); ability.addTarget(new TargetCreaturePermanent(filter)); diff --git a/Mage.Sets/src/mage/cards/f/ForgottenCreation.java b/Mage.Sets/src/mage/cards/f/ForgottenCreation.java index f5435fdc02b..37bfc59efe3 100644 --- a/Mage.Sets/src/mage/cards/f/ForgottenCreation.java +++ b/Mage.Sets/src/mage/cards/f/ForgottenCreation.java @@ -56,7 +56,7 @@ public class ForgottenCreation extends CardImpl { this.toughness = new MageInt(3); // Skulk - this.addAbility(SkulkAbility.getInstance()); + this.addAbility(new SkulkAbility()); // At the beginning of your upkeep, you may discard all the cards in your hand. If you do, draw that many cards. this.addAbility(new BeginningOfUpkeepTriggeredAbility(new ForgottenCreationEffect(), TargetController.YOU, true)); } diff --git a/Mage.Sets/src/mage/cards/f/FurtiveHomunculus.java b/Mage.Sets/src/mage/cards/f/FurtiveHomunculus.java index 11fc20bf02a..de4abdb0944 100644 --- a/Mage.Sets/src/mage/cards/f/FurtiveHomunculus.java +++ b/Mage.Sets/src/mage/cards/f/FurtiveHomunculus.java @@ -48,7 +48,7 @@ public class FurtiveHomunculus extends CardImpl { this.toughness = new MageInt(1); // Skulk (This creature can't be blocked by creatures with greater power.) - this.addAbility(SkulkAbility.getInstance()); + this.addAbility(new SkulkAbility()); } public FurtiveHomunculus(final FurtiveHomunculus card) { diff --git a/Mage.Sets/src/mage/cards/o/OdricLunarchMarshal.java b/Mage.Sets/src/mage/cards/o/OdricLunarchMarshal.java index 353a072d4b1..a88797dcdc9 100644 --- a/Mage.Sets/src/mage/cards/o/OdricLunarchMarshal.java +++ b/Mage.Sets/src/mage/cards/o/OdricLunarchMarshal.java @@ -171,7 +171,7 @@ class OdricLunarchMarshalEffect extends OneShotEffect { // Skulk if (game.getBattlefield().contains(filterSkulk, source.getControllerId(), 1, game)) { - game.addEffect(new GainAbilityControlledEffect(SkulkAbility.getInstance(), Duration.EndOfTurn, filterCreatures), source); + game.addEffect(new GainAbilityControlledEffect(new SkulkAbility(), Duration.EndOfTurn, filterCreatures), source); } // Trample @@ -185,4 +185,4 @@ class OdricLunarchMarshalEffect extends OneShotEffect { } return true; } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/cards/p/PaleRiderOfTrostad.java b/Mage.Sets/src/mage/cards/p/PaleRiderOfTrostad.java index e270688f21d..f09cf4f27b8 100644 --- a/Mage.Sets/src/mage/cards/p/PaleRiderOfTrostad.java +++ b/Mage.Sets/src/mage/cards/p/PaleRiderOfTrostad.java @@ -50,7 +50,7 @@ public class PaleRiderOfTrostad extends CardImpl { this.toughness = new MageInt(3); // Skulk - this.addAbility(SkulkAbility.getInstance()); + this.addAbility(new SkulkAbility()); // When Pale Rider of Trostad enters the battlefield, discard a card. this.addAbility(new EntersBattlefieldTriggeredAbility(new DiscardControllerEffect(1), false)); diff --git a/Mage.Sets/src/mage/cards/p/PersistentNightmare.java b/Mage.Sets/src/mage/cards/p/PersistentNightmare.java index 59a76bd4ff4..efaf3951a0e 100644 --- a/Mage.Sets/src/mage/cards/p/PersistentNightmare.java +++ b/Mage.Sets/src/mage/cards/p/PersistentNightmare.java @@ -54,7 +54,7 @@ public class PersistentNightmare extends CardImpl { this.nightCard = true; // Skulk - this.addAbility(SkulkAbility.getInstance()); + this.addAbility(new SkulkAbility()); // When Persistent Nightmare deals combat damage to a player, return it to its owner's hand. this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(new ReturnToHandSourceEffect(), false)); diff --git a/Mage.Sets/src/mage/cards/r/RancidRats.java b/Mage.Sets/src/mage/cards/r/RancidRats.java index 630cf94c5ca..4dfdb9d0698 100644 --- a/Mage.Sets/src/mage/cards/r/RancidRats.java +++ b/Mage.Sets/src/mage/cards/r/RancidRats.java @@ -50,7 +50,7 @@ public class RancidRats extends CardImpl { this.toughness = new MageInt(1); // Skulk - this.addAbility(SkulkAbility.getInstance()); + this.addAbility(new SkulkAbility()); // Deathtouch this.addAbility(DeathtouchAbility.getInstance()); } diff --git a/Mage.Sets/src/mage/cards/s/SkeletonKey.java b/Mage.Sets/src/mage/cards/s/SkeletonKey.java index dc3774257df..72dc2d91d3b 100644 --- a/Mage.Sets/src/mage/cards/s/SkeletonKey.java +++ b/Mage.Sets/src/mage/cards/s/SkeletonKey.java @@ -57,7 +57,7 @@ public class SkeletonKey extends CardImpl { this.subtype.add(SubType.EQUIPMENT); // Equipped creature has skulk. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(SkulkAbility.getInstance(), AttachmentType.EQUIPMENT))); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(new SkulkAbility(), AttachmentType.EQUIPMENT))); // Whenever equipped creature deals combat damage to a player, you may draw a card. if you do, discard a card. Ability ability = new DealsDamageToAPlayerAttachedTriggeredAbility(new DrawCardSourceControllerEffect(1), "equipped creature", true); diff --git a/Mage.Sets/src/mage/cards/u/UninvitedGeist.java b/Mage.Sets/src/mage/cards/u/UninvitedGeist.java index 037328203e1..4dd1c9776e1 100644 --- a/Mage.Sets/src/mage/cards/u/UninvitedGeist.java +++ b/Mage.Sets/src/mage/cards/u/UninvitedGeist.java @@ -54,7 +54,7 @@ public class UninvitedGeist extends CardImpl { this.secondSideCardClazz = UnimpededTrespasser.class; // Skulk (This creature can't be blocked by creatures with greater power.) - this.addAbility(SkulkAbility.getInstance()); + this.addAbility(new SkulkAbility()); // When Uninvited Geist deals combat damage to a player, transform it. this.addAbility(new TransformAbility()); diff --git a/Mage.Sets/src/mage/cards/v/VampireCutthroat.java b/Mage.Sets/src/mage/cards/v/VampireCutthroat.java index b57163f93c7..a83227695c8 100644 --- a/Mage.Sets/src/mage/cards/v/VampireCutthroat.java +++ b/Mage.Sets/src/mage/cards/v/VampireCutthroat.java @@ -50,7 +50,7 @@ public class VampireCutthroat extends CardImpl { this.toughness = new MageInt(1); // Skulk - this.addAbility(SkulkAbility.getInstance()); + this.addAbility(new SkulkAbility()); // Lifelink this.addAbility(LifelinkAbility.getInstance()); } diff --git a/Mage.Sets/src/mage/cards/w/WharfInfiltrator.java b/Mage.Sets/src/mage/cards/w/WharfInfiltrator.java index 9c49a67b5df..9e3116fc858 100644 --- a/Mage.Sets/src/mage/cards/w/WharfInfiltrator.java +++ b/Mage.Sets/src/mage/cards/w/WharfInfiltrator.java @@ -62,7 +62,7 @@ public class WharfInfiltrator extends CardImpl { this.toughness = new MageInt(1); // Skulk - this.addAbility(SkulkAbility.getInstance()); + this.addAbility(new SkulkAbility()); // Whenever Wharf Infiltrator deals combat damage to a player, you may draw a card. If you do, discard a card. Effect effect = new DrawDiscardControllerEffect(); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/add/GainAbilitiesTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/add/GainAbilitiesTest.java index 8096df1ee30..8b519b94160 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/add/GainAbilitiesTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/add/GainAbilitiesTest.java @@ -14,34 +14,34 @@ public class GainAbilitiesTest extends CardTestPlayerBase { /* Reported bug: Behind the Scenes grants skulk to all creatures instead of just ones under owner's control - */ + */ @Test public void behindTheScenesShouldOnlyGrantSkulkToCreaturesYouControl() { - + /* Behind the Scenes {2}{B} Enchantment Creatures you control have skulk. (They can't be blocked by creatures with greater power.) {4}{W}: Creatures you control get +1/+1 until end of turn - */ - String bScenes = "Behind the Scenes"; + */ + String bScenes = "Behind the Scenes"; String hGiant = "Hill Giant"; // {3}{R} 3/3 String bSable = "Bronze Sable"; // {2} 2/1 String memnite = "Memnite"; // {0} 1/1 String gBears = "Grizzly Bears"; // {1}{G} 2/2 - + addCard(Zone.BATTLEFIELD, playerA, bScenes); addCard(Zone.BATTLEFIELD, playerA, hGiant); addCard(Zone.BATTLEFIELD, playerA, bSable); addCard(Zone.BATTLEFIELD, playerB, memnite); addCard(Zone.BATTLEFIELD, playerB, gBears); - + setStopAt(1, PhaseStep.PRECOMBAT_MAIN); execute(); - - assertAbility(playerA, hGiant, SkulkAbility.getInstance(), true); - assertAbility(playerA, bSable, SkulkAbility.getInstance(), true); - assertAbility(playerB, memnite, SkulkAbility.getInstance(), false); - assertAbility(playerB, gBears, SkulkAbility.getInstance(), false); + + assertAbility(playerA, hGiant, new SkulkAbility(), true); + assertAbility(playerA, bSable, new SkulkAbility(), true); + assertAbility(playerB, memnite, new SkulkAbility(), false); + assertAbility(playerB, gBears, new SkulkAbility(), false); } } diff --git a/Mage/src/main/java/mage/abilities/keyword/SkulkAbility.java b/Mage/src/main/java/mage/abilities/keyword/SkulkAbility.java index f97d4763a96..2378f0a9db6 100644 --- a/Mage/src/main/java/mage/abilities/keyword/SkulkAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/SkulkAbility.java @@ -5,12 +5,11 @@ */ package mage.abilities.keyword; -import java.io.ObjectStreamException; import mage.abilities.Ability; -import mage.abilities.EvasionAbility; -import mage.abilities.MageSingleton; +import mage.abilities.StaticAbility; import mage.abilities.effects.RestrictionEffect; import mage.constants.Duration; +import mage.constants.Zone; import mage.game.Game; import mage.game.permanent.Permanent; @@ -18,31 +17,26 @@ import mage.game.permanent.Permanent; * * @author LevelX2 */ -public class SkulkAbility extends EvasionAbility implements MageSingleton { +public class SkulkAbility extends StaticAbility { - private static final SkulkAbility instance = new SkulkAbility(); - - private Object readResolve() throws ObjectStreamException { - return instance; + public SkulkAbility() { + super(Zone.BATTLEFIELD, new SkulkEffect(Duration.WhileOnBattlefield)); } - public static SkulkAbility getInstance() { - return instance; - } - - private SkulkAbility() { - this.addEffect(new SkulkEffect(Duration.WhileOnBattlefield)); + public SkulkAbility(final SkulkAbility ability) { + super(ability); } @Override public Ability copy() { - return instance; + return new SkulkAbility(this); } @Override public String getRule() { return "Skulk (This creature can't be blocked by creatures with greater power.)"; } + } class SkulkEffect extends RestrictionEffect { diff --git a/Utils/keywords.txt b/Utils/keywords.txt index f2c980846b1..875ab52c008 100644 --- a/Utils/keywords.txt +++ b/Utils/keywords.txt @@ -76,7 +76,7 @@ Shadow|instance| Shroud|instance| Soulbond|instance| Soulshift|number| -Skulk|instance| +Skulk|new| Storm|new| Sunburst|new| Swampcycling|cost|