From df07c7fa0c0f6a6d4809f83b0453bb594ea9873e Mon Sep 17 00:00:00 2001 From: Christian Date: Sat, 12 Aug 2017 20:54:53 -0400 Subject: [PATCH 01/13] Created Kindred Dominance --- .../src/mage/cards/k/KindredDominance.java | 112 ++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/k/KindredDominance.java diff --git a/Mage.Sets/src/mage/cards/k/KindredDominance.java b/Mage.Sets/src/mage/cards/k/KindredDominance.java new file mode 100644 index 00000000000..ffe3feb76b6 --- /dev/null +++ b/Mage.Sets/src/mage/cards/k/KindredDominance.java @@ -0,0 +1,112 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.cards.k; + +import java.util.UUID; + +import mage.MageObject; +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.DestroyAllEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.choices.Choice; +import mage.choices.ChoiceCreatureType; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.game.Game; +import mage.players.Player; + +/** + * + * @author caldover + */ +public class KindredDominance extends CardImpl { + + public KindredDominance(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{5}{B}{B}"); + + // Choose a creature type. Destroy all creatures that are not the chosen type. + this.getSpellAbility().addEffect(new KindredDominanceEffect()); + } + + public KindredDominance(final KindredDominance card) { + super(card); + } + + @Override + public KindredDominance copy() { + return new KindredDominance(this); + } +} + +class KindredDominanceEffect extends OneShotEffect { + + public KindredDominanceEffect() { + super(Outcome.DestroyPermanent); + this.staticText = "Choose a creature type. Destroy all creatures that are not the chosen type."; + } + + public KindredDominanceEffect(final KindredDominanceEffect effect) { + super(effect); + } + + @Override + public KindredDominanceEffect copy() { + return new KindredDominanceEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + MageObject sourceObject = game.getObject(source.getSourceId()); + if (controller != null) { + Choice typeChoice = new ChoiceCreatureType(); + while (!controller.choose(outcome, typeChoice, game)) { + if (!controller.canRespond()) { + return false; + } + } + if (typeChoice.getChoice() != null) { + game.informPlayers(sourceObject.getLogName() + " chosen type: " + typeChoice.getChoice()); + } + + FilterPermanent filter = new FilterCreaturePermanent("creatures"); + + filter.add(Predicates.not(new SubtypePredicate(SubType.byDescription(typeChoice.getChoice())))); + + return new DestroyAllEffect(filter).apply(game, source); + } + return false; + } +} \ No newline at end of file From 478a0b8ea8692bae6d0064c22b87a3e68c46433e Mon Sep 17 00:00:00 2001 From: "Saga\\Robert" Date: Sun, 13 Aug 2017 17:52:48 +0200 Subject: [PATCH 02/13] - updated available set info of Zombie and Gold tokens - added Curse of Vitality - added Curse of Verbosity - added Curse of Disturbance - added Curse of Opulence - added Curse of Bounty - added Curse cycle to C17 --- Mage.Sets/src/mage/cards/c/CurseOfBounty.java | 154 ++++++++++++++++++ .../src/mage/cards/c/CurseOfDisturbance.java | 123 ++++++++++++++ .../src/mage/cards/c/CurseOfOpulence.java | 125 ++++++++++++++ .../src/mage/cards/c/CurseOfVerbosity.java | 122 ++++++++++++++ .../src/mage/cards/c/CurseOfVitality.java | 122 ++++++++++++++ Mage.Sets/src/mage/sets/Commander2017.java | 5 + .../mage/game/permanent/token/GoldToken.java | 19 ++- .../game/permanent/token/ZombieToken.java | 2 +- 8 files changed, 670 insertions(+), 2 deletions(-) create mode 100644 Mage.Sets/src/mage/cards/c/CurseOfBounty.java create mode 100644 Mage.Sets/src/mage/cards/c/CurseOfDisturbance.java create mode 100644 Mage.Sets/src/mage/cards/c/CurseOfOpulence.java create mode 100644 Mage.Sets/src/mage/cards/c/CurseOfVerbosity.java create mode 100644 Mage.Sets/src/mage/cards/c/CurseOfVitality.java diff --git a/Mage.Sets/src/mage/cards/c/CurseOfBounty.java b/Mage.Sets/src/mage/cards/c/CurseOfBounty.java new file mode 100644 index 00000000000..f6a84cc261b --- /dev/null +++ b/Mage.Sets/src/mage/cards/c/CurseOfBounty.java @@ -0,0 +1,154 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.cards.c; + +import mage.abilities.Ability; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.keyword.EnchantAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; +import mage.game.permanent.Permanent; +import mage.target.TargetPlayer; +import mage.target.targetpointer.FixedTarget; +import java.util.UUID; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.UntapAllControllerEffect; +import mage.filter.common.FilterNonlandPermanent; +import mage.players.Player; + +/** + * + * @author Saga + */ +public class CurseOfBounty extends CardImpl { + + public CurseOfBounty(UUID ownerId, CardSetInfo setInfo) { + super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{1}{G}"); + this.subtype.add(SubType.AURA, SubType.CURSE); + + // Enchant player + TargetPlayer auraTarget = new TargetPlayer(); + this.getSpellAbility().addTarget(auraTarget); + this.getSpellAbility().addEffect(new AttachEffect(Outcome.Detriment)); + this.addAbility(new EnchantAbility(auraTarget.getTargetName())); + + // Whenever enchanted player is attacked, untap all nonland permanents you control. + // Each opponent attacking that player untaps all nonland permanents he or she controls. + Ability ability = new CurseOfBountyTriggeredAbility(); + ability.addEffect(new UntapAllControllerEffect(new FilterNonlandPermanent())); + this.addAbility(ability); + } + + public CurseOfBounty(final CurseOfBounty card) { + super(card); + } + + @Override + public CurseOfBounty copy() { + return new CurseOfBounty(this); + } +} + +class CurseOfBountyTriggeredAbility extends TriggeredAbilityImpl { + + public CurseOfBountyTriggeredAbility() { + super(Zone.BATTLEFIELD, new UntapAllNonlandsTargetEffect(), false); + } + + public CurseOfBountyTriggeredAbility(final CurseOfBountyTriggeredAbility ability) { + super(ability); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DECLARED_ATTACKERS; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + Permanent enchantment = game.getPermanent(this.getSourceId()); + if (enchantment != null + && enchantment.getAttachedTo() != null + && game.getCombat().getPlayerDefenders(game).contains(enchantment.getAttachedTo())) { + for (Effect effect: this.getEffects()) { + effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackerId())); + } + return true; + } + return false; + } + + @Override + public String getRule() { + return "Whenever enchanted player is attacked, untap all nonland permanents you control. " + + "Each opponent attacking that player untaps all nonland permanents he or she controls."; + } + + @Override + public CurseOfBountyTriggeredAbility copy() { + return new CurseOfBountyTriggeredAbility(this); + } +} + +class UntapAllNonlandsTargetEffect extends OneShotEffect { + + public UntapAllNonlandsTargetEffect() { + super(Outcome.Untap); + } + + public UntapAllNonlandsTargetEffect(final UntapAllNonlandsTargetEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(this.getTargetPointer().getFirst(game, source)); + if (player != null) { + for (Permanent nonland: game.getBattlefield().getAllActivePermanents(new FilterNonlandPermanent(), player.getId(), game)) { + nonland.untap(game); + } + return true; + } + return false; + } + + @Override + public UntapAllNonlandsTargetEffect copy() { + return new UntapAllNonlandsTargetEffect(this); + } + +} diff --git a/Mage.Sets/src/mage/cards/c/CurseOfDisturbance.java b/Mage.Sets/src/mage/cards/c/CurseOfDisturbance.java new file mode 100644 index 00000000000..11aac5aa0bd --- /dev/null +++ b/Mage.Sets/src/mage/cards/c/CurseOfDisturbance.java @@ -0,0 +1,123 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.cards.c; + +import mage.abilities.Ability; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.keyword.EnchantAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; +import mage.game.permanent.Permanent; +import mage.target.TargetPlayer; +import mage.target.targetpointer.FixedTarget; +import java.util.UUID; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.effects.common.CreateTokenTargetEffect; +import mage.game.permanent.token.ZombieToken; + +/** + * + * @author Saga + */ +public class CurseOfDisturbance extends CardImpl { + + public CurseOfDisturbance(UUID ownerId, CardSetInfo setInfo) { + super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{B}"); + this.subtype.add(SubType.AURA, SubType.CURSE); + + // Enchant player + TargetPlayer auraTarget = new TargetPlayer(); + this.getSpellAbility().addTarget(auraTarget); + this.getSpellAbility().addEffect(new AttachEffect(Outcome.Detriment)); + this.addAbility(new EnchantAbility(auraTarget.getTargetName())); + + // Whenever enchanted player is attacked, create a 2/2 black Zombie creature token. Each opponent attacking that player does the same. + Ability ability = new CurseOfDisturbanceTriggeredAbility(); + ability.addEffect(new CreateTokenEffect(new ZombieToken())); + this.addAbility(ability); + } + + public CurseOfDisturbance(final CurseOfDisturbance card) { + super(card); + } + + @Override + public CurseOfDisturbance copy() { + return new CurseOfDisturbance(this); + } +} + +class CurseOfDisturbanceTriggeredAbility extends TriggeredAbilityImpl { + + public CurseOfDisturbanceTriggeredAbility() { + super(Zone.BATTLEFIELD, new CreateTokenTargetEffect(new ZombieToken()), false); + } + + public CurseOfDisturbanceTriggeredAbility(final CurseOfDisturbanceTriggeredAbility ability) { + super(ability); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DECLARED_ATTACKERS; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + Permanent enchantment = game.getPermanent(this.getSourceId()); + if (enchantment != null + && enchantment.getAttachedTo() != null + && game.getCombat().getPlayerDefenders(game).contains(enchantment.getAttachedTo())) { + for (Effect effect: this.getEffects()) { + effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackerId())); + } + return true; + } + return false; + } + + @Override + public String getRule() { + return "Whenever enchanted player is attacked, create a 2/2 black Zombie creature token. Each opponent attacking that player does the same."; + } + + @Override + public CurseOfDisturbanceTriggeredAbility copy() { + return new CurseOfDisturbanceTriggeredAbility(this); + } + +} diff --git a/Mage.Sets/src/mage/cards/c/CurseOfOpulence.java b/Mage.Sets/src/mage/cards/c/CurseOfOpulence.java new file mode 100644 index 00000000000..e274b7c0daf --- /dev/null +++ b/Mage.Sets/src/mage/cards/c/CurseOfOpulence.java @@ -0,0 +1,125 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.cards.c; + +import mage.abilities.Ability; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.keyword.EnchantAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; +import mage.game.permanent.Permanent; +import mage.target.TargetPlayer; +import mage.target.targetpointer.FixedTarget; +import java.util.UUID; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.effects.common.CreateTokenTargetEffect; +import mage.game.permanent.token.GoldToken; + +/** + * + * @author Saga + */ +public class CurseOfOpulence extends CardImpl { + + public CurseOfOpulence(UUID ownerId, CardSetInfo setInfo) { + super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{R}"); + this.subtype.add(SubType.AURA, SubType.CURSE); + + // Enchant player + TargetPlayer auraTarget = new TargetPlayer(); + this.getSpellAbility().addTarget(auraTarget); + this.getSpellAbility().addEffect(new AttachEffect(Outcome.Detriment)); + this.addAbility(new EnchantAbility(auraTarget.getTargetName())); + + // Whenever enchanted player is attacked, create a colorless artifact token named Gold. + // It has "sacrifice this artifact: Add one mana of any color to your mana pool." Each opponent attacking that player does the same. + Ability ability = new CurseOfOpulenceTriggeredAbility(); + ability.addEffect(new CreateTokenEffect(new GoldToken())); + this.addAbility(ability); + } + + public CurseOfOpulence(final CurseOfOpulence card) { + super(card); + } + + @Override + public CurseOfOpulence copy() { + return new CurseOfOpulence(this); + } +} + +class CurseOfOpulenceTriggeredAbility extends TriggeredAbilityImpl { + + public CurseOfOpulenceTriggeredAbility() { + super(Zone.BATTLEFIELD, new CreateTokenTargetEffect(new GoldToken()), false); + } + + public CurseOfOpulenceTriggeredAbility(final CurseOfOpulenceTriggeredAbility ability) { + super(ability); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DECLARED_ATTACKERS; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + Permanent enchantment = game.getPermanent(this.getSourceId()); + if (enchantment != null + && enchantment.getAttachedTo() != null + && game.getCombat().getPlayerDefenders(game).contains(enchantment.getAttachedTo())) { + for (Effect effect: this.getEffects()) { + effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackerId())); + } + return true; + } + return false; + } + + @Override + public String getRule() { + return "Whenever enchanted player is attacked, create a colorless artifact token named Gold. " + + "It has \"sacrifice this artifact: Add one mana of any color to your mana pool.\" Each opponent attacking that player does the same."; + } + + @Override + public CurseOfOpulenceTriggeredAbility copy() { + return new CurseOfOpulenceTriggeredAbility(this); + } + +} diff --git a/Mage.Sets/src/mage/cards/c/CurseOfVerbosity.java b/Mage.Sets/src/mage/cards/c/CurseOfVerbosity.java new file mode 100644 index 00000000000..07f96e8cb74 --- /dev/null +++ b/Mage.Sets/src/mage/cards/c/CurseOfVerbosity.java @@ -0,0 +1,122 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.cards.c; + +import mage.abilities.Ability; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.keyword.EnchantAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; +import mage.game.permanent.Permanent; +import mage.target.TargetPlayer; +import mage.target.targetpointer.FixedTarget; +import java.util.UUID; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.abilities.effects.common.DrawCardTargetEffect; + +/** + * + * @author Saga + */ +public class CurseOfVerbosity extends CardImpl { + + public CurseOfVerbosity(UUID ownerId, CardSetInfo setInfo) { + super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{U}"); + this.subtype.add(SubType.AURA, SubType.CURSE); + + // Enchant player + TargetPlayer auraTarget = new TargetPlayer(); + this.getSpellAbility().addTarget(auraTarget); + this.getSpellAbility().addEffect(new AttachEffect(Outcome.Detriment)); + this.addAbility(new EnchantAbility(auraTarget.getTargetName())); + + // Whenever enchanted player is attacked, draw a card. Each opponent attacking that player does the same. + Ability ability = new CurseOfVerbosityTriggeredAbility(); + ability.addEffect(new DrawCardSourceControllerEffect(1)); + this.addAbility(ability); + } + + public CurseOfVerbosity(final CurseOfVerbosity card) { + super(card); + } + + @Override + public CurseOfVerbosity copy() { + return new CurseOfVerbosity(this); + } +} + +class CurseOfVerbosityTriggeredAbility extends TriggeredAbilityImpl { + + public CurseOfVerbosityTriggeredAbility() { + super(Zone.BATTLEFIELD, new DrawCardTargetEffect(1), false); + } + + public CurseOfVerbosityTriggeredAbility(final CurseOfVerbosityTriggeredAbility ability) { + super(ability); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DECLARED_ATTACKERS; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + Permanent enchantment = game.getPermanent(this.getSourceId()); + if (enchantment != null + && enchantment.getAttachedTo() != null + && game.getCombat().getPlayerDefenders(game).contains(enchantment.getAttachedTo())) { + for (Effect effect: this.getEffects()) { + effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackerId())); + } + return true; + } + return false; + } + + @Override + public String getRule() { + return "Whenever enchanted player is attacked, draw a card. Each opponent attacking that player does the same."; + } + + @Override + public CurseOfVerbosityTriggeredAbility copy() { + return new CurseOfVerbosityTriggeredAbility(this); + } + +} diff --git a/Mage.Sets/src/mage/cards/c/CurseOfVitality.java b/Mage.Sets/src/mage/cards/c/CurseOfVitality.java new file mode 100644 index 00000000000..224369cb423 --- /dev/null +++ b/Mage.Sets/src/mage/cards/c/CurseOfVitality.java @@ -0,0 +1,122 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.cards.c; + +import mage.abilities.Ability; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.keyword.EnchantAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; +import mage.game.permanent.Permanent; +import mage.target.TargetPlayer; +import mage.target.targetpointer.FixedTarget; +import java.util.UUID; +import mage.abilities.effects.common.GainLifeEffect; +import mage.abilities.effects.common.GainLifeTargetEffect; + +/** + * + * @author Saga + */ +public class CurseOfVitality extends CardImpl { + + public CurseOfVitality(UUID ownerId, CardSetInfo setInfo) { + super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{W}"); + this.subtype.add(SubType.AURA, SubType.CURSE); + + // Enchant player + TargetPlayer auraTarget = new TargetPlayer(); + this.getSpellAbility().addTarget(auraTarget); + this.getSpellAbility().addEffect(new AttachEffect(Outcome.Detriment)); + this.addAbility(new EnchantAbility(auraTarget.getTargetName())); + + // Whenever enchanted player is attacked, you gain 2 life. Each opponent attacking that player does the same. + Ability ability = new CurseOfVitalityTriggeredAbility(); + ability.addEffect(new GainLifeEffect(2)); + this.addAbility(ability); + } + + public CurseOfVitality(final CurseOfVitality card) { + super(card); + } + + @Override + public CurseOfVitality copy() { + return new CurseOfVitality(this); + } +} + +class CurseOfVitalityTriggeredAbility extends TriggeredAbilityImpl { + + public CurseOfVitalityTriggeredAbility() { + super(Zone.BATTLEFIELD, new GainLifeTargetEffect(2), false); + } + + public CurseOfVitalityTriggeredAbility(final CurseOfVitalityTriggeredAbility ability) { + super(ability); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DECLARED_ATTACKERS; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + Permanent enchantment = game.getPermanent(this.getSourceId()); + if (enchantment != null + && enchantment.getAttachedTo() != null + && game.getCombat().getPlayerDefenders(game).contains(enchantment.getAttachedTo())) { + for (Effect effect: this.getEffects()) { + effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackerId())); + } + return true; + } + return false; + } + + @Override + public String getRule() { + return "Whenever enchanted player is attacked, you gain 2 life. Each opponent attacking that player does the same."; + } + + @Override + public CurseOfVitalityTriggeredAbility copy() { + return new CurseOfVitalityTriggeredAbility(this); + } + +} diff --git a/Mage.Sets/src/mage/sets/Commander2017.java b/Mage.Sets/src/mage/sets/Commander2017.java index 021faa8f64d..ccd8e5d2fa2 100644 --- a/Mage.Sets/src/mage/sets/Commander2017.java +++ b/Mage.Sets/src/mage/sets/Commander2017.java @@ -49,6 +49,11 @@ public class Commander2017 extends ExpansionSet { cards.add(new SetCardInfo("Balan, Wandering Knight", 2, Rarity.RARE, mage.cards.b.BalanWanderingKnight.class)); cards.add(new SetCardInfo("Bloodsworn Steward", 22, Rarity.RARE, mage.cards.b.BloodswornSteward.class)); + cards.add(new SetCardInfo("Curse of Bounty", 30, Rarity.UNCOMMON, mage.cards.c.CurseOfBounty.class)); + cards.add(new SetCardInfo("Curse of Disturbance", 16, Rarity.UNCOMMON, mage.cards.c.CurseOfDisturbance.class)); + cards.add(new SetCardInfo("Curse of Opulence", 24, Rarity.UNCOMMON, mage.cards.c.CurseOfOpulence.class)); + cards.add(new SetCardInfo("Curse of Verbosity", 9, Rarity.UNCOMMON, mage.cards.c.CurseOfVerbosity.class)); + cards.add(new SetCardInfo("Curse of Vitality", 3, Rarity.UNCOMMON, mage.cards.c.CurseOfVitality.class)); cards.add(new SetCardInfo("Herald's Horn", 53, Rarity.UNCOMMON, mage.cards.h.HeraldsHorn.class)); cards.add(new SetCardInfo("Hungry Lynx", 31, Rarity.RARE, mage.cards.h.HungryLynx.class)); cards.add(new SetCardInfo("Nazahn, Revered Bladesmith", 44, Rarity.MYTHIC, mage.cards.n.NazahnReveredBladesmith.class)); diff --git a/Mage/src/main/java/mage/game/permanent/token/GoldToken.java b/Mage/src/main/java/mage/game/permanent/token/GoldToken.java index a2bd1071ff5..657b28030d2 100644 --- a/Mage/src/main/java/mage/game/permanent/token/GoldToken.java +++ b/Mage/src/main/java/mage/game/permanent/token/GoldToken.java @@ -28,6 +28,9 @@ package mage.game.permanent.token; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; import mage.abilities.costs.common.SacrificeSourceCost; import mage.abilities.effects.common.AddManaOfAnyColorEffect; import mage.abilities.mana.SimpleManaAbility; @@ -39,10 +42,24 @@ import mage.constants.Zone; * @author LevelX2 */ public class GoldToken extends Token { + + final static private List tokenImageSets = new ArrayList<>(); + static { + tokenImageSets.addAll(Arrays.asList("BNG", "C17")); + } public GoldToken() { + this(null, 0); + } + + public GoldToken(String setCode) { + this(setCode, 0); + } + + public GoldToken(String setCode, int tokenType) { super("Gold", "colorless artifact token named Gold onto the battlefield. It has \"Sacrifice this artifact: Add one mana of any color to your mana pool.\""); - this.setOriginalExpansionSetCode("BNG"); + availableImageSetCodes = tokenImageSets; + setOriginalExpansionSetCode(setCode); cardType.add(CardType.ARTIFACT); this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new AddManaOfAnyColorEffect(), new SacrificeSourceCost())); diff --git a/Mage/src/main/java/mage/game/permanent/token/ZombieToken.java b/Mage/src/main/java/mage/game/permanent/token/ZombieToken.java index c1b13d00144..e3aea20a7a5 100644 --- a/Mage/src/main/java/mage/game/permanent/token/ZombieToken.java +++ b/Mage/src/main/java/mage/game/permanent/token/ZombieToken.java @@ -44,7 +44,7 @@ public class ZombieToken extends Token { final static private List tokenImageSets = new ArrayList<>(); static { - tokenImageSets.addAll(Arrays.asList("10E", "M10", "M11", "M12", "M13", "M14", "M15", "MBS", "ALA", "ISD", "C14", "C15", "C16", "CNS", + tokenImageSets.addAll(Arrays.asList("10E", "M10", "M11", "M12", "M13", "M14", "M15", "MBS", "ALA", "ISD", "C14", "C15", "C16", "C17", "CNS", "MMA", "BNG", "KTK", "DTK", "ORI", "OGW", "SOI", "EMN", "EMA", "MM3", "AKH", "CMA", "E01")); } From e0bbe2da7e4dc3730206a7ac255ea83ccb7f1b78 Mon Sep 17 00:00:00 2001 From: "Saga\\Robert" Date: Sun, 13 Aug 2017 20:19:33 +0200 Subject: [PATCH 03/13] - fixed it so controller doesn't get benefit twice if attacking --- Mage.Sets/src/mage/cards/c/CurseOfBounty.java | 7 +++++-- Mage.Sets/src/mage/cards/c/CurseOfDisturbance.java | 7 +++++-- Mage.Sets/src/mage/cards/c/CurseOfOpulence.java | 7 +++++-- Mage.Sets/src/mage/cards/c/CurseOfVerbosity.java | 7 +++++-- Mage.Sets/src/mage/cards/c/CurseOfVitality.java | 7 +++++-- 5 files changed, 25 insertions(+), 10 deletions(-) diff --git a/Mage.Sets/src/mage/cards/c/CurseOfBounty.java b/Mage.Sets/src/mage/cards/c/CurseOfBounty.java index f6a84cc261b..b3bd01a2a2e 100644 --- a/Mage.Sets/src/mage/cards/c/CurseOfBounty.java +++ b/Mage.Sets/src/mage/cards/c/CurseOfBounty.java @@ -101,11 +101,14 @@ class CurseOfBountyTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { Permanent enchantment = game.getPermanent(this.getSourceId()); + UUID controller = this.getControllerId(); if (enchantment != null && enchantment.getAttachedTo() != null && game.getCombat().getPlayerDefenders(game).contains(enchantment.getAttachedTo())) { - for (Effect effect: this.getEffects()) { - effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackerId())); + if (game.getCombat().getAttackerId() != controller) { + for (Effect effect: this.getEffects()) { + effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackerId())); + } } return true; } diff --git a/Mage.Sets/src/mage/cards/c/CurseOfDisturbance.java b/Mage.Sets/src/mage/cards/c/CurseOfDisturbance.java index 11aac5aa0bd..1c85a3668de 100644 --- a/Mage.Sets/src/mage/cards/c/CurseOfDisturbance.java +++ b/Mage.Sets/src/mage/cards/c/CurseOfDisturbance.java @@ -99,11 +99,14 @@ class CurseOfDisturbanceTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { Permanent enchantment = game.getPermanent(this.getSourceId()); + UUID controller = this.getControllerId(); if (enchantment != null && enchantment.getAttachedTo() != null && game.getCombat().getPlayerDefenders(game).contains(enchantment.getAttachedTo())) { - for (Effect effect: this.getEffects()) { - effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackerId())); + if (game.getCombat().getAttackerId() != controller) { + for (Effect effect: this.getEffects()) { + effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackerId())); + } } return true; } diff --git a/Mage.Sets/src/mage/cards/c/CurseOfOpulence.java b/Mage.Sets/src/mage/cards/c/CurseOfOpulence.java index e274b7c0daf..a345e57f701 100644 --- a/Mage.Sets/src/mage/cards/c/CurseOfOpulence.java +++ b/Mage.Sets/src/mage/cards/c/CurseOfOpulence.java @@ -100,11 +100,14 @@ class CurseOfOpulenceTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { Permanent enchantment = game.getPermanent(this.getSourceId()); + UUID controller = this.getControllerId(); if (enchantment != null && enchantment.getAttachedTo() != null && game.getCombat().getPlayerDefenders(game).contains(enchantment.getAttachedTo())) { - for (Effect effect: this.getEffects()) { - effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackerId())); + if (game.getCombat().getAttackerId() != controller) { + for (Effect effect: this.getEffects()) { + effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackerId())); + } } return true; } diff --git a/Mage.Sets/src/mage/cards/c/CurseOfVerbosity.java b/Mage.Sets/src/mage/cards/c/CurseOfVerbosity.java index 07f96e8cb74..5f71051538f 100644 --- a/Mage.Sets/src/mage/cards/c/CurseOfVerbosity.java +++ b/Mage.Sets/src/mage/cards/c/CurseOfVerbosity.java @@ -98,11 +98,14 @@ class CurseOfVerbosityTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { Permanent enchantment = game.getPermanent(this.getSourceId()); + UUID controller = this.getControllerId(); if (enchantment != null && enchantment.getAttachedTo() != null && game.getCombat().getPlayerDefenders(game).contains(enchantment.getAttachedTo())) { - for (Effect effect: this.getEffects()) { - effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackerId())); + if (game.getCombat().getAttackerId() != controller) { + for (Effect effect: this.getEffects()) { + effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackerId())); + } } return true; } diff --git a/Mage.Sets/src/mage/cards/c/CurseOfVitality.java b/Mage.Sets/src/mage/cards/c/CurseOfVitality.java index 224369cb423..875f9a96725 100644 --- a/Mage.Sets/src/mage/cards/c/CurseOfVitality.java +++ b/Mage.Sets/src/mage/cards/c/CurseOfVitality.java @@ -98,11 +98,14 @@ class CurseOfVitalityTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { Permanent enchantment = game.getPermanent(this.getSourceId()); + UUID controller = this.getControllerId(); if (enchantment != null && enchantment.getAttachedTo() != null && game.getCombat().getPlayerDefenders(game).contains(enchantment.getAttachedTo())) { - for (Effect effect: this.getEffects()) { - effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackerId())); + if (game.getCombat().getAttackerId() != controller) { + for (Effect effect: this.getEffects()) { + effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackerId())); + } } return true; } From 8b427de2d35c80979301fc664aedac54832c04bb Mon Sep 17 00:00:00 2001 From: "Saga\\Robert" Date: Mon, 14 Aug 2017 15:15:36 +0200 Subject: [PATCH 04/13] - changed nonland filter to static filter --- Mage.Sets/src/mage/cards/c/CurseOfBounty.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Mage.Sets/src/mage/cards/c/CurseOfBounty.java b/Mage.Sets/src/mage/cards/c/CurseOfBounty.java index b3bd01a2a2e..afd5848c318 100644 --- a/Mage.Sets/src/mage/cards/c/CurseOfBounty.java +++ b/Mage.Sets/src/mage/cards/c/CurseOfBounty.java @@ -47,6 +47,7 @@ import mage.target.targetpointer.FixedTarget; import java.util.UUID; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.UntapAllControllerEffect; +import mage.filter.StaticFilters; import mage.filter.common.FilterNonlandPermanent; import mage.players.Player; @@ -141,7 +142,7 @@ class UntapAllNonlandsTargetEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player player = game.getPlayer(this.getTargetPointer().getFirst(game, source)); if (player != null) { - for (Permanent nonland: game.getBattlefield().getAllActivePermanents(new FilterNonlandPermanent(), player.getId(), game)) { + for (Permanent nonland: game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_NON_LAND, player.getId(), game)) { nonland.untap(game); } return true; From 62440463304d75e611cf48ddfa2c94c984c53fe3 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Mon, 14 Aug 2017 16:48:48 +0200 Subject: [PATCH 05/13] * Some minor changes. --- .../java/mage/server/game/GameController.java | 2 +- .../mage/cards/a/AbandonedSarcophagus.java | 6 +++--- .../src/mage/cards/a/AzoriusAEthermage.java | 2 +- Mage.Sets/src/mage/cards/m/MenacingOgre.java | 9 ++++----- .../mage/cards/p/PlaneswalkersMischief.java | 2 +- Mage.Sets/src/mage/cards/r/Reparations.java | 7 +++---- .../PlayerDiedStackTargetHandlingTest.java | 4 ++-- ...ttacksAndIsNotBlockedTriggeredAbility.java | 19 ++++++++----------- .../abilities/keyword/AftermathAbility.java | 2 +- 9 files changed, 24 insertions(+), 29 deletions(-) diff --git a/Mage.Server/src/main/java/mage/server/game/GameController.java b/Mage.Server/src/main/java/mage/server/game/GameController.java index 1787d6739ed..366404cff6a 100644 --- a/Mage.Server/src/main/java/mage/server/game/GameController.java +++ b/Mage.Server/src/main/java/mage/server/game/GameController.java @@ -613,7 +613,7 @@ public class GameController implements GameCallback { if (viewLimitedDeckPlayer != null) { if (viewLimitedDeckPlayer.isHuman()) { for (MatchPlayer p : TableManager.instance.getTable(tableId).getMatch().getPlayers()) { - if (p.getPlayer().getId() == userIdRequester) { + if (p.getPlayer().getId().equals(userIdRequester)) { Optional u = UserManager.instance.getUser(origId); if (u != null && u.isPresent() && p.getDeck() != null) { u.get().ccViewLimitedDeck(p.getDeck(), tableId, requestsOpen, true); diff --git a/Mage.Sets/src/mage/cards/a/AbandonedSarcophagus.java b/Mage.Sets/src/mage/cards/a/AbandonedSarcophagus.java index 6621fa8baa7..02b7df4f4e4 100644 --- a/Mage.Sets/src/mage/cards/a/AbandonedSarcophagus.java +++ b/Mage.Sets/src/mage/cards/a/AbandonedSarcophagus.java @@ -181,7 +181,7 @@ class AbandonedSarcophagusReplacementEffect extends ReplacementEffectImpl { Card card = game.getCard(event.getTargetId()); if (card != null && watcher != null - && card.getOwnerId() == controller.getId()) { + && card.getOwnerId().equals(controller.getId())) { for (Ability ability : card.getAbilities()) { if (ability instanceof CyclingAbility) { cardHasCycling = true; @@ -224,8 +224,8 @@ class AbandonedSarcophagusWatcher extends Watcher { Card card = game.getCard(event.getSourceId()); Player controller = game.getPlayer(event.getPlayerId()); if (card != null - && controller != null - && card.getOwnerId() == controller.getId()) { + && controller != null + && card.getOwnerId().equals(controller.getId())) { Cards c = getCardsCycledThisTurn(event.getPlayerId()); c.add(card); cycledCardsThisTurn.put(event.getPlayerId(), c); diff --git a/Mage.Sets/src/mage/cards/a/AzoriusAEthermage.java b/Mage.Sets/src/mage/cards/a/AzoriusAEthermage.java index 26737e39b83..61be2614cf0 100644 --- a/Mage.Sets/src/mage/cards/a/AzoriusAEthermage.java +++ b/Mage.Sets/src/mage/cards/a/AzoriusAEthermage.java @@ -115,7 +115,7 @@ class AzoriusAEthermageAbility extends TriggeredAbilityImpl { } if (permanentThatMoved != null && filter.match(permanentThatMoved, sourceId, controllerId, game) - && zEvent.getPlayerId() == controllerId) { //The controller's hand is where the permanent moved to. + && zEvent.getPlayerId().equals(controllerId)) { //The controller's hand is where the permanent moved to. return true; } } diff --git a/Mage.Sets/src/mage/cards/m/MenacingOgre.java b/Mage.Sets/src/mage/cards/m/MenacingOgre.java index 8b87182ea86..4997b1be685 100644 --- a/Mage.Sets/src/mage/cards/m/MenacingOgre.java +++ b/Mage.Sets/src/mage/cards/m/MenacingOgre.java @@ -27,6 +27,9 @@ */ package mage.cards.m; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; @@ -42,10 +45,6 @@ import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - /** * * @author jeffwadsworth @@ -123,7 +122,7 @@ class MenacingOgreEffect extends OneShotEffect { game.informPlayers(player.getLogName() + " chose number " + numberChosen.get(player)); if (numberChosen.get(player) >= highestNumber) { player.loseLife(highestNumber, game, false); - if (player.getId() == source.getControllerId() + if (player.getId().equals(source.getControllerId()) && menacingOgre != null) { menacingOgre.addCounters(CounterType.P1P1.createInstance(2), source, game); } diff --git a/Mage.Sets/src/mage/cards/p/PlaneswalkersMischief.java b/Mage.Sets/src/mage/cards/p/PlaneswalkersMischief.java index c148859118d..58c4e520882 100644 --- a/Mage.Sets/src/mage/cards/p/PlaneswalkersMischief.java +++ b/Mage.Sets/src/mage/cards/p/PlaneswalkersMischief.java @@ -183,7 +183,7 @@ class SpellWasNotCastCondition implements Condition { List spells = watcher.getSpellsCastThisTurn(source.getControllerId()); if (spells != null) { for (Spell spell : spells) { - if (spell.getSourceId() == cardId) { + if (spell.getSourceId().equals(cardId)) { return false; } } diff --git a/Mage.Sets/src/mage/cards/r/Reparations.java b/Mage.Sets/src/mage/cards/r/Reparations.java index d819dc92f25..6f3a66ee138 100644 --- a/Mage.Sets/src/mage/cards/r/Reparations.java +++ b/Mage.Sets/src/mage/cards/r/Reparations.java @@ -49,11 +49,10 @@ public class Reparations extends CardImpl { public Reparations(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}{U}"); - // Whenever an opponent casts a spell that targets you or a creature you control, you may draw a card. this.addAbility(new ReparationsTriggeredAbility()); - + } public Reparations(final Reparations card) { @@ -96,12 +95,12 @@ class ReparationsTriggeredAbility extends TriggeredAbilityImpl { Player targetPlayer = game.getPlayer(stackObject.getStackAbility().getFirstTarget()); Permanent targetPermanent = game.getPermanent(stackObject.getStackAbility().getFirstTarget()); if (targetPlayer != null - && targetPlayer.getId() == controllerId) { + && targetPlayer.getId().equals(controllerId)) { return true; } if (targetPermanent != null && targetPermanent.isCreature() - && targetPermanent.getControllerId() == controllerId) { + && targetPermanent.getControllerId().equals(controllerId)) { return true; } } diff --git a/Mage.Tests/src/test/java/org/mage/test/multiplayer/PlayerDiedStackTargetHandlingTest.java b/Mage.Tests/src/test/java/org/mage/test/multiplayer/PlayerDiedStackTargetHandlingTest.java index 8f240a2378e..00c796abcb0 100644 --- a/Mage.Tests/src/test/java/org/mage/test/multiplayer/PlayerDiedStackTargetHandlingTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/multiplayer/PlayerDiedStackTargetHandlingTest.java @@ -58,7 +58,7 @@ public class PlayerDiedStackTargetHandlingTest extends CardTestMultiPlayerBase { execute(); assertGraveyardCount(playerA, "Lightning Helix", 2); - Assert.assertTrue("Active player has to be player C", currentGame.getActivePlayerId() == playerC.getId()); + Assert.assertTrue("Active player has to be player C", currentGame.getActivePlayerId().equals(playerC.getId())); assertLife(playerA, 6); @@ -93,7 +93,7 @@ public class PlayerDiedStackTargetHandlingTest extends CardTestMultiPlayerBase { assertPermanentCount(playerA, "Silvercoat Lion", 2); assertGraveyardCount(playerA, "Tendrils of Agony", 1); - Assert.assertTrue("Active player has to be player C", currentGame.getActivePlayerId() == playerC.getId()); + Assert.assertTrue("Active player has to be player C", currentGame.getActivePlayerId().equals(playerC.getId())); assertLife(playerA, 7); diff --git a/Mage/src/main/java/mage/abilities/common/AttacksAndIsNotBlockedTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/AttacksAndIsNotBlockedTriggeredAbility.java index ba69791fe47..0998dd2a4cb 100644 --- a/Mage/src/main/java/mage/abilities/common/AttacksAndIsNotBlockedTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/common/AttacksAndIsNotBlockedTriggeredAbility.java @@ -25,7 +25,6 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of BetaSteward_at_googlemail.com. */ - package mage.abilities.common; import mage.abilities.TriggeredAbilityImpl; @@ -33,14 +32,14 @@ import mage.abilities.effects.Effect; import mage.constants.Zone; import mage.game.Game; import mage.game.combat.CombatGroup; -import mage.game.events.GameEvent.EventType; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.targetpointer.FixedTarget; public class AttacksAndIsNotBlockedTriggeredAbility extends TriggeredAbilityImpl { - private boolean setTargetPointer; + private final boolean setTargetPointer; public AttacksAndIsNotBlockedTriggeredAbility(Effect effect) { this(effect, false, false); @@ -72,14 +71,12 @@ public class AttacksAndIsNotBlockedTriggeredAbility extends TriggeredAbilityImpl @Override public boolean checkTrigger(GameEvent event, Game game) { - Permanent sourcePermanent = game.getPermanent(getSourceId()); - if(sourcePermanent.isAttacking()) { - for(CombatGroup combatGroup: game.getCombat().getGroups()) { - if(combatGroup.getBlockers().isEmpty() && combatGroup.getAttackers().contains(getSourceId())) { - if(setTargetPointer) { - for(Effect effect : this.getEffects()) { - effect.setTargetPointer(new FixedTarget(game.getCombat().getDefendingPlayerId(getSourceId(), game))); - } + Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(getSourceId()); + if (sourcePermanent != null && sourcePermanent.isAttacking()) { + for (CombatGroup combatGroup : game.getCombat().getGroups()) { + if (combatGroup.getBlockers().isEmpty() && combatGroup.getAttackers().contains(getSourceId())) { + if (setTargetPointer) { + this.getEffects().setTargetPointer(new FixedTarget(game.getCombat().getDefendingPlayerId(getSourceId(), game))); } return true; } diff --git a/Mage/src/main/java/mage/abilities/keyword/AftermathAbility.java b/Mage/src/main/java/mage/abilities/keyword/AftermathAbility.java index cd246dd20a8..64d8f1c0121 100644 --- a/Mage/src/main/java/mage/abilities/keyword/AftermathAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/AftermathAbility.java @@ -180,7 +180,7 @@ class AftermathExileAsResolvesFromGraveyard extends ReplacementEffectImpl { sourceId = sourceCard.getId(); } - if (event.getTargetId() == sourceId) { + if (event.getTargetId().equals(sourceId)) { // Moving this spell from stack to yard Spell spell = game.getStack().getSpell(source.getSourceId()); if (spell != null && spell.getFromZone() == Zone.GRAVEYARD) { From 41eff642baadecc24d4a4bca1ac66d17ea906b85 Mon Sep 17 00:00:00 2001 From: spjspj Date: Tue, 15 Aug 2017 01:04:25 +1000 Subject: [PATCH 06/13] Implement Fractured Identity (C17) --- .../src/mage/cards/f/FracturedIdentity.java | 99 +++++++++++++++++++ Mage.Sets/src/mage/sets/Commander2017.java | 1 + 2 files changed, 100 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/f/FracturedIdentity.java diff --git a/Mage.Sets/src/mage/cards/f/FracturedIdentity.java b/Mage.Sets/src/mage/cards/f/FracturedIdentity.java new file mode 100644 index 00000000000..356354b15f9 --- /dev/null +++ b/Mage.Sets/src/mage/cards/f/FracturedIdentity.java @@ -0,0 +1,99 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.cards.f; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.PutTokenOntoBattlefieldCopyTargetEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.common.TargetNonlandPermanent; +import mage.target.targetpointer.FixedTarget; + +/** + * + * @author spjspj + */ +public class FracturedIdentity extends CardImpl { + + public FracturedIdentity(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{W}{U}"); + + // Exile target nonland permanent. Each player other than its controller creates a token that's a copy of it. + this.getSpellAbility().addEffect(new FracturedIdentityEffect()); + this.getSpellAbility().addTarget(new TargetNonlandPermanent()); + } + + public FracturedIdentity(final FracturedIdentity card) { + super(card); + } + + @Override + public FracturedIdentity copy() { + return new FracturedIdentity(this); + } +} + +class FracturedIdentityEffect extends OneShotEffect { + + public FracturedIdentityEffect() { + super(Outcome.Exile); + this.staticText = "Exile target nonland permanent. Each player other than its controller creates a token that's a copy of it"; + } + + public FracturedIdentityEffect(final FracturedIdentityEffect effect) { + super(effect); + } + + @Override + public FracturedIdentityEffect copy() { + return new FracturedIdentityEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = game.getPermanent(source.getFirstTarget()); + if (permanent == null) { + return false; + } + + permanent.moveToExile(null, null, source.getSourceId(), game); + UUID controllerId = permanent.getControllerId(); + for (UUID opponentId : game.getOpponents(controllerId)) { + PutTokenOntoBattlefieldCopyTargetEffect effect = new PutTokenOntoBattlefieldCopyTargetEffect(opponentId, null, true); + effect.setTargetPointer(new FixedTarget(permanent, game)); + effect.apply(game, source); + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/Commander2017.java b/Mage.Sets/src/mage/sets/Commander2017.java index 83bc927ce1f..4a863f87416 100644 --- a/Mage.Sets/src/mage/sets/Commander2017.java +++ b/Mage.Sets/src/mage/sets/Commander2017.java @@ -49,6 +49,7 @@ public class Commander2017 extends ExpansionSet { cards.add(new SetCardInfo("Balan, Wandering Knight", 2, Rarity.RARE, mage.cards.b.BalanWanderingKnight.class)); cards.add(new SetCardInfo("Crimson Honor Guard", 23, Rarity.RARE, mage.cards.c.CrimsonHonorGuard.class)); + cards.add(new SetCardInfo("Fractured Identity", 37, Rarity.RARE, mage.cards.f.FracturedIdentity.class)); cards.add(new SetCardInfo("Nazahn, Revered Bladesmith", 44, Rarity.MYTHIC, mage.cards.n.NazahnReveredBladesmith.class)); cards.add(new SetCardInfo("O-Kagachi, Vengeful Kami", 45, Rarity.MYTHIC, mage.cards.o.OKagachiVengefulKami.class)); cards.add(new SetCardInfo("Patron of the Vein", 20, Rarity.RARE, mage.cards.p.PatronOfTheVein.class)); From 1f759f9291afca83b507729f5de9ebb85fcc28a1 Mon Sep 17 00:00:00 2001 From: "Saga\\Robert" Date: Mon, 14 Aug 2017 17:17:10 +0200 Subject: [PATCH 07/13] - changed getPermanent to getPermanentOrLKIBattlefield - changed == operator to equals() --- Mage.Sets/src/mage/cards/c/CurseOfBounty.java | 4 ++-- Mage.Sets/src/mage/cards/c/CurseOfDisturbance.java | 4 ++-- Mage.Sets/src/mage/cards/c/CurseOfOpulence.java | 4 ++-- Mage.Sets/src/mage/cards/c/CurseOfVerbosity.java | 4 ++-- Mage.Sets/src/mage/cards/c/CurseOfVitality.java | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Mage.Sets/src/mage/cards/c/CurseOfBounty.java b/Mage.Sets/src/mage/cards/c/CurseOfBounty.java index afd5848c318..11dbd64a5c7 100644 --- a/Mage.Sets/src/mage/cards/c/CurseOfBounty.java +++ b/Mage.Sets/src/mage/cards/c/CurseOfBounty.java @@ -101,12 +101,12 @@ class CurseOfBountyTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { - Permanent enchantment = game.getPermanent(this.getSourceId()); + Permanent enchantment = game.getPermanentOrLKIBattlefield(this.getSourceId()); UUID controller = this.getControllerId(); if (enchantment != null && enchantment.getAttachedTo() != null && game.getCombat().getPlayerDefenders(game).contains(enchantment.getAttachedTo())) { - if (game.getCombat().getAttackerId() != controller) { + if (!game.getCombat().getAttackerId().equals(controller)) { for (Effect effect: this.getEffects()) { effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackerId())); } diff --git a/Mage.Sets/src/mage/cards/c/CurseOfDisturbance.java b/Mage.Sets/src/mage/cards/c/CurseOfDisturbance.java index 1c85a3668de..acd0ba03977 100644 --- a/Mage.Sets/src/mage/cards/c/CurseOfDisturbance.java +++ b/Mage.Sets/src/mage/cards/c/CurseOfDisturbance.java @@ -98,12 +98,12 @@ class CurseOfDisturbanceTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { - Permanent enchantment = game.getPermanent(this.getSourceId()); + Permanent enchantment = game.getPermanentOrLKIBattlefield(this.getSourceId()); UUID controller = this.getControllerId(); if (enchantment != null && enchantment.getAttachedTo() != null && game.getCombat().getPlayerDefenders(game).contains(enchantment.getAttachedTo())) { - if (game.getCombat().getAttackerId() != controller) { + if (!game.getCombat().getAttackerId().equals(controller)) { for (Effect effect: this.getEffects()) { effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackerId())); } diff --git a/Mage.Sets/src/mage/cards/c/CurseOfOpulence.java b/Mage.Sets/src/mage/cards/c/CurseOfOpulence.java index a345e57f701..2c8e75a4a6b 100644 --- a/Mage.Sets/src/mage/cards/c/CurseOfOpulence.java +++ b/Mage.Sets/src/mage/cards/c/CurseOfOpulence.java @@ -99,12 +99,12 @@ class CurseOfOpulenceTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { - Permanent enchantment = game.getPermanent(this.getSourceId()); + Permanent enchantment = game.getPermanentOrLKIBattlefield(this.getSourceId()); UUID controller = this.getControllerId(); if (enchantment != null && enchantment.getAttachedTo() != null && game.getCombat().getPlayerDefenders(game).contains(enchantment.getAttachedTo())) { - if (game.getCombat().getAttackerId() != controller) { + if (!game.getCombat().getAttackerId().equals(controller)) { for (Effect effect: this.getEffects()) { effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackerId())); } diff --git a/Mage.Sets/src/mage/cards/c/CurseOfVerbosity.java b/Mage.Sets/src/mage/cards/c/CurseOfVerbosity.java index 5f71051538f..08b91e700e6 100644 --- a/Mage.Sets/src/mage/cards/c/CurseOfVerbosity.java +++ b/Mage.Sets/src/mage/cards/c/CurseOfVerbosity.java @@ -97,12 +97,12 @@ class CurseOfVerbosityTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { - Permanent enchantment = game.getPermanent(this.getSourceId()); + Permanent enchantment = game.getPermanentOrLKIBattlefield(this.getSourceId()); UUID controller = this.getControllerId(); if (enchantment != null && enchantment.getAttachedTo() != null && game.getCombat().getPlayerDefenders(game).contains(enchantment.getAttachedTo())) { - if (game.getCombat().getAttackerId() != controller) { + if (!game.getCombat().getAttackerId().equals(controller)) { for (Effect effect: this.getEffects()) { effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackerId())); } diff --git a/Mage.Sets/src/mage/cards/c/CurseOfVitality.java b/Mage.Sets/src/mage/cards/c/CurseOfVitality.java index 875f9a96725..4315afe8a57 100644 --- a/Mage.Sets/src/mage/cards/c/CurseOfVitality.java +++ b/Mage.Sets/src/mage/cards/c/CurseOfVitality.java @@ -97,12 +97,12 @@ class CurseOfVitalityTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { - Permanent enchantment = game.getPermanent(this.getSourceId()); + Permanent enchantment = game.getPermanentOrLKIBattlefield(this.getSourceId()); UUID controller = this.getControllerId(); if (enchantment != null && enchantment.getAttachedTo() != null && game.getCombat().getPlayerDefenders(game).contains(enchantment.getAttachedTo())) { - if (game.getCombat().getAttackerId() != controller) { + if (!game.getCombat().getAttackerId().equals(controller)) { for (Effect effect: this.getEffects()) { effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackerId())); } From cb34678c704e52d5ceb415830186b00bfadeed1e Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Mon, 14 Aug 2017 13:12:32 -0400 Subject: [PATCH 08/13] Fixed Crooked Scales, Consuming Ferocity, Crash Landing and Crookclaw Elder --- .../src/mage/cards/c/ConsumingFerocity.java | 2 +- Mage.Sets/src/mage/cards/c/CrashLanding.java | 6 +-- .../src/mage/cards/c/CrookclawElder.java | 6 +-- Mage.Sets/src/mage/cards/c/CrookedScales.java | 43 ++++++++++--------- 4 files changed, 30 insertions(+), 27 deletions(-) diff --git a/Mage.Sets/src/mage/cards/c/ConsumingFerocity.java b/Mage.Sets/src/mage/cards/c/ConsumingFerocity.java index a9e73de3ed6..ec6996e2c97 100644 --- a/Mage.Sets/src/mage/cards/c/ConsumingFerocity.java +++ b/Mage.Sets/src/mage/cards/c/ConsumingFerocity.java @@ -125,7 +125,7 @@ class ConsumingFerocityEffect extends OneShotEffect { player.damage(creature.getPower().getValue(), creature.getId(), game, false, true); } effect = new DestroyTargetEffect(true); - effect.setTargetPointer(new FixedTarget(creature.getId())); + effect.setTargetPointer(new FixedTarget(creature, game)); effect.apply(game, source); return true; } diff --git a/Mage.Sets/src/mage/cards/c/CrashLanding.java b/Mage.Sets/src/mage/cards/c/CrashLanding.java index 35a7c9a428e..43f0a8c9243 100644 --- a/Mage.Sets/src/mage/cards/c/CrashLanding.java +++ b/Mage.Sets/src/mage/cards/c/CrashLanding.java @@ -50,8 +50,8 @@ import mage.target.common.TargetCreaturePermanent; */ public class CrashLanding extends CardImpl { - private static final FilterControlledPermanent filter = new FilterControlledPermanent(); - private static final FilterCreaturePermanent filter2 = new FilterCreaturePermanent(); + private static final FilterControlledPermanent filter = new FilterControlledPermanent("Forests you control"); + private static final FilterCreaturePermanent filter2 = new FilterCreaturePermanent("creature with flying"); static { filter.add(new SubtypePredicate(SubType.FOREST)); @@ -66,7 +66,7 @@ public class CrashLanding extends CardImpl { this.getSpellAbility().addEffect(new LoseAbilityTargetEffect( FlyingAbility.getInstance(), Duration.EndOfTurn)); this.getSpellAbility().addEffect(new DamageTargetEffect(amount)); - this.getSpellAbility().addTarget(new TargetCreaturePermanent()); + this.getSpellAbility().addTarget(new TargetCreaturePermanent(filter2)); } public CrashLanding(final CrashLanding card) { diff --git a/Mage.Sets/src/mage/cards/c/CrookclawElder.java b/Mage.Sets/src/mage/cards/c/CrookclawElder.java index 6abc15fb11e..d0810723e9e 100644 --- a/Mage.Sets/src/mage/cards/c/CrookclawElder.java +++ b/Mage.Sets/src/mage/cards/c/CrookclawElder.java @@ -54,8 +54,8 @@ import mage.target.common.TargetCreaturePermanent; */ public class CrookclawElder extends CardImpl { - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("untapped Merfolk you control"); - private static final FilterControlledCreaturePermanent filter2 = new FilterControlledCreaturePermanent("untapped Merfolk you control"); + private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("untapped Bird you control"); + private static final FilterControlledCreaturePermanent filter2 = new FilterControlledCreaturePermanent("untapped Wizards you control"); static { filter.add(new SubtypePredicate(SubType.BIRD)); @@ -78,7 +78,7 @@ public class CrookclawElder extends CardImpl { // Tap two untapped Birds you control: Draw a card. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DrawCardSourceControllerEffect(1), new TapTargetCost(new TargetControlledCreaturePermanent(2, 2, filter, true))); this.addAbility(ability); - + // Tap two untapped Wizards you control: Target creature gains flying until end of turn. ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainAbilityTargetEffect(FlyingAbility.getInstance(), Duration.EndOfTurn), new TapTargetCost(new TargetControlledCreaturePermanent(2, 2, filter2, true))); ability.addTarget(new TargetCreaturePermanent()); diff --git a/Mage.Sets/src/mage/cards/c/CrookedScales.java b/Mage.Sets/src/mage/cards/c/CrookedScales.java index 174f498db14..8886e0d2af8 100644 --- a/Mage.Sets/src/mage/cards/c/CrookedScales.java +++ b/Mage.Sets/src/mage/cards/c/CrookedScales.java @@ -91,29 +91,32 @@ class CrookedScalesEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); - Permanent yourGuy = game.getPermanent(getTargetPointer().getFirst(game, source)); - Permanent theirGuy = game.getPermanent(source.getTargets().get(1).getFirstTarget()); - boolean keepGoing; - Cost cost; - String message = "You lost the flip. Pay {3} to prevent your creature from being destroyed?"; - do { - if (controller.flipCoin(game)) { - if (theirGuy != null) { - theirGuy.destroy(controller.getId(), game, false); - } - keepGoing = false; - } else { - cost = new GenericManaCost(3); - if (!(controller.chooseUse(Outcome.Benefit, message, source, game) && cost.pay(source, game, controller.getId(), controller.getId(), false, null))) { - if (yourGuy != null) { - yourGuy.destroy(controller.getId(), game, false); + if (controller != null) { + Permanent yourGuy = game.getPermanent(getTargetPointer().getFirst(game, source)); + Permanent theirGuy = game.getPermanent(source.getTargets().get(1).getFirstTarget()); + boolean keepGoing; + Cost cost; + String message = "You lost the flip. Pay {3} to prevent your creature from being destroyed?"; + do { + if (controller.flipCoin(game)) { + if (theirGuy != null) { + theirGuy.destroy(controller.getId(), game, false); } keepGoing = false; } else { - keepGoing = true; + cost = new GenericManaCost(3); + if (!(controller.chooseUse(Outcome.Benefit, message, source, game) && cost.pay(source, game, controller.getId(), controller.getId(), false, null))) { + if (yourGuy != null) { + yourGuy.destroy(controller.getId(), game, false); + } + keepGoing = false; + } else { + keepGoing = true; + } } - } - } while (keepGoing); - return true; + } while (keepGoing && controller.isInGame()); + return true; + } + return false; } } From 4838ad7e7a075e8b2237037a793c6def6a648b1a Mon Sep 17 00:00:00 2001 From: Christian Date: Mon, 14 Aug 2017 15:22:01 -0400 Subject: [PATCH 09/13] Added Kindred Dominance to Commander 2017 Set --- Mage.Sets/src/mage/sets/Commander2017.java | 1 + 1 file changed, 1 insertion(+) diff --git a/Mage.Sets/src/mage/sets/Commander2017.java b/Mage.Sets/src/mage/sets/Commander2017.java index 5ec6660fc66..a4ccf09a4a0 100644 --- a/Mage.Sets/src/mage/sets/Commander2017.java +++ b/Mage.Sets/src/mage/sets/Commander2017.java @@ -59,6 +59,7 @@ public class Commander2017 extends ExpansionSet { cards.add(new SetCardInfo("Teferi's Protection", 8, Rarity.RARE, mage.cards.t.TeferisProtection.class)); cards.add(new SetCardInfo("Traverse the Outlands", 34, Rarity.RARE, mage.cards.t.TraverseTheOutlands.class)); cards.add(new SetCardInfo("Wasitora, Nekoru Queen", 49, Rarity.MYTHIC, mage.cards.w.WasitoraNekoruQueen.class)); + cards.add(new SetCardInfo("Kindred Dominance", 18, Rarity.RARE, mage.cards.k.KindredDominance.class)); } } From c9be694f05fecf98be0bbb1207c7cadb06fd6ef5 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Mon, 14 Aug 2017 15:54:24 -0400 Subject: [PATCH 10/13] Fixed Credit Voucher --- Mage.Sets/src/mage/cards/c/CreditVoucher.java | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/Mage.Sets/src/mage/cards/c/CreditVoucher.java b/Mage.Sets/src/mage/cards/c/CreditVoucher.java index cb111d93d43..09ce01569e0 100644 --- a/Mage.Sets/src/mage/cards/c/CreditVoucher.java +++ b/Mage.Sets/src/mage/cards/c/CreditVoucher.java @@ -27,7 +27,6 @@ */ package mage.cards.c; -import java.util.Iterator; import java.util.UUID; import mage.MageObject; import mage.abilities.Ability; @@ -36,9 +35,9 @@ import mage.abilities.costs.common.SacrificeSourceCost; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.effects.OneShotEffect; -import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.CardSetInfo; +import mage.cards.CardsImpl; import mage.constants.CardType; import mage.constants.Outcome; import mage.constants.Zone; @@ -77,7 +76,7 @@ class CreditVoucherEffect extends OneShotEffect { CreditVoucherEffect() { super(Outcome.Neutral); - this.staticText = "Shuffle any number of from your hand into your library, then draw that many cards"; + this.staticText = "Shuffle any number of cards from your hand into your library, then draw that many cards"; } CreditVoucherEffect(final CreditVoucherEffect effect) { @@ -100,14 +99,8 @@ class CreditVoucherEffect extends OneShotEffect { int amountShuffled = 0; if (target.canChoose(source.getControllerId(), game) && target.choose(Outcome.Neutral, source.getControllerId(), source.getSourceId(), game)) { if (!target.getTargets().isEmpty()) { - Iterator targets = target.getTargets().iterator(); - while (targets.hasNext()) { - Card card = game.getCard(targets.next()); - if (card != null) { - controller.moveCards(card, Zone.LIBRARY, source, game); - amountShuffled++; - } - } + amountShuffled = target.getTargets().size(); + controller.moveCards(new CardsImpl(target.getTargets()), Zone.LIBRARY, source, game); } } controller.shuffleLibrary(source, game); From 98ee5931a7bfead43b46cd31475aa843647fc50e Mon Sep 17 00:00:00 2001 From: Christian Date: Mon, 14 Aug 2017 15:57:43 -0400 Subject: [PATCH 11/13] Implemented Kindred Dominance and added to Commander2017 Set --- .../src/mage/cards/k/KindredDominance.java | 112 ++++++++++++++++++ Mage.Sets/src/mage/sets/Commander2017.java | 3 +- 2 files changed, 114 insertions(+), 1 deletion(-) create mode 100644 Mage.Sets/src/mage/cards/k/KindredDominance.java diff --git a/Mage.Sets/src/mage/cards/k/KindredDominance.java b/Mage.Sets/src/mage/cards/k/KindredDominance.java new file mode 100644 index 00000000000..ffe3feb76b6 --- /dev/null +++ b/Mage.Sets/src/mage/cards/k/KindredDominance.java @@ -0,0 +1,112 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.cards.k; + +import java.util.UUID; + +import mage.MageObject; +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.DestroyAllEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.choices.Choice; +import mage.choices.ChoiceCreatureType; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.game.Game; +import mage.players.Player; + +/** + * + * @author caldover + */ +public class KindredDominance extends CardImpl { + + public KindredDominance(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{5}{B}{B}"); + + // Choose a creature type. Destroy all creatures that are not the chosen type. + this.getSpellAbility().addEffect(new KindredDominanceEffect()); + } + + public KindredDominance(final KindredDominance card) { + super(card); + } + + @Override + public KindredDominance copy() { + return new KindredDominance(this); + } +} + +class KindredDominanceEffect extends OneShotEffect { + + public KindredDominanceEffect() { + super(Outcome.DestroyPermanent); + this.staticText = "Choose a creature type. Destroy all creatures that are not the chosen type."; + } + + public KindredDominanceEffect(final KindredDominanceEffect effect) { + super(effect); + } + + @Override + public KindredDominanceEffect copy() { + return new KindredDominanceEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + MageObject sourceObject = game.getObject(source.getSourceId()); + if (controller != null) { + Choice typeChoice = new ChoiceCreatureType(); + while (!controller.choose(outcome, typeChoice, game)) { + if (!controller.canRespond()) { + return false; + } + } + if (typeChoice.getChoice() != null) { + game.informPlayers(sourceObject.getLogName() + " chosen type: " + typeChoice.getChoice()); + } + + FilterPermanent filter = new FilterCreaturePermanent("creatures"); + + filter.add(Predicates.not(new SubtypePredicate(SubType.byDescription(typeChoice.getChoice())))); + + return new DestroyAllEffect(filter).apply(game, source); + } + return false; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/Commander2017.java b/Mage.Sets/src/mage/sets/Commander2017.java index ead1b15a5a1..e57d24632b7 100644 --- a/Mage.Sets/src/mage/sets/Commander2017.java +++ b/Mage.Sets/src/mage/sets/Commander2017.java @@ -64,6 +64,7 @@ public class Commander2017 extends ExpansionSet { cards.add(new SetCardInfo("Teferi's Protection", 8, Rarity.RARE, mage.cards.t.TeferisProtection.class)); cards.add(new SetCardInfo("Traverse the Outlands", 34, Rarity.RARE, mage.cards.t.TraverseTheOutlands.class)); cards.add(new SetCardInfo("Wasitora, Nekoru Queen", 49, Rarity.MYTHIC, mage.cards.w.WasitoraNekoruQueen.class)); - + cards.add(new SetCardInfo("Kindred Dominance", 18, Rarity.RARE, mage.cards.w.WasitoraNekoruQueen.class)); + } } From 75712661de32710dad0254987f6ba55217ca5315 Mon Sep 17 00:00:00 2001 From: Christian Date: Mon, 14 Aug 2017 16:08:35 -0400 Subject: [PATCH 12/13] Updated Kindred Dominance with better code reuse --- .../src/mage/cards/k/KindredDominance.java | 25 ++++++------------- 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/Mage.Sets/src/mage/cards/k/KindredDominance.java b/Mage.Sets/src/mage/cards/k/KindredDominance.java index ffe3feb76b6..0ef55d288cf 100644 --- a/Mage.Sets/src/mage/cards/k/KindredDominance.java +++ b/Mage.Sets/src/mage/cards/k/KindredDominance.java @@ -32,11 +32,10 @@ import java.util.UUID; import mage.MageObject; import mage.abilities.Ability; import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.ChooseCreatureTypeEffect; import mage.abilities.effects.common.DestroyAllEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.choices.Choice; -import mage.choices.ChoiceCreatureType; import mage.constants.CardType; import mage.constants.Outcome; import mage.constants.SubType; @@ -57,6 +56,7 @@ public class KindredDominance extends CardImpl { super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{5}{B}{B}"); // Choose a creature type. Destroy all creatures that are not the chosen type. + this.getSpellAbility().addEffect(new ChooseCreatureTypeEffect(Outcome.DestroyPermanent)); this.getSpellAbility().addEffect(new KindredDominanceEffect()); } @@ -74,7 +74,7 @@ class KindredDominanceEffect extends OneShotEffect { public KindredDominanceEffect() { super(Outcome.DestroyPermanent); - this.staticText = "Choose a creature type. Destroy all creatures that are not the chosen type."; + this.staticText = " Destroy all creatures that are not the chosen type."; } public KindredDominanceEffect(final KindredDominanceEffect effect) { @@ -89,22 +89,11 @@ class KindredDominanceEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); - MageObject sourceObject = game.getObject(source.getSourceId()); - if (controller != null) { - Choice typeChoice = new ChoiceCreatureType(); - while (!controller.choose(outcome, typeChoice, game)) { - if (!controller.canRespond()) { - return false; - } - } - if (typeChoice.getChoice() != null) { - game.informPlayers(sourceObject.getLogName() + " chosen type: " + typeChoice.getChoice()); - } - + MageObject mageObject = game.getObject(source.getSourceId()); + if (controller != null & mageObject != null) { + String creatureType = game.getState().getValue(mageObject.getId() + "_type").toString(); FilterPermanent filter = new FilterCreaturePermanent("creatures"); - - filter.add(Predicates.not(new SubtypePredicate(SubType.byDescription(typeChoice.getChoice())))); - + filter.add(Predicates.not(new SubtypePredicate(SubType.byDescription(creatureType)))); return new DestroyAllEffect(filter).apply(game, source); } return false; From 06806b6f642b4ea7bd3f5ca735a7161a77f32196 Mon Sep 17 00:00:00 2001 From: Christian Date: Mon, 14 Aug 2017 16:52:32 -0400 Subject: [PATCH 13/13] Fixed typo in Kindred Dominance --- Mage.Sets/src/mage/cards/k/KindredDominance.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mage.Sets/src/mage/cards/k/KindredDominance.java b/Mage.Sets/src/mage/cards/k/KindredDominance.java index 24476659014..c8bc222d5dc 100644 --- a/Mage.Sets/src/mage/cards/k/KindredDominance.java +++ b/Mage.Sets/src/mage/cards/k/KindredDominance.java @@ -74,7 +74,7 @@ class KindredDominanceEffect extends OneShotEffect { public KindredDominanceEffect() { super(Outcome.DestroyPermanent); - this.staticText = " Destroy all creatures that are not the chosen type."; + this.staticText = "Destroy all creatures that are not the chosen type."; } public KindredDominanceEffect(final KindredDominanceEffect effect) {