From e36d6d1ac7ec2bf42142699c9b971e3c8f09cc8a Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sat, 16 Sep 2017 11:02:17 -0400 Subject: [PATCH 01/29] Updated Hakim, Loreweaver(untested) --- .../src/mage/cards/h/HakimLoreweaver.java | 35 ++++------- Mage.Sets/src/mage/cards/s/SliceinTwain.java | 63 ------------------- 2 files changed, 12 insertions(+), 86 deletions(-) delete mode 100644 Mage.Sets/src/mage/cards/s/SliceinTwain.java diff --git a/Mage.Sets/src/mage/cards/h/HakimLoreweaver.java b/Mage.Sets/src/mage/cards/h/HakimLoreweaver.java index 1b3082b518..2855978c7f 100644 --- a/Mage.Sets/src/mage/cards/h/HakimLoreweaver.java +++ b/Mage.Sets/src/mage/cards/h/HakimLoreweaver.java @@ -46,6 +46,7 @@ import mage.constants.Outcome; import mage.constants.PhaseStep; import mage.constants.SubType; import mage.constants.SuperType; +import mage.constants.TargetController; import mage.constants.Zone; import mage.filter.FilterCard; import mage.filter.FilterPermanent; @@ -53,6 +54,7 @@ import mage.filter.predicate.mageobject.CardIdPredicate; import mage.filter.predicate.mageobject.CardTypePredicate; import mage.filter.predicate.mageobject.SubtypePredicate; import mage.filter.predicate.other.AuraCardCanAttachToPermanentId; +import mage.filter.predicate.other.OwnerPredicate; import mage.filter.predicate.permanent.AttachedToPredicate; import mage.game.Game; import mage.game.permanent.Permanent; @@ -67,7 +69,13 @@ import mage.target.common.TargetCardInYourGraveyard; public class HakimLoreweaver extends CardImpl { private final static String rule = "Return target Aura card from your graveyard to the battlefield attached to Hakim, Loreweaver. Activate this ability only during your upkeep and only if Hakim isn't enchanted."; - UUID originalId; + private static final FilterCard filter = new FilterCard("target Aura card from your graveyard"); + + static { + filter.add(new CardTypePredicate(CardType.ENCHANTMENT)); + filter.add(new SubtypePredicate(SubType.AURA)); + filter.add(new OwnerPredicate(TargetController.YOU)); + } public HakimLoreweaver(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U}"); @@ -81,11 +89,9 @@ public class HakimLoreweaver extends CardImpl { // Flying this.addAbility(FlyingAbility.getInstance()); - //TODO: Make ability properly copiable // {U}{U}: Return target Aura card from your graveyard to the battlefield attached to Hakim, Loreweaver. Activate this ability only during your upkeep and only if Hakim isn't enchanted. Ability ability = new ConditionalActivatedAbility(Zone.BATTLEFIELD, new HakimLoreweaverEffect(), new ManaCostsImpl("{U}{U}"), new HakimLoreweaverCondition(), rule); - ability.addTarget(new TargetCardInYourGraveyard()); - originalId = ability.getOriginalId(); + ability.addTarget(new TargetCardInYourGraveyard(filter)); this.addAbility(ability); // {U}{U}, {tap}: Destroy all Auras attached to Hakim. @@ -101,26 +107,8 @@ public class HakimLoreweaver extends CardImpl { } - @Override - public void adjustTargets(Ability ability, Game game) { - if (ability.getOriginalId().equals(originalId)) { - Player controller = game.getPlayer(ability.getControllerId()); - if (controller != null) { - ability.getTargets().clear(); - FilterCard filterAuraCard = new FilterCard("target Aura card from your graveyard"); - filterAuraCard.add(new CardTypePredicate(CardType.ENCHANTMENT)); - filterAuraCard.add(new SubtypePredicate(SubType.AURA)); - filterAuraCard.add(new AuraCardCanAttachToPermanentId(ability.getSourceId())); - TargetCardInYourGraveyard target = new TargetCardInYourGraveyard(filterAuraCard); - ability.addTarget(target); - } - } - - } - public HakimLoreweaver(final HakimLoreweaver card) { super(card); - this.originalId = card.originalId; } @Override @@ -153,7 +141,8 @@ class HakimLoreweaverEffect extends OneShotEffect { if (controller != null && hakimLoreweaver != null && controller.canRespond() - && targetAuraCard != null) { + && targetAuraCard != null + && new AuraCardCanAttachToPermanentId(hakimLoreweaver.getId()).apply(targetAuraCard, game)) { Target target = targetAuraCard.getSpellAbility().getTargets().get(0); if (target != null) { game.getState().setValue("attachTo:" + targetAuraCard.getId(), hakimLoreweaver); diff --git a/Mage.Sets/src/mage/cards/s/SliceinTwain.java b/Mage.Sets/src/mage/cards/s/SliceinTwain.java deleted file mode 100644 index abb03b3116..0000000000 --- a/Mage.Sets/src/mage/cards/s/SliceinTwain.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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 mage.abilities.effects.common.DestroyTargetEffect; -import mage.abilities.effects.common.DrawCardSourceControllerEffect; -import mage.cards.CardImpl; -import mage.cards.CardSetInfo; -import mage.constants.CardType; -import mage.filter.StaticFilters; -import mage.target.TargetPermanent; - -import java.util.UUID; - -/** - * - * @author Loki - */ -public class SliceinTwain extends CardImpl { - - public SliceinTwain (UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{2}{G}{G}"); - - this.getSpellAbility().addEffect(new DestroyTargetEffect()); - this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(1)); - this.getSpellAbility().addTarget(new TargetPermanent(StaticFilters.ARTIFACT_OR_ENCHANTMENT_PERMANENT)); - } - - public SliceinTwain (final SliceinTwain card) { - super(card); - } - - @Override - public SliceinTwain copy() { - return new SliceinTwain(this); - } -} From 8302aa1c543c12688a5c18094d7a8ffe119032e6 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sat, 16 Sep 2017 11:25:09 -0400 Subject: [PATCH 02/29] Updated Crown of Doom(untested) --- Mage.Sets/src/mage/cards/c/CrownOfDoom.java | 49 +++++++++------- Mage.Sets/src/mage/cards/s/SliceInTwain.java | 61 -------------------- 2 files changed, 29 insertions(+), 81 deletions(-) delete mode 100644 Mage.Sets/src/mage/cards/s/SliceInTwain.java diff --git a/Mage.Sets/src/mage/cards/c/CrownOfDoom.java b/Mage.Sets/src/mage/cards/c/CrownOfDoom.java index f5417c9a11..6226d57717 100644 --- a/Mage.Sets/src/mage/cards/c/CrownOfDoom.java +++ b/Mage.Sets/src/mage/cards/c/CrownOfDoom.java @@ -39,14 +39,13 @@ import mage.abilities.effects.Effect; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.continuous.BoostTargetEffect; import mage.abilities.effects.common.continuous.GainControlTargetEffect; -import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.*; import mage.filter.FilterPlayer; import mage.filter.StaticFilters; -import mage.filter.predicate.Predicates; -import mage.filter.predicate.other.PlayerIdPredicate; +import mage.filter.predicate.ObjectSourcePlayer; +import mage.filter.predicate.ObjectSourcePlayerPredicate; import mage.game.Game; import mage.players.Player; import mage.target.TargetPlayer; @@ -58,7 +57,11 @@ import mage.target.targetpointer.FixedTarget; */ public class CrownOfDoom extends CardImpl { - private UUID abilityId; + private static final FilterPlayer filter = new FilterPlayer("player other than Crown of Doom's owner"); + + static { + filter.add(new CrownOfDoomPredicate()); + } public CrownOfDoom(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}"); @@ -71,27 +74,12 @@ public class CrownOfDoom extends CardImpl { //TODO: Make ability properly copiable // {2}: Target player other than Crown of Doom's owner gains control of it. Activate this ability only during your turn. Ability ability = new ActivateIfConditionActivatedAbility(Zone.BATTLEFIELD, new CrownOfDoomEffect(), new ManaCostsImpl("{2}"), MyTurnCondition.instance); - ability.addTarget(new TargetPlayer(1, 1, false, new FilterPlayer("player other than Crown of Doom's owner"))); - abilityId = ability.getOriginalId(); + ability.addTarget(new TargetPlayer(1, 1, false, filter)); this.addAbility(ability); } - @Override - public void adjustTargets(Ability ability, Game game) { - if (ability.getOriginalId().equals(abilityId)) { - Card sourceCard = game.getCard(ability.getSourceId()); - if (sourceCard != null) { - ability.getTargets().clear(); - FilterPlayer filter = new FilterPlayer("player other than " + sourceCard.getIdName() + "'s owner"); - filter.add(Predicates.not(new PlayerIdPredicate(sourceCard.getOwnerId()))); - ability.addTarget(new TargetPlayer(1, 1, false, filter)); - } - } - } - public CrownOfDoom(final CrownOfDoom card) { super(card); - this.abilityId = card.abilityId; } @Override @@ -100,6 +88,27 @@ public class CrownOfDoom extends CardImpl { } } +class CrownOfDoomPredicate implements ObjectSourcePlayerPredicate> { + + public CrownOfDoomPredicate() { + } + + @Override + public boolean apply(ObjectSourcePlayer input, Game game) { + Player player = input.getObject(); + UUID playerId = input.getPlayerId(); + if (player == null || playerId == null) { + return false; + } + return !player.getId().equals(playerId); + } + + @Override + public String toString() { + return "Owner()"; + } +} + class CrownOfDoomEffect extends OneShotEffect { public CrownOfDoomEffect() { diff --git a/Mage.Sets/src/mage/cards/s/SliceInTwain.java b/Mage.Sets/src/mage/cards/s/SliceInTwain.java deleted file mode 100644 index 4e1695832a..0000000000 --- a/Mage.Sets/src/mage/cards/s/SliceInTwain.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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.abilities.effects.common.DestroyTargetEffect; -import mage.abilities.effects.common.DrawCardSourceControllerEffect; -import mage.cards.CardImpl; -import mage.cards.CardSetInfo; -import mage.constants.CardType; -import mage.filter.StaticFilters; -import mage.target.TargetPermanent; - -/** - * - * @author Loki - */ -public class SliceInTwain extends CardImpl { - - public SliceInTwain(UUID ownerId, CardSetInfo setInfo) { - super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{G}{G}"); - - this.getSpellAbility().addEffect(new DestroyTargetEffect()); - this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(1).setText("
br>Draw a card")); - this.getSpellAbility().addTarget(new TargetPermanent(StaticFilters.ARTIFACT_OR_ENCHANTMENT_PERMANENT)); - } - - public SliceInTwain(final SliceInTwain card) { - super(card); - } - - @Override - public SliceInTwain copy() { - return new SliceInTwain(this); - } -} From d68efc21c584f659cb1a31c72e19c92baaa7664e Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sat, 16 Sep 2017 12:58:25 -0400 Subject: [PATCH 03/29] Changed some X cost abilities (untested) --- .../src/mage/cards/a/AlexiZephyrMage.java | 26 ++++++---------- .../src/mage/cards/c/CandelabraOfTawnos.java | 19 ++++++------ Mage.Sets/src/mage/cards/f/FloodwaterDam.java | 21 ++++++------- .../mage/cards/m/MagusOfTheCandelabra.java | 19 ++++++------ Mage.Sets/src/mage/cards/m/MishrasHelix.java | 20 ++++++------ .../src/mage/cards/s/SynodArtificer.java | 31 +++++++++---------- .../src/main/java/mage/abilities/Ability.java | 5 +++ .../main/java/mage/abilities/AbilityImpl.java | 10 ++++++ .../java/mage/constants/TargetAdjustment.java | 10 ++++++ .../java/mage/game/stack/StackAbility.java | 10 ++++++ 10 files changed, 99 insertions(+), 72 deletions(-) create mode 100644 Mage/src/main/java/mage/constants/TargetAdjustment.java diff --git a/Mage.Sets/src/mage/cards/a/AlexiZephyrMage.java b/Mage.Sets/src/mage/cards/a/AlexiZephyrMage.java index bd8ff13e1c..2b2415b778 100644 --- a/Mage.Sets/src/mage/cards/a/AlexiZephyrMage.java +++ b/Mage.Sets/src/mage/cards/a/AlexiZephyrMage.java @@ -40,10 +40,11 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; import mage.constants.SuperType; +import mage.constants.TargetAdjustment; import mage.constants.Zone; import mage.filter.FilterCard; import mage.filter.FilterPermanent; -import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.StaticFilters; import mage.game.Game; import mage.target.TargetPermanent; import mage.target.common.TargetCardInHand; @@ -53,17 +54,9 @@ import mage.target.common.TargetCardInHand; * @author escplan9 (Derek Monturo - dmontur1 at gmail dot com) */ public class AlexiZephyrMage extends CardImpl { - - private final UUID originalId; - - private static final FilterPermanent filter = new FilterPermanent("Target creatures"); - - static { - filter.add(new CardTypePredicate(CardType.CREATURE)); - } public AlexiZephyrMage(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{U}{U}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U}{U}"); addSuperType(SuperType.LEGENDARY); this.subtype.add(SubType.HUMAN); this.subtype.add(SubType.SPELLSHAPER); @@ -75,22 +68,21 @@ public class AlexiZephyrMage extends CardImpl { Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ReturnToHandTargetEffect(), new ManaCostsImpl("{X}{U}")); ability.addCost(new TapSourceCost()); ability.addCost(new DiscardTargetCost(new TargetCardInHand(2, new FilterCard("two cards")))); - this.addAbility(ability); - - originalId = ability.getOriginalId(); + ability.addTarget(new TargetPermanent(StaticFilters.FILTER_PERMANENT_CREATURES)); + this.addAbility(ability); } - + @Override public void adjustTargets(Ability ability, Game game) { - if (ability.getOriginalId().equals(originalId)) { + if (ability.getTargetAdjustment() == TargetAdjustment.XCOST) { + FilterPermanent filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter(); ability.getTargets().clear(); - ability.addTarget(new TargetPermanent(ability.getManaCostsToPay().getX(), filter)); + ability.addTarget(new TargetPermanent(ability.getManaCostsToPay().getX(), filter2)); } } public AlexiZephyrMage(final AlexiZephyrMage card) { super(card); - this.originalId = card.originalId; } @Override diff --git a/Mage.Sets/src/mage/cards/c/CandelabraOfTawnos.java b/Mage.Sets/src/mage/cards/c/CandelabraOfTawnos.java index 2d85919813..b2e80d8ca5 100644 --- a/Mage.Sets/src/mage/cards/c/CandelabraOfTawnos.java +++ b/Mage.Sets/src/mage/cards/c/CandelabraOfTawnos.java @@ -37,10 +37,13 @@ import mage.abilities.effects.common.UntapTargetEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; +import mage.constants.TargetAdjustment; import mage.constants.Zone; +import mage.filter.FilterPermanent; +import mage.filter.StaticFilters; import mage.filter.common.FilterLandPermanent; import mage.game.Game; -import mage.target.common.TargetLandPermanent; +import mage.target.TargetPermanent; /** * @@ -48,10 +51,8 @@ import mage.target.common.TargetLandPermanent; */ public class CandelabraOfTawnos extends CardImpl { - private final UUID originalId; - public CandelabraOfTawnos(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{1}"); + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{1}"); //TODO: Make ability properly copiable // {X}, {T}: Untap X target lands. @@ -59,22 +60,22 @@ public class CandelabraOfTawnos extends CardImpl { effect.setText("untap X target lands"); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{X}")); ability.addCost(new TapSourceCost()); - originalId = ability.getOriginalId(); + ability.addTarget(new TargetPermanent(StaticFilters.FILTER_LANDS)); + ability.setTargetAdjustment(TargetAdjustment.XCOST); this.addAbility(ability); } @Override public void adjustTargets(Ability ability, Game game) { - if (ability.getOriginalId().equals(originalId)){ - int xValue = ability.getManaCostsToPay().getX(); + if (ability.getTargetAdjustment() == TargetAdjustment.XCOST) { + FilterPermanent filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter(); ability.getTargets().clear(); - ability.addTarget(new TargetLandPermanent(xValue, xValue, new FilterLandPermanent(), false)); + ability.addTarget(new TargetPermanent(ability.getManaCostsToPay().getX(), filter2)); } } public CandelabraOfTawnos(final CandelabraOfTawnos card) { super(card); - this.originalId = card.originalId; } @Override diff --git a/Mage.Sets/src/mage/cards/f/FloodwaterDam.java b/Mage.Sets/src/mage/cards/f/FloodwaterDam.java index 10f6e12d9b..61418605c7 100644 --- a/Mage.Sets/src/mage/cards/f/FloodwaterDam.java +++ b/Mage.Sets/src/mage/cards/f/FloodwaterDam.java @@ -37,21 +37,21 @@ import mage.abilities.effects.common.TapTargetEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; +import mage.constants.TargetAdjustment; import mage.constants.Zone; -import mage.filter.common.FilterLandPermanent; +import mage.filter.FilterPermanent; +import mage.filter.StaticFilters; import mage.game.Game; -import mage.target.common.TargetLandPermanent; +import mage.target.TargetPermanent; /** * * @author fireshoes */ public class FloodwaterDam extends CardImpl { - - private final UUID originalId; public FloodwaterDam(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{3}"); + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}"); //TODO: Make ability properly copiable // {X}{X}{1}, {tap}: Tap X target lands. @@ -59,22 +59,21 @@ public class FloodwaterDam extends CardImpl { effect.setText("tap X target lands"); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{X}{X}{1}")); ability.addCost(new TapSourceCost()); - originalId = ability.getOriginalId(); + ability.addTarget(new TargetPermanent(StaticFilters.FILTER_LANDS)); this.addAbility(ability); } - + @Override public void adjustTargets(Ability ability, Game game) { - if (ability.getOriginalId().equals(originalId)){ - int xValue = ability.getManaCostsToPay().getX(); + if (ability.getTargetAdjustment() == TargetAdjustment.XCOST) { + FilterPermanent filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter(); ability.getTargets().clear(); - ability.addTarget(new TargetLandPermanent(xValue, xValue, new FilterLandPermanent(), false)); + ability.addTarget(new TargetPermanent(ability.getManaCostsToPay().getX(), filter2)); } } public FloodwaterDam(final FloodwaterDam card) { super(card); - this.originalId = card.originalId; } @Override diff --git a/Mage.Sets/src/mage/cards/m/MagusOfTheCandelabra.java b/Mage.Sets/src/mage/cards/m/MagusOfTheCandelabra.java index c9a584d835..57fc1369fd 100644 --- a/Mage.Sets/src/mage/cards/m/MagusOfTheCandelabra.java +++ b/Mage.Sets/src/mage/cards/m/MagusOfTheCandelabra.java @@ -39,20 +39,21 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; +import mage.constants.TargetAdjustment; import mage.constants.Zone; +import mage.filter.FilterPermanent; import mage.filter.StaticFilters; +import mage.filter.common.FilterLandPermanent; import mage.game.Game; -import mage.target.common.TargetLandPermanent; +import mage.target.TargetPermanent; /** * @author duncant */ public class MagusOfTheCandelabra extends CardImpl { - private final UUID originalId; - public MagusOfTheCandelabra(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{G}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{G}"); this.subtype.add(SubType.HUMAN); this.subtype.add(SubType.WIZARD); @@ -65,22 +66,22 @@ public class MagusOfTheCandelabra extends CardImpl { effect.setText("untap X target lands"); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{X}")); ability.addCost(new TapSourceCost()); - originalId = ability.getOriginalId(); + ability.addTarget(new TargetPermanent(StaticFilters.FILTER_LANDS)); + ability.setTargetAdjustment(TargetAdjustment.XCOST); this.addAbility(ability); } @Override public void adjustTargets(Ability ability, Game game) { - if (ability.getOriginalId().equals(originalId)){ - int xValue = ability.getManaCostsToPay().getX(); + if (ability.getTargetAdjustment() == TargetAdjustment.XCOST) { + FilterPermanent filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter(); ability.getTargets().clear(); - ability.addTarget(new TargetLandPermanent(xValue, xValue, StaticFilters.FILTER_LANDS, false)); + ability.addTarget(new TargetPermanent(ability.getManaCostsToPay().getX(), filter2)); } } public MagusOfTheCandelabra(final MagusOfTheCandelabra card) { super(card); - this.originalId = card.originalId; } @Override diff --git a/Mage.Sets/src/mage/cards/m/MishrasHelix.java b/Mage.Sets/src/mage/cards/m/MishrasHelix.java index c8beab689b..5bc9459d63 100644 --- a/Mage.Sets/src/mage/cards/m/MishrasHelix.java +++ b/Mage.Sets/src/mage/cards/m/MishrasHelix.java @@ -37,43 +37,43 @@ import mage.abilities.effects.common.TapTargetEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; +import mage.constants.TargetAdjustment; import mage.constants.Zone; +import mage.filter.FilterPermanent; import mage.filter.StaticFilters; import mage.game.Game; -import mage.target.common.TargetLandPermanent; +import mage.target.TargetPermanent; /** * * @author fireshoes */ public class MishrasHelix extends CardImpl { - - private final UUID originalId; public MishrasHelix(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{5}"); + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{5}"); //TODO: Make ability properly copiable // {X}, {tap}: Tap X target lands. Effect effect = new TapTargetEffect("X target lands"); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{X}")); ability.addCost(new TapSourceCost()); - originalId = ability.getOriginalId(); + ability.addTarget(new TargetPermanent(StaticFilters.FILTER_LANDS)); + ability.setTargetAdjustment(TargetAdjustment.XCOST); this.addAbility(ability); } - + @Override public void adjustTargets(Ability ability, Game game) { - if (ability.getOriginalId().equals(originalId)){ - int xValue = ability.getManaCostsToPay().getX(); + if (ability.getTargetAdjustment() == TargetAdjustment.XCOST) { + FilterPermanent filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter(); ability.getTargets().clear(); - ability.addTarget(new TargetLandPermanent(xValue, xValue, StaticFilters.FILTER_LANDS, false)); + ability.addTarget(new TargetPermanent(ability.getManaCostsToPay().getX(), filter2)); } } public MishrasHelix(final MishrasHelix card) { super(card); - this.originalId = card.originalId; } @Override diff --git a/Mage.Sets/src/mage/cards/s/SynodArtificer.java b/Mage.Sets/src/mage/cards/s/SynodArtificer.java index bd0ac7cc02..9e1ba9ce68 100644 --- a/Mage.Sets/src/mage/cards/s/SynodArtificer.java +++ b/Mage.Sets/src/mage/cards/s/SynodArtificer.java @@ -40,6 +40,7 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; +import mage.constants.TargetAdjustment; import mage.constants.Zone; import mage.filter.FilterPermanent; import mage.filter.predicate.Predicates; @@ -52,18 +53,16 @@ import mage.target.TargetPermanent; * @author escplan9 (Derek Monturo - dmontur1 at gmail dot com) */ public class SynodArtificer extends CardImpl { - - private final UUID tapId; - private final UUID untapId; - private static final FilterPermanent filter = new FilterPermanent("Target noncreature artifacts"); - + + private static final FilterPermanent filter = new FilterPermanent("noncreature artifacts"); + static { filter.add(new CardTypePredicate(CardType.ARTIFACT)); filter.add(Predicates.not(new CardTypePredicate(CardType.CREATURE))); } public SynodArtificer(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{U}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U}"); this.subtype.add(SubType.VEDALKEN); this.subtype.add(SubType.ARTIFICER); this.power = new MageInt(1); @@ -74,32 +73,32 @@ public class SynodArtificer extends CardImpl { Effect tapEffect = new TapTargetEffect(); tapEffect.setText("Tap X target noncreature artifacts."); Ability tapAbility = new SimpleActivatedAbility(Zone.BATTLEFIELD, tapEffect, new ManaCostsImpl("{X}")); - tapAbility.addCost(new TapSourceCost()); + tapAbility.addCost(new TapSourceCost()); + tapAbility.setTargetAdjustment(TargetAdjustment.XCOST); + tapAbility.addTarget(new TargetPermanent(filter)); this.addAbility(tapAbility); - + // {X}, {tap}: Untap X target noncreature artifacts. Effect untapEffect = new UntapTargetEffect(); untapEffect.setText("Untap X target noncreature artifacts."); Ability untapAbility = new SimpleActivatedAbility(Zone.BATTLEFIELD, untapEffect, new ManaCostsImpl("{X}")); untapAbility.addCost(new TapSourceCost()); + untapAbility.setTargetAdjustment(TargetAdjustment.XCOST); + untapAbility.addTarget(new TargetPermanent(filter)); this.addAbility(untapAbility); - - tapId = tapAbility.getOriginalId(); - untapId = untapAbility.getOriginalId(); } - + @Override public void adjustTargets(Ability ability, Game game) { - if (ability.getOriginalId().equals(tapId) || ability.getOriginalId().equals(untapId)) { + if (ability.getTargetAdjustment() == TargetAdjustment.XCOST) { + FilterPermanent filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter(); ability.getTargets().clear(); - ability.addTarget(new TargetPermanent(ability.getManaCostsToPay().getX(), filter)); + ability.addTarget(new TargetPermanent(ability.getManaCostsToPay().getX(), filter2)); } } public SynodArtificer(final SynodArtificer card) { super(card); - this.tapId = card.tapId; - this.untapId = card.untapId; } @Override diff --git a/Mage/src/main/java/mage/abilities/Ability.java b/Mage/src/main/java/mage/abilities/Ability.java index fcc0a5db82..d6baff95d4 100644 --- a/Mage/src/main/java/mage/abilities/Ability.java +++ b/Mage/src/main/java/mage/abilities/Ability.java @@ -40,6 +40,7 @@ import mage.abilities.effects.Effects; import mage.constants.AbilityType; import mage.constants.AbilityWord; import mage.constants.EffectType; +import mage.constants.TargetAdjustment; import mage.constants.Zone; import mage.game.Controllable; import mage.game.Game; @@ -539,4 +540,8 @@ public interface Ability extends Controllable, Serializable { void setCanFizzle(boolean canFizzle); boolean canFizzle(); + + void setTargetAdjustment(TargetAdjustment targetAdjustment); + + TargetAdjustment getTargetAdjustment(); } diff --git a/Mage/src/main/java/mage/abilities/AbilityImpl.java b/Mage/src/main/java/mage/abilities/AbilityImpl.java index e814b181f0..ed1d152a3f 100644 --- a/Mage/src/main/java/mage/abilities/AbilityImpl.java +++ b/Mage/src/main/java/mage/abilities/AbilityImpl.java @@ -99,6 +99,7 @@ public abstract class AbilityImpl implements Ability { protected List watchers = null; protected List subAbilities = null; protected boolean canFizzle = true; + protected TargetAdjustment targetAdjustment; public AbilityImpl(AbilityType abilityType, Zone zone) { this.id = UUID.randomUUID(); @@ -1233,4 +1234,13 @@ public abstract class AbilityImpl implements Ability { this.canFizzle = canFizzle; } + @Override + public void setTargetAdjustment(TargetAdjustment targetAdjustment) { + this.targetAdjustment = targetAdjustment; + } + + @Override + public TargetAdjustment getTargetAdjustment() { + return targetAdjustment; + } } diff --git a/Mage/src/main/java/mage/constants/TargetAdjustment.java b/Mage/src/main/java/mage/constants/TargetAdjustment.java new file mode 100644 index 0000000000..feef999d24 --- /dev/null +++ b/Mage/src/main/java/mage/constants/TargetAdjustment.java @@ -0,0 +1,10 @@ +package mage.constants; + +/** + * + * @author TheElk801 + */ +public enum TargetAdjustment { + + NONE,XCOST,DEFENDING_PLAYER +} diff --git a/Mage/src/main/java/mage/game/stack/StackAbility.java b/Mage/src/main/java/mage/game/stack/StackAbility.java index 8af807bf2d..6f2240dc01 100644 --- a/Mage/src/main/java/mage/game/stack/StackAbility.java +++ b/Mage/src/main/java/mage/game/stack/StackAbility.java @@ -74,6 +74,7 @@ public class StackAbility extends StackObjImpl implements Ability { private UUID controllerId; private String name; private String expansionSetCode; + private TargetAdjustment targetAdjustment = TargetAdjustment.NONE; public StackAbility(Ability ability, UUID controllerId) { this.ability = ability; @@ -612,4 +613,13 @@ public class StackAbility extends StackObjImpl implements Ability { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } + @Override + public void setTargetAdjustment(TargetAdjustment targetAdjustment) { + this.targetAdjustment = targetAdjustment; + } + + @Override + public TargetAdjustment getTargetAdjustment() { + return targetAdjustment; + } } From 856dcb54d5b76377ade54bd6d8d26f012ec38fcf Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sat, 16 Sep 2017 17:07:48 -0400 Subject: [PATCH 04/29] updated abilities with x targets --- .../src/mage/cards/a/AlexiZephyrMage.java | 2 +- .../src/mage/cards/c/CandelabraOfTawnos.java | 4 +- Mage.Sets/src/mage/cards/f/FloodwaterDam.java | 2 +- .../mage/cards/m/MagusOfTheCandelabra.java | 4 +- Mage.Sets/src/mage/cards/m/MishrasHelix.java | 4 +- Mage.Sets/src/mage/cards/s/SliceInTwain.java | 61 +++++++++++++++++++ .../src/mage/cards/s/SynodArtificer.java | 6 +- .../main/java/mage/abilities/AbilityImpl.java | 3 +- .../java/mage/constants/TargetAdjustment.java | 2 +- .../java/mage/game/stack/StackAbility.java | 1 + 10 files changed, 76 insertions(+), 13 deletions(-) create mode 100644 Mage.Sets/src/mage/cards/s/SliceInTwain.java diff --git a/Mage.Sets/src/mage/cards/a/AlexiZephyrMage.java b/Mage.Sets/src/mage/cards/a/AlexiZephyrMage.java index 2b2415b778..0dcf0b0d3a 100644 --- a/Mage.Sets/src/mage/cards/a/AlexiZephyrMage.java +++ b/Mage.Sets/src/mage/cards/a/AlexiZephyrMage.java @@ -74,7 +74,7 @@ public class AlexiZephyrMage extends CardImpl { @Override public void adjustTargets(Ability ability, Game game) { - if (ability.getTargetAdjustment() == TargetAdjustment.XCOST) { + if (ability.getTargetAdjustment() == TargetAdjustment.X_TARGETS) { FilterPermanent filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter(); ability.getTargets().clear(); ability.addTarget(new TargetPermanent(ability.getManaCostsToPay().getX(), filter2)); diff --git a/Mage.Sets/src/mage/cards/c/CandelabraOfTawnos.java b/Mage.Sets/src/mage/cards/c/CandelabraOfTawnos.java index b2e80d8ca5..eb1ca1f4d9 100644 --- a/Mage.Sets/src/mage/cards/c/CandelabraOfTawnos.java +++ b/Mage.Sets/src/mage/cards/c/CandelabraOfTawnos.java @@ -61,13 +61,13 @@ public class CandelabraOfTawnos extends CardImpl { Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{X}")); ability.addCost(new TapSourceCost()); ability.addTarget(new TargetPermanent(StaticFilters.FILTER_LANDS)); - ability.setTargetAdjustment(TargetAdjustment.XCOST); + ability.setTargetAdjustment(TargetAdjustment.X_TARGETS); this.addAbility(ability); } @Override public void adjustTargets(Ability ability, Game game) { - if (ability.getTargetAdjustment() == TargetAdjustment.XCOST) { + if (ability.getTargetAdjustment() == TargetAdjustment.X_TARGETS) { FilterPermanent filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter(); ability.getTargets().clear(); ability.addTarget(new TargetPermanent(ability.getManaCostsToPay().getX(), filter2)); diff --git a/Mage.Sets/src/mage/cards/f/FloodwaterDam.java b/Mage.Sets/src/mage/cards/f/FloodwaterDam.java index 61418605c7..d2c247a06c 100644 --- a/Mage.Sets/src/mage/cards/f/FloodwaterDam.java +++ b/Mage.Sets/src/mage/cards/f/FloodwaterDam.java @@ -65,7 +65,7 @@ public class FloodwaterDam extends CardImpl { @Override public void adjustTargets(Ability ability, Game game) { - if (ability.getTargetAdjustment() == TargetAdjustment.XCOST) { + if (ability.getTargetAdjustment() == TargetAdjustment.X_TARGETS) { FilterPermanent filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter(); ability.getTargets().clear(); ability.addTarget(new TargetPermanent(ability.getManaCostsToPay().getX(), filter2)); diff --git a/Mage.Sets/src/mage/cards/m/MagusOfTheCandelabra.java b/Mage.Sets/src/mage/cards/m/MagusOfTheCandelabra.java index 57fc1369fd..cf570c5efa 100644 --- a/Mage.Sets/src/mage/cards/m/MagusOfTheCandelabra.java +++ b/Mage.Sets/src/mage/cards/m/MagusOfTheCandelabra.java @@ -67,13 +67,13 @@ public class MagusOfTheCandelabra extends CardImpl { Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{X}")); ability.addCost(new TapSourceCost()); ability.addTarget(new TargetPermanent(StaticFilters.FILTER_LANDS)); - ability.setTargetAdjustment(TargetAdjustment.XCOST); + ability.setTargetAdjustment(TargetAdjustment.X_TARGETS); this.addAbility(ability); } @Override public void adjustTargets(Ability ability, Game game) { - if (ability.getTargetAdjustment() == TargetAdjustment.XCOST) { + if (ability.getTargetAdjustment() == TargetAdjustment.X_TARGETS) { FilterPermanent filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter(); ability.getTargets().clear(); ability.addTarget(new TargetPermanent(ability.getManaCostsToPay().getX(), filter2)); diff --git a/Mage.Sets/src/mage/cards/m/MishrasHelix.java b/Mage.Sets/src/mage/cards/m/MishrasHelix.java index 5bc9459d63..c8c131d7b7 100644 --- a/Mage.Sets/src/mage/cards/m/MishrasHelix.java +++ b/Mage.Sets/src/mage/cards/m/MishrasHelix.java @@ -59,13 +59,13 @@ public class MishrasHelix extends CardImpl { Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{X}")); ability.addCost(new TapSourceCost()); ability.addTarget(new TargetPermanent(StaticFilters.FILTER_LANDS)); - ability.setTargetAdjustment(TargetAdjustment.XCOST); + ability.setTargetAdjustment(TargetAdjustment.X_TARGETS); this.addAbility(ability); } @Override public void adjustTargets(Ability ability, Game game) { - if (ability.getTargetAdjustment() == TargetAdjustment.XCOST) { + if (ability.getTargetAdjustment() == TargetAdjustment.X_TARGETS) { FilterPermanent filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter(); ability.getTargets().clear(); ability.addTarget(new TargetPermanent(ability.getManaCostsToPay().getX(), filter2)); diff --git a/Mage.Sets/src/mage/cards/s/SliceInTwain.java b/Mage.Sets/src/mage/cards/s/SliceInTwain.java new file mode 100644 index 0000000000..4e1695832a --- /dev/null +++ b/Mage.Sets/src/mage/cards/s/SliceInTwain.java @@ -0,0 +1,61 @@ +/* + * 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.abilities.effects.common.DestroyTargetEffect; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.filter.StaticFilters; +import mage.target.TargetPermanent; + +/** + * + * @author Loki + */ +public class SliceInTwain extends CardImpl { + + public SliceInTwain(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{G}{G}"); + + this.getSpellAbility().addEffect(new DestroyTargetEffect()); + this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(1).setText("
br>Draw a card")); + this.getSpellAbility().addTarget(new TargetPermanent(StaticFilters.ARTIFACT_OR_ENCHANTMENT_PERMANENT)); + } + + public SliceInTwain(final SliceInTwain card) { + super(card); + } + + @Override + public SliceInTwain copy() { + return new SliceInTwain(this); + } +} diff --git a/Mage.Sets/src/mage/cards/s/SynodArtificer.java b/Mage.Sets/src/mage/cards/s/SynodArtificer.java index 9e1ba9ce68..4e4f875ec5 100644 --- a/Mage.Sets/src/mage/cards/s/SynodArtificer.java +++ b/Mage.Sets/src/mage/cards/s/SynodArtificer.java @@ -74,7 +74,7 @@ public class SynodArtificer extends CardImpl { tapEffect.setText("Tap X target noncreature artifacts."); Ability tapAbility = new SimpleActivatedAbility(Zone.BATTLEFIELD, tapEffect, new ManaCostsImpl("{X}")); tapAbility.addCost(new TapSourceCost()); - tapAbility.setTargetAdjustment(TargetAdjustment.XCOST); + tapAbility.setTargetAdjustment(TargetAdjustment.X_TARGETS); tapAbility.addTarget(new TargetPermanent(filter)); this.addAbility(tapAbility); @@ -83,14 +83,14 @@ public class SynodArtificer extends CardImpl { untapEffect.setText("Untap X target noncreature artifacts."); Ability untapAbility = new SimpleActivatedAbility(Zone.BATTLEFIELD, untapEffect, new ManaCostsImpl("{X}")); untapAbility.addCost(new TapSourceCost()); - untapAbility.setTargetAdjustment(TargetAdjustment.XCOST); + untapAbility.setTargetAdjustment(TargetAdjustment.X_TARGETS); untapAbility.addTarget(new TargetPermanent(filter)); this.addAbility(untapAbility); } @Override public void adjustTargets(Ability ability, Game game) { - if (ability.getTargetAdjustment() == TargetAdjustment.XCOST) { + if (ability.getTargetAdjustment() == TargetAdjustment.X_TARGETS) { FilterPermanent filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter(); ability.getTargets().clear(); ability.addTarget(new TargetPermanent(ability.getManaCostsToPay().getX(), filter2)); diff --git a/Mage/src/main/java/mage/abilities/AbilityImpl.java b/Mage/src/main/java/mage/abilities/AbilityImpl.java index ed1d152a3f..3fc2020dd7 100644 --- a/Mage/src/main/java/mage/abilities/AbilityImpl.java +++ b/Mage/src/main/java/mage/abilities/AbilityImpl.java @@ -99,7 +99,7 @@ public abstract class AbilityImpl implements Ability { protected List watchers = null; protected List subAbilities = null; protected boolean canFizzle = true; - protected TargetAdjustment targetAdjustment; + protected TargetAdjustment targetAdjustment = TargetAdjustment.NONE; public AbilityImpl(AbilityType abilityType, Zone zone) { this.id = UUID.randomUUID(); @@ -148,6 +148,7 @@ public abstract class AbilityImpl implements Ability { this.sourceObject = ability.sourceObject; this.sourceObjectZoneChangeCounter = ability.sourceObjectZoneChangeCounter; this.canFizzle = ability.canFizzle; + this.targetAdjustment = ability.targetAdjustment; } @Override diff --git a/Mage/src/main/java/mage/constants/TargetAdjustment.java b/Mage/src/main/java/mage/constants/TargetAdjustment.java index feef999d24..a29b5eb436 100644 --- a/Mage/src/main/java/mage/constants/TargetAdjustment.java +++ b/Mage/src/main/java/mage/constants/TargetAdjustment.java @@ -6,5 +6,5 @@ package mage.constants; */ public enum TargetAdjustment { - NONE,XCOST,DEFENDING_PLAYER + NONE, X_TARGETS, X_CMC_EQUAL_PERM, X_CMC_EQUAL_NONPERM, DEFENDING_PLAYER } diff --git a/Mage/src/main/java/mage/game/stack/StackAbility.java b/Mage/src/main/java/mage/game/stack/StackAbility.java index 6f2240dc01..48bf93cffc 100644 --- a/Mage/src/main/java/mage/game/stack/StackAbility.java +++ b/Mage/src/main/java/mage/game/stack/StackAbility.java @@ -87,6 +87,7 @@ public class StackAbility extends StackObjImpl implements Ability { this.controllerId = stackAbility.controllerId; this.name = stackAbility.name; this.expansionSetCode = stackAbility.expansionSetCode; + this.targetAdjustment = stackAbility.targetAdjustment; } @Override From 8ae2bf6c0876216f1c20da11a4461deda5f21910 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sat, 16 Sep 2017 17:39:26 -0400 Subject: [PATCH 05/29] updated abilities that target permanents with cmc x --- .../src/mage/cards/d/DeepfireElemental.java | 24 +++++++------- .../src/mage/cards/g/GethLordOfTheVault.java | 8 ++--- Mage.Sets/src/mage/cards/g/GorillaShaman.java | 32 +++++++++++-------- Mage.Sets/src/mage/cards/h/HearthKami.java | 29 ++++++++++------- .../src/mage/cards/l/LinessaZephyrMage.java | 32 ++++++++++++------- Mage.Sets/src/mage/cards/p/Plaguebearer.java | 28 ++++++++-------- 6 files changed, 87 insertions(+), 66 deletions(-) diff --git a/Mage.Sets/src/mage/cards/d/DeepfireElemental.java b/Mage.Sets/src/mage/cards/d/DeepfireElemental.java index 60ed530eb7..f32e56862d 100644 --- a/Mage.Sets/src/mage/cards/d/DeepfireElemental.java +++ b/Mage.Sets/src/mage/cards/d/DeepfireElemental.java @@ -38,13 +38,13 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; import mage.constants.ComparisonType; +import mage.constants.TargetAdjustment; import mage.constants.Zone; import mage.filter.FilterPermanent; import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.CardTypePredicate; import mage.filter.predicate.mageobject.ConvertedManaCostPredicate; import mage.game.Game; -import mage.target.Target; import mage.target.TargetPermanent; /** @@ -53,8 +53,6 @@ import mage.target.TargetPermanent; */ public class DeepfireElemental extends CardImpl { - private final UUID originalId; - private static final FilterPermanent filter = new FilterPermanent("artifact or creature with converted mana cost X"); static { @@ -62,7 +60,7 @@ public class DeepfireElemental extends CardImpl { } public DeepfireElemental(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{B}{R}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{B}{R}"); this.subtype.add(SubType.ELEMENTAL); this.power = new MageInt(4); @@ -72,25 +70,27 @@ public class DeepfireElemental extends CardImpl { // {X}{X}{1}: Destroy target artifact or creature with converted mana cost X. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DestroyTargetEffect(), new ManaCostsImpl("{X}{X}{1}")); ability.addTarget(new TargetPermanent(filter)); - originalId = ability.getOriginalId(); + ability.setTargetAdjustment(TargetAdjustment.X_CMC_EQUAL_PERM); this.addAbility(ability); } @Override public void adjustTargets(Ability ability, Game game) { - if (ability.getOriginalId().equals(originalId)) { + if (ability.getTargetAdjustment() == TargetAdjustment.X_CMC_EQUAL_PERM) { + int xValue = ability.getManaCostsToPay().getX(); + FilterPermanent filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter().copy(); + StringBuilder message = new StringBuilder(filter2.getMessage()); + message.setLength(message.length() - 1); + message.append(xValue); + filter2.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue)); + filter2.setMessage(message.toString()); ability.getTargets().clear(); - FilterPermanent newFilter = filter.copy(); - newFilter.setMessage(new StringBuilder("artifact or creature with converted mana cost {").append(ability.getManaCostsToPay().getX()).append('}').toString()); - newFilter.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, ability.getManaCostsToPay().getX())); - Target target = new TargetPermanent(newFilter); - ability.addTarget(target); + ability.getTargets().add(new TargetPermanent(filter2)); } } public DeepfireElemental(final DeepfireElemental card) { super(card); - this.originalId = card.originalId; } @Override diff --git a/Mage.Sets/src/mage/cards/g/GethLordOfTheVault.java b/Mage.Sets/src/mage/cards/g/GethLordOfTheVault.java index 2972eaff42..7d397f5562 100644 --- a/Mage.Sets/src/mage/cards/g/GethLordOfTheVault.java +++ b/Mage.Sets/src/mage/cards/g/GethLordOfTheVault.java @@ -42,6 +42,7 @@ import mage.constants.SubType; import mage.constants.ComparisonType; import mage.constants.Outcome; import mage.constants.SuperType; +import mage.constants.TargetAdjustment; import mage.constants.Zone; import mage.filter.FilterCard; import mage.filter.predicate.Predicates; @@ -57,8 +58,6 @@ import mage.target.common.TargetCardInOpponentsGraveyard; */ public class GethLordOfTheVault extends CardImpl { - private final UUID originalId; - public GethLordOfTheVault(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{B}{B}"); addSuperType(SuperType.LEGENDARY); @@ -73,14 +72,14 @@ public class GethLordOfTheVault extends CardImpl { // {X}{B}: Put target artifact or creature card with converted mana cost X from an opponent's graveyard onto the battlefield under your control tapped. // Then that player puts the top X cards of his or her library into his or her graveyard. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GethLordOfTheVaultEffect(), new ManaCostsImpl("{X}{B}")); - originalId = ability.getOriginalId(); + ability.setTargetAdjustment(TargetAdjustment.X_CMC_EQUAL_NONPERM); ability.addTarget(new TargetCardInOpponentsGraveyard(new FilterCard("artifact or creature card with converted mana cost X from an opponent's graveyard"))); this.addAbility(ability); } @Override public void adjustTargets(Ability ability, Game game) { - if (ability.getOriginalId().equals(originalId)) { + if (ability.getTargetAdjustment() == TargetAdjustment.X_CMC_EQUAL_NONPERM) { int xValue = ability.getManaCostsToPay().getX(); ability.getTargets().clear(); FilterCard filter = new FilterCard("artifact or creature card with converted mana cost " + xValue + " from an opponent's graveyard"); @@ -95,7 +94,6 @@ public class GethLordOfTheVault extends CardImpl { public GethLordOfTheVault(final GethLordOfTheVault card) { super(card); - this.originalId = card.originalId; } @Override diff --git a/Mage.Sets/src/mage/cards/g/GorillaShaman.java b/Mage.Sets/src/mage/cards/g/GorillaShaman.java index 96ce257d6f..17d0d377f0 100644 --- a/Mage.Sets/src/mage/cards/g/GorillaShaman.java +++ b/Mage.Sets/src/mage/cards/g/GorillaShaman.java @@ -38,13 +38,13 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; import mage.constants.ComparisonType; +import mage.constants.TargetAdjustment; import mage.constants.Zone; -import mage.filter.common.FilterArtifactPermanent; +import mage.filter.FilterPermanent; import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.CardTypePredicate; import mage.filter.predicate.mageobject.ConvertedManaCostPredicate; import mage.game.Game; -import mage.target.Target; import mage.target.TargetPermanent; /** @@ -53,10 +53,15 @@ import mage.target.TargetPermanent; */ public class GorillaShaman extends CardImpl { - private final UUID originalId; + private static final FilterPermanent filter = new FilterPermanent("noncreature artifact with converted mana cost X"); + + static { + filter.add(new CardTypePredicate(CardType.ARTIFACT)); + filter.add(Predicates.not(new CardTypePredicate(CardType.CREATURE))); + } public GorillaShaman(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{R}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{R}"); this.subtype.add(SubType.APE); this.subtype.add(SubType.SHAMAN); this.power = new MageInt(1); @@ -65,27 +70,28 @@ public class GorillaShaman extends CardImpl { //TODO: Make ability properly copiable // {X}{X}{1}: Destroy target noncreature artifact with converted mana cost X. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DestroyTargetEffect(), new ManaCostsImpl("{X}{X}{1}")); - ability.addTarget(new TargetPermanent(new FilterArtifactPermanent("noncreature artifact with converted mana cost X"))); - originalId = ability.getOriginalId(); + ability.addTarget(new TargetPermanent(filter)); + ability.setTargetAdjustment(TargetAdjustment.X_CMC_EQUAL_PERM); this.addAbility(ability); } @Override public void adjustTargets(Ability ability, Game game) { - if (ability.getOriginalId().equals(originalId)) { + if (ability.getTargetAdjustment() == TargetAdjustment.X_CMC_EQUAL_PERM) { int xValue = ability.getManaCostsToPay().getX(); + FilterPermanent filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter().copy(); + StringBuilder message = new StringBuilder(filter2.getMessage()); + message.setLength(message.length() - 1); + message.append(xValue); + filter2.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue)); + filter2.setMessage(message.toString()); ability.getTargets().clear(); - FilterArtifactPermanent filter = new FilterArtifactPermanent(new StringBuilder("noncreature artifact with converted mana cost ").append(xValue).toString()); - filter.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue)); - filter.add(Predicates.not(new CardTypePredicate(CardType.CREATURE))); - Target target = new TargetPermanent(filter); - ability.addTarget(target); + ability.getTargets().add(new TargetPermanent(filter2)); } } public GorillaShaman(final GorillaShaman card) { super(card); - this.originalId = card.originalId; } @Override diff --git a/Mage.Sets/src/mage/cards/h/HearthKami.java b/Mage.Sets/src/mage/cards/h/HearthKami.java index 636785d695..b2b0f851fa 100644 --- a/Mage.Sets/src/mage/cards/h/HearthKami.java +++ b/Mage.Sets/src/mage/cards/h/HearthKami.java @@ -39,11 +39,12 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; import mage.constants.ComparisonType; +import mage.constants.TargetAdjustment; import mage.constants.Zone; -import mage.filter.common.FilterArtifactPermanent; +import mage.filter.FilterPermanent; +import mage.filter.predicate.mageobject.CardTypePredicate; import mage.filter.predicate.mageobject.ConvertedManaCostPredicate; import mage.game.Game; -import mage.target.Target; import mage.target.TargetPermanent; /** @@ -51,7 +52,11 @@ import mage.target.TargetPermanent; */ public class HearthKami extends CardImpl { - private final UUID originalId; + private static final FilterPermanent filter = new FilterPermanent("artifact with converted mana cost X"); + + static { + filter.add(new CardTypePredicate(CardType.ARTIFACT)); + } public HearthKami(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{R}"); @@ -64,26 +69,28 @@ public class HearthKami extends CardImpl { // {X}, Sacrifice Hearth Kami: Destroy target artifact with converted mana cost X. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DestroyTargetEffect(), new ManaCostsImpl("{X}")); ability.addCost(new SacrificeSourceCost()); - ability.addTarget(new TargetPermanent(new FilterArtifactPermanent("artifact with converted mana cost X"))); - originalId = ability.getOriginalId(); + ability.addTarget(new TargetPermanent(filter)); + ability.setTargetAdjustment(TargetAdjustment.X_CMC_EQUAL_PERM); this.addAbility(ability); } @Override public void adjustTargets(Ability ability, Game game) { - if (ability.getOriginalId().equals(originalId)) { + if (ability.getTargetAdjustment() == TargetAdjustment.X_CMC_EQUAL_PERM) { int xValue = ability.getManaCostsToPay().getX(); + FilterPermanent filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter().copy(); + StringBuilder message = new StringBuilder(filter2.getMessage()); + message.setLength(message.length() - 1); + message.append(xValue); + filter2.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue)); + filter2.setMessage(message.toString()); ability.getTargets().clear(); - FilterArtifactPermanent filter = new FilterArtifactPermanent(new StringBuilder("artifact with converted mana cost ").append(xValue).toString()); - filter.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue)); - Target target = new TargetPermanent(filter); - ability.addTarget(target); + ability.getTargets().add(new TargetPermanent(filter2)); } } public HearthKami(final HearthKami card) { super(card); - this.originalId = card.originalId; } @Override diff --git a/Mage.Sets/src/mage/cards/l/LinessaZephyrMage.java b/Mage.Sets/src/mage/cards/l/LinessaZephyrMage.java index a3d8e126ca..c4201a00e4 100644 --- a/Mage.Sets/src/mage/cards/l/LinessaZephyrMage.java +++ b/Mage.Sets/src/mage/cards/l/LinessaZephyrMage.java @@ -43,19 +43,20 @@ import mage.constants.SubType; import mage.constants.ComparisonType; import mage.constants.Outcome; import mage.constants.SuperType; +import mage.constants.TargetAdjustment; import mage.constants.Zone; +import mage.filter.FilterPermanent; import mage.filter.common.FilterControlledPermanent; -import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.mageobject.CardTypePredicate; import mage.filter.predicate.mageobject.ConvertedManaCostPredicate; import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.Target; +import mage.target.TargetPermanent; import mage.target.TargetPlayer; import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetControlledPermanent; -import mage.target.common.TargetCreaturePermanent; /** * @@ -63,10 +64,14 @@ import mage.target.common.TargetCreaturePermanent; */ public class LinessaZephyrMage extends CardImpl { - private final UUID originalId; + private static final FilterPermanent filter = new FilterPermanent("creature with converted mana cost X"); + + static { + filter.add(new CardTypePredicate(CardType.CREATURE)); + } public LinessaZephyrMage(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{U}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U}"); this.addSuperType(SuperType.LEGENDARY); this.subtype.add(SubType.HUMAN); this.subtype.add(SubType.WIZARD); @@ -74,12 +79,12 @@ public class LinessaZephyrMage extends CardImpl { this.power = new MageInt(3); this.toughness = new MageInt(3); - //TODO: Make ability properly copiable + //TODO: Make ability properly copiable // {X}{U}{U}, {tap}: Return target creature with converted mana cost X to its owner's hand. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ReturnToHandTargetEffect(), new ManaCostsImpl("{X}{U}{U}")); ability.addCost(new TapSourceCost()); - ability.addTarget(new TargetCreaturePermanent()); - originalId = ability.getOriginalId(); + ability.addTarget(new TargetPermanent(filter)); + ability.setTargetAdjustment(TargetAdjustment.X_CMC_EQUAL_PERM); this.addAbility(ability); // Grandeur - Discard another card named Linessa, Zephyr Mage: Target player returns a creature he or she controls to its owner's hand, then repeats this process for an artifact, an enchantment, and a land. @@ -90,17 +95,20 @@ public class LinessaZephyrMage extends CardImpl { public LinessaZephyrMage(final LinessaZephyrMage card) { super(card); - this.originalId = card.originalId; } @Override public void adjustTargets(Ability ability, Game game) { - if (ability.getOriginalId().equals(originalId)) { + if (ability.getTargetAdjustment() == TargetAdjustment.X_CMC_EQUAL_PERM) { int xValue = ability.getManaCostsToPay().getX(); + FilterPermanent filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter().copy(); + StringBuilder message = new StringBuilder(filter2.getMessage()); + message.setLength(message.length() - 1); + message.append(xValue); + filter2.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue)); + filter2.setMessage(message.toString()); ability.getTargets().clear(); - FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with converted mana cost " + xValue); - filter.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue)); - ability.getTargets().add(new TargetCreaturePermanent(filter)); + ability.getTargets().add(new TargetPermanent(filter2)); } } diff --git a/Mage.Sets/src/mage/cards/p/Plaguebearer.java b/Mage.Sets/src/mage/cards/p/Plaguebearer.java index e308d6b8ee..b36c7bf8d8 100644 --- a/Mage.Sets/src/mage/cards/p/Plaguebearer.java +++ b/Mage.Sets/src/mage/cards/p/Plaguebearer.java @@ -39,13 +39,14 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; import mage.constants.ComparisonType; +import mage.constants.TargetAdjustment; import mage.constants.Zone; -import mage.filter.common.FilterCreaturePermanent; +import mage.filter.FilterPermanent; import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.CardTypePredicate; import mage.filter.predicate.mageobject.ColorPredicate; import mage.filter.predicate.mageobject.ConvertedManaCostPredicate; import mage.game.Game; -import mage.target.Target; import mage.target.TargetPermanent; /** @@ -54,15 +55,15 @@ import mage.target.TargetPermanent; */ public class Plaguebearer extends CardImpl { - private final UUID originalId; - private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("nonblack creature"); + private static final FilterPermanent filter = new FilterPermanent("nonblack creature with converted mana cost X"); static { + filter.add(new CardTypePredicate(CardType.CREATURE)); filter.add(Predicates.not(new ColorPredicate(ObjectColor.BLACK))); } public Plaguebearer(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{B}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{B}"); this.subtype.add(SubType.ZOMBIE); this.power = new MageInt(1); this.toughness = new MageInt(1); @@ -71,26 +72,27 @@ public class Plaguebearer extends CardImpl { // {X}{X}{B}: Destroy target nonblack creature with converted mana cost X. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DestroyTargetEffect(), new ManaCostsImpl("{X}{X}{B}")); ability.addTarget(new TargetPermanent(filter)); - originalId = ability.getOriginalId(); + ability.setTargetAdjustment(TargetAdjustment.X_CMC_EQUAL_PERM); this.addAbility(ability); } @Override public void adjustTargets(Ability ability, Game game) { - if (ability.getOriginalId().equals(originalId)) { + if (ability.getTargetAdjustment() == TargetAdjustment.X_CMC_EQUAL_PERM) { int xValue = ability.getManaCostsToPay().getX(); + FilterPermanent filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter().copy(); + StringBuilder message = new StringBuilder(filter2.getMessage()); + message.setLength(message.length() - 1); + message.append(xValue); + filter2.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue)); + filter2.setMessage(message.toString()); ability.getTargets().clear(); - FilterCreaturePermanent filter = new FilterCreaturePermanent(new StringBuilder("nonblack creature with converted mana cost ").append(xValue).toString()); - filter.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue)); - filter.add(Predicates.not(new ColorPredicate(ObjectColor.BLACK))); - Target target = new TargetPermanent(filter); - ability.addTarget(target); + ability.getTargets().add(new TargetPermanent(filter2)); } } public Plaguebearer(final Plaguebearer card) { super(card); - this.originalId = card.originalId; } @Override From b3712b88c7b3b2aee9ecb929a11809cf0a4037bc Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sat, 16 Sep 2017 21:06:29 -0400 Subject: [PATCH 06/29] updated Hakim, Loreweaver --- Mage.Sets/src/mage/cards/h/HakimLoreweaver.java | 16 ++++++++++++---- Mage.Sets/src/mage/sets/Mirage.java | 1 + .../decorator/ConditionalActivatedAbility.java | 2 +- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/Mage.Sets/src/mage/cards/h/HakimLoreweaver.java b/Mage.Sets/src/mage/cards/h/HakimLoreweaver.java index 2855978c7f..ba3efa7f1d 100644 --- a/Mage.Sets/src/mage/cards/h/HakimLoreweaver.java +++ b/Mage.Sets/src/mage/cards/h/HakimLoreweaver.java @@ -64,11 +64,10 @@ import mage.target.common.TargetCardInYourGraveyard; /** * - * @author jeffwadsworth + * @author jeffwadsworth, TheElk801 */ public class HakimLoreweaver extends CardImpl { - private final static String rule = "Return target Aura card from your graveyard to the battlefield attached to Hakim, Loreweaver. Activate this ability only during your upkeep and only if Hakim isn't enchanted."; private static final FilterCard filter = new FilterCard("target Aura card from your graveyard"); static { @@ -90,7 +89,11 @@ public class HakimLoreweaver extends CardImpl { this.addAbility(FlyingAbility.getInstance()); // {U}{U}: Return target Aura card from your graveyard to the battlefield attached to Hakim, Loreweaver. Activate this ability only during your upkeep and only if Hakim isn't enchanted. - Ability ability = new ConditionalActivatedAbility(Zone.BATTLEFIELD, new HakimLoreweaverEffect(), new ManaCostsImpl("{U}{U}"), new HakimLoreweaverCondition(), rule); + Ability ability = new ConditionalActivatedAbility( + Zone.BATTLEFIELD, + new HakimLoreweaverEffect(), + new ManaCostsImpl("{U}{U}"), + new HakimLoreweaverCondition()); ability.addTarget(new TargetCardInYourGraveyard(filter)); this.addAbility(ability); @@ -121,7 +124,7 @@ class HakimLoreweaverEffect extends OneShotEffect { public HakimLoreweaverEffect() { super(Outcome.Benefit); - this.staticText = "Return target Aura card from your graveyard to the battlefield attached to {this}. Activate this ability only during your upkeep and only if Hakim isn't enchanted"; + this.staticText = "Return target Aura card from your graveyard to the battlefield attached to {this}."; } public HakimLoreweaverEffect(final HakimLoreweaverEffect effect) { @@ -177,4 +180,9 @@ class HakimLoreweaverCondition implements Condition { } return false; } + + @Override + public String toString() { + return "only during your upkeep and only if {this} isn't enchanted"; + } } diff --git a/Mage.Sets/src/mage/sets/Mirage.java b/Mage.Sets/src/mage/sets/Mirage.java index 1106b3b3f1..1ef4ede70d 100644 --- a/Mage.Sets/src/mage/sets/Mirage.java +++ b/Mage.Sets/src/mage/sets/Mirage.java @@ -154,6 +154,7 @@ public class Mirage extends ExpansionSet { cards.add(new SetCardInfo("Gravebane Zombie", 25, Rarity.COMMON, mage.cards.g.GravebaneZombie.class)); cards.add(new SetCardInfo("Grave Servitude", 24, Rarity.COMMON, mage.cards.g.GraveServitude.class)); cards.add(new SetCardInfo("Grinning Totem", 268, Rarity.RARE, mage.cards.g.GrinningTotem.class)); + cards.add(new SetCardInfo("Hakim, Loreweaver", 68, Rarity.RARE, mage.cards.h.HakimLoreweaver.class)); cards.add(new SetCardInfo("Hall of Gemstone", 119, Rarity.RARE, mage.cards.h.HallOfGemstone.class)); cards.add(new SetCardInfo("Hammer of Bogardan", 181, Rarity.RARE, mage.cards.h.HammerOfBogardan.class)); cards.add(new SetCardInfo("Harbinger of Night", 26, Rarity.RARE, mage.cards.h.HarbingerOfNight.class)); diff --git a/Mage/src/main/java/mage/abilities/decorator/ConditionalActivatedAbility.java b/Mage/src/main/java/mage/abilities/decorator/ConditionalActivatedAbility.java index 86186e4b01..5f6cc15444 100644 --- a/Mage/src/main/java/mage/abilities/decorator/ConditionalActivatedAbility.java +++ b/Mage/src/main/java/mage/abilities/decorator/ConditionalActivatedAbility.java @@ -71,6 +71,6 @@ public class ConditionalActivatedAbility extends ActivatedAbilityImpl { if (ruleText != null && !ruleText.isEmpty()) { return ruleText; } - return super.getRule() + " Activate this ability only " + condition.toString(); + return super.getRule() + " Activate this ability only " + condition.toString() + "."; } } From dcddc91144c0ff4174acaf6abfb06d1dfc464226 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sat, 16 Sep 2017 21:08:52 -0400 Subject: [PATCH 07/29] Updated cards which target cards with attribute x --- .../src/mage/cards/d/DeepfireElemental.java | 4 -- .../src/mage/cards/g/GethLordOfTheVault.java | 27 +++++++----- Mage.Sets/src/mage/cards/g/GorillaShaman.java | 11 +++-- Mage.Sets/src/mage/cards/h/HearthKami.java | 4 -- .../src/mage/cards/l/LinessaZephyrMage.java | 4 -- .../src/mage/cards/m/MinamoSightbender.java | 42 +++++++++---------- Mage.Sets/src/mage/cards/p/Plaguebearer.java | 4 -- .../java/mage/constants/TargetAdjustment.java | 2 +- Mage/src/main/java/mage/target/Target.java | 9 ++-- .../src/main/java/mage/target/TargetImpl.java | 5 +++ 10 files changed, 53 insertions(+), 59 deletions(-) diff --git a/Mage.Sets/src/mage/cards/d/DeepfireElemental.java b/Mage.Sets/src/mage/cards/d/DeepfireElemental.java index f32e56862d..4cc1269083 100644 --- a/Mage.Sets/src/mage/cards/d/DeepfireElemental.java +++ b/Mage.Sets/src/mage/cards/d/DeepfireElemental.java @@ -79,11 +79,7 @@ public class DeepfireElemental extends CardImpl { if (ability.getTargetAdjustment() == TargetAdjustment.X_CMC_EQUAL_PERM) { int xValue = ability.getManaCostsToPay().getX(); FilterPermanent filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter().copy(); - StringBuilder message = new StringBuilder(filter2.getMessage()); - message.setLength(message.length() - 1); - message.append(xValue); filter2.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue)); - filter2.setMessage(message.toString()); ability.getTargets().clear(); ability.getTargets().add(new TargetPermanent(filter2)); } diff --git a/Mage.Sets/src/mage/cards/g/GethLordOfTheVault.java b/Mage.Sets/src/mage/cards/g/GethLordOfTheVault.java index 7d397f5562..3a99811b27 100644 --- a/Mage.Sets/src/mage/cards/g/GethLordOfTheVault.java +++ b/Mage.Sets/src/mage/cards/g/GethLordOfTheVault.java @@ -50,7 +50,7 @@ import mage.filter.predicate.mageobject.CardTypePredicate; import mage.filter.predicate.mageobject.ConvertedManaCostPredicate; import mage.game.Game; import mage.players.Player; -import mage.target.Target; +import mage.target.TargetCard; import mage.target.common.TargetCardInOpponentsGraveyard; /** @@ -58,6 +58,14 @@ import mage.target.common.TargetCardInOpponentsGraveyard; */ public class GethLordOfTheVault extends CardImpl { + private static final FilterCard filter = new FilterCard("artifact or creature card with converted mana cost X from an opponent's graveyard"); + + static { + filter.add(Predicates.or( + new CardTypePredicate(CardType.ARTIFACT), + new CardTypePredicate(CardType.CREATURE))); + } + public GethLordOfTheVault(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{B}{B}"); addSuperType(SuperType.LEGENDARY); @@ -72,23 +80,20 @@ public class GethLordOfTheVault extends CardImpl { // {X}{B}: Put target artifact or creature card with converted mana cost X from an opponent's graveyard onto the battlefield under your control tapped. // Then that player puts the top X cards of his or her library into his or her graveyard. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GethLordOfTheVaultEffect(), new ManaCostsImpl("{X}{B}")); - ability.setTargetAdjustment(TargetAdjustment.X_CMC_EQUAL_NONPERM); - ability.addTarget(new TargetCardInOpponentsGraveyard(new FilterCard("artifact or creature card with converted mana cost X from an opponent's graveyard"))); + ability.setTargetAdjustment(TargetAdjustment.GETH); + ability.addTarget(new TargetCardInOpponentsGraveyard(filter)); this.addAbility(ability); } @Override public void adjustTargets(Ability ability, Game game) { - if (ability.getTargetAdjustment() == TargetAdjustment.X_CMC_EQUAL_NONPERM) { + if (ability.getTargetAdjustment() == TargetAdjustment.GETH) { int xValue = ability.getManaCostsToPay().getX(); + TargetCard oldTarget = (TargetCard) ability.getTargets().get(0); + FilterCard filter2 = oldTarget.getFilter().copy(); + filter2.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue)); ability.getTargets().clear(); - FilterCard filter = new FilterCard("artifact or creature card with converted mana cost " + xValue + " from an opponent's graveyard"); - filter.add(Predicates.or( - new CardTypePredicate(CardType.ARTIFACT), - new CardTypePredicate(CardType.CREATURE))); - filter.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue)); - Target target = new TargetCardInOpponentsGraveyard(filter); - ability.addTarget(target); + ability.getTargets().add(new TargetCardInOpponentsGraveyard(filter2)); } } diff --git a/Mage.Sets/src/mage/cards/g/GorillaShaman.java b/Mage.Sets/src/mage/cards/g/GorillaShaman.java index 17d0d377f0..60d3ed4911 100644 --- a/Mage.Sets/src/mage/cards/g/GorillaShaman.java +++ b/Mage.Sets/src/mage/cards/g/GorillaShaman.java @@ -79,14 +79,13 @@ public class GorillaShaman extends CardImpl { public void adjustTargets(Ability ability, Game game) { if (ability.getTargetAdjustment() == TargetAdjustment.X_CMC_EQUAL_PERM) { int xValue = ability.getManaCostsToPay().getX(); - FilterPermanent filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter().copy(); - StringBuilder message = new StringBuilder(filter2.getMessage()); - message.setLength(message.length() - 1); - message.append(xValue); + TargetPermanent oldTarget = (TargetPermanent) ability.getTargets().get(0); + int minTargets = oldTarget.getMinNumberOfTargets(); + int maxTargets = oldTarget.getMaxNumberOfTargets(); + FilterPermanent filter2 = oldTarget.getFilter().copy(); filter2.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue)); - filter2.setMessage(message.toString()); ability.getTargets().clear(); - ability.getTargets().add(new TargetPermanent(filter2)); + ability.getTargets().add(new TargetPermanent(minTargets, maxTargets, filter2, false)); } } diff --git a/Mage.Sets/src/mage/cards/h/HearthKami.java b/Mage.Sets/src/mage/cards/h/HearthKami.java index b2b0f851fa..5e15b83de5 100644 --- a/Mage.Sets/src/mage/cards/h/HearthKami.java +++ b/Mage.Sets/src/mage/cards/h/HearthKami.java @@ -79,11 +79,7 @@ public class HearthKami extends CardImpl { if (ability.getTargetAdjustment() == TargetAdjustment.X_CMC_EQUAL_PERM) { int xValue = ability.getManaCostsToPay().getX(); FilterPermanent filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter().copy(); - StringBuilder message = new StringBuilder(filter2.getMessage()); - message.setLength(message.length() - 1); - message.append(xValue); filter2.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue)); - filter2.setMessage(message.toString()); ability.getTargets().clear(); ability.getTargets().add(new TargetPermanent(filter2)); } diff --git a/Mage.Sets/src/mage/cards/l/LinessaZephyrMage.java b/Mage.Sets/src/mage/cards/l/LinessaZephyrMage.java index c4201a00e4..c0df84cc21 100644 --- a/Mage.Sets/src/mage/cards/l/LinessaZephyrMage.java +++ b/Mage.Sets/src/mage/cards/l/LinessaZephyrMage.java @@ -102,11 +102,7 @@ public class LinessaZephyrMage extends CardImpl { if (ability.getTargetAdjustment() == TargetAdjustment.X_CMC_EQUAL_PERM) { int xValue = ability.getManaCostsToPay().getX(); FilterPermanent filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter().copy(); - StringBuilder message = new StringBuilder(filter2.getMessage()); - message.setLength(message.length() - 1); - message.append(xValue); filter2.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue)); - filter2.setMessage(message.toString()); ability.getTargets().clear(); ability.getTargets().add(new TargetPermanent(filter2)); } diff --git a/Mage.Sets/src/mage/cards/m/MinamoSightbender.java b/Mage.Sets/src/mage/cards/m/MinamoSightbender.java index 2b58cb8755..2fcb0b0b4b 100644 --- a/Mage.Sets/src/mage/cards/m/MinamoSightbender.java +++ b/Mage.Sets/src/mage/cards/m/MinamoSightbender.java @@ -33,19 +33,20 @@ import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.mana.ManaCostsImpl; -import mage.abilities.effects.Effect; import mage.abilities.effects.common.combat.CantBeBlockedTargetEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; import mage.constants.ComparisonType; +import mage.constants.TargetAdjustment; import mage.constants.Zone; -import mage.filter.common.FilterCreaturePermanent; +import mage.filter.FilterPermanent; +import mage.filter.predicate.mageobject.CardTypePredicate; import mage.filter.predicate.mageobject.PowerPredicate; import mage.game.Game; import mage.target.Target; -import mage.target.common.TargetCreaturePermanent; +import mage.target.TargetPermanent; /** * @@ -53,11 +54,14 @@ import mage.target.common.TargetCreaturePermanent; */ public class MinamoSightbender extends CardImpl { - private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with power X or less"); - private final UUID originalId; + private static final FilterPermanent filter = new FilterPermanent("creature with power X or less"); + + static { + filter.add(new CardTypePredicate(CardType.CREATURE)); + } public MinamoSightbender(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{U}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}"); this.subtype.add(SubType.HUMAN); this.subtype.add(SubType.WIZARD); @@ -67,34 +71,30 @@ public class MinamoSightbender extends CardImpl { //TODO: Make ability properly copiable // {X}, {T}: Target creature with power X or less can't be blocked this turn. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CantBeBlockedTargetEffect(), new ManaCostsImpl("{X}")); - Target target = new TargetCreaturePermanent(filter); + Target target = new TargetPermanent(filter); + ability.setTargetAdjustment(TargetAdjustment.X_POWER_LEQ); ability.addTarget(target); ability.addCost(new TapSourceCost()); - originalId = ability.getOriginalId(); this.addAbility(ability); } @Override public void adjustTargets(Ability ability, Game game) { - if (ability.getOriginalId().equals(originalId)) { - for (Effect effect : ability.getEffects()) { - if (effect instanceof CantBeBlockedTargetEffect) { - int manaX = ability.getManaCostsToPay().getX(); - ability.getTargets().clear(); - FilterCreaturePermanent newFilter = new FilterCreaturePermanent(new StringBuilder("creature with power ").append(manaX).append(" or less").toString()); - filter.add(new PowerPredicate(ComparisonType.FEWER_THAN, manaX + 1)); - Target target = new TargetCreaturePermanent(newFilter); - ability.addTarget(target); - break; - } - } + if (ability.getTargetAdjustment() == TargetAdjustment.X_POWER_LEQ) { + int xValue = ability.getManaCostsToPay().getX(); + TargetPermanent oldTarget = (TargetPermanent) ability.getTargets().get(0); + int minTargets = oldTarget.getMinNumberOfTargets(); + int maxTargets = oldTarget.getMaxNumberOfTargets(); + FilterPermanent filter2 = oldTarget.getFilter().copy(); + filter2.add(new PowerPredicate(ComparisonType.FEWER_THAN, xValue + 1)); + ability.getTargets().clear(); + ability.getTargets().add(new TargetPermanent(minTargets, maxTargets, filter2, false)); } } public MinamoSightbender(final MinamoSightbender card) { super(card); - this.originalId = card.originalId; } @Override diff --git a/Mage.Sets/src/mage/cards/p/Plaguebearer.java b/Mage.Sets/src/mage/cards/p/Plaguebearer.java index b36c7bf8d8..d3aeb685a4 100644 --- a/Mage.Sets/src/mage/cards/p/Plaguebearer.java +++ b/Mage.Sets/src/mage/cards/p/Plaguebearer.java @@ -81,11 +81,7 @@ public class Plaguebearer extends CardImpl { if (ability.getTargetAdjustment() == TargetAdjustment.X_CMC_EQUAL_PERM) { int xValue = ability.getManaCostsToPay().getX(); FilterPermanent filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter().copy(); - StringBuilder message = new StringBuilder(filter2.getMessage()); - message.setLength(message.length() - 1); - message.append(xValue); filter2.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue)); - filter2.setMessage(message.toString()); ability.getTargets().clear(); ability.getTargets().add(new TargetPermanent(filter2)); } diff --git a/Mage/src/main/java/mage/constants/TargetAdjustment.java b/Mage/src/main/java/mage/constants/TargetAdjustment.java index a29b5eb436..110087be1c 100644 --- a/Mage/src/main/java/mage/constants/TargetAdjustment.java +++ b/Mage/src/main/java/mage/constants/TargetAdjustment.java @@ -6,5 +6,5 @@ package mage.constants; */ public enum TargetAdjustment { - NONE, X_TARGETS, X_CMC_EQUAL_PERM, X_CMC_EQUAL_NONPERM, DEFENDING_PLAYER + NONE, X_TARGETS, X_CMC_EQUAL_PERM, GETH, DEFENDING_PLAYER,X_POWER_LEQ } diff --git a/Mage/src/main/java/mage/target/Target.java b/Mage/src/main/java/mage/target/Target.java index 647c6281e7..e36ef210c1 100644 --- a/Mage/src/main/java/mage/target/Target.java +++ b/Mage/src/main/java/mage/target/Target.java @@ -53,8 +53,7 @@ public interface Target extends Serializable { boolean isNotTarget(); /** - * controls if it will be checked, if the target can be targeted from - * source + * controls if it will be checked, if the target can be targeted from source * * @param notTarget true = do not check for protection, false = check for * protection @@ -113,6 +112,8 @@ public interface Target extends Serializable { int getNumberOfTargets(); + int getMinNumberOfTargets(); + int getMaxNumberOfTargets(); void setMinNumberOfTargets(int minNumberofTargets); @@ -157,8 +158,8 @@ public interface Target extends Serializable { void setTargetTag(int tag); Target getOriginalTarget(); - + // used for cards like Spellskite void setTargetAmount(UUID targetId, int amount, Game game); - + } diff --git a/Mage/src/main/java/mage/target/TargetImpl.java b/Mage/src/main/java/mage/target/TargetImpl.java index 546bafd5ad..3dbe7568cc 100644 --- a/Mage/src/main/java/mage/target/TargetImpl.java +++ b/Mage/src/main/java/mage/target/TargetImpl.java @@ -105,6 +105,11 @@ public abstract class TargetImpl implements Target { return this.minNumberOfTargets; } + @Override + public int getMinNumberOfTargets() { + return this.minNumberOfTargets; + } + @Override public int getMaxNumberOfTargets() { return this.maxNumberOfTargets; From 6800d80cae5e2d5295a4cb8513d717f4628ae7b6 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Tue, 19 Sep 2017 11:41:16 -0400 Subject: [PATCH 08/29] updated Crown of Doom --- Mage.Sets/src/mage/cards/c/CrownOfDoom.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Mage.Sets/src/mage/cards/c/CrownOfDoom.java b/Mage.Sets/src/mage/cards/c/CrownOfDoom.java index 6226d57717..851c8ecd92 100644 --- a/Mage.Sets/src/mage/cards/c/CrownOfDoom.java +++ b/Mage.Sets/src/mage/cards/c/CrownOfDoom.java @@ -47,6 +47,7 @@ import mage.filter.StaticFilters; import mage.filter.predicate.ObjectSourcePlayer; import mage.filter.predicate.ObjectSourcePlayerPredicate; import mage.game.Game; +import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.TargetPlayer; import mage.target.targetpointer.FixedTarget; @@ -57,7 +58,7 @@ import mage.target.targetpointer.FixedTarget; */ public class CrownOfDoom extends CardImpl { - private static final FilterPlayer filter = new FilterPlayer("player other than Crown of Doom's owner"); + private static final FilterPlayer filter = new FilterPlayer("player other than {this}'s owner"); static { filter.add(new CrownOfDoomPredicate()); @@ -95,17 +96,17 @@ class CrownOfDoomPredicate implements ObjectSourcePlayerPredicate input, Game game) { - Player player = input.getObject(); - UUID playerId = input.getPlayerId(); - if (player == null || playerId == null) { + Player targetPlayer = input.getObject(); + Permanent sourceObject = game.getPermanentOrLKIBattlefield(input.getSourceId()); + if (targetPlayer == null || sourceObject == null) { return false; } - return !player.getId().equals(playerId); + return !targetPlayer.getId().equals(sourceObject.getOwnerId()); } @Override public String toString() { - return "Owner()"; + return "Owner(" + ')'; } } From 96a3f40891722285170bd478b482f6368bbfab8c Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Tue, 19 Sep 2017 11:50:29 -0400 Subject: [PATCH 09/29] changed Ancient Hellkite, made predicate for cards/permanents defending player controls/owns --- .../src/mage/cards/a/AncientHellkite.java | 44 +++++++++------- .../java/mage/constants/TargetAdjustment.java | 2 +- .../DefendingPlayerControlsPredicate.java | 50 +++++++++++++++++++ .../DefendingPlayerOwnsCardPredicate.java | 50 +++++++++++++++++++ 4 files changed, 126 insertions(+), 20 deletions(-) create mode 100644 Mage/src/main/java/mage/filter/predicate/permanent/DefendingPlayerControlsPredicate.java create mode 100644 Mage/src/main/java/mage/filter/predicate/permanent/DefendingPlayerOwnsCardPredicate.java diff --git a/Mage.Sets/src/mage/cards/a/AncientHellkite.java b/Mage.Sets/src/mage/cards/a/AncientHellkite.java index 13b83e4168..85c754e4e7 100644 --- a/Mage.Sets/src/mage/cards/a/AncientHellkite.java +++ b/Mage.Sets/src/mage/cards/a/AncientHellkite.java @@ -40,10 +40,10 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; import mage.constants.Zone; -import mage.filter.common.FilterCreaturePermanent; -import mage.filter.predicate.permanent.ControllerIdPredicate; -import mage.game.Game; -import mage.target.common.TargetCreaturePermanent; +import mage.filter.FilterPermanent; +import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.predicate.permanent.DefendingPlayerControlsPredicate; +import mage.target.TargetPermanent; /** * @@ -51,7 +51,12 @@ import mage.target.common.TargetCreaturePermanent; */ public class AncientHellkite extends CardImpl { - private final UUID originalId; + private static final FilterPermanent filter = new FilterPermanent("creature defending player controlsknlokn"); + + static { + filter.add(new CardTypePredicate(CardType.CREATURE)); + filter.add(new DefendingPlayerControlsPredicate()); + } public AncientHellkite(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{R}{R}{R}"); @@ -63,27 +68,28 @@ public class AncientHellkite extends CardImpl { //TODO: Make ability properly copiable this.addAbility(FlyingAbility.getInstance()); Ability ability = new ConditionalActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(1), new ManaCostsImpl("{R}"), SourceAttackingCondition.instance); - ability.addTarget(new TargetCreaturePermanent(new FilterCreaturePermanent("creature defending player controls"))); - originalId = ability.getOriginalId(); + ability.addTarget(new TargetPermanent(filter)); +// ability.setTargetAdjustment(TargetAdjustment.DEFENDING_PLAYER); this.addAbility(ability); } public AncientHellkite(final AncientHellkite card) { super(card); - this.originalId = card.originalId; } - @Override - public void adjustTargets(Ability ability, Game game) { - if (ability.getOriginalId().equals(originalId)) { - ability.getTargets().clear(); - FilterCreaturePermanent filter = new FilterCreaturePermanent("creature defending player controls"); - UUID defenderId = game.getCombat().getDefenderId(ability.getSourceId()); - filter.add(new ControllerIdPredicate(defenderId)); - TargetCreaturePermanent target = new TargetCreaturePermanent(filter); - ability.addTarget(target); - } - } +// @Override +// public void adjustTargets(Ability ability, Game game) { +// if (ability.getTargetAdjustment() == TargetAdjustment.DEFENDING_PLAYER) { +// TargetPermanent oldTarget = (TargetPermanent) ability.getTargets().get(0); +// int minTargets = oldTarget.getMinNumberOfTargets(); +// int maxTargets = oldTarget.getMaxNumberOfTargets(); +// FilterPermanent filter2 = oldTarget.getFilter().copy(); +// UUID defenderId = game.getCombat().getDefenderId(ability.getSourceId()); +// filter2.add(new ControllerIdPredicate(defenderId)); +// ability.getTargets().clear(); +// ability.getTargets().add(new TargetPermanent(minTargets, maxTargets, filter2, false)); +// } +// } @Override public AncientHellkite copy() { diff --git a/Mage/src/main/java/mage/constants/TargetAdjustment.java b/Mage/src/main/java/mage/constants/TargetAdjustment.java index 110087be1c..c48571ef32 100644 --- a/Mage/src/main/java/mage/constants/TargetAdjustment.java +++ b/Mage/src/main/java/mage/constants/TargetAdjustment.java @@ -6,5 +6,5 @@ package mage.constants; */ public enum TargetAdjustment { - NONE, X_TARGETS, X_CMC_EQUAL_PERM, GETH, DEFENDING_PLAYER,X_POWER_LEQ + NONE, X_TARGETS, X_CMC_EQUAL_PERM, GETH, DEFENDING_PLAYER, X_POWER_LEQ, } diff --git a/Mage/src/main/java/mage/filter/predicate/permanent/DefendingPlayerControlsPredicate.java b/Mage/src/main/java/mage/filter/predicate/permanent/DefendingPlayerControlsPredicate.java new file mode 100644 index 0000000000..3bd9e326e6 --- /dev/null +++ b/Mage/src/main/java/mage/filter/predicate/permanent/DefendingPlayerControlsPredicate.java @@ -0,0 +1,50 @@ +/* + * 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 mage.filter.predicate.ObjectSourcePlayer; +import mage.filter.predicate.ObjectSourcePlayerPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; + +/** + * + * @author North + */ +public class DefendingPlayerControlsPredicate implements ObjectSourcePlayerPredicate> { + + @Override + public boolean apply(ObjectSourcePlayer input, Game game) { + return input.getObject().getControllerId().equals(game.getCombat().getDefenderId(input.getSourceId())); + } + + @Override + public String toString() { + return "Another"; + } +} diff --git a/Mage/src/main/java/mage/filter/predicate/permanent/DefendingPlayerOwnsCardPredicate.java b/Mage/src/main/java/mage/filter/predicate/permanent/DefendingPlayerOwnsCardPredicate.java new file mode 100644 index 0000000000..defa91a6d5 --- /dev/null +++ b/Mage/src/main/java/mage/filter/predicate/permanent/DefendingPlayerOwnsCardPredicate.java @@ -0,0 +1,50 @@ +/* + * 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 mage.cards.Card; +import mage.filter.predicate.ObjectSourcePlayer; +import mage.filter.predicate.ObjectSourcePlayerPredicate; +import mage.game.Game; + +/** + * + * @author North + */ +public class DefendingPlayerOwnsCardPredicate implements ObjectSourcePlayerPredicate> { + + @Override + public boolean apply(ObjectSourcePlayer input, Game game) { + return input.getObject().getOwnerId().equals(game.getCombat().getDefenderId(input.getSourceId())); + } + + @Override + public String toString() { + return "Another"; + } +} From e2a1fa50ea8e46ee1b4fd446c5e64e7d2c16ff6c Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Tue, 19 Sep 2017 12:43:52 -0400 Subject: [PATCH 10/29] moved some target choices to CardImpl, they should be properly copiable now --- .../src/mage/cards/a/AlexiZephyrMage.java | 16 +++---- .../src/mage/cards/c/CandelabraOfTawnos.java | 16 +++---- .../src/mage/cards/d/DeclarationOfNaught.java | 9 ++-- .../src/mage/cards/d/DeepfireElemental.java | 20 ++++----- Mage.Sets/src/mage/cards/f/FloodwaterDam.java | 16 +++---- Mage.Sets/src/mage/cards/g/GorillaShaman.java | 26 +++++------ Mage.Sets/src/mage/cards/h/HearthKami.java | 20 ++++----- .../src/mage/cards/l/LinessaZephyrMage.java | 20 ++++----- .../mage/cards/m/MagusOfTheCandelabra.java | 16 +++---- .../src/mage/cards/m/MinamoSightbender.java | 26 +++++------ Mage.Sets/src/mage/cards/m/MishrasHelix.java | 16 +++---- Mage.Sets/src/mage/cards/p/Plaguebearer.java | 20 ++++----- .../src/mage/cards/s/SynodArtificer.java | 16 +++---- Mage/src/main/java/mage/cards/CardImpl.java | 44 +++++++++++++++++++ .../java/mage/constants/TargetAdjustment.java | 2 +- 15 files changed, 163 insertions(+), 120 deletions(-) diff --git a/Mage.Sets/src/mage/cards/a/AlexiZephyrMage.java b/Mage.Sets/src/mage/cards/a/AlexiZephyrMage.java index 0dcf0b0d3a..2f37ecb1e7 100644 --- a/Mage.Sets/src/mage/cards/a/AlexiZephyrMage.java +++ b/Mage.Sets/src/mage/cards/a/AlexiZephyrMage.java @@ -72,14 +72,14 @@ public class AlexiZephyrMage extends CardImpl { this.addAbility(ability); } - @Override - public void adjustTargets(Ability ability, Game game) { - if (ability.getTargetAdjustment() == TargetAdjustment.X_TARGETS) { - FilterPermanent filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter(); - ability.getTargets().clear(); - ability.addTarget(new TargetPermanent(ability.getManaCostsToPay().getX(), filter2)); - } - } +// @Override +// public void adjustTargets(Ability ability, Game game) { +// if (ability.getTargetAdjustment() == TargetAdjustment.X_TARGETS) { +// FilterPermanent filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter(); +// ability.getTargets().clear(); +// ability.addTarget(new TargetPermanent(ability.getManaCostsToPay().getX(), filter2)); +// } +// } public AlexiZephyrMage(final AlexiZephyrMage card) { super(card); diff --git a/Mage.Sets/src/mage/cards/c/CandelabraOfTawnos.java b/Mage.Sets/src/mage/cards/c/CandelabraOfTawnos.java index eb1ca1f4d9..d9ac8435c6 100644 --- a/Mage.Sets/src/mage/cards/c/CandelabraOfTawnos.java +++ b/Mage.Sets/src/mage/cards/c/CandelabraOfTawnos.java @@ -65,14 +65,14 @@ public class CandelabraOfTawnos extends CardImpl { this.addAbility(ability); } - @Override - public void adjustTargets(Ability ability, Game game) { - if (ability.getTargetAdjustment() == TargetAdjustment.X_TARGETS) { - FilterPermanent filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter(); - ability.getTargets().clear(); - ability.addTarget(new TargetPermanent(ability.getManaCostsToPay().getX(), filter2)); - } - } +// @Override +// public void adjustTargets(Ability ability, Game game) { +// if (ability.getTargetAdjustment() == TargetAdjustment.X_TARGETS) { +// FilterPermanent filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter(); +// ability.getTargets().clear(); +// ability.addTarget(new TargetPermanent(ability.getManaCostsToPay().getX(), filter2)); +// } +// } public CandelabraOfTawnos(final CandelabraOfTawnos card) { super(card); diff --git a/Mage.Sets/src/mage/cards/d/DeclarationOfNaught.java b/Mage.Sets/src/mage/cards/d/DeclarationOfNaught.java index b0fb8f6405..1bf36696c3 100644 --- a/Mage.Sets/src/mage/cards/d/DeclarationOfNaught.java +++ b/Mage.Sets/src/mage/cards/d/DeclarationOfNaught.java @@ -37,6 +37,7 @@ import mage.abilities.effects.common.NameACardEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; +import mage.constants.TargetAdjustment; import mage.constants.Zone; import mage.filter.FilterSpell; import mage.filter.predicate.mageobject.NamePredicate; @@ -49,11 +50,10 @@ import mage.target.TargetSpell; */ public class DeclarationOfNaught extends CardImpl { - private final UUID originalId; static final private FilterSpell filter = new FilterSpell("spell with the chosen name"); public DeclarationOfNaught(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{U}{U}"); + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{U}{U}"); // As Declaration of Naught enters the battlefield, name a card. this.addAbility(new AsEntersBattlefieldAbility(new NameACardEffect(NameACardEffect.TypeOfName.ALL))); @@ -61,15 +61,15 @@ public class DeclarationOfNaught extends CardImpl { //TODO: Make ability properly copiable // {U}: Counter target spell with the chosen name. SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CounterTargetEffect(), new ManaCostsImpl("{U}")); + ability.setTargetAdjustment(TargetAdjustment.CHOSEN_NAME); ability.addTarget(new TargetSpell(filter)); - originalId = ability.getOriginalId(); this.addAbility(ability); } @Override public void adjustTargets(Ability ability, Game game) { - if (ability.getOriginalId().equals(originalId)) { + if (ability.getTargetAdjustment() == TargetAdjustment.CHOSEN_NAME) { ability.getTargets().clear(); FilterSpell filter2 = new FilterSpell("spell with the chosen name"); filter2.add(new NamePredicate((String) game.getState().getValue(ability.getSourceId().toString() + NameACardEffect.INFO_KEY))); @@ -80,7 +80,6 @@ public class DeclarationOfNaught extends CardImpl { public DeclarationOfNaught(final DeclarationOfNaught card) { super(card); - this.originalId = card.originalId; } @Override diff --git a/Mage.Sets/src/mage/cards/d/DeepfireElemental.java b/Mage.Sets/src/mage/cards/d/DeepfireElemental.java index 4cc1269083..6aa8ea35d8 100644 --- a/Mage.Sets/src/mage/cards/d/DeepfireElemental.java +++ b/Mage.Sets/src/mage/cards/d/DeepfireElemental.java @@ -74,16 +74,16 @@ public class DeepfireElemental extends CardImpl { this.addAbility(ability); } - @Override - public void adjustTargets(Ability ability, Game game) { - if (ability.getTargetAdjustment() == TargetAdjustment.X_CMC_EQUAL_PERM) { - int xValue = ability.getManaCostsToPay().getX(); - FilterPermanent filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter().copy(); - filter2.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue)); - ability.getTargets().clear(); - ability.getTargets().add(new TargetPermanent(filter2)); - } - } +// @Override +// public void adjustTargets(Ability ability, Game game) { +// if (ability.getTargetAdjustment() == TargetAdjustment.X_CMC_EQUAL_PERM) { +// int xValue = ability.getManaCostsToPay().getX(); +// FilterPermanent filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter().copy(); +// filter2.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue)); +// ability.getTargets().clear(); +// ability.getTargets().add(new TargetPermanent(filter2)); +// } +// } public DeepfireElemental(final DeepfireElemental card) { super(card); diff --git a/Mage.Sets/src/mage/cards/f/FloodwaterDam.java b/Mage.Sets/src/mage/cards/f/FloodwaterDam.java index d2c247a06c..74a50b7cff 100644 --- a/Mage.Sets/src/mage/cards/f/FloodwaterDam.java +++ b/Mage.Sets/src/mage/cards/f/FloodwaterDam.java @@ -63,14 +63,14 @@ public class FloodwaterDam extends CardImpl { this.addAbility(ability); } - @Override - public void adjustTargets(Ability ability, Game game) { - if (ability.getTargetAdjustment() == TargetAdjustment.X_TARGETS) { - FilterPermanent filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter(); - ability.getTargets().clear(); - ability.addTarget(new TargetPermanent(ability.getManaCostsToPay().getX(), filter2)); - } - } +// @Override +// public void adjustTargets(Ability ability, Game game) { +// if (ability.getTargetAdjustment() == TargetAdjustment.X_TARGETS) { +// FilterPermanent filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter(); +// ability.getTargets().clear(); +// ability.addTarget(new TargetPermanent(ability.getManaCostsToPay().getX(), filter2)); +// } +// } public FloodwaterDam(final FloodwaterDam card) { super(card); diff --git a/Mage.Sets/src/mage/cards/g/GorillaShaman.java b/Mage.Sets/src/mage/cards/g/GorillaShaman.java index 60d3ed4911..7036fd8c20 100644 --- a/Mage.Sets/src/mage/cards/g/GorillaShaman.java +++ b/Mage.Sets/src/mage/cards/g/GorillaShaman.java @@ -75,19 +75,19 @@ public class GorillaShaman extends CardImpl { this.addAbility(ability); } - @Override - public void adjustTargets(Ability ability, Game game) { - if (ability.getTargetAdjustment() == TargetAdjustment.X_CMC_EQUAL_PERM) { - int xValue = ability.getManaCostsToPay().getX(); - TargetPermanent oldTarget = (TargetPermanent) ability.getTargets().get(0); - int minTargets = oldTarget.getMinNumberOfTargets(); - int maxTargets = oldTarget.getMaxNumberOfTargets(); - FilterPermanent filter2 = oldTarget.getFilter().copy(); - filter2.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue)); - ability.getTargets().clear(); - ability.getTargets().add(new TargetPermanent(minTargets, maxTargets, filter2, false)); - } - } +// @Override +// public void adjustTargets(Ability ability, Game game) { +// if (ability.getTargetAdjustment() == TargetAdjustment.X_CMC_EQUAL_PERM) { +// int xValue = ability.getManaCostsToPay().getX(); +// TargetPermanent oldTarget = (TargetPermanent) ability.getTargets().get(0); +// int minTargets = oldTarget.getMinNumberOfTargets(); +// int maxTargets = oldTarget.getMaxNumberOfTargets(); +// FilterPermanent filter2 = oldTarget.getFilter().copy(); +// filter2.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue)); +// ability.getTargets().clear(); +// ability.getTargets().add(new TargetPermanent(minTargets, maxTargets, filter2, false)); +// } +// } public GorillaShaman(final GorillaShaman card) { super(card); diff --git a/Mage.Sets/src/mage/cards/h/HearthKami.java b/Mage.Sets/src/mage/cards/h/HearthKami.java index 5e15b83de5..95932d3830 100644 --- a/Mage.Sets/src/mage/cards/h/HearthKami.java +++ b/Mage.Sets/src/mage/cards/h/HearthKami.java @@ -74,16 +74,16 @@ public class HearthKami extends CardImpl { this.addAbility(ability); } - @Override - public void adjustTargets(Ability ability, Game game) { - if (ability.getTargetAdjustment() == TargetAdjustment.X_CMC_EQUAL_PERM) { - int xValue = ability.getManaCostsToPay().getX(); - FilterPermanent filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter().copy(); - filter2.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue)); - ability.getTargets().clear(); - ability.getTargets().add(new TargetPermanent(filter2)); - } - } +// @Override +// public void adjustTargets(Ability ability, Game game) { +// if (ability.getTargetAdjustment() == TargetAdjustment.X_CMC_EQUAL_PERM) { +// int xValue = ability.getManaCostsToPay().getX(); +// FilterPermanent filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter().copy(); +// filter2.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue)); +// ability.getTargets().clear(); +// ability.getTargets().add(new TargetPermanent(filter2)); +// } +// } public HearthKami(final HearthKami card) { super(card); diff --git a/Mage.Sets/src/mage/cards/l/LinessaZephyrMage.java b/Mage.Sets/src/mage/cards/l/LinessaZephyrMage.java index c0df84cc21..cb30e909da 100644 --- a/Mage.Sets/src/mage/cards/l/LinessaZephyrMage.java +++ b/Mage.Sets/src/mage/cards/l/LinessaZephyrMage.java @@ -97,16 +97,16 @@ public class LinessaZephyrMage extends CardImpl { super(card); } - @Override - public void adjustTargets(Ability ability, Game game) { - if (ability.getTargetAdjustment() == TargetAdjustment.X_CMC_EQUAL_PERM) { - int xValue = ability.getManaCostsToPay().getX(); - FilterPermanent filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter().copy(); - filter2.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue)); - ability.getTargets().clear(); - ability.getTargets().add(new TargetPermanent(filter2)); - } - } +// @Override +// public void adjustTargets(Ability ability, Game game) { +// if (ability.getTargetAdjustment() == TargetAdjustment.X_CMC_EQUAL_PERM) { +// int xValue = ability.getManaCostsToPay().getX(); +// FilterPermanent filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter().copy(); +// filter2.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue)); +// ability.getTargets().clear(); +// ability.getTargets().add(new TargetPermanent(filter2)); +// } +// } @Override public LinessaZephyrMage copy() { diff --git a/Mage.Sets/src/mage/cards/m/MagusOfTheCandelabra.java b/Mage.Sets/src/mage/cards/m/MagusOfTheCandelabra.java index cf570c5efa..2778845b8b 100644 --- a/Mage.Sets/src/mage/cards/m/MagusOfTheCandelabra.java +++ b/Mage.Sets/src/mage/cards/m/MagusOfTheCandelabra.java @@ -71,14 +71,14 @@ public class MagusOfTheCandelabra extends CardImpl { this.addAbility(ability); } - @Override - public void adjustTargets(Ability ability, Game game) { - if (ability.getTargetAdjustment() == TargetAdjustment.X_TARGETS) { - FilterPermanent filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter(); - ability.getTargets().clear(); - ability.addTarget(new TargetPermanent(ability.getManaCostsToPay().getX(), filter2)); - } - } +// @Override +// public void adjustTargets(Ability ability, Game game) { +// if (ability.getTargetAdjustment() == TargetAdjustment.X_TARGETS) { +// FilterPermanent filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter(); +// ability.getTargets().clear(); +// ability.addTarget(new TargetPermanent(ability.getManaCostsToPay().getX(), filter2)); +// } +// } public MagusOfTheCandelabra(final MagusOfTheCandelabra card) { super(card); diff --git a/Mage.Sets/src/mage/cards/m/MinamoSightbender.java b/Mage.Sets/src/mage/cards/m/MinamoSightbender.java index 2fcb0b0b4b..d88ec47ed0 100644 --- a/Mage.Sets/src/mage/cards/m/MinamoSightbender.java +++ b/Mage.Sets/src/mage/cards/m/MinamoSightbender.java @@ -79,19 +79,19 @@ public class MinamoSightbender extends CardImpl { } - @Override - public void adjustTargets(Ability ability, Game game) { - if (ability.getTargetAdjustment() == TargetAdjustment.X_POWER_LEQ) { - int xValue = ability.getManaCostsToPay().getX(); - TargetPermanent oldTarget = (TargetPermanent) ability.getTargets().get(0); - int minTargets = oldTarget.getMinNumberOfTargets(); - int maxTargets = oldTarget.getMaxNumberOfTargets(); - FilterPermanent filter2 = oldTarget.getFilter().copy(); - filter2.add(new PowerPredicate(ComparisonType.FEWER_THAN, xValue + 1)); - ability.getTargets().clear(); - ability.getTargets().add(new TargetPermanent(minTargets, maxTargets, filter2, false)); - } - } +// @Override +// public void adjustTargets(Ability ability, Game game) { +// if (ability.getTargetAdjustment() == TargetAdjustment.X_POWER_LEQ) { +// int xValue = ability.getManaCostsToPay().getX(); +// TargetPermanent oldTarget = (TargetPermanent) ability.getTargets().get(0); +// int minTargets = oldTarget.getMinNumberOfTargets(); +// int maxTargets = oldTarget.getMaxNumberOfTargets(); +// FilterPermanent filter2 = oldTarget.getFilter().copy(); +// filter2.add(new PowerPredicate(ComparisonType.FEWER_THAN, xValue + 1)); +// ability.getTargets().clear(); +// ability.getTargets().add(new TargetPermanent(minTargets, maxTargets, filter2, false)); +// } +// } public MinamoSightbender(final MinamoSightbender card) { super(card); diff --git a/Mage.Sets/src/mage/cards/m/MishrasHelix.java b/Mage.Sets/src/mage/cards/m/MishrasHelix.java index c8c131d7b7..7a0d67c6da 100644 --- a/Mage.Sets/src/mage/cards/m/MishrasHelix.java +++ b/Mage.Sets/src/mage/cards/m/MishrasHelix.java @@ -63,14 +63,14 @@ public class MishrasHelix extends CardImpl { this.addAbility(ability); } - @Override - public void adjustTargets(Ability ability, Game game) { - if (ability.getTargetAdjustment() == TargetAdjustment.X_TARGETS) { - FilterPermanent filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter(); - ability.getTargets().clear(); - ability.addTarget(new TargetPermanent(ability.getManaCostsToPay().getX(), filter2)); - } - } +// @Override +// public void adjustTargets(Ability ability, Game game) { +// if (ability.getTargetAdjustment() == TargetAdjustment.X_TARGETS) { +// FilterPermanent filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter(); +// ability.getTargets().clear(); +// ability.addTarget(new TargetPermanent(ability.getManaCostsToPay().getX(), filter2)); +// } +// } public MishrasHelix(final MishrasHelix card) { super(card); diff --git a/Mage.Sets/src/mage/cards/p/Plaguebearer.java b/Mage.Sets/src/mage/cards/p/Plaguebearer.java index d3aeb685a4..eb6b39b521 100644 --- a/Mage.Sets/src/mage/cards/p/Plaguebearer.java +++ b/Mage.Sets/src/mage/cards/p/Plaguebearer.java @@ -76,16 +76,16 @@ public class Plaguebearer extends CardImpl { this.addAbility(ability); } - @Override - public void adjustTargets(Ability ability, Game game) { - if (ability.getTargetAdjustment() == TargetAdjustment.X_CMC_EQUAL_PERM) { - int xValue = ability.getManaCostsToPay().getX(); - FilterPermanent filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter().copy(); - filter2.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue)); - ability.getTargets().clear(); - ability.getTargets().add(new TargetPermanent(filter2)); - } - } +// @Override +// public void adjustTargets(Ability ability, Game game) { +// if (ability.getTargetAdjustment() == TargetAdjustment.X_CMC_EQUAL_PERM) { +// int xValue = ability.getManaCostsToPay().getX(); +// FilterPermanent filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter().copy(); +// filter2.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue)); +// ability.getTargets().clear(); +// ability.getTargets().add(new TargetPermanent(filter2)); +// } +// } public Plaguebearer(final Plaguebearer card) { super(card); diff --git a/Mage.Sets/src/mage/cards/s/SynodArtificer.java b/Mage.Sets/src/mage/cards/s/SynodArtificer.java index 4e4f875ec5..25d696f312 100644 --- a/Mage.Sets/src/mage/cards/s/SynodArtificer.java +++ b/Mage.Sets/src/mage/cards/s/SynodArtificer.java @@ -88,14 +88,14 @@ public class SynodArtificer extends CardImpl { this.addAbility(untapAbility); } - @Override - public void adjustTargets(Ability ability, Game game) { - if (ability.getTargetAdjustment() == TargetAdjustment.X_TARGETS) { - FilterPermanent filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter(); - ability.getTargets().clear(); - ability.addTarget(new TargetPermanent(ability.getManaCostsToPay().getX(), filter2)); - } - } +// @Override +// public void adjustTargets(Ability ability, Game game) { +// if (ability.getTargetAdjustment() == TargetAdjustment.X_TARGETS) { +// FilterPermanent filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter(); +// ability.getTargets().clear(); +// ability.addTarget(new TargetPermanent(ability.getManaCostsToPay().getX(), filter2)); +// } +// } public SynodArtificer(final SynodArtificer card) { super(card); diff --git a/Mage/src/main/java/mage/cards/CardImpl.java b/Mage/src/main/java/mage/cards/CardImpl.java index 2215ea496a..ea17d1af12 100644 --- a/Mage/src/main/java/mage/cards/CardImpl.java +++ b/Mage/src/main/java/mage/cards/CardImpl.java @@ -42,12 +42,16 @@ import mage.cards.repository.PluginClassloaderRegistery; import mage.constants.*; import mage.counters.Counter; import mage.counters.Counters; +import mage.filter.FilterPermanent; +import mage.filter.predicate.mageobject.ConvertedManaCostPredicate; +import mage.filter.predicate.mageobject.PowerPredicate; import mage.game.*; import mage.game.events.GameEvent; import mage.game.events.ZoneChangeEvent; import mage.game.permanent.Permanent; import mage.game.stack.Spell; import mage.game.stack.StackObject; +import mage.target.TargetPermanent; import mage.util.GameLog; import mage.util.SubTypeList; import mage.watchers.Watcher; @@ -317,6 +321,46 @@ public abstract class CardImpl extends MageObjectImpl implements Card { return spellAbility; } +// @Override +// public void adjustCosts(Ability ability, Game game) { +// } + @Override + public void adjustTargets(Ability ability, Game game) { + int xValue; + TargetPermanent oldTargetPermanent; + int minTargets; + int maxTargets; + switch (ability.getTargetAdjustment()) { + case NONE: + break; + case X_CMC_EQUAL_PERM: + xValue = ability.getManaCostsToPay().getX(); + oldTargetPermanent = (TargetPermanent) ability.getTargets().get(0); + minTargets = oldTargetPermanent.getMinNumberOfTargets(); + maxTargets = oldTargetPermanent.getMaxNumberOfTargets(); + FilterPermanent filter2 = oldTargetPermanent.getFilter().copy(); + filter2.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue)); + ability.getTargets().clear(); + ability.getTargets().add(new TargetPermanent(minTargets, maxTargets, filter2, false)); + break; + case X_POWER_LEQ: + xValue = ability.getManaCostsToPay().getX(); + oldTargetPermanent = (TargetPermanent) ability.getTargets().get(0); + minTargets = oldTargetPermanent.getMinNumberOfTargets(); + maxTargets = oldTargetPermanent.getMaxNumberOfTargets(); + filter2 = oldTargetPermanent.getFilter().copy(); + filter2.add(new PowerPredicate(ComparisonType.FEWER_THAN, xValue + 1)); + ability.getTargets().clear(); + ability.getTargets().add(new TargetPermanent(minTargets, maxTargets, filter2, false)); + break; + case X_TARGETS: + xValue = ability.getManaCostsToPay().getX(); + filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter(); + ability.getTargets().clear(); + ability.addTarget(new TargetPermanent(xValue, filter2)); + } + } + @Override public void setOwnerId(UUID ownerId) { this.ownerId = ownerId; diff --git a/Mage/src/main/java/mage/constants/TargetAdjustment.java b/Mage/src/main/java/mage/constants/TargetAdjustment.java index c48571ef32..0b60e4182e 100644 --- a/Mage/src/main/java/mage/constants/TargetAdjustment.java +++ b/Mage/src/main/java/mage/constants/TargetAdjustment.java @@ -6,5 +6,5 @@ package mage.constants; */ public enum TargetAdjustment { - NONE, X_TARGETS, X_CMC_EQUAL_PERM, GETH, DEFENDING_PLAYER, X_POWER_LEQ, + NONE, X_TARGETS, X_CMC_EQUAL_PERM, GETH, DEFENDING_PLAYER, X_POWER_LEQ, CHOSEN_NAME } From 79d3bd24d5040268e380f1550c2800ed8bc1c257 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Tue, 19 Sep 2017 15:40:45 -0400 Subject: [PATCH 11/29] cleaned up some cards, tested that the abilities can be copied --- .../src/mage/cards/a/AlexiZephyrMage.java | 13 ------ .../src/mage/cards/a/AncientHellkite.java | 18 +------- .../src/mage/cards/c/CandelabraOfTawnos.java | 13 ------ .../src/mage/cards/d/DeclarationOfNaught.java | 16 ------- .../src/mage/cards/d/DeepfireElemental.java | 15 ------- Mage.Sets/src/mage/cards/f/FloodwaterDam.java | 13 ------ .../src/mage/cards/g/GethLordOfTheVault.java | 18 +------- Mage.Sets/src/mage/cards/g/GorillaShaman.java | 18 -------- Mage.Sets/src/mage/cards/h/HearthKami.java | 15 ------- .../src/mage/cards/l/LinessaZephyrMage.java | 14 ------- .../mage/cards/m/MagusOfTheCandelabra.java | 13 ------ .../src/mage/cards/m/MinamoSightbender.java | 18 -------- Mage.Sets/src/mage/cards/m/MishrasHelix.java | 12 ------ Mage.Sets/src/mage/cards/p/Plaguebearer.java | 15 ------- .../src/mage/cards/s/SynodArtificer.java | 11 ----- Mage/src/main/java/mage/cards/CardImpl.java | 42 +++++++++++++++---- .../java/mage/constants/TargetAdjustment.java | 2 +- 17 files changed, 36 insertions(+), 230 deletions(-) diff --git a/Mage.Sets/src/mage/cards/a/AlexiZephyrMage.java b/Mage.Sets/src/mage/cards/a/AlexiZephyrMage.java index 2f37ecb1e7..3f55ec6cdb 100644 --- a/Mage.Sets/src/mage/cards/a/AlexiZephyrMage.java +++ b/Mage.Sets/src/mage/cards/a/AlexiZephyrMage.java @@ -40,12 +40,9 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; import mage.constants.SuperType; -import mage.constants.TargetAdjustment; import mage.constants.Zone; import mage.filter.FilterCard; -import mage.filter.FilterPermanent; import mage.filter.StaticFilters; -import mage.game.Game; import mage.target.TargetPermanent; import mage.target.common.TargetCardInHand; @@ -63,7 +60,6 @@ public class AlexiZephyrMage extends CardImpl { this.power = new MageInt(3); this.toughness = new MageInt(3); - //TODO: Make ability properly copiable // {X}{U}, {tap}, Discard two cards: Return X target creatures to their owners' hands. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ReturnToHandTargetEffect(), new ManaCostsImpl("{X}{U}")); ability.addCost(new TapSourceCost()); @@ -72,15 +68,6 @@ public class AlexiZephyrMage extends CardImpl { this.addAbility(ability); } -// @Override -// public void adjustTargets(Ability ability, Game game) { -// if (ability.getTargetAdjustment() == TargetAdjustment.X_TARGETS) { -// FilterPermanent filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter(); -// ability.getTargets().clear(); -// ability.addTarget(new TargetPermanent(ability.getManaCostsToPay().getX(), filter2)); -// } -// } - public AlexiZephyrMage(final AlexiZephyrMage card) { super(card); } diff --git a/Mage.Sets/src/mage/cards/a/AncientHellkite.java b/Mage.Sets/src/mage/cards/a/AncientHellkite.java index 85c754e4e7..ce4ccc612f 100644 --- a/Mage.Sets/src/mage/cards/a/AncientHellkite.java +++ b/Mage.Sets/src/mage/cards/a/AncientHellkite.java @@ -51,7 +51,7 @@ import mage.target.TargetPermanent; */ public class AncientHellkite extends CardImpl { - private static final FilterPermanent filter = new FilterPermanent("creature defending player controlsknlokn"); + private static final FilterPermanent filter = new FilterPermanent("creature defending player controls"); static { filter.add(new CardTypePredicate(CardType.CREATURE)); @@ -65,11 +65,9 @@ public class AncientHellkite extends CardImpl { this.power = new MageInt(6); this.toughness = new MageInt(6); - //TODO: Make ability properly copiable this.addAbility(FlyingAbility.getInstance()); Ability ability = new ConditionalActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(1), new ManaCostsImpl("{R}"), SourceAttackingCondition.instance); ability.addTarget(new TargetPermanent(filter)); -// ability.setTargetAdjustment(TargetAdjustment.DEFENDING_PLAYER); this.addAbility(ability); } @@ -77,20 +75,6 @@ public class AncientHellkite extends CardImpl { super(card); } -// @Override -// public void adjustTargets(Ability ability, Game game) { -// if (ability.getTargetAdjustment() == TargetAdjustment.DEFENDING_PLAYER) { -// TargetPermanent oldTarget = (TargetPermanent) ability.getTargets().get(0); -// int minTargets = oldTarget.getMinNumberOfTargets(); -// int maxTargets = oldTarget.getMaxNumberOfTargets(); -// FilterPermanent filter2 = oldTarget.getFilter().copy(); -// UUID defenderId = game.getCombat().getDefenderId(ability.getSourceId()); -// filter2.add(new ControllerIdPredicate(defenderId)); -// ability.getTargets().clear(); -// ability.getTargets().add(new TargetPermanent(minTargets, maxTargets, filter2, false)); -// } -// } - @Override public AncientHellkite copy() { return new AncientHellkite(this); diff --git a/Mage.Sets/src/mage/cards/c/CandelabraOfTawnos.java b/Mage.Sets/src/mage/cards/c/CandelabraOfTawnos.java index d9ac8435c6..4cbab1c4fc 100644 --- a/Mage.Sets/src/mage/cards/c/CandelabraOfTawnos.java +++ b/Mage.Sets/src/mage/cards/c/CandelabraOfTawnos.java @@ -39,10 +39,7 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.TargetAdjustment; import mage.constants.Zone; -import mage.filter.FilterPermanent; import mage.filter.StaticFilters; -import mage.filter.common.FilterLandPermanent; -import mage.game.Game; import mage.target.TargetPermanent; /** @@ -54,7 +51,6 @@ public class CandelabraOfTawnos extends CardImpl { public CandelabraOfTawnos(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{1}"); - //TODO: Make ability properly copiable // {X}, {T}: Untap X target lands. Effect effect = new UntapTargetEffect(); effect.setText("untap X target lands"); @@ -65,15 +61,6 @@ public class CandelabraOfTawnos extends CardImpl { this.addAbility(ability); } -// @Override -// public void adjustTargets(Ability ability, Game game) { -// if (ability.getTargetAdjustment() == TargetAdjustment.X_TARGETS) { -// FilterPermanent filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter(); -// ability.getTargets().clear(); -// ability.addTarget(new TargetPermanent(ability.getManaCostsToPay().getX(), filter2)); -// } -// } - public CandelabraOfTawnos(final CandelabraOfTawnos card) { super(card); } diff --git a/Mage.Sets/src/mage/cards/d/DeclarationOfNaught.java b/Mage.Sets/src/mage/cards/d/DeclarationOfNaught.java index 1bf36696c3..da4dd1c605 100644 --- a/Mage.Sets/src/mage/cards/d/DeclarationOfNaught.java +++ b/Mage.Sets/src/mage/cards/d/DeclarationOfNaught.java @@ -28,7 +28,6 @@ package mage.cards.d; import java.util.UUID; -import mage.abilities.Ability; import mage.abilities.common.AsEntersBattlefieldAbility; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.mana.ManaCostsImpl; @@ -40,8 +39,6 @@ import mage.constants.CardType; import mage.constants.TargetAdjustment; import mage.constants.Zone; import mage.filter.FilterSpell; -import mage.filter.predicate.mageobject.NamePredicate; -import mage.game.Game; import mage.target.TargetSpell; /** @@ -58,24 +55,11 @@ public class DeclarationOfNaught extends CardImpl { // As Declaration of Naught enters the battlefield, name a card. this.addAbility(new AsEntersBattlefieldAbility(new NameACardEffect(NameACardEffect.TypeOfName.ALL))); - //TODO: Make ability properly copiable // {U}: Counter target spell with the chosen name. SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CounterTargetEffect(), new ManaCostsImpl("{U}")); ability.setTargetAdjustment(TargetAdjustment.CHOSEN_NAME); ability.addTarget(new TargetSpell(filter)); this.addAbility(ability); - - } - - @Override - public void adjustTargets(Ability ability, Game game) { - if (ability.getTargetAdjustment() == TargetAdjustment.CHOSEN_NAME) { - ability.getTargets().clear(); - FilterSpell filter2 = new FilterSpell("spell with the chosen name"); - filter2.add(new NamePredicate((String) game.getState().getValue(ability.getSourceId().toString() + NameACardEffect.INFO_KEY))); - TargetSpell target = new TargetSpell(1, filter2); - ability.addTarget(target); - } } public DeclarationOfNaught(final DeclarationOfNaught card) { diff --git a/Mage.Sets/src/mage/cards/d/DeepfireElemental.java b/Mage.Sets/src/mage/cards/d/DeepfireElemental.java index 6aa8ea35d8..ae04912c4c 100644 --- a/Mage.Sets/src/mage/cards/d/DeepfireElemental.java +++ b/Mage.Sets/src/mage/cards/d/DeepfireElemental.java @@ -37,14 +37,11 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; -import mage.constants.ComparisonType; import mage.constants.TargetAdjustment; import mage.constants.Zone; import mage.filter.FilterPermanent; import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.CardTypePredicate; -import mage.filter.predicate.mageobject.ConvertedManaCostPredicate; -import mage.game.Game; import mage.target.TargetPermanent; /** @@ -66,7 +63,6 @@ public class DeepfireElemental extends CardImpl { this.power = new MageInt(4); this.toughness = new MageInt(4); - //TODO: Make ability properly copiable // {X}{X}{1}: Destroy target artifact or creature with converted mana cost X. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DestroyTargetEffect(), new ManaCostsImpl("{X}{X}{1}")); ability.addTarget(new TargetPermanent(filter)); @@ -74,17 +70,6 @@ public class DeepfireElemental extends CardImpl { this.addAbility(ability); } -// @Override -// public void adjustTargets(Ability ability, Game game) { -// if (ability.getTargetAdjustment() == TargetAdjustment.X_CMC_EQUAL_PERM) { -// int xValue = ability.getManaCostsToPay().getX(); -// FilterPermanent filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter().copy(); -// filter2.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue)); -// ability.getTargets().clear(); -// ability.getTargets().add(new TargetPermanent(filter2)); -// } -// } - public DeepfireElemental(final DeepfireElemental card) { super(card); } diff --git a/Mage.Sets/src/mage/cards/f/FloodwaterDam.java b/Mage.Sets/src/mage/cards/f/FloodwaterDam.java index 74a50b7cff..fad71572e0 100644 --- a/Mage.Sets/src/mage/cards/f/FloodwaterDam.java +++ b/Mage.Sets/src/mage/cards/f/FloodwaterDam.java @@ -37,11 +37,8 @@ import mage.abilities.effects.common.TapTargetEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.TargetAdjustment; import mage.constants.Zone; -import mage.filter.FilterPermanent; import mage.filter.StaticFilters; -import mage.game.Game; import mage.target.TargetPermanent; /** @@ -53,7 +50,6 @@ public class FloodwaterDam extends CardImpl { public FloodwaterDam(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}"); - //TODO: Make ability properly copiable // {X}{X}{1}, {tap}: Tap X target lands. Effect effect = new TapTargetEffect(); effect.setText("tap X target lands"); @@ -63,15 +59,6 @@ public class FloodwaterDam extends CardImpl { this.addAbility(ability); } -// @Override -// public void adjustTargets(Ability ability, Game game) { -// if (ability.getTargetAdjustment() == TargetAdjustment.X_TARGETS) { -// FilterPermanent filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter(); -// ability.getTargets().clear(); -// ability.addTarget(new TargetPermanent(ability.getManaCostsToPay().getX(), filter2)); -// } -// } - public FloodwaterDam(final FloodwaterDam card) { super(card); } diff --git a/Mage.Sets/src/mage/cards/g/GethLordOfTheVault.java b/Mage.Sets/src/mage/cards/g/GethLordOfTheVault.java index 3a99811b27..e375d2631d 100644 --- a/Mage.Sets/src/mage/cards/g/GethLordOfTheVault.java +++ b/Mage.Sets/src/mage/cards/g/GethLordOfTheVault.java @@ -39,7 +39,6 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; -import mage.constants.ComparisonType; import mage.constants.Outcome; import mage.constants.SuperType; import mage.constants.TargetAdjustment; @@ -47,10 +46,8 @@ import mage.constants.Zone; import mage.filter.FilterCard; import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.CardTypePredicate; -import mage.filter.predicate.mageobject.ConvertedManaCostPredicate; import mage.game.Game; import mage.players.Player; -import mage.target.TargetCard; import mage.target.common.TargetCardInOpponentsGraveyard; /** @@ -76,27 +73,14 @@ public class GethLordOfTheVault extends CardImpl { // Intimidate this.addAbility(IntimidateAbility.getInstance()); - //TODO: Make ability properly copiable // {X}{B}: Put target artifact or creature card with converted mana cost X from an opponent's graveyard onto the battlefield under your control tapped. // Then that player puts the top X cards of his or her library into his or her graveyard. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GethLordOfTheVaultEffect(), new ManaCostsImpl("{X}{B}")); - ability.setTargetAdjustment(TargetAdjustment.GETH); + ability.setTargetAdjustment(TargetAdjustment.X_CMC_EQUAL_GY_CARD); ability.addTarget(new TargetCardInOpponentsGraveyard(filter)); this.addAbility(ability); } - @Override - public void adjustTargets(Ability ability, Game game) { - if (ability.getTargetAdjustment() == TargetAdjustment.GETH) { - int xValue = ability.getManaCostsToPay().getX(); - TargetCard oldTarget = (TargetCard) ability.getTargets().get(0); - FilterCard filter2 = oldTarget.getFilter().copy(); - filter2.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue)); - ability.getTargets().clear(); - ability.getTargets().add(new TargetCardInOpponentsGraveyard(filter2)); - } - } - public GethLordOfTheVault(final GethLordOfTheVault card) { super(card); } diff --git a/Mage.Sets/src/mage/cards/g/GorillaShaman.java b/Mage.Sets/src/mage/cards/g/GorillaShaman.java index 7036fd8c20..751fed34d6 100644 --- a/Mage.Sets/src/mage/cards/g/GorillaShaman.java +++ b/Mage.Sets/src/mage/cards/g/GorillaShaman.java @@ -37,14 +37,11 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; -import mage.constants.ComparisonType; import mage.constants.TargetAdjustment; import mage.constants.Zone; import mage.filter.FilterPermanent; import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.CardTypePredicate; -import mage.filter.predicate.mageobject.ConvertedManaCostPredicate; -import mage.game.Game; import mage.target.TargetPermanent; /** @@ -67,7 +64,6 @@ public class GorillaShaman extends CardImpl { this.power = new MageInt(1); this.toughness = new MageInt(1); - //TODO: Make ability properly copiable // {X}{X}{1}: Destroy target noncreature artifact with converted mana cost X. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DestroyTargetEffect(), new ManaCostsImpl("{X}{X}{1}")); ability.addTarget(new TargetPermanent(filter)); @@ -75,20 +71,6 @@ public class GorillaShaman extends CardImpl { this.addAbility(ability); } -// @Override -// public void adjustTargets(Ability ability, Game game) { -// if (ability.getTargetAdjustment() == TargetAdjustment.X_CMC_EQUAL_PERM) { -// int xValue = ability.getManaCostsToPay().getX(); -// TargetPermanent oldTarget = (TargetPermanent) ability.getTargets().get(0); -// int minTargets = oldTarget.getMinNumberOfTargets(); -// int maxTargets = oldTarget.getMaxNumberOfTargets(); -// FilterPermanent filter2 = oldTarget.getFilter().copy(); -// filter2.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue)); -// ability.getTargets().clear(); -// ability.getTargets().add(new TargetPermanent(minTargets, maxTargets, filter2, false)); -// } -// } - public GorillaShaman(final GorillaShaman card) { super(card); } diff --git a/Mage.Sets/src/mage/cards/h/HearthKami.java b/Mage.Sets/src/mage/cards/h/HearthKami.java index 95932d3830..40d3cf2b6d 100644 --- a/Mage.Sets/src/mage/cards/h/HearthKami.java +++ b/Mage.Sets/src/mage/cards/h/HearthKami.java @@ -38,13 +38,10 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; -import mage.constants.ComparisonType; import mage.constants.TargetAdjustment; import mage.constants.Zone; import mage.filter.FilterPermanent; import mage.filter.predicate.mageobject.CardTypePredicate; -import mage.filter.predicate.mageobject.ConvertedManaCostPredicate; -import mage.game.Game; import mage.target.TargetPermanent; /** @@ -65,7 +62,6 @@ public class HearthKami extends CardImpl { this.power = new MageInt(2); this.toughness = new MageInt(1); - //TODO: Make ability properly copiable // {X}, Sacrifice Hearth Kami: Destroy target artifact with converted mana cost X. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DestroyTargetEffect(), new ManaCostsImpl("{X}")); ability.addCost(new SacrificeSourceCost()); @@ -74,17 +70,6 @@ public class HearthKami extends CardImpl { this.addAbility(ability); } -// @Override -// public void adjustTargets(Ability ability, Game game) { -// if (ability.getTargetAdjustment() == TargetAdjustment.X_CMC_EQUAL_PERM) { -// int xValue = ability.getManaCostsToPay().getX(); -// FilterPermanent filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter().copy(); -// filter2.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue)); -// ability.getTargets().clear(); -// ability.getTargets().add(new TargetPermanent(filter2)); -// } -// } - public HearthKami(final HearthKami card) { super(card); } diff --git a/Mage.Sets/src/mage/cards/l/LinessaZephyrMage.java b/Mage.Sets/src/mage/cards/l/LinessaZephyrMage.java index cb30e909da..097b5f3210 100644 --- a/Mage.Sets/src/mage/cards/l/LinessaZephyrMage.java +++ b/Mage.Sets/src/mage/cards/l/LinessaZephyrMage.java @@ -40,7 +40,6 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; -import mage.constants.ComparisonType; import mage.constants.Outcome; import mage.constants.SuperType; import mage.constants.TargetAdjustment; @@ -48,7 +47,6 @@ import mage.constants.Zone; import mage.filter.FilterPermanent; import mage.filter.common.FilterControlledPermanent; import mage.filter.predicate.mageobject.CardTypePredicate; -import mage.filter.predicate.mageobject.ConvertedManaCostPredicate; import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; @@ -79,7 +77,6 @@ public class LinessaZephyrMage extends CardImpl { this.power = new MageInt(3); this.toughness = new MageInt(3); - //TODO: Make ability properly copiable // {X}{U}{U}, {tap}: Return target creature with converted mana cost X to its owner's hand. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ReturnToHandTargetEffect(), new ManaCostsImpl("{X}{U}{U}")); ability.addCost(new TapSourceCost()); @@ -97,17 +94,6 @@ public class LinessaZephyrMage extends CardImpl { super(card); } -// @Override -// public void adjustTargets(Ability ability, Game game) { -// if (ability.getTargetAdjustment() == TargetAdjustment.X_CMC_EQUAL_PERM) { -// int xValue = ability.getManaCostsToPay().getX(); -// FilterPermanent filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter().copy(); -// filter2.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue)); -// ability.getTargets().clear(); -// ability.getTargets().add(new TargetPermanent(filter2)); -// } -// } - @Override public LinessaZephyrMage copy() { return new LinessaZephyrMage(this); diff --git a/Mage.Sets/src/mage/cards/m/MagusOfTheCandelabra.java b/Mage.Sets/src/mage/cards/m/MagusOfTheCandelabra.java index 2778845b8b..d1a5c93b32 100644 --- a/Mage.Sets/src/mage/cards/m/MagusOfTheCandelabra.java +++ b/Mage.Sets/src/mage/cards/m/MagusOfTheCandelabra.java @@ -41,10 +41,7 @@ import mage.constants.CardType; import mage.constants.SubType; import mage.constants.TargetAdjustment; import mage.constants.Zone; -import mage.filter.FilterPermanent; import mage.filter.StaticFilters; -import mage.filter.common.FilterLandPermanent; -import mage.game.Game; import mage.target.TargetPermanent; /** @@ -60,7 +57,6 @@ public class MagusOfTheCandelabra extends CardImpl { this.power = new MageInt(1); this.toughness = new MageInt(2); - //TODO: Make ability properly copiable // {X}, {T}: Untap X target lands. Effect effect = new UntapTargetEffect(); effect.setText("untap X target lands"); @@ -71,15 +67,6 @@ public class MagusOfTheCandelabra extends CardImpl { this.addAbility(ability); } -// @Override -// public void adjustTargets(Ability ability, Game game) { -// if (ability.getTargetAdjustment() == TargetAdjustment.X_TARGETS) { -// FilterPermanent filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter(); -// ability.getTargets().clear(); -// ability.addTarget(new TargetPermanent(ability.getManaCostsToPay().getX(), filter2)); -// } -// } - public MagusOfTheCandelabra(final MagusOfTheCandelabra card) { super(card); } diff --git a/Mage.Sets/src/mage/cards/m/MinamoSightbender.java b/Mage.Sets/src/mage/cards/m/MinamoSightbender.java index d88ec47ed0..a856679fa7 100644 --- a/Mage.Sets/src/mage/cards/m/MinamoSightbender.java +++ b/Mage.Sets/src/mage/cards/m/MinamoSightbender.java @@ -38,13 +38,10 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; -import mage.constants.ComparisonType; import mage.constants.TargetAdjustment; import mage.constants.Zone; import mage.filter.FilterPermanent; import mage.filter.predicate.mageobject.CardTypePredicate; -import mage.filter.predicate.mageobject.PowerPredicate; -import mage.game.Game; import mage.target.Target; import mage.target.TargetPermanent; @@ -68,7 +65,6 @@ public class MinamoSightbender extends CardImpl { this.power = new MageInt(1); this.toughness = new MageInt(2); - //TODO: Make ability properly copiable // {X}, {T}: Target creature with power X or less can't be blocked this turn. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CantBeBlockedTargetEffect(), new ManaCostsImpl("{X}")); Target target = new TargetPermanent(filter); @@ -79,20 +75,6 @@ public class MinamoSightbender extends CardImpl { } -// @Override -// public void adjustTargets(Ability ability, Game game) { -// if (ability.getTargetAdjustment() == TargetAdjustment.X_POWER_LEQ) { -// int xValue = ability.getManaCostsToPay().getX(); -// TargetPermanent oldTarget = (TargetPermanent) ability.getTargets().get(0); -// int minTargets = oldTarget.getMinNumberOfTargets(); -// int maxTargets = oldTarget.getMaxNumberOfTargets(); -// FilterPermanent filter2 = oldTarget.getFilter().copy(); -// filter2.add(new PowerPredicate(ComparisonType.FEWER_THAN, xValue + 1)); -// ability.getTargets().clear(); -// ability.getTargets().add(new TargetPermanent(minTargets, maxTargets, filter2, false)); -// } -// } - public MinamoSightbender(final MinamoSightbender card) { super(card); } diff --git a/Mage.Sets/src/mage/cards/m/MishrasHelix.java b/Mage.Sets/src/mage/cards/m/MishrasHelix.java index 7a0d67c6da..8d3446a039 100644 --- a/Mage.Sets/src/mage/cards/m/MishrasHelix.java +++ b/Mage.Sets/src/mage/cards/m/MishrasHelix.java @@ -39,9 +39,7 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.TargetAdjustment; import mage.constants.Zone; -import mage.filter.FilterPermanent; import mage.filter.StaticFilters; -import mage.game.Game; import mage.target.TargetPermanent; /** @@ -53,7 +51,6 @@ public class MishrasHelix extends CardImpl { public MishrasHelix(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{5}"); - //TODO: Make ability properly copiable // {X}, {tap}: Tap X target lands. Effect effect = new TapTargetEffect("X target lands"); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{X}")); @@ -63,15 +60,6 @@ public class MishrasHelix extends CardImpl { this.addAbility(ability); } -// @Override -// public void adjustTargets(Ability ability, Game game) { -// if (ability.getTargetAdjustment() == TargetAdjustment.X_TARGETS) { -// FilterPermanent filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter(); -// ability.getTargets().clear(); -// ability.addTarget(new TargetPermanent(ability.getManaCostsToPay().getX(), filter2)); -// } -// } - public MishrasHelix(final MishrasHelix card) { super(card); } diff --git a/Mage.Sets/src/mage/cards/p/Plaguebearer.java b/Mage.Sets/src/mage/cards/p/Plaguebearer.java index eb6b39b521..819b32dce0 100644 --- a/Mage.Sets/src/mage/cards/p/Plaguebearer.java +++ b/Mage.Sets/src/mage/cards/p/Plaguebearer.java @@ -38,15 +38,12 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; -import mage.constants.ComparisonType; import mage.constants.TargetAdjustment; import mage.constants.Zone; import mage.filter.FilterPermanent; import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.CardTypePredicate; import mage.filter.predicate.mageobject.ColorPredicate; -import mage.filter.predicate.mageobject.ConvertedManaCostPredicate; -import mage.game.Game; import mage.target.TargetPermanent; /** @@ -68,7 +65,6 @@ public class Plaguebearer extends CardImpl { this.power = new MageInt(1); this.toughness = new MageInt(1); - //TODO: Make ability properly copiable // {X}{X}{B}: Destroy target nonblack creature with converted mana cost X. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DestroyTargetEffect(), new ManaCostsImpl("{X}{X}{B}")); ability.addTarget(new TargetPermanent(filter)); @@ -76,17 +72,6 @@ public class Plaguebearer extends CardImpl { this.addAbility(ability); } -// @Override -// public void adjustTargets(Ability ability, Game game) { -// if (ability.getTargetAdjustment() == TargetAdjustment.X_CMC_EQUAL_PERM) { -// int xValue = ability.getManaCostsToPay().getX(); -// FilterPermanent filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter().copy(); -// filter2.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue)); -// ability.getTargets().clear(); -// ability.getTargets().add(new TargetPermanent(filter2)); -// } -// } - public Plaguebearer(final Plaguebearer card) { super(card); } diff --git a/Mage.Sets/src/mage/cards/s/SynodArtificer.java b/Mage.Sets/src/mage/cards/s/SynodArtificer.java index 25d696f312..937336f0a9 100644 --- a/Mage.Sets/src/mage/cards/s/SynodArtificer.java +++ b/Mage.Sets/src/mage/cards/s/SynodArtificer.java @@ -45,7 +45,6 @@ import mage.constants.Zone; import mage.filter.FilterPermanent; import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.CardTypePredicate; -import mage.game.Game; import mage.target.TargetPermanent; /** @@ -68,7 +67,6 @@ public class SynodArtificer extends CardImpl { this.power = new MageInt(1); this.toughness = new MageInt(2); - //TODO: Make ability properly copiable // {X}, {tap}: Tap X target noncreature artifacts. Effect tapEffect = new TapTargetEffect(); tapEffect.setText("Tap X target noncreature artifacts."); @@ -88,15 +86,6 @@ public class SynodArtificer extends CardImpl { this.addAbility(untapAbility); } -// @Override -// public void adjustTargets(Ability ability, Game game) { -// if (ability.getTargetAdjustment() == TargetAdjustment.X_TARGETS) { -// FilterPermanent filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter(); -// ability.getTargets().clear(); -// ability.addTarget(new TargetPermanent(ability.getManaCostsToPay().getX(), filter2)); -// } -// } - public SynodArtificer(final SynodArtificer card) { super(card); } diff --git a/Mage/src/main/java/mage/cards/CardImpl.java b/Mage/src/main/java/mage/cards/CardImpl.java index ea17d1af12..dc20a9ce1e 100644 --- a/Mage/src/main/java/mage/cards/CardImpl.java +++ b/Mage/src/main/java/mage/cards/CardImpl.java @@ -37,13 +37,17 @@ import mage.MageObjectImpl; import mage.Mana; import mage.ObjectColor; import mage.abilities.*; +import mage.abilities.effects.common.NameACardEffect; import mage.abilities.mana.ActivatedManaAbilityImpl; import mage.cards.repository.PluginClassloaderRegistery; import mage.constants.*; import mage.counters.Counter; import mage.counters.Counters; +import mage.filter.FilterCard; import mage.filter.FilterPermanent; +import mage.filter.FilterSpell; import mage.filter.predicate.mageobject.ConvertedManaCostPredicate; +import mage.filter.predicate.mageobject.NamePredicate; import mage.filter.predicate.mageobject.PowerPredicate; import mage.game.*; import mage.game.events.GameEvent; @@ -51,7 +55,10 @@ import mage.game.events.ZoneChangeEvent; import mage.game.permanent.Permanent; import mage.game.stack.Spell; import mage.game.stack.StackObject; +import mage.target.TargetCard; import mage.target.TargetPermanent; +import mage.target.TargetSpell; +import mage.target.common.TargetCardInOpponentsGraveyard; import mage.util.GameLog; import mage.util.SubTypeList; import mage.watchers.Watcher; @@ -328,6 +335,7 @@ public abstract class CardImpl extends MageObjectImpl implements Card { public void adjustTargets(Ability ability, Game game) { int xValue; TargetPermanent oldTargetPermanent; + FilterPermanent permanentFilter; int minTargets; int maxTargets; switch (ability.getTargetAdjustment()) { @@ -338,26 +346,42 @@ public abstract class CardImpl extends MageObjectImpl implements Card { oldTargetPermanent = (TargetPermanent) ability.getTargets().get(0); minTargets = oldTargetPermanent.getMinNumberOfTargets(); maxTargets = oldTargetPermanent.getMaxNumberOfTargets(); - FilterPermanent filter2 = oldTargetPermanent.getFilter().copy(); - filter2.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue)); + permanentFilter = oldTargetPermanent.getFilter().copy(); + permanentFilter.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue)); ability.getTargets().clear(); - ability.getTargets().add(new TargetPermanent(minTargets, maxTargets, filter2, false)); + ability.getTargets().add(new TargetPermanent(minTargets, maxTargets, permanentFilter, false)); break; - case X_POWER_LEQ: + case X_POWER_LEQ:// Minamo Sightbender only xValue = ability.getManaCostsToPay().getX(); oldTargetPermanent = (TargetPermanent) ability.getTargets().get(0); minTargets = oldTargetPermanent.getMinNumberOfTargets(); maxTargets = oldTargetPermanent.getMaxNumberOfTargets(); - filter2 = oldTargetPermanent.getFilter().copy(); - filter2.add(new PowerPredicate(ComparisonType.FEWER_THAN, xValue + 1)); + permanentFilter = oldTargetPermanent.getFilter().copy(); + permanentFilter.add(new PowerPredicate(ComparisonType.FEWER_THAN, xValue + 1)); ability.getTargets().clear(); - ability.getTargets().add(new TargetPermanent(minTargets, maxTargets, filter2, false)); + ability.getTargets().add(new TargetPermanent(minTargets, maxTargets, permanentFilter, false)); break; case X_TARGETS: xValue = ability.getManaCostsToPay().getX(); - filter2 = ((TargetPermanent) ability.getTargets().get(0)).getFilter(); + permanentFilter = ((TargetPermanent) ability.getTargets().get(0)).getFilter(); ability.getTargets().clear(); - ability.addTarget(new TargetPermanent(xValue, filter2)); + ability.addTarget(new TargetPermanent(xValue, permanentFilter)); + break; + case X_CMC_EQUAL_GY_CARD: //Geth, Lord of the Vault only + xValue = ability.getManaCostsToPay().getX(); + TargetCard oldTarget = (TargetCard) ability.getTargets().get(0); + FilterCard filterCard = oldTarget.getFilter().copy(); + filterCard.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue)); + ability.getTargets().clear(); + ability.getTargets().add(new TargetCardInOpponentsGraveyard(filterCard)); + break; + case CHOSEN_NAME: //Declaration of Naught only + ability.getTargets().clear(); + FilterSpell filterSpell = new FilterSpell("spell with the chosen name"); + filterSpell.add(new NamePredicate((String) game.getState().getValue(ability.getSourceId().toString() + NameACardEffect.INFO_KEY))); + TargetSpell target = new TargetSpell(1, filterSpell); + ability.addTarget(target); + break; } } diff --git a/Mage/src/main/java/mage/constants/TargetAdjustment.java b/Mage/src/main/java/mage/constants/TargetAdjustment.java index 0b60e4182e..e5b8a8f1f5 100644 --- a/Mage/src/main/java/mage/constants/TargetAdjustment.java +++ b/Mage/src/main/java/mage/constants/TargetAdjustment.java @@ -6,5 +6,5 @@ package mage.constants; */ public enum TargetAdjustment { - NONE, X_TARGETS, X_CMC_EQUAL_PERM, GETH, DEFENDING_PLAYER, X_POWER_LEQ, CHOSEN_NAME + NONE, X_TARGETS, X_CMC_EQUAL_PERM, X_CMC_EQUAL_GY_CARD, X_POWER_LEQ, CHOSEN_NAME } From 449000de589faf385a7a39e539480aa15b0f324f Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Tue, 19 Sep 2017 15:44:26 -0400 Subject: [PATCH 12/29] cleaned up some cards, tested that the abilities can be copied --- Mage.Sets/src/mage/cards/h/HopeOfGhirapur.java | 1 - 1 file changed, 1 deletion(-) diff --git a/Mage.Sets/src/mage/cards/h/HopeOfGhirapur.java b/Mage.Sets/src/mage/cards/h/HopeOfGhirapur.java index 07c212e770..51502d1549 100644 --- a/Mage.Sets/src/mage/cards/h/HopeOfGhirapur.java +++ b/Mage.Sets/src/mage/cards/h/HopeOfGhirapur.java @@ -70,7 +70,6 @@ public class HopeOfGhirapur extends CardImpl { // Flying this.addAbility(FlyingAbility.getInstance()); - //TODO: Make ability properly copiable // Sacrifice Hope of Ghirapur: Until your next turn, target player who was dealt combat damage by Hope of Ghirapur this turn can't cast noncreature spells. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new HopeOfGhirapurCantCastEffect(), new SacrificeSourceCost()); ability.addTarget(new TargetPlayer()); From bc9a3dd58a3c960b694717725c167da19f7faa5e Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Tue, 19 Sep 2017 17:02:18 -0400 Subject: [PATCH 13/29] minor updates --- Mage.Sets/src/mage/cards/l/LegacysAllure.java | 1 + .../cards/l/LilianaDefiantNecromancer.java | 1 + .../src/mage/cards/p/PentarchPaladin.java | 1 + .../mage/cards/s/SwordOfLightAndShadow.java | 22 ++++--------------- Mage.Sets/src/mage/cards/v/VileRequiem.java | 1 + 5 files changed, 8 insertions(+), 18 deletions(-) diff --git a/Mage.Sets/src/mage/cards/l/LegacysAllure.java b/Mage.Sets/src/mage/cards/l/LegacysAllure.java index bd96e9f2d7..d11c609fd2 100644 --- a/Mage.Sets/src/mage/cards/l/LegacysAllure.java +++ b/Mage.Sets/src/mage/cards/l/LegacysAllure.java @@ -61,6 +61,7 @@ public class LegacysAllure extends CardImpl { // At the beginning of your upkeep, you may put a treasure counter on Legacy's Allure. this.addAbility(new BeginningOfUpkeepTriggeredAbility(new AddCountersSourceEffect(new Counter("treasure")), TargetController.YOU, true)); + //TODO: Make ability properly copiable // Sacrifice Legacy's Allure: Gain control of target creature with power less than or equal to the number of treasure counters on Legacy's Allure. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainControlTargetEffect(Duration.EndOfGame, true), new SacrificeSourceCost()); ability.addTarget(new TargetCreaturePermanent(new FilterCreaturePermanent("creature with power less than or equal to the number of treasure counters on " + getLogName()))); diff --git a/Mage.Sets/src/mage/cards/l/LilianaDefiantNecromancer.java b/Mage.Sets/src/mage/cards/l/LilianaDefiantNecromancer.java index 0eaca90de6..be62977d53 100644 --- a/Mage.Sets/src/mage/cards/l/LilianaDefiantNecromancer.java +++ b/Mage.Sets/src/mage/cards/l/LilianaDefiantNecromancer.java @@ -75,6 +75,7 @@ public class LilianaDefiantNecromancer extends CardImpl { // +2: Each player discards a card. this.addAbility(new LoyaltyAbility(new DiscardEachPlayerEffect(1, false), 2)); + //TODO: Make ability properly copiable // -X: Return target nonlegendary creature with converted mana cost X from your graveyard to the battlefield. Ability ability = new LoyaltyAbility(new ReturnFromGraveyardToBattlefieldTargetEffect()); ability2Id = ability.getOriginalId(); diff --git a/Mage.Sets/src/mage/cards/p/PentarchPaladin.java b/Mage.Sets/src/mage/cards/p/PentarchPaladin.java index 8ed6f885ac..7916db45b2 100644 --- a/Mage.Sets/src/mage/cards/p/PentarchPaladin.java +++ b/Mage.Sets/src/mage/cards/p/PentarchPaladin.java @@ -72,6 +72,7 @@ public class PentarchPaladin extends CardImpl { // As Pentarch Paladin enters the battlefield, choose a color. this.addAbility(new AsEntersBattlefieldAbility(new ChooseColorEffect(Outcome.Detriment))); + //TODO: Make ability properly copiable // {W}{W}, {tap}: Destroy target permanent of the chosen color. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DestroyTargetEffect(), new ManaCostsImpl("{W}{W}")); ability.addCost(new TapSourceCost()); diff --git a/Mage.Sets/src/mage/cards/s/SwordOfLightAndShadow.java b/Mage.Sets/src/mage/cards/s/SwordOfLightAndShadow.java index 033ee888e5..e96d1af110 100644 --- a/Mage.Sets/src/mage/cards/s/SwordOfLightAndShadow.java +++ b/Mage.Sets/src/mage/cards/s/SwordOfLightAndShadow.java @@ -62,14 +62,16 @@ import mage.target.common.TargetCardInYourGraveyard; public class SwordOfLightAndShadow extends CardImpl { public SwordOfLightAndShadow(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{3}"); + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}"); this.subtype.add(SubType.EQUIPMENT); // Equipped creature gets +2/+2 and has protection from white and from black. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEquippedEffect(2, 2))); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(ProtectionAbility.from(ObjectColor.WHITE, ObjectColor.BLACK), AttachmentType.EQUIPMENT))); // Whenever equipped creature deals combat damage to a player, you gain 3 life and you may return up to one target creature card from your graveyard to your hand. - this.addAbility(new SwordOfLightAndShadowAbility()); + Ability ability = new SwordOfLightAndShadowAbility(); + ability.addTarget(new TargetCardInYourGraveyard(0, 1, new FilterCreatureCard("creature card from your graveyard"))); + this.addAbility(ability); // Equip {2} this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(2))); } @@ -82,22 +84,6 @@ public class SwordOfLightAndShadow extends CardImpl { public SwordOfLightAndShadow copy() { return new SwordOfLightAndShadow(this); } - - @Override - public void adjustTargets(Ability ability, Game game) { - - if (ability instanceof SwordOfLightAndShadowAbility) { - Player controller = game.getPlayer(ability.getControllerId()); - if (controller != null) { - // Target may only be added if possible target exists. Else the gain life effect won't trigger, because there is no valid target for the - // return to hand ability - if (controller.getGraveyard().count(new FilterCreatureCard(), ability.getSourceId(), ability.getControllerId(), game) > 0) { - ability.addTarget(new TargetCardInYourGraveyard(0, 1, new FilterCreatureCard("creature card from your graveyard"))); - } - } - } - - } } class SwordOfLightAndShadowAbility extends TriggeredAbilityImpl { diff --git a/Mage.Sets/src/mage/cards/v/VileRequiem.java b/Mage.Sets/src/mage/cards/v/VileRequiem.java index f32b7afec0..9740c89860 100644 --- a/Mage.Sets/src/mage/cards/v/VileRequiem.java +++ b/Mage.Sets/src/mage/cards/v/VileRequiem.java @@ -71,6 +71,7 @@ public class VileRequiem extends CardImpl { // At the beginning of your upkeep, you may put a verse counter on Vile Requiem. this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.VERSE.createInstance(), true ), TargetController.YOU, true)); + //TODO: Make ability properly copiable // {1}{B}, Sacrifice Vile Requiem: Destroy up to X target nonblack creatures, where X is the number of verse counters on Vile Requiem. They can't be regenerated. Effect effect = new DestroyTargetEffect(true); effect.setText("Destroy up to X target nonblack creatures, where X is the number of verse counters on {this}. They can't be regenerated"); From ce68a1d9ed0e59387298ed541026b56c14175b20 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Tue, 19 Sep 2017 18:01:37 -0400 Subject: [PATCH 14/29] Pentarch Paladin is now supported properly --- .../src/mage/cards/p/PentarchPaladin.java | 31 ++++--------------- Mage/src/main/java/mage/cards/CardImpl.java | 25 +++++++++++---- .../java/mage/constants/TargetAdjustment.java | 2 +- 3 files changed, 26 insertions(+), 32 deletions(-) diff --git a/Mage.Sets/src/mage/cards/p/PentarchPaladin.java b/Mage.Sets/src/mage/cards/p/PentarchPaladin.java index 7916db45b2..86a28c5eb4 100644 --- a/Mage.Sets/src/mage/cards/p/PentarchPaladin.java +++ b/Mage.Sets/src/mage/cards/p/PentarchPaladin.java @@ -29,7 +29,6 @@ package mage.cards.p; import java.util.UUID; import mage.MageInt; -import mage.ObjectColor; import mage.abilities.Ability; import mage.abilities.common.AsEntersBattlefieldAbility; import mage.abilities.common.SimpleActivatedAbility; @@ -44,23 +43,21 @@ import mage.constants.SubType; import mage.constants.Outcome; import mage.constants.Zone; import mage.filter.FilterPermanent; -import mage.filter.predicate.mageobject.ColorPredicate; -import mage.game.Game; import mage.target.TargetPermanent; import mage.abilities.effects.common.DestroyTargetEffect; +import mage.constants.TargetAdjustment; /** * * @author jeffwadsworth */ public class PentarchPaladin extends CardImpl { - - private final UUID originalId; + FilterPermanent filter = new FilterPermanent("permanent of the chosen color."); public PentarchPaladin(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{W}{W}{W}"); - + this.subtype.add(SubType.HUMAN); this.subtype.add(SubType.KNIGHT); this.power = new MageInt(3); @@ -71,37 +68,21 @@ public class PentarchPaladin extends CardImpl { // As Pentarch Paladin enters the battlefield, choose a color. this.addAbility(new AsEntersBattlefieldAbility(new ChooseColorEffect(Outcome.Detriment))); - - //TODO: Make ability properly copiable + // {W}{W}, {tap}: Destroy target permanent of the chosen color. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DestroyTargetEffect(), new ManaCostsImpl("{W}{W}")); ability.addCost(new TapSourceCost()); ability.addTarget(new TargetPermanent(filter)); - originalId = ability.getOriginalId(); + ability.setTargetAdjustment(TargetAdjustment.CHOSEN_COLOR); this.addAbility(ability); - - } - - @Override - public void adjustTargets(Ability ability, Game game) { - ObjectColor color = (ObjectColor) game.getState().getValue(ability.getSourceId() + "_color"); - if (ability.getOriginalId().equals(originalId) - && color != null) { - ability.getTargets().clear(); - FilterPermanent filter = new FilterPermanent("permanent of the chosen color."); - filter.add(new ColorPredicate(color)); - TargetPermanent target = new TargetPermanent(filter); - ability.addTarget(target); - } } public PentarchPaladin(final PentarchPaladin card) { super(card); - this.originalId = card.originalId; } @Override public PentarchPaladin copy() { return new PentarchPaladin(this); } -} \ No newline at end of file +} diff --git a/Mage/src/main/java/mage/cards/CardImpl.java b/Mage/src/main/java/mage/cards/CardImpl.java index dc20a9ce1e..e6919510d8 100644 --- a/Mage/src/main/java/mage/cards/CardImpl.java +++ b/Mage/src/main/java/mage/cards/CardImpl.java @@ -46,6 +46,7 @@ import mage.counters.Counters; import mage.filter.FilterCard; import mage.filter.FilterPermanent; import mage.filter.FilterSpell; +import mage.filter.predicate.mageobject.ColorPredicate; import mage.filter.predicate.mageobject.ConvertedManaCostPredicate; import mage.filter.predicate.mageobject.NamePredicate; import mage.filter.predicate.mageobject.PowerPredicate; @@ -351,6 +352,12 @@ public abstract class CardImpl extends MageObjectImpl implements Card { ability.getTargets().clear(); ability.getTargets().add(new TargetPermanent(minTargets, maxTargets, permanentFilter, false)); break; + case X_TARGETS: + xValue = ability.getManaCostsToPay().getX(); + permanentFilter = ((TargetPermanent) ability.getTargets().get(0)).getFilter(); + ability.getTargets().clear(); + ability.addTarget(new TargetPermanent(xValue, permanentFilter)); + break; case X_POWER_LEQ:// Minamo Sightbender only xValue = ability.getManaCostsToPay().getX(); oldTargetPermanent = (TargetPermanent) ability.getTargets().get(0); @@ -361,12 +368,6 @@ public abstract class CardImpl extends MageObjectImpl implements Card { ability.getTargets().clear(); ability.getTargets().add(new TargetPermanent(minTargets, maxTargets, permanentFilter, false)); break; - case X_TARGETS: - xValue = ability.getManaCostsToPay().getX(); - permanentFilter = ((TargetPermanent) ability.getTargets().get(0)).getFilter(); - ability.getTargets().clear(); - ability.addTarget(new TargetPermanent(xValue, permanentFilter)); - break; case X_CMC_EQUAL_GY_CARD: //Geth, Lord of the Vault only xValue = ability.getManaCostsToPay().getX(); TargetCard oldTarget = (TargetCard) ability.getTargets().get(0); @@ -382,6 +383,18 @@ public abstract class CardImpl extends MageObjectImpl implements Card { TargetSpell target = new TargetSpell(1, filterSpell); ability.addTarget(target); break; + case CHOSEN_COLOR: //Pentarch Paladin only + ObjectColor chosenColor = (ObjectColor) game.getState().getValue(ability.getSourceId() + "_color"); + ability.getTargets().clear(); + FilterPermanent filter = new FilterPermanent("permanent of the chosen color."); + if (chosenColor != null) { + filter.add(new ColorPredicate(chosenColor)); + } else { + filter.add(new ConvertedManaCostPredicate(ComparisonType.FEWER_THAN, -5));// Pretty sure this is always false + } + oldTargetPermanent = new TargetPermanent(filter); + ability.addTarget(oldTargetPermanent); + break; } } diff --git a/Mage/src/main/java/mage/constants/TargetAdjustment.java b/Mage/src/main/java/mage/constants/TargetAdjustment.java index e5b8a8f1f5..0f28ea3255 100644 --- a/Mage/src/main/java/mage/constants/TargetAdjustment.java +++ b/Mage/src/main/java/mage/constants/TargetAdjustment.java @@ -6,5 +6,5 @@ package mage.constants; */ public enum TargetAdjustment { - NONE, X_TARGETS, X_CMC_EQUAL_PERM, X_CMC_EQUAL_GY_CARD, X_POWER_LEQ, CHOSEN_NAME + NONE, X_TARGETS, X_CMC_EQUAL_PERM, X_CMC_EQUAL_GY_CARD, X_POWER_LEQ, CHOSEN_NAME, CHOSEN_COLOR } From 602eee1928c6d10ef54d334a924b095f76cd36b8 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Tue, 19 Sep 2017 20:29:33 -0400 Subject: [PATCH 15/29] Vile Requiem modified so its ability can be copied, implemented Recantation, Rumbling Crescendo, Serra's Liturgy and War Dance --- Mage.Sets/src/mage/cards/r/Recantation.java | 80 ++++++++++++++++ .../src/mage/cards/r/RumblingCrescendo.java | 87 ++++++++++++++++++ Mage.Sets/src/mage/cards/s/SerrasLiturgy.java | 91 +++++++++++++++++++ Mage.Sets/src/mage/cards/t/TorchSong.java | 11 ++- Mage.Sets/src/mage/cards/v/VileRequiem.java | 41 +++------ Mage.Sets/src/mage/cards/w/WarDance.java | 82 +++++++++++++++++ Mage.Sets/src/mage/sets/UrzasSaga.java | 5 + Mage/src/main/java/mage/cards/CardImpl.java | 10 ++ .../java/mage/constants/TargetAdjustment.java | 2 +- 9 files changed, 376 insertions(+), 33 deletions(-) create mode 100644 Mage.Sets/src/mage/cards/r/Recantation.java create mode 100644 Mage.Sets/src/mage/cards/r/RumblingCrescendo.java create mode 100644 Mage.Sets/src/mage/cards/s/SerrasLiturgy.java create mode 100644 Mage.Sets/src/mage/cards/w/WarDance.java diff --git a/Mage.Sets/src/mage/cards/r/Recantation.java b/Mage.Sets/src/mage/cards/r/Recantation.java new file mode 100644 index 0000000000..e2f9cad954 --- /dev/null +++ b/Mage.Sets/src/mage/cards/r/Recantation.java @@ -0,0 +1,80 @@ +/* + * 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.abilities.Ability; +import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.SacrificeSourceCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.ReturnToHandTargetEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.TargetAdjustment; +import mage.constants.TargetController; +import mage.constants.Zone; +import mage.counters.CounterType; +import mage.filter.FilterPermanent; +import mage.target.TargetPermanent; + +/** + * + * @author TheElk801 + */ +public class Recantation extends CardImpl { + + public Recantation(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{U}"); + + // At the beginning of your upkeep, you may put a verse counter on Recantation. + this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, + new AddCountersSourceEffect(CounterType.VERSE.createInstance(), true), TargetController.YOU, true)); + + // {U}, Sacrifice Recantation: Return up to X target permanents to their owners' hands, where X is the number of verse counters on Recantation. + Effect effect = new ReturnToHandTargetEffect(true); + effect.setText("Return up to X target permanents to their owners' hands, where X is the number of verse counters on {this}."); + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{U}")); + ability.addCost(new SacrificeSourceCost()); + ability.addTarget(new TargetPermanent(0, 0, new FilterPermanent("up to X target permanents, where X is the number of verse counters on {this}."), false)); + ability.setTargetAdjustment(TargetAdjustment.VERSE_COUNTER_TARGETS); + this.addAbility(ability); + } + + public Recantation(final Recantation card) { + super(card); + } + + @Override + public Recantation copy() { + return new Recantation(this); + } +} diff --git a/Mage.Sets/src/mage/cards/r/RumblingCrescendo.java b/Mage.Sets/src/mage/cards/r/RumblingCrescendo.java new file mode 100644 index 0000000000..093b89338a --- /dev/null +++ b/Mage.Sets/src/mage/cards/r/RumblingCrescendo.java @@ -0,0 +1,87 @@ +/* + * 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.abilities.Ability; +import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.SacrificeSourceCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.DestroyTargetEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.TargetAdjustment; +import mage.constants.TargetController; +import mage.constants.Zone; +import mage.counters.CounterType; +import mage.filter.FilterPermanent; +import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.target.TargetPermanent; + +/** + * + * @author TheElk801 + */ +public class RumblingCrescendo extends CardImpl { + + private static final FilterPermanent filter = new FilterPermanent("up to X target lands, where X is the number of verse counters on {this}"); + + static { + filter.add(new CardTypePredicate(CardType.LAND)); + } + + public RumblingCrescendo(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{R}{R}"); + + // At the beginning of your upkeep, you may put a verse counter on Rumbling Crescendo. + this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, + new AddCountersSourceEffect(CounterType.VERSE.createInstance(), true), TargetController.YOU, true)); + + // {R}, Sacrifice Rumbling Crescendo: Destroy up to X target lands, where X is the number of verse counters on Rumbling Crescendo. + Effect effect = new DestroyTargetEffect(true); + effect.setText("Destroy up to X target lands, where X is the number of verse counters on {this}."); + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{R}")); + ability.addCost(new SacrificeSourceCost()); + ability.addTarget(new TargetPermanent(0, 0, filter, false)); + ability.setTargetAdjustment(TargetAdjustment.VERSE_COUNTER_TARGETS); + this.addAbility(ability); + } + + public RumblingCrescendo(final RumblingCrescendo card) { + super(card); + } + + @Override + public RumblingCrescendo copy() { + return new RumblingCrescendo(this); + } +} diff --git a/Mage.Sets/src/mage/cards/s/SerrasLiturgy.java b/Mage.Sets/src/mage/cards/s/SerrasLiturgy.java new file mode 100644 index 0000000000..a0695c7017 --- /dev/null +++ b/Mage.Sets/src/mage/cards/s/SerrasLiturgy.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.s; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.SacrificeSourceCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.DestroyTargetEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.TargetAdjustment; +import mage.constants.TargetController; +import mage.constants.Zone; +import mage.counters.CounterType; +import mage.filter.FilterPermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.target.TargetPermanent; + +/** + * + * @author TheElk801 + */ +public class SerrasLiturgy extends CardImpl { + + private static final FilterPermanent filter = new FilterPermanent("up to X target artifacts and/or enchantments, where X is the number of verse counters on {this}"); + + static { + filter.add(Predicates.or( + new CardTypePredicate(CardType.ARTIFACT), + new CardTypePredicate(CardType.ENCHANTMENT) + )); + } + + public SerrasLiturgy(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{W}{W}"); + + // At the beginning of your upkeep, you may put a verse counter on Serra's Liturgy. + this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, + new AddCountersSourceEffect(CounterType.VERSE.createInstance(), true), TargetController.YOU, true)); + + // {W}, Sacrifice Serra's Liturgy: Destroy up to X target artifacts and/or enchantments, where X is the number of verse counters on Serra's Liturgy. + Effect effect = new DestroyTargetEffect(true); + effect.setText("Destroy up to X target artifacts and/or enchantments, where X is the number of verse counters on {this}."); + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{W}")); + ability.addCost(new SacrificeSourceCost()); + ability.addTarget(new TargetPermanent(0, 0, filter, false)); + ability.setTargetAdjustment(TargetAdjustment.VERSE_COUNTER_TARGETS); + this.addAbility(ability); + } + + public SerrasLiturgy(final SerrasLiturgy card) { + super(card); + } + + @Override + public SerrasLiturgy copy() { + return new SerrasLiturgy(this); + } +} diff --git a/Mage.Sets/src/mage/cards/t/TorchSong.java b/Mage.Sets/src/mage/cards/t/TorchSong.java index 2da5523d9b..d6a19c2a46 100644 --- a/Mage.Sets/src/mage/cards/t/TorchSong.java +++ b/Mage.Sets/src/mage/cards/t/TorchSong.java @@ -51,13 +51,18 @@ import mage.target.common.TargetCreatureOrPlayer; public class TorchSong extends CardImpl { public TorchSong(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{R}"); + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{R}"); // At the beginning of your upkeep, you may put a verse counter on Torch Song. this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, - new AddCountersSourceEffect(CounterType.VERSE.createInstance(), true), TargetController.YOU, true)); + new AddCountersSourceEffect(CounterType.VERSE.createInstance(), true), TargetController.YOU, true)); + // {2}{R}, Sacrifice Torch Song: Torch Song deals X damage to target creature or player, where X is the number of verse counters on Torch Song. - Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(new CountersSourceCount(CounterType.VERSE)), new ManaCostsImpl("{2}{R}")); + Ability ability = new SimpleActivatedAbility( + Zone.BATTLEFIELD, + new DamageTargetEffect(new CountersSourceCount(CounterType.VERSE)), + new ManaCostsImpl("{2}{R}") + ); ability.addCost(new SacrificeSourceCost()); ability.addTarget(new TargetCreatureOrPlayer()); this.addAbility(ability); diff --git a/Mage.Sets/src/mage/cards/v/VileRequiem.java b/Mage.Sets/src/mage/cards/v/VileRequiem.java index 9740c89860..4573f230b6 100644 --- a/Mage.Sets/src/mage/cards/v/VileRequiem.java +++ b/Mage.Sets/src/mage/cards/v/VileRequiem.java @@ -40,16 +40,15 @@ import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; +import mage.constants.TargetAdjustment; import mage.constants.TargetController; import mage.constants.Zone; import mage.counters.CounterType; -import mage.filter.common.FilterCreaturePermanent; +import mage.filter.FilterPermanent; import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.CardTypePredicate; import mage.filter.predicate.mageobject.ColorPredicate; -import mage.game.Game; -import mage.game.permanent.Permanent; -import mage.target.common.TargetCreaturePermanent; -import mage.util.CardUtil; +import mage.target.TargetPermanent; /** * @@ -57,49 +56,33 @@ import mage.util.CardUtil; */ public class VileRequiem extends CardImpl { - private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("up to X target nonblack creatures, where X is the number of verse counters on {this}"); + private static final FilterPermanent filter = new FilterPermanent("up to X target nonblack creatures, where X is the number of verse counters on {this}"); + static { filter.add(Predicates.not(new ColorPredicate(ObjectColor.BLACK))); + filter.add(new CardTypePredicate(CardType.CREATURE)); } - private final UUID originalId; public VileRequiem(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{B}{B}"); - - this.color.setBlack(true); + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{B}{B}"); // At the beginning of your upkeep, you may put a verse counter on Vile Requiem. this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, - new AddCountersSourceEffect(CounterType.VERSE.createInstance(), true ), TargetController.YOU, true)); - //TODO: Make ability properly copiable + new AddCountersSourceEffect(CounterType.VERSE.createInstance(), true), TargetController.YOU, true)); + // {1}{B}, Sacrifice Vile Requiem: Destroy up to X target nonblack creatures, where X is the number of verse counters on Vile Requiem. They can't be regenerated. Effect effect = new DestroyTargetEffect(true); effect.setText("Destroy up to X target nonblack creatures, where X is the number of verse counters on {this}. They can't be regenerated"); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{1}{B}")); ability.addCost(new SacrificeSourceCost()); - ability.addTarget(new TargetCreaturePermanent(0,0,filter, false)); + ability.addTarget(new TargetPermanent(0, 0, filter, false)); + ability.setTargetAdjustment(TargetAdjustment.VERSE_COUNTER_TARGETS); this.addAbility(ability); - originalId = ability.getOriginalId(); } - @Override - public void adjustTargets(Ability ability, Game game) { - if (ability.getOriginalId().equals(originalId)) { - Permanent sourcePermanent = game.getPermanent(ability.getSourceId()); - if (sourcePermanent != null) { - int numberCounters = sourcePermanent.getCounters(game).getCount(CounterType.VERSE); - ability.getTargets().clear(); - FilterCreaturePermanent newFilter = filter.copy(); - newFilter.setMessage(new StringBuilder("up to ").append(CardUtil.numberToText(numberCounters)).append(" target nonblack creatures").toString()); - ability.addTarget(new TargetCreaturePermanent(0,numberCounters,newFilter, false)); - } - } - } - public VileRequiem(final VileRequiem card) { super(card); - this.originalId = card.originalId; } @Override diff --git a/Mage.Sets/src/mage/cards/w/WarDance.java b/Mage.Sets/src/mage/cards/w/WarDance.java new file mode 100644 index 0000000000..93a920d3c1 --- /dev/null +++ b/Mage.Sets/src/mage/cards/w/WarDance.java @@ -0,0 +1,82 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.cards.w; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.SacrificeSourceCost; +import mage.abilities.dynamicvalue.common.CountersSourceCount; +import mage.abilities.effects.common.continuous.BoostTargetEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.TargetController; +import mage.constants.Zone; +import mage.counters.CounterType; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author TheElk801 + */ +public class WarDance extends CardImpl { + + public WarDance(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{G}"); + + // At the beginning of your upkeep, you may put a verse counter on War Dance. + this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, + new AddCountersSourceEffect(CounterType.VERSE.createInstance(), true), TargetController.YOU, true)); + + // Sacrifice War Dance: Target creature gets +X/+X until end of turn, where X is the number of verse counters on War Dance. + Ability ability = new SimpleActivatedAbility( + Zone.BATTLEFIELD, + new BoostTargetEffect( + new CountersSourceCount(CounterType.VERSE), + new CountersSourceCount(CounterType.VERSE), + Duration.EndOfTurn + ), + new SacrificeSourceCost() + ); + ability.addTarget(new TargetCreaturePermanent()); + this.addAbility(ability); + } + + public WarDance(final WarDance card) { + super(card); + } + + @Override + public WarDance copy() { + return new WarDance(this); + } +} diff --git a/Mage.Sets/src/mage/sets/UrzasSaga.java b/Mage.Sets/src/mage/sets/UrzasSaga.java index 5f2187a3c7..dc70a3ebca 100644 --- a/Mage.Sets/src/mage/sets/UrzasSaga.java +++ b/Mage.Sets/src/mage/sets/UrzasSaga.java @@ -261,6 +261,7 @@ public class UrzasSaga extends ExpansionSet { cards.add(new SetCardInfo("Rain of Salt", 206, Rarity.UNCOMMON, mage.cards.r.RainOfSalt.class)); cards.add(new SetCardInfo("Ravenous Skirge", 152, Rarity.COMMON, mage.cards.r.RavenousSkirge.class)); cards.add(new SetCardInfo("Raze", 207, Rarity.COMMON, mage.cards.r.Raze.class)); + cards.add(new SetCardInfo("Recantation", 91, Rarity.RARE, mage.cards.r.Recantation.class)); cards.add(new SetCardInfo("Redeem", 33, Rarity.UNCOMMON, mage.cards.r.Redeem.class)); cards.add(new SetCardInfo("Reflexes", 208, Rarity.COMMON, mage.cards.r.Reflexes.class)); cards.add(new SetCardInfo("Rejuvenate", 271, Rarity.COMMON, mage.cards.r.Rejuvenate.class)); @@ -270,6 +271,7 @@ public class UrzasSaga extends ExpansionSet { cards.add(new SetCardInfo("Rescind", 92, Rarity.COMMON, mage.cards.r.Rescind.class)); cards.add(new SetCardInfo("Retaliation", 272, Rarity.UNCOMMON, mage.cards.r.Retaliation.class)); cards.add(new SetCardInfo("Rewind", 93, Rarity.COMMON, mage.cards.r.Rewind.class)); + cards.add(new SetCardInfo("Rumbling Crescendo", 210, Rarity.RARE, mage.cards.r.RumblingCrescendo.class)); cards.add(new SetCardInfo("Rune of Protection: Artifacts", 35, Rarity.UNCOMMON, mage.cards.r.RuneOfProtectionArtifacts.class)); cards.add(new SetCardInfo("Rune of Protection: Black", 36, Rarity.COMMON, mage.cards.r.RuneOfProtectionBlack.class)); cards.add(new SetCardInfo("Rune of Protection: Blue", 37, Rarity.COMMON, mage.cards.r.RuneOfProtectionBlue.class)); @@ -288,8 +290,10 @@ public class UrzasSaga extends ExpansionSet { cards.add(new SetCardInfo("Seasoned Marshal", 44, Rarity.UNCOMMON, mage.cards.s.SeasonedMarshal.class)); cards.add(new SetCardInfo("Serra Avatar", 45, Rarity.RARE, mage.cards.s.SerraAvatar.class)); cards.add(new SetCardInfo("Serra's Embrace", 47, Rarity.UNCOMMON, mage.cards.s.SerrasEmbrace.class)); + cards.add(new SetCardInfo("Serra's Liturgy", 49, Rarity.RARE, mage.cards.s.SerrasLiturgy.class)); cards.add(new SetCardInfo("Serra's Sanctum", 325, Rarity.RARE, mage.cards.s.SerrasSanctum.class)); cards.add(new SetCardInfo("Serra Zealot", 46, Rarity.COMMON, mage.cards.s.SerraZealot.class)); + cards.add(new SetCardInfo("Serra's Liturgy", 49, Rarity.RARE, mage.cards.s.SerrasLiturgy.class)); cards.add(new SetCardInfo("Shimmering Barrier", 50, Rarity.UNCOMMON, mage.cards.s.ShimmeringBarrier.class)); cards.add(new SetCardInfo("Shivan Gorge", 326, Rarity.RARE, mage.cards.s.ShivanGorge.class)); cards.add(new SetCardInfo("Shivan Hellkite", 214, Rarity.RARE, mage.cards.s.ShivanHellkite.class)); @@ -349,6 +353,7 @@ public class UrzasSaga extends ExpansionSet { cards.add(new SetCardInfo("Voice of Law", 55, Rarity.UNCOMMON, mage.cards.v.VoiceOfLaw.class)); cards.add(new SetCardInfo("Voltaic Key", 314, Rarity.UNCOMMON, mage.cards.v.VoltaicKey.class)); cards.add(new SetCardInfo("Vug Lizard", 227, Rarity.UNCOMMON, mage.cards.v.VugLizard.class)); + cards.add(new SetCardInfo("War Dance", 282, Rarity.UNCOMMON, mage.cards.w.WarDance.class)); cards.add(new SetCardInfo("Western Paladin", 168, Rarity.RARE, mage.cards.w.WesternPaladin.class)); cards.add(new SetCardInfo("Whetstone", 316, Rarity.RARE, mage.cards.w.Whetstone.class)); cards.add(new SetCardInfo("Whirlwind", 283, Rarity.RARE, mage.cards.w.Whirlwind.class)); diff --git a/Mage/src/main/java/mage/cards/CardImpl.java b/Mage/src/main/java/mage/cards/CardImpl.java index e6919510d8..95cc2f7cc7 100644 --- a/Mage/src/main/java/mage/cards/CardImpl.java +++ b/Mage/src/main/java/mage/cards/CardImpl.java @@ -42,6 +42,7 @@ import mage.abilities.mana.ActivatedManaAbilityImpl; import mage.cards.repository.PluginClassloaderRegistery; import mage.constants.*; import mage.counters.Counter; +import mage.counters.CounterType; import mage.counters.Counters; import mage.filter.FilterCard; import mage.filter.FilterPermanent; @@ -395,6 +396,15 @@ public abstract class CardImpl extends MageObjectImpl implements Card { oldTargetPermanent = new TargetPermanent(filter); ability.addTarget(oldTargetPermanent); break; + case VERSE_COUNTER_TARGETS: + Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(ability.getSourceId()); + if (sourcePermanent != null) { + xValue = sourcePermanent.getCounters(game).getCount(CounterType.VERSE); + permanentFilter = ((TargetPermanent) ability.getTargets().get(0)).getFilter(); + ability.getTargets().clear(); + ability.addTarget(new TargetPermanent(0, xValue, permanentFilter, false)); + } + break; } } diff --git a/Mage/src/main/java/mage/constants/TargetAdjustment.java b/Mage/src/main/java/mage/constants/TargetAdjustment.java index 0f28ea3255..06c025ddaa 100644 --- a/Mage/src/main/java/mage/constants/TargetAdjustment.java +++ b/Mage/src/main/java/mage/constants/TargetAdjustment.java @@ -6,5 +6,5 @@ package mage.constants; */ public enum TargetAdjustment { - NONE, X_TARGETS, X_CMC_EQUAL_PERM, X_CMC_EQUAL_GY_CARD, X_POWER_LEQ, CHOSEN_NAME, CHOSEN_COLOR + NONE, X_TARGETS, X_CMC_EQUAL_PERM, X_CMC_EQUAL_GY_CARD, X_POWER_LEQ, CHOSEN_NAME, CHOSEN_COLOR, VERSE_COUNTER_TARGETS } From bd415215f51ba0b23d7cbec94fa54f169e8bb633 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Tue, 19 Sep 2017 20:52:18 -0400 Subject: [PATCH 16/29] Legacy's Allure modified so its ability can be copied --- Mage.Sets/src/mage/cards/l/LegacysAllure.java | 32 ++++--------------- Mage/src/main/java/mage/cards/CardImpl.java | 12 +++++++ .../java/mage/constants/TargetAdjustment.java | 2 +- .../main/java/mage/counters/CounterType.java | 1 + 4 files changed, 21 insertions(+), 26 deletions(-) diff --git a/Mage.Sets/src/mage/cards/l/LegacysAllure.java b/Mage.Sets/src/mage/cards/l/LegacysAllure.java index d11c609fd2..6d58e0cdfc 100644 --- a/Mage.Sets/src/mage/cards/l/LegacysAllure.java +++ b/Mage.Sets/src/mage/cards/l/LegacysAllure.java @@ -37,15 +37,12 @@ import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.ComparisonType; import mage.constants.Duration; +import mage.constants.TargetAdjustment; import mage.constants.TargetController; import mage.constants.Zone; -import mage.counters.Counter; +import mage.counters.CounterType; import mage.filter.common.FilterCreaturePermanent; -import mage.filter.predicate.mageobject.PowerPredicate; -import mage.game.Game; -import mage.game.permanent.Permanent; import mage.target.common.TargetCreaturePermanent; /** @@ -53,39 +50,24 @@ import mage.target.common.TargetCreaturePermanent; */ public class LegacysAllure extends CardImpl { - private final UUID originalId; + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with power less than or equal to the number of treasure counters on {this}"); public LegacysAllure(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{U}{U}"); // At the beginning of your upkeep, you may put a treasure counter on Legacy's Allure. - this.addAbility(new BeginningOfUpkeepTriggeredAbility(new AddCountersSourceEffect(new Counter("treasure")), TargetController.YOU, true)); + this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, + new AddCountersSourceEffect(CounterType.TREASURE.createInstance(), true), TargetController.YOU, true)); - //TODO: Make ability properly copiable // Sacrifice Legacy's Allure: Gain control of target creature with power less than or equal to the number of treasure counters on Legacy's Allure. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainControlTargetEffect(Duration.EndOfGame, true), new SacrificeSourceCost()); - ability.addTarget(new TargetCreaturePermanent(new FilterCreaturePermanent("creature with power less than or equal to the number of treasure counters on " + getLogName()))); - originalId = ability.getOriginalId(); + ability.addTarget(new TargetCreaturePermanent(0, 0, filter, false)); + ability.setTargetAdjustment(TargetAdjustment.TREASURE_COUNTER_POWER); this.addAbility(ability); } public LegacysAllure(final LegacysAllure card) { super(card); - this.originalId = card.originalId; - } - - @Override - public void adjustTargets(Ability ability, Game game) { - if (ability.getOriginalId().equals(originalId)) { - Permanent sourcePermanent = game.getPermanent(ability.getSourceId()); - if (sourcePermanent != null) { - int numbCounters = sourcePermanent.getCounters(game).getCount("treasure"); - FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with power less than or equal to the number of treasure counters on " + getLogName()); - filter.add(new PowerPredicate(ComparisonType.FEWER_THAN, numbCounters + 1)); - ability.getTargets().clear(); - ability.getTargets().add(new TargetCreaturePermanent(filter)); - } - } } @Override diff --git a/Mage/src/main/java/mage/cards/CardImpl.java b/Mage/src/main/java/mage/cards/CardImpl.java index 95cc2f7cc7..8b34fa18e7 100644 --- a/Mage/src/main/java/mage/cards/CardImpl.java +++ b/Mage/src/main/java/mage/cards/CardImpl.java @@ -47,6 +47,7 @@ import mage.counters.Counters; import mage.filter.FilterCard; import mage.filter.FilterPermanent; import mage.filter.FilterSpell; +import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.mageobject.ColorPredicate; import mage.filter.predicate.mageobject.ConvertedManaCostPredicate; import mage.filter.predicate.mageobject.NamePredicate; @@ -61,6 +62,7 @@ import mage.target.TargetCard; import mage.target.TargetPermanent; import mage.target.TargetSpell; import mage.target.common.TargetCardInOpponentsGraveyard; +import mage.target.common.TargetCreaturePermanent; import mage.util.GameLog; import mage.util.SubTypeList; import mage.watchers.Watcher; @@ -405,6 +407,16 @@ public abstract class CardImpl extends MageObjectImpl implements Card { ability.addTarget(new TargetPermanent(0, xValue, permanentFilter, false)); } break; + case TREASURE_COUNTER_POWER: + sourcePermanent = game.getPermanentOrLKIBattlefield(ability.getSourceId()); + if (sourcePermanent != null) { + xValue = sourcePermanent.getCounters(game).getCount(CounterType.TREASURE); + FilterCreaturePermanent filter2 = new FilterCreaturePermanent("creature with power less than or equal to the number of treasure counters on {this}"); + filter2.add(new PowerPredicate(ComparisonType.FEWER_THAN, xValue + 1)); + ability.getTargets().clear(); + ability.getTargets().add(new TargetCreaturePermanent(filter2)); + } + break; } } diff --git a/Mage/src/main/java/mage/constants/TargetAdjustment.java b/Mage/src/main/java/mage/constants/TargetAdjustment.java index 06c025ddaa..177fa7f924 100644 --- a/Mage/src/main/java/mage/constants/TargetAdjustment.java +++ b/Mage/src/main/java/mage/constants/TargetAdjustment.java @@ -6,5 +6,5 @@ package mage.constants; */ public enum TargetAdjustment { - NONE, X_TARGETS, X_CMC_EQUAL_PERM, X_CMC_EQUAL_GY_CARD, X_POWER_LEQ, CHOSEN_NAME, CHOSEN_COLOR, VERSE_COUNTER_TARGETS + NONE, X_TARGETS, X_CMC_EQUAL_PERM, X_CMC_EQUAL_GY_CARD, X_POWER_LEQ, CHOSEN_NAME, CHOSEN_COLOR, VERSE_COUNTER_TARGETS, TREASURE_COUNTER_POWER } diff --git a/Mage/src/main/java/mage/counters/CounterType.java b/Mage/src/main/java/mage/counters/CounterType.java index cc7ff45b3e..d4b4464157 100644 --- a/Mage/src/main/java/mage/counters/CounterType.java +++ b/Mage/src/main/java/mage/counters/CounterType.java @@ -122,6 +122,7 @@ public enum CounterType { TIME("time"), TOWER("tower"), TRAP("trap"), + TREASURE("treasure"), UNITY("unity"), VELOCITY("velocity"), VERSE("verse"), From b0c3d6aee6f5d71fee4611d81309118e0e4d91f6 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Tue, 19 Sep 2017 21:56:55 -0400 Subject: [PATCH 17/29] small fix --- Mage/src/main/java/mage/cards/CardImpl.java | 20 +++++++++---------- .../java/mage/constants/TargetAdjustment.java | 9 ++++++++- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/Mage/src/main/java/mage/cards/CardImpl.java b/Mage/src/main/java/mage/cards/CardImpl.java index 8b34fa18e7..0e045b2153 100644 --- a/Mage/src/main/java/mage/cards/CardImpl.java +++ b/Mage/src/main/java/mage/cards/CardImpl.java @@ -371,6 +371,15 @@ public abstract class CardImpl extends MageObjectImpl implements Card { ability.getTargets().clear(); ability.getTargets().add(new TargetPermanent(minTargets, maxTargets, permanentFilter, false)); break; + case VERSE_COUNTER_TARGETS: + Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(ability.getSourceId()); + if (sourcePermanent != null) { + xValue = sourcePermanent.getCounters(game).getCount(CounterType.VERSE); + permanentFilter = ((TargetPermanent) ability.getTargets().get(0)).getFilter(); + ability.getTargets().clear(); + ability.addTarget(new TargetPermanent(0, xValue, permanentFilter, false)); + } + break; case X_CMC_EQUAL_GY_CARD: //Geth, Lord of the Vault only xValue = ability.getManaCostsToPay().getX(); TargetCard oldTarget = (TargetCard) ability.getTargets().get(0); @@ -398,16 +407,7 @@ public abstract class CardImpl extends MageObjectImpl implements Card { oldTargetPermanent = new TargetPermanent(filter); ability.addTarget(oldTargetPermanent); break; - case VERSE_COUNTER_TARGETS: - Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(ability.getSourceId()); - if (sourcePermanent != null) { - xValue = sourcePermanent.getCounters(game).getCount(CounterType.VERSE); - permanentFilter = ((TargetPermanent) ability.getTargets().get(0)).getFilter(); - ability.getTargets().clear(); - ability.addTarget(new TargetPermanent(0, xValue, permanentFilter, false)); - } - break; - case TREASURE_COUNTER_POWER: + case TREASURE_COUNTER_POWER: //Legacy's Allure only sourcePermanent = game.getPermanentOrLKIBattlefield(ability.getSourceId()); if (sourcePermanent != null) { xValue = sourcePermanent.getCounters(game).getCount(CounterType.TREASURE); diff --git a/Mage/src/main/java/mage/constants/TargetAdjustment.java b/Mage/src/main/java/mage/constants/TargetAdjustment.java index 177fa7f924..6b395b9e61 100644 --- a/Mage/src/main/java/mage/constants/TargetAdjustment.java +++ b/Mage/src/main/java/mage/constants/TargetAdjustment.java @@ -6,5 +6,12 @@ package mage.constants; */ public enum TargetAdjustment { - NONE, X_TARGETS, X_CMC_EQUAL_PERM, X_CMC_EQUAL_GY_CARD, X_POWER_LEQ, CHOSEN_NAME, CHOSEN_COLOR, VERSE_COUNTER_TARGETS, TREASURE_COUNTER_POWER + NONE, + X_TARGETS, + X_CMC_EQUAL_PERM, + X_CMC_EQUAL_GY_CARD, + X_POWER_LEQ, CHOSEN_NAME, + CHOSEN_COLOR, + VERSE_COUNTER_TARGETS, + TREASURE_COUNTER_POWER } From 0d49e385d5b0fe975e0811363a74cfd2b277bfec Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Tue, 19 Sep 2017 22:12:50 -0400 Subject: [PATCH 18/29] small fix --- Mage.Sets/src/mage/cards/d/DeepfireElemental.java | 5 ++++- Mage.Sets/src/mage/sets/UrzasSaga.java | 15 +++++++-------- .../java/mage/constants/TargetAdjustment.java | 1 - 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/Mage.Sets/src/mage/cards/d/DeepfireElemental.java b/Mage.Sets/src/mage/cards/d/DeepfireElemental.java index ae04912c4c..331de2866f 100644 --- a/Mage.Sets/src/mage/cards/d/DeepfireElemental.java +++ b/Mage.Sets/src/mage/cards/d/DeepfireElemental.java @@ -53,7 +53,10 @@ public class DeepfireElemental extends CardImpl { private static final FilterPermanent filter = new FilterPermanent("artifact or creature with converted mana cost X"); static { - filter.add(Predicates.or(new CardTypePredicate(CardType.ARTIFACT), new CardTypePredicate(CardType.CREATURE))); + filter.add(Predicates.or( + new CardTypePredicate(CardType.ARTIFACT), + new CardTypePredicate(CardType.CREATURE) + )); } public DeepfireElemental(UUID ownerId, CardSetInfo setInfo) { diff --git a/Mage.Sets/src/mage/sets/UrzasSaga.java b/Mage.Sets/src/mage/sets/UrzasSaga.java index dc70a3ebca..e59f6a3d2e 100644 --- a/Mage.Sets/src/mage/sets/UrzasSaga.java +++ b/Mage.Sets/src/mage/sets/UrzasSaga.java @@ -150,7 +150,7 @@ public class UrzasSaga extends ExpansionSet { cards.add(new SetCardInfo("Fertile Ground", 252, Rarity.COMMON, mage.cards.f.FertileGround.class)); cards.add(new SetCardInfo("Fiery Mantle", 186, Rarity.COMMON, mage.cards.f.FieryMantle.class)); cards.add(new SetCardInfo("Fire Ants", 187, Rarity.UNCOMMON, mage.cards.f.FireAnts.class)); - cards.add(new SetCardInfo("Flesh Reaver", 136, Rarity.UNCOMMON, mage.cards.f.FleshReaver.class)); + cards.add(new SetCardInfo("Flesh Reaver", 136, Rarity.UNCOMMON, mage.cards.f.FleshReaver.class)); cards.add(new SetCardInfo("Fluctuator", 295, Rarity.RARE, mage.cards.f.Fluctuator.class)); cards.add(new SetCardInfo("Fog Bank", 75, Rarity.UNCOMMON, mage.cards.f.FogBank.class)); cards.add(new SetCardInfo("Forest", 347, Rarity.LAND, mage.cards.basiclands.Forest.class, NON_FULL_USE_VARIOUS)); @@ -261,17 +261,17 @@ public class UrzasSaga extends ExpansionSet { cards.add(new SetCardInfo("Rain of Salt", 206, Rarity.UNCOMMON, mage.cards.r.RainOfSalt.class)); cards.add(new SetCardInfo("Ravenous Skirge", 152, Rarity.COMMON, mage.cards.r.RavenousSkirge.class)); cards.add(new SetCardInfo("Raze", 207, Rarity.COMMON, mage.cards.r.Raze.class)); - cards.add(new SetCardInfo("Recantation", 91, Rarity.RARE, mage.cards.r.Recantation.class)); + cards.add(new SetCardInfo("Recantation", 91, Rarity.RARE, mage.cards.r.Recantation.class)); cards.add(new SetCardInfo("Redeem", 33, Rarity.UNCOMMON, mage.cards.r.Redeem.class)); cards.add(new SetCardInfo("Reflexes", 208, Rarity.COMMON, mage.cards.r.Reflexes.class)); cards.add(new SetCardInfo("Rejuvenate", 271, Rarity.COMMON, mage.cards.r.Rejuvenate.class)); - cards.add(new SetCardInfo("Remembrance", 34, Rarity.RARE, mage.cards.r.Remembrance.class)); + cards.add(new SetCardInfo("Remembrance", 34, Rarity.RARE, mage.cards.r.Remembrance.class)); cards.add(new SetCardInfo("Remote Isle", 324, Rarity.COMMON, mage.cards.r.RemoteIsle.class)); cards.add(new SetCardInfo("Reprocess", 154, Rarity.RARE, mage.cards.r.Reprocess.class)); cards.add(new SetCardInfo("Rescind", 92, Rarity.COMMON, mage.cards.r.Rescind.class)); cards.add(new SetCardInfo("Retaliation", 272, Rarity.UNCOMMON, mage.cards.r.Retaliation.class)); cards.add(new SetCardInfo("Rewind", 93, Rarity.COMMON, mage.cards.r.Rewind.class)); - cards.add(new SetCardInfo("Rumbling Crescendo", 210, Rarity.RARE, mage.cards.r.RumblingCrescendo.class)); + cards.add(new SetCardInfo("Rumbling Crescendo", 210, Rarity.RARE, mage.cards.r.RumblingCrescendo.class)); cards.add(new SetCardInfo("Rune of Protection: Artifacts", 35, Rarity.UNCOMMON, mage.cards.r.RuneOfProtectionArtifacts.class)); cards.add(new SetCardInfo("Rune of Protection: Black", 36, Rarity.COMMON, mage.cards.r.RuneOfProtectionBlack.class)); cards.add(new SetCardInfo("Rune of Protection: Blue", 37, Rarity.COMMON, mage.cards.r.RuneOfProtectionBlue.class)); @@ -290,10 +290,9 @@ public class UrzasSaga extends ExpansionSet { cards.add(new SetCardInfo("Seasoned Marshal", 44, Rarity.UNCOMMON, mage.cards.s.SeasonedMarshal.class)); cards.add(new SetCardInfo("Serra Avatar", 45, Rarity.RARE, mage.cards.s.SerraAvatar.class)); cards.add(new SetCardInfo("Serra's Embrace", 47, Rarity.UNCOMMON, mage.cards.s.SerrasEmbrace.class)); - cards.add(new SetCardInfo("Serra's Liturgy", 49, Rarity.RARE, mage.cards.s.SerrasLiturgy.class)); + cards.add(new SetCardInfo("Serra's Liturgy", 49, Rarity.RARE, mage.cards.s.SerrasLiturgy.class)); cards.add(new SetCardInfo("Serra's Sanctum", 325, Rarity.RARE, mage.cards.s.SerrasSanctum.class)); cards.add(new SetCardInfo("Serra Zealot", 46, Rarity.COMMON, mage.cards.s.SerraZealot.class)); - cards.add(new SetCardInfo("Serra's Liturgy", 49, Rarity.RARE, mage.cards.s.SerrasLiturgy.class)); cards.add(new SetCardInfo("Shimmering Barrier", 50, Rarity.UNCOMMON, mage.cards.s.ShimmeringBarrier.class)); cards.add(new SetCardInfo("Shivan Gorge", 326, Rarity.RARE, mage.cards.s.ShivanGorge.class)); cards.add(new SetCardInfo("Shivan Hellkite", 214, Rarity.RARE, mage.cards.s.ShivanHellkite.class)); @@ -310,7 +309,7 @@ public class UrzasSaga extends ExpansionSet { cards.add(new SetCardInfo("Smokestack", 309, Rarity.RARE, mage.cards.s.Smokestack.class)); cards.add(new SetCardInfo("Smoldering Crater", 328, Rarity.COMMON, mage.cards.s.SmolderingCrater.class)); cards.add(new SetCardInfo("Sneak Attack", 218, Rarity.RARE, mage.cards.s.SneakAttack.class)); - cards.add(new SetCardInfo("Somnophore", 97, Rarity.RARE, mage.cards.s.Somnophore.class)); + cards.add(new SetCardInfo("Somnophore", 97, Rarity.RARE, mage.cards.s.Somnophore.class)); cards.add(new SetCardInfo("Spined Fluke", 160, Rarity.UNCOMMON, mage.cards.s.SpinedFluke.class)); cards.add(new SetCardInfo("Spire Owl", 98, Rarity.COMMON, mage.cards.s.SpireOwl.class)); cards.add(new SetCardInfo("Spreading Algae", 274, Rarity.UNCOMMON, mage.cards.s.SpreadingAlgae.class)); @@ -353,7 +352,7 @@ public class UrzasSaga extends ExpansionSet { cards.add(new SetCardInfo("Voice of Law", 55, Rarity.UNCOMMON, mage.cards.v.VoiceOfLaw.class)); cards.add(new SetCardInfo("Voltaic Key", 314, Rarity.UNCOMMON, mage.cards.v.VoltaicKey.class)); cards.add(new SetCardInfo("Vug Lizard", 227, Rarity.UNCOMMON, mage.cards.v.VugLizard.class)); - cards.add(new SetCardInfo("War Dance", 282, Rarity.UNCOMMON, mage.cards.w.WarDance.class)); + cards.add(new SetCardInfo("War Dance", 282, Rarity.UNCOMMON, mage.cards.w.WarDance.class)); cards.add(new SetCardInfo("Western Paladin", 168, Rarity.RARE, mage.cards.w.WesternPaladin.class)); cards.add(new SetCardInfo("Whetstone", 316, Rarity.RARE, mage.cards.w.Whetstone.class)); cards.add(new SetCardInfo("Whirlwind", 283, Rarity.RARE, mage.cards.w.Whirlwind.class)); diff --git a/Mage/src/main/java/mage/constants/TargetAdjustment.java b/Mage/src/main/java/mage/constants/TargetAdjustment.java index 6b395b9e61..0eb07153af 100644 --- a/Mage/src/main/java/mage/constants/TargetAdjustment.java +++ b/Mage/src/main/java/mage/constants/TargetAdjustment.java @@ -5,7 +5,6 @@ package mage.constants; * @author TheElk801 */ public enum TargetAdjustment { - NONE, X_TARGETS, X_CMC_EQUAL_PERM, From f76eac996c488c025ac685183220ed79de41ae81 Mon Sep 17 00:00:00 2001 From: Zzooouhh Date: Fri, 22 Sep 2017 20:37:34 +0200 Subject: [PATCH 19/29] Implemented Baki's Curse --- Mage.Sets/src/mage/sets/Homelands.java | 1 + 1 file changed, 1 insertion(+) diff --git a/Mage.Sets/src/mage/sets/Homelands.java b/Mage.Sets/src/mage/sets/Homelands.java index 79ef1dd30c..b2d2f1d677 100644 --- a/Mage.Sets/src/mage/sets/Homelands.java +++ b/Mage.Sets/src/mage/sets/Homelands.java @@ -89,6 +89,7 @@ public class Homelands extends ExpansionSet { cards.add(new SetCardInfo("Aysen Bureaucrats", 105, Rarity.COMMON, mage.cards.a.AysenBureaucrats.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Aysen Crusader", 106, Rarity.RARE, mage.cards.a.AysenCrusader.class)); cards.add(new SetCardInfo("Aysen Highway", 107, Rarity.RARE, mage.cards.a.AysenHighway.class)); + cards.add(new SetCardInfo("Baki's Curse", 27, Rarity.RARE, mage.cards.b.BakisCurse.class)); cards.add(new SetCardInfo("Baron Sengir", 1, Rarity.RARE, mage.cards.b.BaronSengir.class)); cards.add(new SetCardInfo("Black Carriage", 2, Rarity.RARE, mage.cards.b.BlackCarriage.class)); cards.add(new SetCardInfo("Carapace", 55, Rarity.COMMON, mage.cards.c.Carapace.class)); From 9c53125ad8903994385ba0e8fb1cad70f37df6fa Mon Sep 17 00:00:00 2001 From: Zzooouhh Date: Fri, 22 Sep 2017 20:38:26 +0200 Subject: [PATCH 20/29] Implemented Wall of Junk --- Mage.Sets/src/mage/sets/UrzasSaga.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Mage.Sets/src/mage/sets/UrzasSaga.java b/Mage.Sets/src/mage/sets/UrzasSaga.java index 5f2187a3c7..e883a0b76b 100644 --- a/Mage.Sets/src/mage/sets/UrzasSaga.java +++ b/Mage.Sets/src/mage/sets/UrzasSaga.java @@ -150,7 +150,7 @@ public class UrzasSaga extends ExpansionSet { cards.add(new SetCardInfo("Fertile Ground", 252, Rarity.COMMON, mage.cards.f.FertileGround.class)); cards.add(new SetCardInfo("Fiery Mantle", 186, Rarity.COMMON, mage.cards.f.FieryMantle.class)); cards.add(new SetCardInfo("Fire Ants", 187, Rarity.UNCOMMON, mage.cards.f.FireAnts.class)); - cards.add(new SetCardInfo("Flesh Reaver", 136, Rarity.UNCOMMON, mage.cards.f.FleshReaver.class)); + cards.add(new SetCardInfo("Flesh Reaver", 136, Rarity.UNCOMMON, mage.cards.f.FleshReaver.class)); cards.add(new SetCardInfo("Fluctuator", 295, Rarity.RARE, mage.cards.f.Fluctuator.class)); cards.add(new SetCardInfo("Fog Bank", 75, Rarity.UNCOMMON, mage.cards.f.FogBank.class)); cards.add(new SetCardInfo("Forest", 347, Rarity.LAND, mage.cards.basiclands.Forest.class, NON_FULL_USE_VARIOUS)); @@ -264,7 +264,7 @@ public class UrzasSaga extends ExpansionSet { cards.add(new SetCardInfo("Redeem", 33, Rarity.UNCOMMON, mage.cards.r.Redeem.class)); cards.add(new SetCardInfo("Reflexes", 208, Rarity.COMMON, mage.cards.r.Reflexes.class)); cards.add(new SetCardInfo("Rejuvenate", 271, Rarity.COMMON, mage.cards.r.Rejuvenate.class)); - cards.add(new SetCardInfo("Remembrance", 34, Rarity.RARE, mage.cards.r.Remembrance.class)); + cards.add(new SetCardInfo("Remembrance", 34, Rarity.RARE, mage.cards.r.Remembrance.class)); cards.add(new SetCardInfo("Remote Isle", 324, Rarity.COMMON, mage.cards.r.RemoteIsle.class)); cards.add(new SetCardInfo("Reprocess", 154, Rarity.RARE, mage.cards.r.Reprocess.class)); cards.add(new SetCardInfo("Rescind", 92, Rarity.COMMON, mage.cards.r.Rescind.class)); @@ -306,7 +306,7 @@ public class UrzasSaga extends ExpansionSet { cards.add(new SetCardInfo("Smokestack", 309, Rarity.RARE, mage.cards.s.Smokestack.class)); cards.add(new SetCardInfo("Smoldering Crater", 328, Rarity.COMMON, mage.cards.s.SmolderingCrater.class)); cards.add(new SetCardInfo("Sneak Attack", 218, Rarity.RARE, mage.cards.s.SneakAttack.class)); - cards.add(new SetCardInfo("Somnophore", 97, Rarity.RARE, mage.cards.s.Somnophore.class)); + cards.add(new SetCardInfo("Somnophore", 97, Rarity.RARE, mage.cards.s.Somnophore.class)); cards.add(new SetCardInfo("Spined Fluke", 160, Rarity.UNCOMMON, mage.cards.s.SpinedFluke.class)); cards.add(new SetCardInfo("Spire Owl", 98, Rarity.COMMON, mage.cards.s.SpireOwl.class)); cards.add(new SetCardInfo("Spreading Algae", 274, Rarity.UNCOMMON, mage.cards.s.SpreadingAlgae.class)); @@ -349,6 +349,7 @@ public class UrzasSaga extends ExpansionSet { cards.add(new SetCardInfo("Voice of Law", 55, Rarity.UNCOMMON, mage.cards.v.VoiceOfLaw.class)); cards.add(new SetCardInfo("Voltaic Key", 314, Rarity.UNCOMMON, mage.cards.v.VoltaicKey.class)); cards.add(new SetCardInfo("Vug Lizard", 227, Rarity.UNCOMMON, mage.cards.v.VugLizard.class)); + cards.add(new SetCardInfo("Wall of Junk", 315, Rarity.UNCOMMON, mage.cards.w.WallOfJunk.class)); cards.add(new SetCardInfo("Western Paladin", 168, Rarity.RARE, mage.cards.w.WesternPaladin.class)); cards.add(new SetCardInfo("Whetstone", 316, Rarity.RARE, mage.cards.w.Whetstone.class)); cards.add(new SetCardInfo("Whirlwind", 283, Rarity.RARE, mage.cards.w.Whirlwind.class)); From 1122e41557ee31ed063a22c25215de8773bd3b54 Mon Sep 17 00:00:00 2001 From: Zzooouhh Date: Fri, 22 Sep 2017 20:39:27 +0200 Subject: [PATCH 21/29] Added Nature's Wrath, Ritual of Subdual --- Mage.Sets/src/mage/sets/MastersEditionII.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Mage.Sets/src/mage/sets/MastersEditionII.java b/Mage.Sets/src/mage/sets/MastersEditionII.java index 78771bfe21..71ce4a93ba 100644 --- a/Mage.Sets/src/mage/sets/MastersEditionII.java +++ b/Mage.Sets/src/mage/sets/MastersEditionII.java @@ -69,7 +69,7 @@ public class MastersEditionII extends ExpansionSet { cards.add(new SetCardInfo("Adarkar Sentinel", 201, Rarity.COMMON, mage.cards.a.AdarkarSentinel.class)); cards.add(new SetCardInfo("Aeolipile", 202, Rarity.COMMON, mage.cards.a.Aeolipile.class)); cards.add(new SetCardInfo("Ambush Party", 115, Rarity.COMMON, mage.cards.a.AmbushParty.class)); - cards.add(new SetCardInfo("An-Zerrin Ruins", 117, Rarity.RARE, mage.cards.a.AnZerrinRuins.class)); + cards.add(new SetCardInfo("An-Zerrin Ruins", 117, Rarity.RARE, mage.cards.a.AnZerrinRuins.class)); cards.add(new SetCardInfo("Anarchy", 116, Rarity.RARE, mage.cards.a.Anarchy.class)); cards.add(new SetCardInfo("Angel of Fury", 2, Rarity.RARE, mage.cards.a.AngelOfFury.class)); cards.add(new SetCardInfo("Angel of Light", 3, Rarity.UNCOMMON, mage.cards.a.AngelOfLight.class)); @@ -78,7 +78,7 @@ public class MastersEditionII extends ExpansionSet { cards.add(new SetCardInfo("Armor Thrull", 77, Rarity.COMMON, ArmorThrull.class)); cards.add(new SetCardInfo("Aurochs", 153, Rarity.COMMON, mage.cards.a.Aurochs.class)); cards.add(new SetCardInfo("Aysen Bureaucrats", 6, Rarity.COMMON, mage.cards.a.AysenBureaucrats.class)); - cards.add(new SetCardInfo("Aysen Crusader", 7, Rarity.UNCOMMON, mage.cards.a.AysenCrusader.class)); + cards.add(new SetCardInfo("Aysen Crusader", 7, Rarity.UNCOMMON, mage.cards.a.AysenCrusader.class)); cards.add(new SetCardInfo("Badlands", 225, Rarity.RARE, mage.cards.b.Badlands.class)); cards.add(new SetCardInfo("Balduvian Conjurer", 40, Rarity.COMMON, mage.cards.b.BalduvianConjurer.class)); cards.add(new SetCardInfo("Balduvian Dead", 79, Rarity.UNCOMMON, mage.cards.b.BalduvianDead.class)); @@ -116,7 +116,7 @@ public class MastersEditionII extends ExpansionSet { cards.add(new SetCardInfo("Elvish Hunter", 157, Rarity.COMMON, ElvishHunter.class)); cards.add(new SetCardInfo("Elvish Ranger", 158, Rarity.COMMON, mage.cards.e.ElvishRanger.class)); cards.add(new SetCardInfo("Elvish Spirit Guide", 159, Rarity.UNCOMMON, mage.cards.e.ElvishSpiritGuide.class)); - cards.add(new SetCardInfo("Energy Storm", 11, Rarity.RARE, mage.cards.e.EnergyStorm.class)); + cards.add(new SetCardInfo("Energy Storm", 11, Rarity.RARE, mage.cards.e.EnergyStorm.class)); cards.add(new SetCardInfo("Enervate", 47, Rarity.COMMON, mage.cards.e.Enervate.class)); cards.add(new SetCardInfo("Errantry", 124, Rarity.COMMON, mage.cards.e.Errantry.class)); cards.add(new SetCardInfo("Farrel's Mantle", 13, Rarity.UNCOMMON, mage.cards.f.FarrelsMantle.class)); @@ -171,6 +171,7 @@ public class MastersEditionII extends ExpansionSet { cards.add(new SetCardInfo("Minion of Leshrac", 104, Rarity.RARE, mage.cards.m.MinionOfLeshrac.class)); cards.add(new SetCardInfo("Mudslide", 136, Rarity.RARE, mage.cards.m.Mudslide.class)); cards.add(new SetCardInfo("Narwhal", 57, Rarity.UNCOMMON, mage.cards.n.Narwhal.class)); + cards.add(new SetCardInfo("Nature's Wrath", 172, Rarity.RARE, mage.cards.n.NaturesWrath.class)); cards.add(new SetCardInfo("Necrite", 106, Rarity.COMMON, Necrite.class)); cards.add(new SetCardInfo("Necropotence", 107, Rarity.RARE, mage.cards.n.Necropotence.class)); cards.add(new SetCardInfo("Night Soil", 173, Rarity.UNCOMMON, NightSoil.class)); @@ -193,6 +194,7 @@ public class MastersEditionII extends ExpansionSet { cards.add(new SetCardInfo("Reinforcements", 28, Rarity.COMMON, mage.cards.r.Reinforcements.class)); cards.add(new SetCardInfo("Reprisal", 29, Rarity.COMMON, mage.cards.r.Reprisal.class)); cards.add(new SetCardInfo("Righteous Fury", 30, Rarity.RARE, mage.cards.r.RighteousFury.class)); + cards.add(new SetCardInfo("Ritual of Subdual", 174, Rarity.RARE, mage.cards.r.RitualOfSubdual.class)); cards.add(new SetCardInfo("Ritual of the Machine", 109, Rarity.RARE, mage.cards.r.RitualOfTheMachine.class)); cards.add(new SetCardInfo("Roterothopter", 218, Rarity.COMMON, mage.cards.r.Roterothopter.class)); cards.add(new SetCardInfo("Royal Trooper", 32, Rarity.COMMON, mage.cards.r.RoyalTrooper.class)); @@ -249,4 +251,4 @@ public class MastersEditionII extends ExpansionSet { cards.add(new SetCardInfo("Zuran Spellcaster", 76, Rarity.COMMON, mage.cards.z.ZuranSpellcaster.class)); } -} \ No newline at end of file +} From d6b529ca7fa7b82cf95519a0809bad1a57226407 Mon Sep 17 00:00:00 2001 From: Zzooouhh Date: Fri, 22 Sep 2017 20:40:14 +0200 Subject: [PATCH 22/29] Added Scarwood Bandits --- Mage.Sets/src/mage/sets/MastersEditionIV.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Mage.Sets/src/mage/sets/MastersEditionIV.java b/Mage.Sets/src/mage/sets/MastersEditionIV.java index 520f0dedb2..c6762b5653 100644 --- a/Mage.Sets/src/mage/sets/MastersEditionIV.java +++ b/Mage.Sets/src/mage/sets/MastersEditionIV.java @@ -224,6 +224,7 @@ public class MastersEditionIV extends ExpansionSet { cards.add(new SetCardInfo("Sandstorm", 164, Rarity.COMMON, mage.cards.s.Sandstorm.class)); cards.add(new SetCardInfo("Savannah", 250, Rarity.RARE, mage.cards.s.Savannah.class)); cards.add(new SetCardInfo("Savannah Lions", 24, Rarity.UNCOMMON, mage.cards.s.SavannahLions.class)); + cards.add(new SetCardInfo("Scarwood Bandits", 165, Rarity.RARE, mage.cards.s.ScarwoodBandits.class)); cards.add(new SetCardInfo("Scavenger Folk", 166, Rarity.COMMON, mage.cards.s.ScavengerFolk.class)); cards.add(new SetCardInfo("Scavenging Ghoul", 95, Rarity.UNCOMMON, mage.cards.s.ScavengingGhoul.class)); cards.add(new SetCardInfo("Scrubland", 251, Rarity.RARE, mage.cards.s.Scrubland.class)); @@ -277,7 +278,7 @@ public class MastersEditionIV extends ExpansionSet { cards.add(new SetCardInfo("Urza's Power Plant", 258, Rarity.LAND, mage.cards.u.UrzasPowerPlant.class)); cards.add(new SetCardInfo("Urza's Tower", 259, Rarity.LAND, mage.cards.u.UrzasTower.class)); 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("Vibrating Sphere", 238, Rarity.RARE, mage.cards.v.VibratingSphere.class)); cards.add(new SetCardInfo("Volcanic Island", 260, Rarity.RARE, mage.cards.v.VolcanicIsland.class)); cards.add(new SetCardInfo("War Mammoth", 172, Rarity.COMMON, mage.cards.w.WarMammoth.class)); cards.add(new SetCardInfo("Warp Artifact", 100, Rarity.COMMON, mage.cards.w.WarpArtifact.class)); @@ -296,4 +297,4 @@ public class MastersEditionIV extends ExpansionSet { cards.add(new SetCardInfo("Zombie Master", 105, Rarity.UNCOMMON, mage.cards.z.ZombieMaster.class)); } -} \ No newline at end of file +} From cca73f1dbc61703240d88085f21a0ae2372d935e Mon Sep 17 00:00:00 2001 From: Zzooouhh Date: Fri, 22 Sep 2017 20:42:28 +0200 Subject: [PATCH 23/29] Implemented Baki's Curse --- Mage.Sets/src/mage/cards/b/BakisCurse.java | 101 +++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/b/BakisCurse.java diff --git a/Mage.Sets/src/mage/cards/b/BakisCurse.java b/Mage.Sets/src/mage/cards/b/BakisCurse.java new file mode 100644 index 0000000000..0d42115ab5 --- /dev/null +++ b/Mage.Sets/src/mage/cards/b/BakisCurse.java @@ -0,0 +1,101 @@ +/* + * 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 LIAB8LE 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.b; + +import java.util.UUID; +import mage.abilities.Ability; +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.filter.FilterPermanent; +import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; + +/** + * + * @author L_J + */ +public class BakisCurse extends CardImpl { + + public BakisCurse(UUID ownerId, CardSetInfo setInfo) { + super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{2}{U}{U}"); + + // Baki's Curse deals 2 damage to each creature for each Aura attached to that creature. + this.getSpellAbility().addEffect(new BakisCurseEffect()); + } + + public BakisCurse(final BakisCurse card) { + super(card); + } + + @Override + public BakisCurse copy() { + return new BakisCurse(this); + } + + private static class BakisCurseEffect extends OneShotEffect { + + public BakisCurseEffect() { + super(Outcome.Detriment); + staticText = "Baki's Curse deals 2 damage to each creature for each Aura attached to that creature."; + } + + public BakisCurseEffect(final BakisCurseEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + + FilterPermanent filterEnchantments = new FilterPermanent(); + filterEnchantments.add(new CardTypePredicate(CardType.ENCHANTMENT)); + filterEnchantments.add(new SubtypePredicate(SubType.AURA)); + for (Permanent auraEnchantment : game.getBattlefield().getActivePermanents(filterEnchantments, source.getControllerId(), source.getSourceId(), game)) { + if (auraEnchantment.getAttachedTo() != null) { + Permanent attachedToCreature = game.getPermanent(auraEnchantment.getAttachedTo()); + if (attachedToCreature != null && attachedToCreature.isCreature()) { + attachedToCreature.damage(2, source.getId(), game, false, true); + game.informPlayers("2 damage assigned to " + attachedToCreature.getName() + " from Baki's Curse due to " + auraEnchantment.getName()); + } + } + } + return true; + } + + @Override + public BakisCurseEffect copy() { + return new BakisCurseEffect(this); + } + + } +} From c73cd1527c09582a74e81f4fb323d99f2b7118cb Mon Sep 17 00:00:00 2001 From: Zzooouhh Date: Fri, 22 Sep 2017 20:44:07 +0200 Subject: [PATCH 24/29] Implemented Wall of Junk --- Mage.Sets/src/mage/cards/w/WallOfJunk.java | 73 ++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/w/WallOfJunk.java diff --git a/Mage.Sets/src/mage/cards/w/WallOfJunk.java b/Mage.Sets/src/mage/cards/w/WallOfJunk.java new file mode 100644 index 0000000000..7aab73c462 --- /dev/null +++ b/Mage.Sets/src/mage/cards/w/WallOfJunk.java @@ -0,0 +1,73 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.cards.w; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.BlocksTriggeredAbility; +import mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect; +import mage.abilities.effects.common.ReturnToHandSourceEffect; +import mage.abilities.keyword.DefenderAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; + +/** + * + * @author L_J + */ +public class WallOfJunk extends CardImpl { + + public WallOfJunk(UUID ownerId, CardSetInfo setInfo) { + super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT,CardType.CREATURE},"{2}"); + this.subtype.add(SubType.WALL); + this.power = new MageInt(0); + this.toughness = new MageInt(7); + + // Defender (This creature can't attack.) + this.addAbility(DefenderAbility.getInstance()); + + // When Wall of Junk blocks, return it to its owner's hand at end of combat. + Effect effect = new CreateDelayedTriggeredAbilityEffect( + new AtTheEndOfCombatDelayedTriggeredAbility(new ReturnToHandSourceEffect(true))); + effect.setText("return it to its owner's hand at end of combat"); + this.addAbility(new BlocksTriggeredAbility(effect, false)); + } + + public WallOfJunk(final WallOfJunk card) { + super(card); + } + + @Override + public WallOfJunk copy() { + return new WallOfJunk(this); + } +} From 4285aced9783eed268a17d6c451eaef880fc06f9 Mon Sep 17 00:00:00 2001 From: JRHerlehy Date: Sat, 23 Sep 2017 02:36:51 -0700 Subject: [PATCH 25/29] Fix Old Growth Dryad Fix effect choice text and filter to Basic Lands --- Mage.Sets/src/mage/cards/o/OldGrowthDryads.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Mage.Sets/src/mage/cards/o/OldGrowthDryads.java b/Mage.Sets/src/mage/cards/o/OldGrowthDryads.java index 8f3438977c..a0dfc49a7d 100644 --- a/Mage.Sets/src/mage/cards/o/OldGrowthDryads.java +++ b/Mage.Sets/src/mage/cards/o/OldGrowthDryads.java @@ -30,6 +30,7 @@ package mage.cards.o; import java.util.HashSet; import java.util.Set; import java.util.UUID; + import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; @@ -38,10 +39,10 @@ import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.SubType; import mage.constants.Outcome; +import mage.constants.SubType; import mage.constants.Zone; -import mage.filter.common.FilterLandCard; +import mage.filter.common.FilterBasicLandCard; import mage.game.Game; import mage.players.Player; import mage.target.common.TargetCardInLibrary; @@ -94,8 +95,8 @@ class OldGrowthDryadsEffect extends OneShotEffect { Set playersThatSearched = new HashSet<>(1); for (UUID opponentId : game.getOpponents(source.getControllerId())) { Player opponent = game.getPlayer(opponentId); - if (opponent != null && opponent.chooseUse(Outcome.PutCreatureInPlay, "Search your library for a creature card and put it onto the battlefield?", source, game)) { - TargetCardInLibrary target = new TargetCardInLibrary(new FilterLandCard()); + if (opponent != null && opponent.chooseUse(Outcome.PutLandInPlay, "Search your library for a basic land card and put it onto the battlefield tapped?", source, game)) { + TargetCardInLibrary target = new TargetCardInLibrary(new FilterBasicLandCard()); if (opponent.searchLibrary(target, game)) { Card targetCard = opponent.getLibrary().getCard(target.getFirstTarget(), game); if (targetCard != null) { From 0eb6a83c6dfec646e9fd3206382b17eba3b9259f Mon Sep 17 00:00:00 2001 From: Zzooouhh Date: Sat, 23 Sep 2017 18:15:36 +0200 Subject: [PATCH 26/29] Updated Baki's Curse damage processing --- Mage.Sets/src/mage/cards/b/BakisCurse.java | 53 ++++++++++------------ 1 file changed, 25 insertions(+), 28 deletions(-) diff --git a/Mage.Sets/src/mage/cards/b/BakisCurse.java b/Mage.Sets/src/mage/cards/b/BakisCurse.java index 0d42115ab5..d550b757ee 100644 --- a/Mage.Sets/src/mage/cards/b/BakisCurse.java +++ b/Mage.Sets/src/mage/cards/b/BakisCurse.java @@ -27,6 +27,7 @@ */ package mage.cards.b; +import java.util.List; import java.util.UUID; import mage.abilities.Ability; import mage.abilities.effects.OneShotEffect; @@ -35,11 +36,10 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Outcome; import mage.constants.SubType; -import mage.filter.FilterPermanent; -import mage.filter.predicate.mageobject.CardTypePredicate; -import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.filter.common.FilterCreaturePermanent; import mage.game.Game; import mage.game.permanent.Permanent; +import mage.players.Player; /** * @@ -62,40 +62,37 @@ public class BakisCurse extends CardImpl { public BakisCurse copy() { return new BakisCurse(this); } +} - private static class BakisCurseEffect extends OneShotEffect { - +class BakisCurseEffect extends OneShotEffect { + public BakisCurseEffect() { super(Outcome.Detriment); staticText = "Baki's Curse deals 2 damage to each creature for each Aura attached to that creature."; - } + } - public BakisCurseEffect(final BakisCurseEffect effect) { - super(effect); - } + public BakisCurseEffect(final BakisCurseEffect effect) { + super(effect); + } - @Override - public boolean apply(Game game, Ability source) { + @Override + public BakisCurseEffect copy() { + return new BakisCurseEffect(this); + } - FilterPermanent filterEnchantments = new FilterPermanent(); - filterEnchantments.add(new CardTypePredicate(CardType.ENCHANTMENT)); - filterEnchantments.add(new SubtypePredicate(SubType.AURA)); - for (Permanent auraEnchantment : game.getBattlefield().getActivePermanents(filterEnchantments, source.getControllerId(), source.getSourceId(), game)) { - if (auraEnchantment.getAttachedTo() != null) { - Permanent attachedToCreature = game.getPermanent(auraEnchantment.getAttachedTo()); - if (attachedToCreature != null && attachedToCreature.isCreature()) { - attachedToCreature.damage(2, source.getId(), game, false, true); - game.informPlayers("2 damage assigned to " + attachedToCreature.getName() + " from Baki's Curse due to " + auraEnchantment.getName()); - } + @Override + public boolean apply(Game game, Ability source) { + for (Permanent creature : game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), source.getSourceId(), game)) { + int count = 0; + List attachments = creature.getAttachments(); + for (UUID attachmentId : attachments) { + Permanent attached = game.getPermanent(attachmentId); + if (attached != null && attached.getSubtype(game).contains(SubType.AURA)) { + count++; } } - return true; + creature.damage(count * 2, source.getId(), game, false, true); } - - @Override - public BakisCurseEffect copy() { - return new BakisCurseEffect(this); - } - + return true; } } From 4b71be6e32ebe716a84154914f26f580d5e76253 Mon Sep 17 00:00:00 2001 From: Zzooouhh Date: Sat, 23 Sep 2017 18:16:58 +0200 Subject: [PATCH 27/29] Implemented Tidal Control --- Mage.Sets/src/mage/sets/Alliances.java | 1 + 1 file changed, 1 insertion(+) diff --git a/Mage.Sets/src/mage/sets/Alliances.java b/Mage.Sets/src/mage/sets/Alliances.java index c5afbbb3c2..36e2192a5f 100644 --- a/Mage.Sets/src/mage/sets/Alliances.java +++ b/Mage.Sets/src/mage/sets/Alliances.java @@ -143,6 +143,7 @@ public class Alliances extends ExpansionSet { cards.add(new SetCardInfo("Swamp Mosquito", 31, Rarity.COMMON, SwampMosquito.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Thawing Glaciers", 189, Rarity.RARE, mage.cards.t.ThawingGlaciers.class)); cards.add(new SetCardInfo("Thought Lash", 58, Rarity.RARE, mage.cards.t.ThoughtLash.class)); + cards.add(new SetCardInfo("Tidal Control", 59, Rarity.RARE, mage.cards.t.TidalControl.class)); cards.add(new SetCardInfo("Tornado", 86, Rarity.RARE, mage.cards.t.Tornado.class)); cards.add(new SetCardInfo("Unlikely Alliance", 153, Rarity.UNCOMMON, mage.cards.u.UnlikelyAlliance.class)); cards.add(new SetCardInfo("Varchild's War-Riders", 122, Rarity.RARE, mage.cards.v.VarchildsWarRiders.class)); From 0474a5e407dc469fe2546ba60a122ff73198b253 Mon Sep 17 00:00:00 2001 From: Zzooouhh Date: Sat, 23 Sep 2017 18:17:51 +0200 Subject: [PATCH 28/29] Implemented Tidal Control --- Mage.Sets/src/mage/cards/t/TidalControl.java | 84 ++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/t/TidalControl.java diff --git a/Mage.Sets/src/mage/cards/t/TidalControl.java b/Mage.Sets/src/mage/cards/t/TidalControl.java new file mode 100644 index 0000000000..a6d02a23fa --- /dev/null +++ b/Mage.Sets/src/mage/cards/t/TidalControl.java @@ -0,0 +1,84 @@ +/* + * 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.ObjectColor; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.Cost; +import mage.abilities.costs.CostImpl; +import mage.abilities.costs.common.PayLifeCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.costs.OrCost; +import mage.abilities.effects.common.CounterTargetEffect; +import mage.abilities.effects.common.InfoEffect; +import mage.abilities.keyword.CumulativeUpkeepAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.TargetController; +import mage.constants.Zone; +import mage.filter.FilterSpell; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.ColorPredicate; +import mage.target.TargetSpell; + +/** + * + * @author L_J + */ +public class TidalControl extends CardImpl { + private static final FilterSpell filter = new FilterSpell("red or green spell"); + static{ + filter.add(Predicates.or(new ColorPredicate(ObjectColor.RED), new ColorPredicate(ObjectColor.GREEN))); + } + + public TidalControl(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{U}{U}"); + + // Cumulative upkeep-Pay {2}. + this.addAbility(new CumulativeUpkeepAbility(new ManaCostsImpl("{2}"))); + + // Pay 2 life or {2}: Counter target red or green spell. Any player may activate this ability. + SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CounterTargetEffect(), new OrCost(new PayLifeCost(2), new ManaCostsImpl("{2}"), "pay 2 life or pay {2}")); + ability.addTarget(new TargetSpell(filter)); + ability.setMayActivate(TargetController.ANY); + ability.addEffect(new InfoEffect("Any player may activate this ability")); + this.addAbility(ability); + } + + public TidalControl(final TidalControl card) { + super(card); + } + + @Override + public TidalControl copy() { + return new TidalControl(this); + } +} From 0714ae39dcce18938319ab93feb779c08ee237a2 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Sat, 23 Sep 2017 19:16:21 +0200 Subject: [PATCH 29/29] * Hope of Ghirapur - Fixed a problem with check if current object has daone the damage. --- .../src/mage/cards/h/HopeOfGhirapur.java | 37 ++++++++++++------- .../cards/single/aer/HopeOfGhirapurTest.java | 7 +++- .../java/mage/game/stack/StackAbility.java | 2 +- 3 files changed, 30 insertions(+), 16 deletions(-) diff --git a/Mage.Sets/src/mage/cards/h/HopeOfGhirapur.java b/Mage.Sets/src/mage/cards/h/HopeOfGhirapur.java index 7111d06e4d..9bfc1de65a 100644 --- a/Mage.Sets/src/mage/cards/h/HopeOfGhirapur.java +++ b/Mage.Sets/src/mage/cards/h/HopeOfGhirapur.java @@ -33,6 +33,7 @@ import java.util.Set; import java.util.UUID; import mage.MageInt; import mage.MageObject; +import mage.MageObjectReference; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.SacrificeSourceCost; @@ -49,6 +50,8 @@ import mage.game.Game; import mage.game.events.DamagedPlayerEvent; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; +import mage.game.stack.StackAbility; +import mage.game.stack.StackObject; import mage.players.Player; import mage.target.TargetPlayer; import mage.watchers.Watcher; @@ -115,7 +118,7 @@ class HopeOfGhirapurCantCastEffect extends ContinuousRuleModifyingEffectImpl { @Override public String getInfoMessage(Ability source, GameEvent event, Game game) { - MageObject mageObject = game.getObject(source.getSourceId()); + MageObject mageObject = source.getSourceObject(game); if (mageObject != null) { return "You can't cast noncreature spells this turn (you were dealt damage by " + mageObject.getLogName() + ')'; } @@ -153,7 +156,7 @@ class HopeOfGhirapurPlayerLostLifePredicate implements ObjectSourcePlayerPredica } HopeOfGhirapurCombatDamageWatcher watcher = (HopeOfGhirapurCombatDamageWatcher) game.getState().getWatchers().get(HopeOfGhirapurCombatDamageWatcher.class.getSimpleName()); if (watcher != null) { - return watcher.playerGotCombatDamage(input.getSourceId(), input.getObject().getId()); + return watcher.playerGotCombatDamage(input.getSourceId(), input.getObject().getId(), game); } return false; } @@ -161,7 +164,7 @@ class HopeOfGhirapurPlayerLostLifePredicate implements ObjectSourcePlayerPredica class HopeOfGhirapurCombatDamageWatcher extends Watcher { - private final HashMap> combatDamagedPlayers = new HashMap<>(); + private final HashMap> combatDamagedPlayers = new HashMap<>(); public HopeOfGhirapurCombatDamageWatcher() { super(HopeOfGhirapurCombatDamageWatcher.class.getSimpleName(), WatcherScope.GAME); @@ -169,10 +172,10 @@ class HopeOfGhirapurCombatDamageWatcher extends Watcher { public HopeOfGhirapurCombatDamageWatcher(final HopeOfGhirapurCombatDamageWatcher watcher) { super(watcher); - for (UUID damagerId : watcher.combatDamagedPlayers.keySet()) { + for (MageObjectReference damager : watcher.combatDamagedPlayers.keySet()) { Set players = new HashSet<>(); - players.addAll(watcher.combatDamagedPlayers.get(damagerId)); - this.combatDamagedPlayers.put(damagerId, players); + players.addAll(watcher.combatDamagedPlayers.get(damager)); + this.combatDamagedPlayers.put(damager, players); } } @@ -184,13 +187,13 @@ class HopeOfGhirapurCombatDamageWatcher extends Watcher { @Override public void watch(GameEvent event, Game game) { if (event.getType() == EventType.DAMAGED_PLAYER && ((DamagedPlayerEvent) event).isCombatDamage()) { - UUID damagerId = event.getSourceId(); + MageObjectReference damager = new MageObjectReference(event.getSourceId(), game); Set players; - if (combatDamagedPlayers.containsKey(damagerId)) { - players = combatDamagedPlayers.get(damagerId); + if (combatDamagedPlayers.containsKey(damager)) { + players = combatDamagedPlayers.get(damager); } else { players = new HashSet<>(); - combatDamagedPlayers.put(damagerId, players); + combatDamagedPlayers.put(damager, players); } players.add(event.getTargetId()); } @@ -204,9 +207,17 @@ class HopeOfGhirapurCombatDamageWatcher extends Watcher { * @param playerId * @return */ - public boolean playerGotCombatDamage(UUID objectId, UUID playerId) { - if (combatDamagedPlayers.containsKey(objectId)) { - return combatDamagedPlayers.get(objectId).contains(playerId); + public boolean playerGotCombatDamage(UUID objectId, UUID playerId, Game game) { + StackObject stackObject = game.getState().getStack().getStackObject(objectId); + MageObjectReference mor; + if (stackObject != null && stackObject instanceof StackAbility) { + // This is neccessary because the source object was sacrificed as cost and the correct zone change counter for target calid check can only be get from stack + mor = new MageObjectReference(objectId, ((StackAbility) stackObject).getSourceObjectZoneChangeCounter(), game); + } else { + mor = new MageObjectReference(objectId, game); + } + if (combatDamagedPlayers.containsKey(mor)) { + return combatDamagedPlayers.get(mor).contains(playerId); } return false; } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/aer/HopeOfGhirapurTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/aer/HopeOfGhirapurTest.java index b0340abb5b..df838afba5 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/single/aer/HopeOfGhirapurTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/aer/HopeOfGhirapurTest.java @@ -35,16 +35,19 @@ public class HopeOfGhirapurTest extends CardTestPlayerBase { // from the battlefield and returned back. @Test public void testWhenHopeOfGhirapurWasRemovedAndReturnedBack() { + // Flying + // Sacrifice Hope of Ghirapur: Until your next turn, target player who was dealt combat damage by Hope of Ghirapur this turn can't cast noncreature spells. addCard(Zone.BATTLEFIELD, playerA, "Hope of Ghirapur"); addCard(Zone.BATTLEFIELD, playerA, "Plains", 1); + // Exile target creature you control, then return that card to the battlefield under your control. addCard(Zone.HAND, playerA, "Cloudshift"); addCard(Zone.BATTLEFIELD, playerB, "Mountain", 1); addCard(Zone.HAND, playerB, "Shock"); attack(1, playerA, "Hope of Ghirapur"); - castSpell(1, PhaseStep.END_COMBAT, playerA, "Cloudshift", "Hope of Ghirapur"); - activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Sacrifice", playerB); + castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Cloudshift", "Hope of Ghirapur"); + activateAbility(1, PhaseStep.END_TURN, playerA, "Sacrifice", playerB); castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Shock", playerA); diff --git a/Mage/src/main/java/mage/game/stack/StackAbility.java b/Mage/src/main/java/mage/game/stack/StackAbility.java index 8af807bf2d..0121d4d4d6 100644 --- a/Mage/src/main/java/mage/game/stack/StackAbility.java +++ b/Mage/src/main/java/mage/game/stack/StackAbility.java @@ -537,7 +537,7 @@ public class StackAbility extends StackObjImpl implements Ability { @Override public int getSourceObjectZoneChangeCounter() { - throw new UnsupportedOperationException("Not supported."); + return ability.getSourceObjectZoneChangeCounter(); } @Override