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/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/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); 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; } } 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..11dbd64a5c7 --- /dev/null +++ b/Mage.Sets/src/mage/cards/c/CurseOfBounty.java @@ -0,0 +1,158 @@ +/* + * 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.StaticFilters; +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.getPermanentOrLKIBattlefield(this.getSourceId()); + UUID controller = this.getControllerId(); + if (enchantment != null + && enchantment.getAttachedTo() != null + && game.getCombat().getPlayerDefenders(game).contains(enchantment.getAttachedTo())) { + if (!game.getCombat().getAttackerId().equals(controller)) { + 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(StaticFilters.FILTER_PERMANENT_NON_LAND, 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..acd0ba03977 --- /dev/null +++ b/Mage.Sets/src/mage/cards/c/CurseOfDisturbance.java @@ -0,0 +1,126 @@ +/* + * 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.getPermanentOrLKIBattlefield(this.getSourceId()); + UUID controller = this.getControllerId(); + if (enchantment != null + && enchantment.getAttachedTo() != null + && game.getCombat().getPlayerDefenders(game).contains(enchantment.getAttachedTo())) { + if (!game.getCombat().getAttackerId().equals(controller)) { + 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..2c8e75a4a6b --- /dev/null +++ b/Mage.Sets/src/mage/cards/c/CurseOfOpulence.java @@ -0,0 +1,128 @@ +/* + * 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.getPermanentOrLKIBattlefield(this.getSourceId()); + UUID controller = this.getControllerId(); + if (enchantment != null + && enchantment.getAttachedTo() != null + && game.getCombat().getPlayerDefenders(game).contains(enchantment.getAttachedTo())) { + if (!game.getCombat().getAttackerId().equals(controller)) { + 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..08b91e700e6 --- /dev/null +++ b/Mage.Sets/src/mage/cards/c/CurseOfVerbosity.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.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.getPermanentOrLKIBattlefield(this.getSourceId()); + UUID controller = this.getControllerId(); + if (enchantment != null + && enchantment.getAttachedTo() != null + && game.getCombat().getPlayerDefenders(game).contains(enchantment.getAttachedTo())) { + if (!game.getCombat().getAttackerId().equals(controller)) { + 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..4315afe8a57 --- /dev/null +++ b/Mage.Sets/src/mage/cards/c/CurseOfVitality.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.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.getPermanentOrLKIBattlefield(this.getSourceId()); + UUID controller = this.getControllerId(); + if (enchantment != null + && enchantment.getAttachedTo() != null + && game.getCombat().getPlayerDefenders(game).contains(enchantment.getAttachedTo())) { + if (!game.getCombat().getAttackerId().equals(controller)) { + 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/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/cards/k/KindredDominance.java b/Mage.Sets/src/mage/cards/k/KindredDominance.java new file mode 100644 index 00000000000..c8bc222d5dc --- /dev/null +++ b/Mage.Sets/src/mage/cards/k/KindredDominance.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 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.abilities.effects.common.ChooseCreatureTypeEffect; +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 ChooseCreatureTypeEffect(Outcome.DestroyPermanent)); + 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 = "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 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(creatureType)))); + return new DestroyAllEffect(filter).apply(game, source); + } + return false; + } +} \ No newline at end of file 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.Sets/src/mage/sets/Commander2017.java b/Mage.Sets/src/mage/sets/Commander2017.java index 04b278dcc5b..c2679d7cc0f 100644 --- a/Mage.Sets/src/mage/sets/Commander2017.java +++ b/Mage.Sets/src/mage/sets/Commander2017.java @@ -49,9 +49,15 @@ 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("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)); @@ -63,6 +69,8 @@ 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)); + + } } 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) { 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")); }