diff --git a/Mage.Client/src/main/java/org/mage/card/arcane/CardPanel.java b/Mage.Client/src/main/java/org/mage/card/arcane/CardPanel.java index 19fdbedb73..f6a60065d1 100644 --- a/Mage.Client/src/main/java/org/mage/card/arcane/CardPanel.java +++ b/Mage.Client/src/main/java/org/mage/card/arcane/CardPanel.java @@ -721,13 +721,13 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti private BufferedImage getFaceDownImage() { if (isPermanent) { - if (gameCard.isMorphCard() && ((PermanentView) gameCard).isMorphed()) { + if (((PermanentView) gameCard).isMorphed()) { return ImageCache.getMorphImage(); } else { return ImageCache.getManifestImage(); } } else { - if (gameCard.isMorphCard() && this.gameCard instanceof StackAbilityView) { + if (this.gameCard instanceof StackAbilityView) { return ImageCache.getMorphImage(); } else { return ImageCache.loadImage(new TFile(DirectLinksForDownload.outDir + File.separator + DirectLinksForDownload.cardbackFilename)); diff --git a/Mage.Common/src/mage/view/CardView.java b/Mage.Common/src/mage/view/CardView.java index 1211594b2e..52abf75f4e 100644 --- a/Mage.Common/src/mage/view/CardView.java +++ b/Mage.Common/src/mage/view/CardView.java @@ -87,7 +87,7 @@ public class CardView extends SimpleCardView { protected boolean transformed; protected boolean flipCard; - protected boolean morphCard; + protected boolean faceDown; protected String alternateName; protected String originalName; @@ -138,13 +138,12 @@ public class CardView extends SimpleCardView { * @param controlled is the card view created for the card controller - used for morph / face down cards to know which player may see information for the card */ public CardView(Card card, Game game, UUID cardId, boolean controlled) { - super(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.isFaceDown(), card.getUsesVariousArt(), card.getTokenSetCode()); - this.morphCard = card.isMorphCard(); + super(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.getUsesVariousArt(), card.getTokenSetCode()); // no information available for face down cards as long it's not a controlled face down morph card // TODO: Better handle this in Framework (but currently I'm not sure how to do it there) LevelX2 - if (card.isFaceDown()) { + if (card.isFaceDown(game)) { this.fillEmpty(card, controlled); - if (card.isMorphCard() && card instanceof Spell) { + if (card instanceof Spell) { // special handling for casting of Morph cards if (controlled) { this.name = card.getName(); @@ -242,7 +241,7 @@ public class CardView extends SimpleCardView { this.color = card.getColor(); this.canTransform = card.canTransform(); this.flipCard = card.isFlipCard(); - + this.faceDown = game != null ? card.isFaceDown(game) : false; if (card instanceof PermanentToken) { this.isToken = true; @@ -299,7 +298,7 @@ public class CardView extends SimpleCardView { } public CardView(MageObject object) { - super(object.getId(), "", 0, false, false, ""); + super(object.getId(), "", 0, false, ""); this.name = object.getName(); this.displayName = object.getName(); if (object instanceof Permanent) { @@ -343,7 +342,7 @@ public class CardView extends SimpleCardView { } protected CardView() { - super(null, "", 0, false, false, ""); + super(null, "", 0, false, ""); } public CardView(EmblemView emblem) { @@ -359,7 +358,7 @@ public class CardView extends SimpleCardView { } public CardView(boolean empty) { - super(null, "", 0, false, false, ""); + super(null, "", 0, false, ""); if (!empty) { throw new IllegalArgumentException("Not supported."); } @@ -417,7 +416,7 @@ public class CardView extends SimpleCardView { } CardView(Token token) { - super(token.getId(), "", 0, false, false, ""); + super(token.getId(), "", 0, false, ""); this.isToken = true; this.id = token.getId(); this.name = token.getName(); @@ -581,7 +580,6 @@ public class CardView extends SimpleCardView { return getName() + " [" + getId() + "]"; } - @Override public boolean isFaceDown() { return faceDown; } @@ -696,10 +694,6 @@ public class CardView extends SimpleCardView { return flipCard; } - public boolean isMorphCard() { - return morphCard; - } - public boolean isToRotate() { return rotate; } diff --git a/Mage.Common/src/mage/view/LookedAtView.java b/Mage.Common/src/mage/view/LookedAtView.java index 109d81fb0d..a7485e7120 100644 --- a/Mage.Common/src/mage/view/LookedAtView.java +++ b/Mage.Common/src/mage/view/LookedAtView.java @@ -46,7 +46,7 @@ public class LookedAtView implements Serializable { public LookedAtView(String name, Cards cards, Game game) { this.name = name; for (Card card: cards.getCards(game)) { - this.cards.put(card.getId(), new SimpleCardView(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.getUsesVariousArt(), card.isFaceDown(), card.getTokenSetCode())); + this.cards.put(card.getId(), new SimpleCardView(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.getUsesVariousArt(), card.getTokenSetCode())); } } diff --git a/Mage.Common/src/mage/view/PermanentView.java b/Mage.Common/src/mage/view/PermanentView.java index 376e63e69a..4ce0246ea0 100644 --- a/Mage.Common/src/mage/view/PermanentView.java +++ b/Mage.Common/src/mage/view/PermanentView.java @@ -84,10 +84,7 @@ public class PermanentView extends CardView { } else { if (card != null) { // original may not be face down - boolean wasfaceDown = card.isFaceDown(); - card.setFaceDown(false); original = new CardView(card); - card.setFaceDown(wasfaceDown); } else { original = null; } @@ -119,7 +116,7 @@ public class PermanentView extends CardView { this.nameOwner = ""; } - if (permanent.isFaceDown() && card != null) { + if (permanent.isFaceDown(game) && card != null) { if (controlled){ // must be a morphed or manifested card for (Ability permanentAbility : permanent.getAbilities()) { diff --git a/Mage.Common/src/mage/view/RevealedView.java b/Mage.Common/src/mage/view/RevealedView.java index 2d573ef89f..3f067267cd 100644 --- a/Mage.Common/src/mage/view/RevealedView.java +++ b/Mage.Common/src/mage/view/RevealedView.java @@ -45,7 +45,7 @@ public class RevealedView implements Serializable { public RevealedView(String name, Cards cards, Game game) { this.name = name; for (Card card: cards.getCards(game)) { - this.cards.put(card.getId(), new SimpleCardView(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.getUsesVariousArt(), card.isFaceDown(), card.getTokenSetCode())); + this.cards.put(card.getId(), new SimpleCardView(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.getUsesVariousArt(), card.getTokenSetCode())); } } diff --git a/Mage.Common/src/mage/view/SimpleCardView.java b/Mage.Common/src/mage/view/SimpleCardView.java index 5678cdef2b..daf216d72c 100644 --- a/Mage.Common/src/mage/view/SimpleCardView.java +++ b/Mage.Common/src/mage/view/SimpleCardView.java @@ -40,14 +40,12 @@ public class SimpleCardView implements Serializable { protected String expansionSetCode; protected String tokenSetCode; protected int cardNumber; - protected boolean faceDown; protected boolean usesVariousArt; - public SimpleCardView(UUID id, String expansionSetCode, int cardNumber, boolean faceDown, boolean usesVariousArt, String tokenSetCode) { + public SimpleCardView(UUID id, String expansionSetCode, int cardNumber, boolean usesVariousArt, String tokenSetCode) { this.id = id; this.expansionSetCode = expansionSetCode; this.cardNumber = cardNumber; - this.faceDown = faceDown; this.usesVariousArt = usesVariousArt; this.tokenSetCode = tokenSetCode; } @@ -64,10 +62,6 @@ public class SimpleCardView implements Serializable { return cardNumber; } - public boolean isFaceDown() { - return faceDown; - } - public boolean getUsesVariousArt() { return usesVariousArt; } diff --git a/Mage.Common/src/mage/view/SimpleCardsView.java b/Mage.Common/src/mage/view/SimpleCardsView.java index e01c69f7aa..d3763e4eed 100644 --- a/Mage.Common/src/mage/view/SimpleCardsView.java +++ b/Mage.Common/src/mage/view/SimpleCardsView.java @@ -44,7 +44,7 @@ public class SimpleCardsView extends LinkedHashMap { public SimpleCardsView(Collection cards) { for (Card card: cards) { - this.put(card.getId(), new SimpleCardView(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.isFaceDown(), card.getUsesVariousArt(), card.getTokenSetCode())); + this.put(card.getId(), new SimpleCardView(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.getUsesVariousArt(), card.getTokenSetCode())); } } diff --git a/Mage.Common/src/mage/view/StackAbilityView.java b/Mage.Common/src/mage/view/StackAbilityView.java index 9872f9eaf9..8a5dae7d00 100644 --- a/Mage.Common/src/mage/view/StackAbilityView.java +++ b/Mage.Common/src/mage/view/StackAbilityView.java @@ -74,7 +74,7 @@ public class StackAbilityView extends CardView { this.power = ability.getPower().toString(); this.toughness = ability.getToughness().toString(); String nameToShow; - if (sourceCard.isMorphCard() && sourceCard.isFaceDown()) { + if (sourceCard.isFaceDown()) { CardView tmpSourceCard = this.getSourceCard(); tmpSourceCard.displayName = "Face Down"; tmpSourceCard.superTypes.clear(); diff --git a/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java b/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java index b29ea9d02d..ecc476e085 100644 --- a/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java +++ b/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java @@ -575,7 +575,7 @@ public class HumanPlayer extends PlayerImpl { if (object != null) { Zone zone = game.getState().getZone(object.getId()); if (zone != null) { - if (object instanceof Card && ((Card) object).isFaceDown()) { + if (object instanceof Card && ((Card) object).isFaceDown(game)) { revealFaceDownCard((Card) object, game); result = true; } diff --git a/Mage.Sets/src/mage/sets/commander2014/LifebloodHydra.java b/Mage.Sets/src/mage/sets/commander2014/LifebloodHydra.java index ff27e65a73..1f167e226a 100644 --- a/Mage.Sets/src/mage/sets/commander2014/LifebloodHydra.java +++ b/Mage.Sets/src/mage/sets/commander2014/LifebloodHydra.java @@ -94,7 +94,7 @@ class LifebloodHydraComesIntoPlayEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getSourceId()); - if (permanent != null && !permanent.isFaceDown()) { + if (permanent != null && !permanent.isFaceDown(game)) { Object obj = getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY); if (obj != null && obj instanceof SpellAbility) { int amount = ((SpellAbility) obj).getManaCostsToPay().getX(); diff --git a/Mage.Sets/src/mage/sets/dragonsoftarkir/AinokSurvivalist.java b/Mage.Sets/src/mage/sets/dragonsoftarkir/AinokSurvivalist.java new file mode 100644 index 0000000000..522483a073 --- /dev/null +++ b/Mage.Sets/src/mage/sets/dragonsoftarkir/AinokSurvivalist.java @@ -0,0 +1,85 @@ +/* + * 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.sets.dragonsoftarkir; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.TurnedFaceUpSourceTriggeredAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.DestroyTargetEffect; +import mage.abilities.keyword.MorphAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.TargetController; +import mage.filter.common.FilterArtifactOrEnchantmentPermanent; +import mage.filter.predicate.permanent.ControllerPredicate; +import mage.target.TargetPermanent; + +/** + * + * @author fireshoes + */ +public class AinokSurvivalist extends CardImpl { + + private static final FilterArtifactOrEnchantmentPermanent filter = new FilterArtifactOrEnchantmentPermanent("artifact or enchantment an opponent controls"); + + static { + filter.add(new ControllerPredicate(TargetController.OPPONENT)); + } + + public AinokSurvivalist(UUID ownerId) { + super(ownerId, 172, "Ainok Survivalist", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{1}{G}"); + this.expansionSetCode = "DTK"; + this.subtype.add("Hound"); + this.subtype.add("Shaman"); + this.power = new MageInt(2); + this.toughness = new MageInt(1); + + // Megamorph {1}{G} + this.addAbility(new MorphAbility(this, new ManaCostsImpl("{1}{G}"), true)); + + // When Ainok Survivalist is turned face up, destroy target artifact or enchantment an opponent controls. + Effect effect = new DestroyTargetEffect(); + effect.setText("destroy target artifact or enchantment an opponent controls"); + Ability ability = new TurnedFaceUpSourceTriggeredAbility(effect, false); + ability.addTarget(new TargetPermanent(filter)); + this.addAbility(ability); + } + + public AinokSurvivalist(final AinokSurvivalist card) { + super(card); + } + + @Override + public AinokSurvivalist copy() { + return new AinokSurvivalist(this); + } +} diff --git a/Mage.Sets/src/mage/sets/dragonsoftarkir/AvatarOfTheResolute.java b/Mage.Sets/src/mage/sets/dragonsoftarkir/AvatarOfTheResolute.java new file mode 100644 index 0000000000..d1de1ad6ad --- /dev/null +++ b/Mage.Sets/src/mage/sets/dragonsoftarkir/AvatarOfTheResolute.java @@ -0,0 +1,86 @@ +/* + * 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.sets.dragonsoftarkir; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.EntersBattlefieldAbility; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.abilities.keyword.ReachAbility; +import mage.abilities.keyword.TrampleAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.counters.CounterType; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.predicate.permanent.AnotherPredicate; +import mage.filter.predicate.permanent.CounterPredicate; + +/** + * + * @author jeffwadsworth + */ +public class AvatarOfTheResolute extends CardImpl { + + private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("other creature you control with a +1/+1 counter on it"); + + static { + filter.add(new CounterPredicate(CounterType.P1P1)); + filter.add(new AnotherPredicate()); + } + + public AvatarOfTheResolute(UUID ownerId) { + super(ownerId, 175, "Avatar of the Resolute", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{G}{G}"); + this.expansionSetCode = "DTK"; + this.subtype.add("Avatar"); + this.power = new MageInt(3); + this.toughness = new MageInt(2); + + // Reach + this.addAbility(ReachAbility.getInstance()); + + // Trample + this.addAbility(TrampleAbility.getInstance()); + + // Avatar of the Resolute enters the battlefield with a +1/+1 counter on it for each other creature you control with a +1/+1 counter on it. + DynamicValue numberCounters = new PermanentsOnBattlefieldCount(filter); + this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance(), numberCounters, true))); + + } + + public AvatarOfTheResolute(final AvatarOfTheResolute card) { + super(card); + } + + @Override + public AvatarOfTheResolute copy() { + return new AvatarOfTheResolute(this); + } +} diff --git a/Mage.Sets/src/mage/sets/dragonsoftarkir/CloneLegion.java b/Mage.Sets/src/mage/sets/dragonsoftarkir/CloneLegion.java new file mode 100644 index 0000000000..1ab5b09da0 --- /dev/null +++ b/Mage.Sets/src/mage/sets/dragonsoftarkir/CloneLegion.java @@ -0,0 +1,102 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.dragonsoftarkir; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.filter.common.FilterCreaturePermanent; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.game.permanent.token.EmptyToken; +import mage.players.Player; +import mage.target.TargetPlayer; +import mage.util.CardUtil; + +/** + * + * @author jeffwadsworth + */ +public class CloneLegion extends CardImpl { + + public CloneLegion(UUID ownerId) { + super(ownerId, 48, "Clone Legion", Rarity.MYTHIC, new CardType[]{CardType.SORCERY}, "{7}{U}{U}"); + this.expansionSetCode = "DTK"; + + // For each creature target player controls, put a token onto the the battlefield that's a copy of that creature. + this.getSpellAbility().addEffect(new CloneLegionEffect()); + this.getSpellAbility().addTarget(new TargetPlayer()); + + } + + public CloneLegion(final CloneLegion card) { + super(card); + } + + @Override + public CloneLegion copy() { + return new CloneLegion(this); + } +} + +class CloneLegionEffect extends OneShotEffect { + + public CloneLegionEffect() { + super(Outcome.Benefit); + this.staticText = "For each creature target player controls, put a token onto the the battlefield that's a copy of that creature"; + } + + public CloneLegionEffect(final CloneLegionEffect effect) { + super(effect); + } + + @Override + public CloneLegionEffect copy() { + return new CloneLegionEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source)); + if (targetPlayer != null) { + for (Permanent permanent : game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), targetPlayer.getId(), game)) { + if (permanent != null) { + EmptyToken token = new EmptyToken(); + CardUtil.copyTo(token).from(permanent); + token.putOntoBattlefield(1, game, source.getSourceId(), targetPlayer.getId()); + } + } + return true; + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/dragonsoftarkir/CommuneWithLava.java b/Mage.Sets/src/mage/sets/dragonsoftarkir/CommuneWithLava.java new file mode 100644 index 0000000000..244a7c9a2f --- /dev/null +++ b/Mage.Sets/src/mage/sets/dragonsoftarkir/CommuneWithLava.java @@ -0,0 +1,152 @@ +/* + * 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.sets.dragonsoftarkir; + +import java.util.List; +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.effects.AsThoughEffectImpl; +import mage.abilities.effects.ContinuousEffect; +import mage.abilities.effects.OneShotEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.constants.AsThoughEffectType; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.PhaseStep; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.game.Game; +import mage.players.Player; +import mage.target.targetpointer.FixedTarget; +import mage.util.CardUtil; + +/** + * + * @author jeffwadsworth + */ +public class CommuneWithLava extends CardImpl { + + public CommuneWithLava(UUID ownerId) { + super(ownerId, 131, "Commune with Lava", Rarity.RARE, new CardType[]{CardType.INSTANT}, "{X}{R}{R}"); + this.expansionSetCode = "DTK"; + + // Exile the top X cards of your library. Until the end of your next turn, you may play those cards. + this.getSpellAbility().addEffect(new CommuneWithLavaEffect()); + + } + + public CommuneWithLava(final CommuneWithLava card) { + super(card); + } + + @Override + public CommuneWithLava copy() { + return new CommuneWithLava(this); + } +} + +class CommuneWithLavaEffect extends OneShotEffect { + + public CommuneWithLavaEffect() { + super(Outcome.PlayForFree); + this.staticText = "Exile the top X cards of your library. Until the end of your next turn, you may play those cards"; + } + + public CommuneWithLavaEffect(final CommuneWithLavaEffect effect) { + super(effect); + } + + @Override + public CommuneWithLavaEffect copy() { + return new CommuneWithLavaEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + Card sourceCard = game.getCard(source.getSourceId()); + if (controller != null) { + int amount = source.getManaCostsToPay().getX(); + List cards = controller.getLibrary().getTopCards(game, amount); + for (Card card : cards) { + if (card != null) { + controller.moveCardToExileWithInfo(card, CardUtil.getCardExileZoneId(game, source), sourceCard.getName(), source.getSourceId(), game, Zone.LIBRARY); + ContinuousEffect effect = new CommuneWithLavaMayPlayEffect(); + effect.setTargetPointer(new FixedTarget(card.getId())); + game.addEffect(effect, source); + } + } + + return true; + } + return false; + } +} + +class CommuneWithLavaMayPlayEffect extends AsThoughEffectImpl { + + public CommuneWithLavaMayPlayEffect() { + super(AsThoughEffectType.PLAY_FROM_NON_HAND_ZONE, Duration.Custom, Outcome.Benefit); + this.staticText = "Until the end of your next turn, you may play that card."; + } + + public CommuneWithLavaMayPlayEffect(final CommuneWithLavaMayPlayEffect effect) { + super(effect); + } + + @Override + public CommuneWithLavaMayPlayEffect copy() { + return new CommuneWithLavaMayPlayEffect(this); + } + + @Override + public boolean isInactive(Ability source, Game game) { + if (game.getPhase().getStep().getType() == PhaseStep.END_TURN) { + if (game.getActivePlayerId().equals(source.getControllerId())) { + return true; + } + } + return false; + } + + @Override + public boolean apply(Game game, Ability source) { + return true; + } + + @Override + public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) { + if (targetPointer.getTargets(game, source).contains(sourceId)) { + return game.getState().getZone(sourceId).equals(Zone.EXILED); + } + return false; + } + +} diff --git a/Mage.Sets/src/mage/sets/dragonsoftarkir/DromokasCommand.java b/Mage.Sets/src/mage/sets/dragonsoftarkir/DromokasCommand.java new file mode 100644 index 0000000000..070a1dc56a --- /dev/null +++ b/Mage.Sets/src/mage/sets/dragonsoftarkir/DromokasCommand.java @@ -0,0 +1,114 @@ +/* + * 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.sets.dragonsoftarkir; + +import java.util.UUID; +import mage.abilities.Mode; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.FightTargetsEffect; +import mage.abilities.effects.common.PreventDamageByTargetEffect; +import mage.abilities.effects.common.SacrificeEffect; +import mage.abilities.effects.common.counter.AddCountersTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.TargetController; +import mage.counters.CounterType; +import mage.filter.FilterPermanent; +import mage.filter.FilterStackObject; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.predicate.permanent.ControllerPredicate; +import mage.target.TargetPlayer; +import mage.target.TargetStackObject; +import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author jeffwadsworth + */ +public class DromokasCommand extends CardImpl { + + private static final FilterStackObject filterInstantOrSorcery = new FilterStackObject("instant or sorcery spell"); + private static final FilterPermanent filterEnchantment = new FilterPermanent("enchantment"); + private static final FilterCreaturePermanent filterCreature = new FilterCreaturePermanent("creature to put the +1/+1 counter on"); + private static final FilterCreaturePermanent filterUncontrolledCreature = new FilterCreaturePermanent("creature you don't control"); + + static { + filterInstantOrSorcery.add(Predicates.or(new CardTypePredicate(CardType.INSTANT), + new CardTypePredicate(CardType.SORCERY))); + filterUncontrolledCreature.add(new ControllerPredicate(TargetController.NOT_YOU)); + } + + public DromokasCommand(UUID ownerId) { + super(ownerId, 221, "Dromoka's Command", Rarity.RARE, new CardType[]{CardType.INSTANT}, "{G}{W}"); + this.expansionSetCode = "DTK"; + + // Choose two - Prevent all damage target instant or sorcery spell would deal this turn; Target player sacrifices an enchantment; Put a +1/+1 counter on target creature; or Target creature you control fights target creature you don't control. + this.getSpellAbility().getModes().setMinModes(2); + this.getSpellAbility().getModes().setMaxModes(2); + + // Prevent all damage target instant or sorcery spell would deal this turn; + this.getSpellAbility().getEffects().add(new PreventDamageByTargetEffect(Duration.EndOfTurn)); + this.getSpellAbility().getTargets().add(new TargetStackObject(filterInstantOrSorcery)); + + // or Target player sacrifices an enchantment; + Mode mode = new Mode(); + mode.getEffects().add(new SacrificeEffect(filterEnchantment, 1, "target player")); + mode.getTargets().add(new TargetPlayer()); + this.getSpellAbility().getModes().addMode(mode); + + // Put a +1/+1 counter on target creature; + mode = new Mode(); + mode.getEffects().add(new AddCountersTargetEffect(CounterType.P1P1.createInstance())); + mode.getTargets().add(new TargetCreaturePermanent(filterCreature)); + this.getSpellAbility().getModes().addMode(mode); + + // or Target creature you control fights target creature you don't control. + mode = new Mode(); + Effect effect = new FightTargetsEffect(); + effect.setText("Target creature you control fights target creature you don't control"); + mode.getEffects().add(effect); + mode.getTargets().add(new TargetControlledCreaturePermanent()); + mode.getTargets().add(new TargetCreaturePermanent(filterUncontrolledCreature)); + this.getSpellAbility().getModes().addMode(mode); + + } + + public DromokasCommand(final DromokasCommand card) { + super(card); + } + + @Override + public DromokasCommand copy() { + return new DromokasCommand(this); + } +} diff --git a/Mage.Sets/src/mage/sets/dragonsoftarkir/HavenOfTheSpiritDragon.java b/Mage.Sets/src/mage/sets/dragonsoftarkir/HavenOfTheSpiritDragon.java new file mode 100644 index 0000000000..b8f4ce26ff --- /dev/null +++ b/Mage.Sets/src/mage/sets/dragonsoftarkir/HavenOfTheSpiritDragon.java @@ -0,0 +1,167 @@ +/* + * 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.sets.dragonsoftarkir; + +import java.util.UUID; +import mage.ConditionalMana; +import mage.MageObject; +import mage.Mana; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.SacrificeSourceCost; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.ReturnFromGraveyardToHandTargetEffect; +import mage.abilities.mana.ColorlessManaAbility; +import mage.abilities.mana.ConditionalAnyColorManaAbility; +import mage.abilities.mana.builder.ConditionalManaBuilder; +import mage.abilities.mana.conditional.CreatureCastManaCondition; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.FilterCard; +import mage.filter.predicate.Predicate; +import mage.filter.predicate.Predicates; +import mage.game.Game; +import mage.target.common.TargetCardInYourGraveyard; + +/** + * + * @author jeffwadsworth + */ +public class HavenOfTheSpiritDragon extends CardImpl { + + private static final FilterCard filter = new FilterCard("Dragon creature card or Ugin planeswalker card from your graveyard"); + + static { + filter.add(Predicates.or(new DragonCreatureCardPredicate(), + new UginPlaneswalkerCardPredicate())); + } + + public HavenOfTheSpiritDragon(UUID ownerId) { + super(ownerId, 249, "Haven of the Spirit Dragon", Rarity.RARE, new CardType[]{CardType.LAND}, ""); + this.expansionSetCode = "DTK"; + + // {T}: Add {1} to your mana pool. + this.addAbility(new ColorlessManaAbility()); + + // {T}: add one mana of any color to your mana pool. Spend this mana only to cast a Dragon creature spell. + this.addAbility(new ConditionalAnyColorManaAbility(new TapSourceCost(), 1, new HavenOfTheSpiritManaBuilder(), true)); + + // {2}, {T}, Sacrifice Haven of the Spirit Dragon: Return target Dragon creature card or Ugin planeswalker card from your graveyard to your hand. + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ReturnFromGraveyardToHandTargetEffect(), new ManaCostsImpl("{2}")); + ability.addCost(new TapSourceCost()); + ability.addCost(new SacrificeSourceCost()); + ability.addTarget(new TargetCardInYourGraveyard(filter)); + this.addAbility(ability); + + } + + public HavenOfTheSpiritDragon(final HavenOfTheSpiritDragon card) { + super(card); + } + + @Override + public HavenOfTheSpiritDragon copy() { + return new HavenOfTheSpiritDragon(this); + } +} + +class HavenOfTheSpiritManaBuilder extends ConditionalManaBuilder { + + @Override + public ConditionalMana build(Object... options) { + this.mana.setFlag(true); // indicates that the mana is from second ability + return new HavenOfTheSpiritConditionalMana(this.mana); + } + + @Override + public String getRule() { + return "Spend this mana only to cast a Dragon creature spell."; + } +} + +class HavenOfTheSpiritConditionalMana extends ConditionalMana { + + HavenOfTheSpiritConditionalMana(Mana mana) { + super(mana); + staticText = "Spend this mana only to cast a Dragon creature spell."; + addCondition(new HavenOfTheSpiritManaCondition()); + } +} + +class HavenOfTheSpiritManaCondition extends CreatureCastManaCondition { + + @Override + public boolean apply(Game game, Ability source, UUID manaProducer) { + if (super.apply(game, source)) { + MageObject object = game.getObject(source.getSourceId()); + if (object.hasSubtype("Dragon") + && object.getCardType().contains(CardType.CREATURE)) { + return true; + } + } + return false; + } +} + +class DragonCreatureCardPredicate implements Predicate { + + public DragonCreatureCardPredicate() { + } + + @Override + public boolean apply(Card input, Game game) { + return input.getCardType().contains(CardType.CREATURE) + && input.getSubtype().contains("Dragon"); + } + + @Override + public String toString() { + return ""; + } +} + +class UginPlaneswalkerCardPredicate implements Predicate { + + public UginPlaneswalkerCardPredicate() { + } + + @Override + public boolean apply(Card input, Game game) { + return input.getCardType().contains(CardType.PLANESWALKER) + && input.getName().contains("Ugin, the Spirit Dragon"); + } + + @Override + public String toString() { + return ""; + } +} diff --git a/Mage.Sets/src/mage/sets/dragonsoftarkir/SaltRoadAmbushers.java b/Mage.Sets/src/mage/sets/dragonsoftarkir/SaltRoadAmbushers.java new file mode 100644 index 0000000000..4c9094a5e2 --- /dev/null +++ b/Mage.Sets/src/mage/sets/dragonsoftarkir/SaltRoadAmbushers.java @@ -0,0 +1,100 @@ +/* + * 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.sets.dragonsoftarkir; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.TurnedFaceUpAllTriggeredAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.counter.AddCountersTargetEffect; +import mage.abilities.keyword.MorphAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.counters.CounterType; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.predicate.permanent.AnotherPredicate; + +/** + * + * @author fireshoes + */ +public class SaltRoadAmbushers extends CardImpl { + + public SaltRoadAmbushers(UUID ownerId) { + super(ownerId, 198, "Salt Road Ambushers", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{3}{G}"); + this.expansionSetCode = "DTK"; + this.subtype.add("Hound"); + this.subtype.add("Warrior"); + this.power = new MageInt(3); + this.toughness = new MageInt(3); + + // Whenever another permanent you control is turned face up, if it's a creature, put two +1/+1 counters on it. + this.addAbility(new SaltRoadAmbushersTriggeredAbility()); + + // Megamorph {3}{G}{G} + this.addAbility(new MorphAbility(this, new ManaCostsImpl("{3}{G}{G}"), true)); + } + + public SaltRoadAmbushers(final SaltRoadAmbushers card) { + super(card); + } + + @Override + public SaltRoadAmbushers copy() { + return new SaltRoadAmbushers(this); + } +} + +class SaltRoadAmbushersTriggeredAbility extends TurnedFaceUpAllTriggeredAbility { + + +private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("another permanent you control"); + + static { + filter.add(new AnotherPredicate()); + } + + public SaltRoadAmbushersTriggeredAbility() { + super(new AddCountersTargetEffect(CounterType.P1P1.createInstance(2)), filter, true); + } + + public SaltRoadAmbushersTriggeredAbility(final SaltRoadAmbushersTriggeredAbility ability) { + super(ability); + } + + @Override + public SaltRoadAmbushersTriggeredAbility copy() { + return new SaltRoadAmbushersTriggeredAbility(this); + } + + @Override + public String getRule() { + return "Whenever another permanent you control is turned face up, if it's a creature, put two +1/+1 counters on it."; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/dragonsoftarkir/ShorecrasherElemental.java b/Mage.Sets/src/mage/sets/dragonsoftarkir/ShorecrasherElemental.java index ddd21920b5..a5a297bcab 100644 --- a/Mage.Sets/src/mage/sets/dragonsoftarkir/ShorecrasherElemental.java +++ b/Mage.Sets/src/mage/sets/dragonsoftarkir/ShorecrasherElemental.java @@ -107,8 +107,7 @@ class ShorecrasherElementalEffect extends OneShotEffect { if (shorecrasherElemental.moveToExile(source.getSourceId(), "Shorecrasher Elemental", source.getSourceId(), game)) { Card card = game.getExile().getCard(source.getSourceId(), game); if (card != null) { - card.setFaceDown(true); - return card.moveToZone(Zone.BATTLEFIELD, source.getSourceId(), game, false); + return card.putOntoBattlefield(game, Zone.EXILED, source.getSourceId(), card.getOwnerId(), false, true); } } } diff --git a/Mage.Sets/src/mage/sets/fatereforged/GhastlyConscription.java b/Mage.Sets/src/mage/sets/fatereforged/GhastlyConscription.java index 34f0260ba1..5f8d251556 100644 --- a/Mage.Sets/src/mage/sets/fatereforged/GhastlyConscription.java +++ b/Mage.Sets/src/mage/sets/fatereforged/GhastlyConscription.java @@ -99,14 +99,12 @@ class GhastlyConscriptionEffect extends OneShotEffect { for(Card card: targetPlayer.getGraveyard().getCards(new FilterCreatureCard(), game)) { cardsToManifest.add(card); controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.GRAVEYARD); - card.setFaceDown(true); } Collections.shuffle(cardsToManifest); game.informPlayers(controller.getName() + " shuffles the face-down pile"); Ability newSource = source.copy(); newSource.setWorksFaceDown(true); for (Card card: cardsToManifest) { - card.setFaceDown(true); ManaCosts manaCosts = null; if (card.getCardType().contains(CardType.CREATURE)) { manaCosts = card.getSpellAbility().getManaCosts(); @@ -116,7 +114,7 @@ class GhastlyConscriptionEffect extends OneShotEffect { } MageObjectReference objectReference= new MageObjectReference(card.getId(), card.getZoneChangeCounter() +1, game); game.addEffect(new BecomesFaceDownCreatureEffect(manaCosts, objectReference, Duration.Custom, FaceDownType.MANIFESTED), newSource); - if (controller.putOntoBattlefieldWithInfo(card, game, Zone.EXILED, source.getSourceId())) { + if (controller.putOntoBattlefieldWithInfo(card, game, Zone.EXILED, source.getSourceId(), false, true)) { game.informPlayers(new StringBuilder(controller.getName()) .append(" puts facedown card from exile onto the battlefield").toString()); } diff --git a/Mage.Sets/src/mage/sets/fatereforged/JeskaiInfiltrator.java b/Mage.Sets/src/mage/sets/fatereforged/JeskaiInfiltrator.java index 30aea7685e..b1e7ad2abd 100644 --- a/Mage.Sets/src/mage/sets/fatereforged/JeskaiInfiltrator.java +++ b/Mage.Sets/src/mage/sets/fatereforged/JeskaiInfiltrator.java @@ -114,12 +114,10 @@ class JeskaiInfiltratorEffect extends OneShotEffect { Card sourceCard = game.getCard(source.getSourceId()); if (sourcePermanent != null && sourceCard != null) { player.moveCardToExileWithInfo(sourcePermanent, sourcePermanent.getId(), sourcePermanent.getName(), source.getSourceId(), game, Zone.BATTLEFIELD); - sourceCard.setFaceDown(true); cardsToManifest.add(sourceCard); } if (sourcePermanent!= null && player.getLibrary().size() > 0) { Card cardFromLibrary = player.getLibrary().removeFromTop(game); - cardFromLibrary.setFaceDown(true); player.moveCardToExileWithInfo(cardFromLibrary, sourcePermanent.getId(), sourcePermanent.getName(), source.getSourceId(), game, Zone.LIBRARY); cardsToManifest.add(cardFromLibrary); } @@ -128,7 +126,6 @@ class JeskaiInfiltratorEffect extends OneShotEffect { Ability newSource = source.copy(); newSource.setWorksFaceDown(true); for (Card card : cardsToManifest) { - card.setFaceDown(true); ManaCosts manaCosts = null; if (card.getCardType().contains(CardType.CREATURE)) { manaCosts = card.getSpellAbility().getManaCosts(); @@ -138,7 +135,7 @@ class JeskaiInfiltratorEffect extends OneShotEffect { } MageObjectReference objectReference= new MageObjectReference(card.getId(), card.getZoneChangeCounter() +1, game); game.addEffect(new BecomesFaceDownCreatureEffect(manaCosts, objectReference, Duration.Custom, FaceDownType.MANIFESTED), newSource); - if (card.moveToZone(Zone.BATTLEFIELD, newSource.getSourceId(), game, false)) { + if (player.putOntoBattlefieldWithInfo(card, game, Zone.EXILED, source.getSourceId(), false, true)) { game.informPlayers(new StringBuilder(player.getName()) .append(" puts facedown card from exile onto the battlefield").toString()); } diff --git a/Mage.Sets/src/mage/sets/fifthdawn/SummonersEgg.java b/Mage.Sets/src/mage/sets/fifthdawn/SummonersEgg.java index ecb14fc543..80d44e2422 100644 --- a/Mage.Sets/src/mage/sets/fifthdawn/SummonersEgg.java +++ b/Mage.Sets/src/mage/sets/fifthdawn/SummonersEgg.java @@ -97,8 +97,8 @@ class SummonersEggImprintEffect extends OneShotEffect { && controller.choose(Outcome.Benefit, controller.getHand(), target, game)) { Card card = controller.getHand().get(target.getFirstTarget(), game); if (card != null) { - card.setFaceDown(true); controller.moveCardToExileWithInfo(card, source.getSourceId(), sourcePermanent.getLogName() +" (Imprint)", source.getSourceId(), game, Zone.HAND); + card.setFaceDown(true, game); Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { permanent.imprint(card.getId(), game); diff --git a/Mage.Sets/src/mage/sets/fifthedition/PrimalClay.java b/Mage.Sets/src/mage/sets/fifthedition/PrimalClay.java index 86e783c8e3..a1db6a6bac 100644 --- a/Mage.Sets/src/mage/sets/fifthedition/PrimalClay.java +++ b/Mage.Sets/src/mage/sets/fifthedition/PrimalClay.java @@ -105,7 +105,7 @@ class PrimalPlasmaReplacementEffect extends ReplacementEffectImpl { public boolean applies(GameEvent event, Ability source, Game game) { if (event.getTargetId().equals(source.getSourceId())) { Permanent sourcePermanent = game.getPermanent(source.getSourceId()); - if (sourcePermanent != null && !sourcePermanent.isFaceDown()) { + if (sourcePermanent != null && !sourcePermanent.isFaceDown(game)) { return true; } } diff --git a/Mage.Sets/src/mage/sets/gatecrash/BaneAlleyBroker.java b/Mage.Sets/src/mage/sets/gatecrash/BaneAlleyBroker.java index a4ec98fd2e..bff58c49db 100644 --- a/Mage.Sets/src/mage/sets/gatecrash/BaneAlleyBroker.java +++ b/Mage.Sets/src/mage/sets/gatecrash/BaneAlleyBroker.java @@ -146,8 +146,10 @@ class BaneAlleyBrokerDrawExileEffect extends OneShotEffect { Card card = game.getCard(target.getFirstTarget()); MageObject sourceObject = game.getObject(source.getSourceId()); if (card != null && sourceObject != null) { - card.setFaceDown(true); - return card.moveToExile(CardUtil.getCardExileZoneId(game, source), new StringBuilder(sourceObject.getLogName()).toString(), source.getSourceId(), game); + if (card.moveToExile(CardUtil.getCardExileZoneId(game, source), new StringBuilder(sourceObject.getLogName()).toString(), source.getSourceId(), game)) { + card.setFaceDown(true, game); + return true; + } } } } diff --git a/Mage.Sets/src/mage/sets/iceage/Necropotence.java b/Mage.Sets/src/mage/sets/iceage/Necropotence.java index 4780c1fc63..fea8b3cfd2 100644 --- a/Mage.Sets/src/mage/sets/iceage/Necropotence.java +++ b/Mage.Sets/src/mage/sets/iceage/Necropotence.java @@ -136,8 +136,8 @@ class NecropotenceEffect extends OneShotEffect { if (controller != null) { if (controller.getLibrary().size() > 0) { Card card = controller.getLibrary().removeFromTop(game); - card.setFaceDown(true); if (controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.LIBRARY)) { + card.setFaceDown(true, game); Effect returnToHandeffect = new ReturnToHandTargetEffect(); returnToHandeffect.setText("put that face down card into your hand"); returnToHandeffect.setTargetPointer(new FixedTarget(card.getId())); diff --git a/Mage.Sets/src/mage/sets/invasion/CursedFlesh.java b/Mage.Sets/src/mage/sets/invasion/CursedFlesh.java index d0a00e7ab2..33ff2ca394 100644 --- a/Mage.Sets/src/mage/sets/invasion/CursedFlesh.java +++ b/Mage.Sets/src/mage/sets/invasion/CursedFlesh.java @@ -29,6 +29,7 @@ package mage.sets.invasion; import java.util.UUID; import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.common.AttachEffect; import mage.abilities.effects.common.continuous.BoostEnchantedEffect; @@ -64,10 +65,9 @@ public class CursedFlesh extends CardImpl { this.addAbility(ability); // Enchanted creature gets -1/-1 and has fear. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEnchantedEffect(-1, -1, Duration.WhileOnBattlefield))); - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(FearAbility.getInstance(), AttachmentType.AURA))); - - + ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEnchantedEffect(-1, -1, Duration.WhileOnBattlefield)); + ability.addEffect(new GainAbilityAttachedEffect(FearAbility.getInstance(), AttachmentType.AURA, Duration.WhileOnBattlefield, "and has fear")); + this.addAbility(ability); } public CursedFlesh(final CursedFlesh card) { diff --git a/Mage.Sets/src/mage/sets/invasion/SunscapeMaster.java b/Mage.Sets/src/mage/sets/invasion/SunscapeMaster.java index def28bde62..d89037c0b5 100644 --- a/Mage.Sets/src/mage/sets/invasion/SunscapeMaster.java +++ b/Mage.Sets/src/mage/sets/invasion/SunscapeMaster.java @@ -59,7 +59,7 @@ public class SunscapeMaster extends CardImpl { // {G}{G}, {tap}: Creatures you control get +2/+2 until end of turn. Effect effect1 = new BoostControlledEffect(2, 2, Duration.EndOfTurn); - effect1.setText("Creatures you control get +2/+2"); + effect1.setText("Creatures you control get +2/+2 until end of turn"); Ability ability1 = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect1, new ManaCostsImpl("{G}{G}")); ability1.addCost(new TapSourceCost()); this.addAbility(ability1); diff --git a/Mage.Sets/src/mage/sets/invasion/YavimayaKavu.java b/Mage.Sets/src/mage/sets/invasion/YavimayaKavu.java index 8ff3da3a1a..c6246778f3 100644 --- a/Mage.Sets/src/mage/sets/invasion/YavimayaKavu.java +++ b/Mage.Sets/src/mage/sets/invasion/YavimayaKavu.java @@ -48,8 +48,8 @@ import mage.filter.predicate.mageobject.ColorPredicate; */ public class YavimayaKavu extends CardImpl { - private static final FilterCreaturePermanent filterGreenCreature = new FilterCreaturePermanent("Green"); - private static final FilterCreaturePermanent filterRedCreature = new FilterCreaturePermanent("Red"); + private static final FilterCreaturePermanent filterGreenCreature = new FilterCreaturePermanent("green creatures on the battlefield"); + private static final FilterCreaturePermanent filterRedCreature = new FilterCreaturePermanent("red creatures on the battlefield"); static { filterGreenCreature.add(new ColorPredicate(ObjectColor.GREEN)); diff --git a/Mage.Sets/src/mage/sets/khansoftarkir/AshcloudPhoenix.java b/Mage.Sets/src/mage/sets/khansoftarkir/AshcloudPhoenix.java index fadc4cae4c..5a03885f3d 100644 --- a/Mage.Sets/src/mage/sets/khansoftarkir/AshcloudPhoenix.java +++ b/Mage.Sets/src/mage/sets/khansoftarkir/AshcloudPhoenix.java @@ -112,8 +112,7 @@ class AshcloudPhoenixEffect extends OneShotEffect { if (card != null) { Player owner = game.getPlayer(card.getOwnerId()); if (owner != null && owner.getGraveyard().contains(card.getId())) { - card.setFaceDown(true); - player.putOntoBattlefieldWithInfo(card, game, Zone.GRAVEYARD, source.getSourceId()); + player.putOntoBattlefieldWithInfo(card, game, Zone.GRAVEYARD, source.getSourceId(), false, true); } } return true; diff --git a/Mage.Sets/src/mage/sets/khansoftarkir/EfreetWeaponmaster.java b/Mage.Sets/src/mage/sets/khansoftarkir/EfreetWeaponmaster.java index 3a41006dd8..cae5e775c3 100644 --- a/Mage.Sets/src/mage/sets/khansoftarkir/EfreetWeaponmaster.java +++ b/Mage.Sets/src/mage/sets/khansoftarkir/EfreetWeaponmaster.java @@ -120,7 +120,7 @@ class EfreetWeaponmasterAbility extends TriggeredAbilityImpl { } if (event.getType() == EventType.ENTERS_THE_BATTLEFIELD && event.getTargetId().equals(this.getSourceId()) ) { Permanent sourcePermanent = game.getPermanent(getSourceId()); - if (sourcePermanent != null && !sourcePermanent.isFaceDown()) { + if (sourcePermanent != null && !sourcePermanent.isFaceDown(game)) { return true; } } diff --git a/Mage.Sets/src/mage/sets/khansoftarkir/HoodedHydra.java b/Mage.Sets/src/mage/sets/khansoftarkir/HoodedHydra.java index d5e3ab1d6a..c4762f8719 100644 --- a/Mage.Sets/src/mage/sets/khansoftarkir/HoodedHydra.java +++ b/Mage.Sets/src/mage/sets/khansoftarkir/HoodedHydra.java @@ -111,7 +111,7 @@ class HoodedHydraEffect1 extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getSourceId()); - if (permanent != null && !permanent.isFaceDown()) { + if (permanent != null && !permanent.isFaceDown(game)) { Object obj = getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY); if (obj != null && obj instanceof SpellAbility) { int amount = ((SpellAbility) obj).getManaCostsToPay().getX(); diff --git a/Mage.Sets/src/mage/sets/khansoftarkir/LensOfClarity.java b/Mage.Sets/src/mage/sets/khansoftarkir/LensOfClarity.java index 3546d190a3..e20963a0d1 100644 --- a/Mage.Sets/src/mage/sets/khansoftarkir/LensOfClarity.java +++ b/Mage.Sets/src/mage/sets/khansoftarkir/LensOfClarity.java @@ -184,7 +184,7 @@ class LensOfClarityLookFaceDownEffect extends OneShotEffect { Permanent faceDownCreature = game.getPermanent(getTargetPointer().getFirst(game, source)); if (faceDownCreature != null) { Permanent copyFaceDown = faceDownCreature.copy(); - copyFaceDown.setFaceDown(false); + copyFaceDown.setFaceDown(false, game); Cards cards = new CardsImpl(); cards.add(copyFaceDown); Player player = game.getPlayer(faceDownCreature.getControllerId()); diff --git a/Mage.Sets/src/mage/sets/khansoftarkir/PonybackBrigade.java b/Mage.Sets/src/mage/sets/khansoftarkir/PonybackBrigade.java index 8fa6373223..d81f97c68f 100644 --- a/Mage.Sets/src/mage/sets/khansoftarkir/PonybackBrigade.java +++ b/Mage.Sets/src/mage/sets/khansoftarkir/PonybackBrigade.java @@ -107,7 +107,7 @@ class PonybackBrigadeAbility extends TriggeredAbilityImpl { } if (event.getType() == EventType.ENTERS_THE_BATTLEFIELD && event.getTargetId().equals(this.getSourceId()) ) { Permanent sourcePermanent = game.getPermanent(getSourceId()); - if (sourcePermanent != null && !sourcePermanent.isFaceDown()) { + if (sourcePermanent != null && !sourcePermanent.isFaceDown(game)) { return true; } } diff --git a/Mage.Sets/src/mage/sets/khansoftarkir/SmokeTeller.java b/Mage.Sets/src/mage/sets/khansoftarkir/SmokeTeller.java index 2cffd93713..7c00d2fb3f 100644 --- a/Mage.Sets/src/mage/sets/khansoftarkir/SmokeTeller.java +++ b/Mage.Sets/src/mage/sets/khansoftarkir/SmokeTeller.java @@ -112,7 +112,7 @@ class SmokeTellerLookFaceDownEffect extends OneShotEffect { Permanent faceDownCreature = game.getPermanent(getTargetPointer().getFirst(game, source)); if (faceDownCreature != null) { Permanent copyFaceDown = faceDownCreature.copy(); - copyFaceDown.setFaceDown(false); + copyFaceDown.setFaceDown(false, game); Cards cards = new CardsImpl(); cards.add(copyFaceDown); player.lookAtCards("face down card - " + mageObject.getLogName(), cards, game); diff --git a/Mage.Sets/src/mage/sets/magic2010/MirrorOfFate.java b/Mage.Sets/src/mage/sets/magic2010/MirrorOfFate.java index 03b18ddd4d..501a3d8baf 100644 --- a/Mage.Sets/src/mage/sets/magic2010/MirrorOfFate.java +++ b/Mage.Sets/src/mage/sets/magic2010/MirrorOfFate.java @@ -136,7 +136,7 @@ class FaceUpPredicate implements Predicate { @Override public boolean apply(Card input, Game game) { - return !input.isFaceDown(); + return !input.isFaceDown(game); } @Override diff --git a/Mage.Sets/src/mage/sets/newphyrexia/PraetorsGrasp.java b/Mage.Sets/src/mage/sets/newphyrexia/PraetorsGrasp.java index 156ebe3ed2..ca58c5fd1c 100644 --- a/Mage.Sets/src/mage/sets/newphyrexia/PraetorsGrasp.java +++ b/Mage.Sets/src/mage/sets/newphyrexia/PraetorsGrasp.java @@ -105,9 +105,9 @@ class PraetorsGraspEffect extends OneShotEffect { Card card = opponent.getLibrary().getCard(targetId, game); UUID exileId = CardUtil.getObjectExileZoneId(game, sourceObject); if (card != null && exileId != null) { - card.setFaceDown(true); game.informPlayers(controller.getName() + " moves the searched card face down to exile"); card.moveToExile(exileId, sourceObject.getName(), source.getSourceId(), game); + card.setFaceDown(true, game); game.addEffect(new PraetorsGraspPlayEffect(card.getId()), source); game.addEffect(new PraetorsGraspRevealEffect(card.getId()), source); } diff --git a/Mage.Sets/src/mage/sets/planechase2012/PrimalPlasma.java b/Mage.Sets/src/mage/sets/planechase2012/PrimalPlasma.java index 5c737db700..f448b9501c 100644 --- a/Mage.Sets/src/mage/sets/planechase2012/PrimalPlasma.java +++ b/Mage.Sets/src/mage/sets/planechase2012/PrimalPlasma.java @@ -106,7 +106,7 @@ class PrimalPlasmaReplacementEffect extends ReplacementEffectImpl { public boolean applies(GameEvent event, Ability source, Game game) { if (event.getTargetId().equals(source.getSourceId())) { Permanent sourcePermanent = game.getPermanent(source.getSourceId()); - if (sourcePermanent != null && !sourcePermanent.isFaceDown()) { + if (sourcePermanent != null && !sourcePermanent.isFaceDown(game)) { return true; } } diff --git a/Mage.Sets/src/mage/sets/ravnica/BottledCloister.java b/Mage.Sets/src/mage/sets/ravnica/BottledCloister.java index 403f5334ef..1abbb400e6 100644 --- a/Mage.Sets/src/mage/sets/ravnica/BottledCloister.java +++ b/Mage.Sets/src/mage/sets/ravnica/BottledCloister.java @@ -101,8 +101,8 @@ class BottledCloisterExileEffect extends OneShotEffect { if (numberOfCards > 0) { UUID exileId = CardUtil.getCardExileZoneId(game, source); for (Card card: controller.getHand().getCards(game)) { - card.setFaceDown(true); card.moveToExile(exileId, sourcePermanent.getName(), source.getSourceId(), game); + card.setFaceDown(true, game); } game.informPlayers(sourcePermanent.getName() + ": " + controller.getName() + " exiles his or her hand face down (" + numberOfCards + "card" + (numberOfCards > 1 ?"s":"") +")"); } @@ -140,8 +140,8 @@ class BottledCloisterReturnEffect extends OneShotEffect { for (Card card: exileZone.getCards(game)) { if (card.getOwnerId().equals(controller.getId())) { numberOfCards++; - card.setFaceDown(false); card.moveToZone(Zone.HAND, source.getSourceId(), game, true); + card.setFaceDown(false, game); } } } diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/CloneShell.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/CloneShell.java index 135cf640a8..b200bd833e 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/CloneShell.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/CloneShell.java @@ -113,8 +113,8 @@ class CloneShellEffect extends OneShotEffect { Card card = cards.get(target1.getFirstTarget(), game); if (card != null) { cards.remove(card); - card.setFaceDown(true); card.moveToExile(getId(), "Clone Shell (Imprint)", source.getSourceId(), game); + card.setFaceDown(true, game); Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { permanent.imprint(card.getId(), game); @@ -166,7 +166,7 @@ class CloneShellDiesEffect extends OneShotEffect { List imprinted = permanent.getImprinted(); if (imprinted.size() > 0) { Card imprintedCard = game.getCard(imprinted.get(0)); - imprintedCard.setFaceDown(false); + imprintedCard.setFaceDown(false, game); if (imprintedCard.getCardType().contains(CardType.CREATURE)) { imprintedCard.putOntoBattlefield(game, Zone.EXILED, source.getSourceId(), source.getControllerId()); } diff --git a/Mage.Sets/src/mage/sets/speedvscunning/AquamorphEntity.java b/Mage.Sets/src/mage/sets/speedvscunning/AquamorphEntity.java index fe236f7b99..be0377d3d7 100644 --- a/Mage.Sets/src/mage/sets/speedvscunning/AquamorphEntity.java +++ b/Mage.Sets/src/mage/sets/speedvscunning/AquamorphEntity.java @@ -115,7 +115,7 @@ class AquamorphEntityReplacementEffect extends ReplacementEffectImpl { if (event.getType() == EventType.ENTERS_THE_BATTLEFIELD) { if (event.getTargetId().equals(source.getSourceId())) { Permanent sourcePermanent = game.getPermanent(source.getSourceId()); - if (sourcePermanent != null && !sourcePermanent.isFaceDown()) { + if (sourcePermanent != null && !sourcePermanent.isFaceDown(game)) { return true; } } diff --git a/Mage.Sets/src/mage/sets/tempest/ScrollRack.java b/Mage.Sets/src/mage/sets/tempest/ScrollRack.java index 2bc6be045d..455dc63578 100644 --- a/Mage.Sets/src/mage/sets/tempest/ScrollRack.java +++ b/Mage.Sets/src/mage/sets/tempest/ScrollRack.java @@ -101,8 +101,8 @@ class ScrollRackEffect extends OneShotEffect { for (UUID targetId : targets) { Card card = game.getCard(targetId); if (card != null) { - card.setFaceDown(true); if (card.moveToExile(source.getSourceId(), sourceObject.getLogName(), source.getSourceId(), game)) { + card.setFaceDown(true, game); amountExiled++; } } diff --git a/Mage.Sets/src/mage/sets/theros/PyxisOfPandemonium.java b/Mage.Sets/src/mage/sets/theros/PyxisOfPandemonium.java index bf5dbd4492..4045b5f7ef 100644 --- a/Mage.Sets/src/mage/sets/theros/PyxisOfPandemonium.java +++ b/Mage.Sets/src/mage/sets/theros/PyxisOfPandemonium.java @@ -122,10 +122,10 @@ class PyxisOfPandemoniumExileEffect extends OneShotEffect { exileId = UUID.randomUUID(); exileIds.put(exileKey, exileId); } - card.setFaceDown(true); player.moveCardToExileWithInfo(card, exileId, new StringBuilder(sourceObject.getLogName() +" (").append(player.getName()).append(")").toString(), source.getSourceId(), game, Zone.LIBRARY); + card.setFaceDown(true, game); } } } @@ -173,7 +173,7 @@ class PyxisOfPandemoniumPutOntoBattlefieldEffect extends OneShotEffect { ExileZone exileZone = game.getState().getExile().getExileZone(exileId); if (exileZone != null) { for(Card card: exileZone.getCards(game)) { - card.setFaceDown(false); +// card.setFaceDown(false, game); if (CardUtil.isPermanentCard(card)) { player.putOntoBattlefieldWithInfo(card, game, Zone.EXILED, source.getSourceId()); } diff --git a/Mage.Sets/src/mage/sets/theros/RescueFromTheUnderworld.java b/Mage.Sets/src/mage/sets/theros/RescueFromTheUnderworld.java index f53eb0db14..00e2299d9b 100644 --- a/Mage.Sets/src/mage/sets/theros/RescueFromTheUnderworld.java +++ b/Mage.Sets/src/mage/sets/theros/RescueFromTheUnderworld.java @@ -248,7 +248,7 @@ class RescueFromTheUnderworldReturnEffect extends OneShotEffect { if (source.getTargets().get(1) != null) { for (UUID targetId: ((Target) source.getTargets().get(1)).getTargets()) { Card card = game.getCard(targetId); - if (card != null && !card.isFaceDown()) { + if (card != null && !card.isFaceDown(game)) { Player player = game.getPlayer(card.getOwnerId()); if (player != null) { Zone currentZone = game.getState().getZone(card.getId()); diff --git a/Mage.Sets/src/mage/sets/urzaslegacy/MemoryJar.java b/Mage.Sets/src/mage/sets/urzaslegacy/MemoryJar.java index aad24e856f..1387ec5084 100644 --- a/Mage.Sets/src/mage/sets/urzaslegacy/MemoryJar.java +++ b/Mage.Sets/src/mage/sets/urzaslegacy/MemoryJar.java @@ -107,8 +107,8 @@ class MemoryJarEffect extends OneShotEffect { Card card = hand.get(hand.iterator().next(), game); if(card != null) { - card.setFaceDown(true); card.moveToExile(getId(), "Memory Jar", source.getSourceId(), game); + card.setFaceDown(true, game); cards.add(card); } } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/ManifestTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/ManifestTest.java index 5cb26d5935..97f0aca9f5 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/ManifestTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/ManifestTest.java @@ -247,7 +247,7 @@ public class ManifestTest extends CardTestPlayerBase { for (Card card :currentGame.getExile().getAllCards(currentGame)){ if (card.getName().equals("Gore Swine")) { - Assert.assertTrue("Gore Swine may not be face down in exile", !card.isFaceDown()); + Assert.assertTrue("Gore Swine may not be face down in exile", !card.isFaceDown(currentGame)); } } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/facedown/BaneAlleyBrokerTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/facedown/BaneAlleyBrokerTest.java new file mode 100644 index 0000000000..025c46e4f3 --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/facedown/BaneAlleyBrokerTest.java @@ -0,0 +1,55 @@ +package org.mage.test.cards.facedown; + +import mage.cards.Card; +import mage.constants.PhaseStep; +import mage.constants.Zone; +import mage.game.ExileZone; +import org.junit.Assert; +import static org.junit.Assert.assertTrue; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + +/** + * @author BetaSteward + */ +public class BaneAlleyBrokerTest extends CardTestPlayerBase { + + /** + * Bane Alley Broker + * Creature — Human Rogue 0/3, 1UB (3) + * {T}: Draw a card, then exile a card from your hand face down. + * You may look at cards exiled with Bane Alley Broker. + * {U}{B}, {T}: Return a card exiled with Bane Alley Broker to its owner's hand. + * + */ + + // test that cards exiled using Bane Alley Broker are face down + @Test + public void testBaneAlleyBroker() { + addCard(Zone.BATTLEFIELD, playerA, "Bane Alley Broker"); + addCard(Zone.HAND, playerA, "Goblin Roughrider"); + addCard(Zone.HAND, playerA, "Sejiri Merfolk"); + addCard(Zone.BATTLEFIELD, playerA, "Island"); + addCard(Zone.BATTLEFIELD, playerA, "Swamp"); + + activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Draw a card, then exile a card from your hand face down."); + addTarget(playerA, "Goblin Roughrider"); + + setStopAt(1, PhaseStep.BEGIN_COMBAT); + execute(); + + assertHandCount(playerA, 2); + assertHandCount(playerA, "Sejiri Merfolk", 1); + assertHandCount(playerA, "Goblin Roughrider", 0); + + assertExileCount("Goblin Roughrider", 1); + + for (Card card :currentGame.getExile().getAllCards(currentGame)){ + if (card.getName().equals("Goblin Roughrider")) { + Assert.assertTrue("Exiled card is not face down", card.isFaceDown(currentGame)); + } + } + + } + +} diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/facedown/GhastlyConscriptionTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/facedown/GhastlyConscriptionTest.java new file mode 100644 index 0000000000..638ac645a7 --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/facedown/GhastlyConscriptionTest.java @@ -0,0 +1,45 @@ +package org.mage.test.cards.facedown; + +import mage.constants.PhaseStep; +import mage.constants.Zone; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + +/** + * @author BetaSteward + */ +public class GhastlyConscriptionTest extends CardTestPlayerBase { + + /** + * Ghastly Conscription + * Sorcery, 5BB (7) + * Exile all creature cards from target player's graveyard in a face-down pile, + * shuffle that pile, then manifest those cards. (To manifest a card, put it + * onto the battlefield face down as a 2/2 creature. Turn it face up any time + * for its mana cost if it's a creature card.) + * + */ + + // test that cards exiled using Ghastly Conscription return face down + @Test + public void testGhastlyConscription() { + addCard(Zone.BATTLEFIELD, playerA, "Swamp", 7); + addCard(Zone.HAND, playerA, "Ghastly Conscription"); + addCard(Zone.GRAVEYARD, playerA, "Ashcloud Phoenix"); + addCard(Zone.GRAVEYARD, playerA, "Goblin Roughrider"); + addCard(Zone.GRAVEYARD, playerA, "Island"); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Ghastly Conscription", playerA); + + setStopAt(1, PhaseStep.BEGIN_COMBAT); + execute(); + + assertLife(playerA, 20); + assertLife(playerB, 20); + + assertGraveyardCount(playerA, 2); + assertPermanentCount(playerA, "face down creature", 2); + + } + +} diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/facedown/SummonersEggTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/facedown/SummonersEggTest.java new file mode 100644 index 0000000000..4213b6ffb8 --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/facedown/SummonersEggTest.java @@ -0,0 +1,117 @@ +package org.mage.test.cards.facedown; + +import mage.cards.Card; +import mage.constants.PhaseStep; +import mage.constants.Zone; +import mage.game.ExileZone; +import mage.game.permanent.Permanent; +import org.junit.Assert; +import static org.junit.Assert.assertTrue; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + +/** + * @author BetaSteward + */ +public class SummonersEggTest extends CardTestPlayerBase { + + /** + * Summoner's Egg + * Artifact Creature — Construct 0/4, 4 (4) + * Imprint — When Summoner's Egg enters the battlefield, you may exile a + * card from your hand face down. + * When Summoner's Egg dies, turn the exiled card face up. If it's a creature + * card, put it onto the battlefield under your control. + * + */ + + // test that cards imprinted using Summoner's Egg are face down + @Test + public void testSummonersEggImprint() { + addCard(Zone.HAND, playerA, "Summoner's Egg"); + addCard(Zone.HAND, playerA, "Sejiri Merfolk"); + addCard(Zone.HAND, playerA, "Goblin Roughrider"); + addCard(Zone.BATTLEFIELD, playerA, "Island", 4); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Summoner's Egg"); + + setStopAt(1, PhaseStep.BEGIN_COMBAT); + execute(); + + assertHandCount(playerA, 1); + assertHandCount(playerA, "Sejiri Merfolk", 1); + assertHandCount(playerA, "Goblin Roughrider", 0); + + assertExileCount("Goblin Roughrider", 1); + for (Card card :currentGame.getExile().getAllCards(currentGame)){ + if (card.getName().equals("Goblin Roughrider")) { + Assert.assertTrue("Exiled card is not face down", card.isFaceDown(currentGame)); + } + } + + } + + // test that creature cards imprinted using Summoner's Egg are put in play face up + @Test + public void testSummonersEggDies() { + addCard(Zone.HAND, playerA, "Summoner's Egg"); + addCard(Zone.HAND, playerA, "Sejiri Merfolk"); + addCard(Zone.HAND, playerA, "Goblin Roughrider"); + addCard(Zone.BATTLEFIELD, playerA, "Island", 4); + addCard(Zone.HAND, playerB, "Char"); + addCard(Zone.BATTLEFIELD, playerB, "Mountain", 3); + + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Summoner's Egg"); + castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Char", "Summoner's Egg"); + + setStopAt(1, PhaseStep.END_TURN); + execute(); + + assertHandCount(playerA, 1); + assertHandCount(playerA, "Sejiri Merfolk", 1); + assertHandCount(playerA, "Goblin Roughrider", 0); + + assertGraveyardCount(playerA, "Summoner's Egg", 1); + + assertExileCount("Goblin Roughrider", 0); + assertPermanentCount(playerA, "Goblin Roughrider", 1); + for (Permanent p :currentGame.getBattlefield().getAllActivePermanents()){ + if (p.getName().equals("Goblin Roughrider")) { + Assert.assertTrue("Permanent is not face up", !p.isFaceDown(currentGame)); + } + } + + } + + // test that non-creature cards imprinted using Summoner's Egg are left in exile face up + @Test + public void testSummonersEggDies2() { + addCard(Zone.HAND, playerA, "Summoner's Egg"); + addCard(Zone.HAND, playerA, "Forest", 2); + addCard(Zone.BATTLEFIELD, playerA, "Island", 4); + addCard(Zone.HAND, playerB, "Char"); + addCard(Zone.BATTLEFIELD, playerB, "Mountain", 3); + + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Summoner's Egg"); + castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Char", "Summoner's Egg"); + + setStopAt(1, PhaseStep.END_TURN); + execute(); + + assertHandCount(playerA, 1); + assertHandCount(playerA, "Forest", 1); + + assertGraveyardCount(playerA, "Summoner's Egg", 1); + + assertExileCount("Forest", 1); + for (Card card :currentGame.getExile().getAllCards(currentGame)){ + if (card.getName().equals("Forest")) { + Assert.assertTrue("Exiled card is not face up", !card.isFaceDown(currentGame)); + } + } + + } + +} diff --git a/Mage/src/mage/abilities/AbilityImpl.java b/Mage/src/mage/abilities/AbilityImpl.java index ae3f30b82f..ea2cca5004 100644 --- a/Mage/src/mage/abilities/AbilityImpl.java +++ b/Mage/src/mage/abilities/AbilityImpl.java @@ -860,7 +860,7 @@ public abstract class AbilityImpl implements Ability { return false; } } else if (object instanceof PermanentCard) { - if (((PermanentCard)object).isFaceDown()&& !this.getWorksFaceDown()) { + if (((PermanentCard)object).isFaceDown(game)&& !this.getWorksFaceDown()) { return false; } } diff --git a/Mage/src/mage/abilities/TriggeredAbilities.java b/Mage/src/mage/abilities/TriggeredAbilities.java index f48a5745d6..b3b341c8ab 100644 --- a/Mage/src/mage/abilities/TriggeredAbilities.java +++ b/Mage/src/mage/abilities/TriggeredAbilities.java @@ -95,28 +95,6 @@ public class TriggeredAbilities extends ConcurrentHashMap cards = controller.getLibrary().getTopCards(game, amount); for (Card card: cards) { - card.setFaceDown(true); ManaCosts manaCosts = null; if (card.getCardType().contains(CardType.CREATURE)) { manaCosts = card.getSpellAbility().getManaCosts(); @@ -89,7 +88,7 @@ public class ManifestEffect extends OneShotEffect { } MageObjectReference objectReference= new MageObjectReference(card.getId(), card.getZoneChangeCounter() +1, game); game.addEffect(new BecomesFaceDownCreatureEffect(manaCosts, objectReference, Duration.Custom, FaceDownType.MANIFESTED), newSource); - controller.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, newSource.getSourceId()); + controller.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, newSource.getSourceId(), false, true); Permanent permanent = game.getPermanent(card.getId()); if (permanent != null) { permanent.setManifested(true); diff --git a/Mage/src/mage/abilities/effects/keyword/ManifestTargetPlayerEffect.java b/Mage/src/mage/abilities/effects/keyword/ManifestTargetPlayerEffect.java index 565f5e9f41..4f4de17935 100644 --- a/Mage/src/mage/abilities/effects/keyword/ManifestTargetPlayerEffect.java +++ b/Mage/src/mage/abilities/effects/keyword/ManifestTargetPlayerEffect.java @@ -83,7 +83,6 @@ public class ManifestTargetPlayerEffect extends OneShotEffect { newSource.setWorksFaceDown(true); List cards = targetPlayer.getLibrary().getTopCards(game, amount); for (Card card: cards) { - card.setFaceDown(true); ManaCosts manaCosts = null; if (card.getCardType().contains(CardType.CREATURE)) { manaCosts = card.getSpellAbility().getManaCosts(); @@ -93,7 +92,7 @@ public class ManifestTargetPlayerEffect extends OneShotEffect { } MageObjectReference objectReference= new MageObjectReference(card.getId(), card.getZoneChangeCounter() +1, game); game.addEffect(new BecomesFaceDownCreatureEffect(manaCosts, objectReference, Duration.Custom, FaceDownType.MANIFESTED), newSource); - targetPlayer.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, newSource.getSourceId()); + targetPlayer.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, newSource.getSourceId(), false, true); Permanent permanent = game.getPermanent(card.getId()); if (permanent != null) { permanent.setManifested(true); diff --git a/Mage/src/mage/abilities/keyword/HideawayAbility.java b/Mage/src/mage/abilities/keyword/HideawayAbility.java index f204dae032..83809b634e 100644 --- a/Mage/src/mage/abilities/keyword/HideawayAbility.java +++ b/Mage/src/mage/abilities/keyword/HideawayAbility.java @@ -130,10 +130,10 @@ class HideawayExileEffect extends OneShotEffect { Card card = cards.get(target1.getFirstTarget(), game); if (card != null) { cards.remove(card); - card.setFaceDown(true); card.moveToExile(CardUtil.getCardExileZoneId(game, source), new StringBuilder("Hideaway (").append(hideawaySource.getName()).append(")").toString(), source.getSourceId(), game); + card.setFaceDown(true, game); } target1.clearChosen(); } diff --git a/Mage/src/mage/abilities/keyword/MorphAbility.java b/Mage/src/mage/abilities/keyword/MorphAbility.java index 6fe4083dbc..ced4465661 100644 --- a/Mage/src/mage/abilities/keyword/MorphAbility.java +++ b/Mage/src/mage/abilities/keyword/MorphAbility.java @@ -122,7 +122,6 @@ public class MorphAbility extends StaticAbility implements AlternativeSourceCost super(Zone.HAND, null); this.morphCosts = morphCosts; this.megamorph = megamorph; - card.setMorphCard(true); this.setWorksFaceDown(true); StringBuilder sb = new StringBuilder(); if (megamorph) { @@ -203,7 +202,7 @@ public class MorphAbility extends StaticAbility implements AlternativeSourceCost Spell spell = game.getStack().getSpell(ability.getId()); if (player != null && spell != null) { this.resetMorph(); - spell.setFaceDown(true); // so only the back is visible + spell.setFaceDown(true, game); // so only the back is visible if (alternateCosts.canPay(ability, sourceId, controllerId, game)) { if (player.chooseUse(Outcome.Benefit, new StringBuilder("Cast this card as a 2/2 face-down creature for ").append(getCosts().getText()).append(" ?").toString(), game)) { activateMorph(game); @@ -226,7 +225,7 @@ public class MorphAbility extends StaticAbility implements AlternativeSourceCost spellColor.setWhite(false); spellColor.setBlue(false); } else { - spell.setFaceDown(false); + spell.setFaceDown(false, game); } } } diff --git a/Mage/src/mage/cards/Card.java b/Mage/src/mage/cards/Card.java index 50cc60e67c..e2fe537f0d 100644 --- a/Mage/src/mage/cards/Card.java +++ b/Mage/src/mage/cards/Card.java @@ -54,8 +54,8 @@ public interface Card extends MageObject { List getRules(Game game); // gets card rules + in game modifications String getExpansionSetCode(); String getTokenSetCode(); - void setFaceDown(boolean value); - boolean isFaceDown(); + void setFaceDown(boolean value, Game game); + boolean isFaceDown(Game game); boolean turnFaceUp(Game game, UUID playerId); boolean turnFaceDown(Game game, UUID playerId); boolean isFlipCard(); @@ -106,12 +106,12 @@ public interface Card extends MageObject { boolean cast(Game game, Zone fromZone, SpellAbility ability, UUID controllerId); boolean putOntoBattlefield(Game game, Zone fromZone, UUID sourceId, UUID controllerId); boolean putOntoBattlefield(Game game, Zone fromZone, UUID sourceId, UUID controllerId, boolean tapped); - boolean putOntoBattlefield(Game game, Zone fromZone, UUID sourceId, UUID controllerId, boolean tapped, ArrayList appliedEffects); + boolean putOntoBattlefield(Game game, Zone fromZone, UUID sourceId, UUID controllerId, boolean tapped, boolean facedown); + boolean putOntoBattlefield(Game game, Zone fromZone, UUID sourceId, UUID controllerId, boolean tapped, boolean facedown, ArrayList appliedEffects); List getMana(); void build(); - void setUsesVariousArt(boolean usesVariousArt); /** * * @return true if there exists various art images for this card @@ -127,9 +127,6 @@ public interface Card extends MageObject { void removeCounters(String name, int amount, Game game); void removeCounters(Counter counter, Game game); - void setMorphCard(boolean morphCard); - boolean isMorphCard(); - @Override Card copy(); diff --git a/Mage/src/mage/cards/CardImpl.java b/Mage/src/mage/cards/CardImpl.java index 810125a6c3..ece5240825 100644 --- a/Mage/src/mage/cards/CardImpl.java +++ b/Mage/src/mage/cards/CardImpl.java @@ -39,6 +39,7 @@ import mage.Mana; import mage.abilities.Ability; import mage.abilities.PlayLandAbility; import mage.abilities.SpellAbility; +import mage.abilities.keyword.MorphAbility; import mage.abilities.mana.ManaAbility; import mage.constants.CardType; import mage.constants.ColoredManaSymbol; @@ -78,7 +79,6 @@ public abstract class CardImpl extends MageObjectImpl implements Card { protected String expansionSetCode; protected String tokenSetCode; protected Rarity rarity; - protected boolean faceDown; protected boolean canTransform; protected Card secondSideCard; protected boolean nightCard; @@ -143,7 +143,6 @@ public abstract class CardImpl extends MageObjectImpl implements Card { cardNumber = card.cardNumber; expansionSetCode = card.expansionSetCode; rarity = card.rarity; - faceDown = card.faceDown; canTransform = card.canTransform; if (canTransform) { @@ -155,7 +154,6 @@ public abstract class CardImpl extends MageObjectImpl implements Card { flipCardName = card.flipCardName; splitCard = card.splitCard; usesVariousArt = card.usesVariousArt; - morphCard = card.isMorphCard(); } @Override @@ -341,10 +339,7 @@ public abstract class CardImpl extends MageObjectImpl implements Card { game.rememberLKI(objectId, event.getFromZone(), this); } - if (isFaceDown() && !event.getToZone().equals(Zone.BATTLEFIELD)) { // to battlefield is possible because of Morph - setFaceDown(false); - game.getCard(this.getId()).setFaceDown(false); - } + setFaceDown(false, game); updateZoneChangeCounter(); switch (event.getToZone()) { case GRAVEYARD: @@ -477,6 +472,7 @@ public abstract class CardImpl extends MageObjectImpl implements Card { } else { game.getExile().createZone(exileId, name).add(this); } + setFaceDown(false, game); updateZoneChangeCounter(); game.setZone(objectId, event.getToZone()); game.addSimultaneousEvent(event); @@ -487,17 +483,21 @@ public abstract class CardImpl extends MageObjectImpl implements Card { @Override public boolean putOntoBattlefield(Game game, Zone fromZone, UUID sourceId, UUID controllerId) { - return this.putOntoBattlefield(game, fromZone, sourceId, controllerId, false); + return this.putOntoBattlefield(game, fromZone, sourceId, controllerId, false, false, null); } @Override public boolean putOntoBattlefield(Game game, Zone fromZone, UUID sourceId, UUID controllerId, boolean tapped){ - return this.putOntoBattlefield(game, fromZone, sourceId, controllerId, tapped, null); + return this.putOntoBattlefield(game, fromZone, sourceId, controllerId, tapped, false, null); + } + @Override + public boolean putOntoBattlefield(Game game, Zone fromZone, UUID sourceId, UUID controllerId, boolean tapped, boolean facedown){ + return this.putOntoBattlefield(game, fromZone, sourceId, controllerId, tapped, facedown, null); } @Override - public boolean putOntoBattlefield(Game game, Zone fromZone, UUID sourceId, UUID controllerId, boolean tapped, ArrayList appliedEffects){ + public boolean putOntoBattlefield(Game game, Zone fromZone, UUID sourceId, UUID controllerId, boolean tapped, boolean facedown, ArrayList appliedEffects){ ZoneChangeEvent event = new ZoneChangeEvent(this.objectId, sourceId, controllerId, fromZone, Zone.BATTLEFIELD, appliedEffects, tapped); if (!game.replaceEvent(event)) { if (fromZone != null) { @@ -514,10 +514,6 @@ public abstract class CardImpl extends MageObjectImpl implements Card { break; case EXILED: game.getExile().removeCard(this, game); - if (isFaceDown()) { - // 110.6b Permanents enter the battlefield untapped, unflipped, face up, and phased in unless a spell or ability says otherwise. - this.setFaceDown(false); - } removed = true; break; case COMMAND: @@ -543,6 +539,7 @@ public abstract class CardImpl extends MageObjectImpl implements Card { setZone(Zone.BATTLEFIELD, game); game.setScopeRelevant(true); permanent.setTapped(tapped); + permanent.setFaceDown(facedown, game); permanent.entersBattlefield(sourceId, game, event.getFromZone(), true); game.setScopeRelevant(false); game.applyEffects(); @@ -553,21 +550,20 @@ public abstract class CardImpl extends MageObjectImpl implements Card { } @Override - public void setFaceDown(boolean value) { - faceDown = value; + public void setFaceDown(boolean value, Game game) { + game.getState().getCardState(objectId).setFaceDown(value); } @Override - public boolean isFaceDown() { - return faceDown; + public boolean isFaceDown(Game game) { + return game.getState().getCardState(objectId).isFaceDown(); } @Override public boolean turnFaceUp(Game game, UUID playerId) { GameEvent event = GameEvent.getEvent(GameEvent.EventType.TURNFACEUP, getId(), playerId); if (!game.replaceEvent(event)) { - setFaceDown(false); - game.getCard(objectId).setFaceDown(false); // Another instance? + setFaceDown(false, game); for (Ability ability :abilities) { // abilities that were set to not visible face down must be set to visible again if (ability.getWorksFaceDown() && !ability.getRuleVisible()) { ability.setRuleVisible(true); @@ -583,8 +579,7 @@ public abstract class CardImpl extends MageObjectImpl implements Card { public boolean turnFaceDown(Game game, UUID playerId) { GameEvent event = GameEvent.getEvent(GameEvent.EventType.TURNFACEDOWN, getId(), playerId); if (!game.replaceEvent(event)) { - setFaceDown(true); - game.getCard(objectId).setFaceDown(true); // Another instance? + setFaceDown(true, game); game.fireEvent(GameEvent.getEvent(GameEvent.EventType.TURNEDFACEDOWN, getId(), playerId)); return true; } @@ -638,11 +633,6 @@ public abstract class CardImpl extends MageObjectImpl implements Card { @Override public void build() {} - @Override - public void setUsesVariousArt(boolean usesVariousArt) { - this.usesVariousArt = usesVariousArt; - } - @Override public boolean getUsesVariousArt() { return usesVariousArt; @@ -713,21 +703,11 @@ public abstract class CardImpl extends MageObjectImpl implements Card { removeCounters(counter.getName(), counter.getCount(), game); } - @Override - public void setMorphCard(boolean morphCard) { - this.morphCard = morphCard; - } - - @Override - public boolean isMorphCard() { - return morphCard; - } - @Override public String getLogName() { - if (this.isFaceDown()) { - return "facedown card"; - } +// if (this.isFaceDown()) { +// return "facedown card"; +// } return name; } diff --git a/Mage/src/mage/filter/predicate/other/FaceDownPredicate.java b/Mage/src/mage/filter/predicate/other/FaceDownPredicate.java index 38f180d4b2..e05b57a9f7 100644 --- a/Mage/src/mage/filter/predicate/other/FaceDownPredicate.java +++ b/Mage/src/mage/filter/predicate/other/FaceDownPredicate.java @@ -39,7 +39,7 @@ public class FaceDownPredicate implements Predicate { @Override public boolean apply(Card input, Game game) { - return input.isFaceDown(); + return input.isFaceDown(game); } @Override diff --git a/Mage/src/mage/game/CardState.java b/Mage/src/mage/game/CardState.java index 60bc055b33..44ab1257f3 100644 --- a/Mage/src/mage/game/CardState.java +++ b/Mage/src/mage/game/CardState.java @@ -9,6 +9,7 @@ import mage.counters.Counters; */ public class CardState { + protected boolean faceDown; protected Map info; protected Counters counters; @@ -19,6 +20,7 @@ public class CardState { } public CardState(final CardState state) { + this.faceDown = state.faceDown; if (state.info != null) { info = new HashMap<>(); info.putAll(state.info); @@ -30,6 +32,14 @@ public class CardState { return new CardState(this); } + public void setFaceDown(boolean value) { + faceDown = value; + } + + public boolean isFaceDown() { + return faceDown; + } + public Counters getCounters() { return counters; } diff --git a/Mage/src/mage/game/GameCommanderImpl.java b/Mage/src/mage/game/GameCommanderImpl.java index 19541ff2ee..d50f8adc3e 100644 --- a/Mage/src/mage/game/GameCommanderImpl.java +++ b/Mage/src/mage/game/GameCommanderImpl.java @@ -127,8 +127,8 @@ public abstract class GameCommanderImpl extends GameImpl { if(!mulliganedCards.containsKey(playerId)){ mulliganedCards.put(playerId, new CardsImpl()); } - card.setFaceDown(true); card.moveToExile(null, "", null, this); + card.setFaceDown(true, this); mulliganedCards.get(playerId).add(card); } } @@ -165,8 +165,8 @@ public abstract class GameCommanderImpl extends GameImpl { if(player != null && mulliganedCards.containsKey(playerId)){ for(Card card : mulliganedCards.get(playerId).getCards(this)){ if(card != null){ - card.setFaceDown(false); card.moveToZone(Zone.LIBRARY, null, this, false); + card.setFaceDown(false, this); } } if(mulliganedCards.get(playerId).size() > 0){ diff --git a/Mage/src/mage/game/GameImpl.java b/Mage/src/mage/game/GameImpl.java index a3584a1191..f93b91ced0 100644 --- a/Mage/src/mage/game/GameImpl.java +++ b/Mage/src/mage/game/GameImpl.java @@ -277,7 +277,6 @@ public abstract class GameImpl implements Game, Serializable { card = ((PermanentCard)card).getCard(); } card.setOwnerId(ownerId); - card.setFaceDown(false); // can be set face down from previous game gameCards.put(card.getId(), card); state.addCard(card); if (card.isSplitCard()) { diff --git a/Mage/src/mage/game/permanent/PermanentCard.java b/Mage/src/mage/game/permanent/PermanentCard.java index 8de01c60e3..ecde8334a3 100644 --- a/Mage/src/mage/game/permanent/PermanentCard.java +++ b/Mage/src/mage/game/permanent/PermanentCard.java @@ -88,7 +88,16 @@ public class PermanentCard extends PermanentImpl { protected void copyFromCard(Card card) { this.name = card.getName(); this.abilities.clear(); - this.abilities.addAll(card.getAbilities().copy()); + if (this.faceDown) { + for (Ability ability: card.getAbilities()) { + if (ability.getWorksFaceDown()) { + this.abilities.add(ability.copy()); + } + } + } + else { + this.abilities = card.getAbilities().copy(); + } this.abilities.setControllerId(this.controllerId); this.cardType.clear(); this.cardType.addAll(card.getCardType()); @@ -116,8 +125,6 @@ public class PermanentCard extends PermanentImpl { } this.flipCard = card.isFlipCard(); this.flipCardName = card.getFlipCardName(); - this.faceDown = card.isFaceDown(); - this.morphCard = card.isMorphCard(); } public Card getCard() { @@ -134,12 +141,6 @@ public class PermanentCard extends PermanentImpl { Player controller = game.getPlayer(controllerId); if (controller != null && controller.removeFromBattlefield(this, game)) { Card originalCard = game.getCard(this.getId()); - if (isFaceDown()) { - setFaceDown(false); - if (originalCard != null) { - originalCard.setFaceDown(false); //TODO: Do this in a better way - } - } ZoneChangeEvent event = new ZoneChangeEvent(this, sourceId, controllerId, fromZone, toZone, appliedEffects); if (!game.replaceEvent(event)) { Player owner = game.getPlayer(ownerId); @@ -190,10 +191,6 @@ public class PermanentCard extends PermanentImpl { @Override public boolean moveToExile(UUID exileId, String name, UUID sourceId, Game game, ArrayList appliedEffects) { Zone fromZone = game.getState().getZone(objectId); - if (isFaceDown() && fromZone.equals(Zone.BATTLEFIELD) && (isMorphed() || isManifested())) { - setFaceDown(false); - game.getCard(this.getId()).setFaceDown(false); //TODO: Do this in a better way - } Player controller = game.getPlayer(controllerId); if (controller != null && controller.removeFromBattlefield(this, game)) { ZoneChangeEvent event = new ZoneChangeEvent(this, sourceId, ownerId, fromZone, Zone.EXILED, appliedEffects); @@ -228,16 +225,6 @@ public class PermanentCard extends PermanentImpl { if (super.turnFaceUp(game, playerId)) { setManifested(false); setMorphed(false); - card.setFaceDown(false); - return true; - } - return false; - } - - @Override - public boolean turnFaceDown(Game game, UUID playerId) { - if (super.turnFaceDown(game, playerId)) { - card.setFaceDown(true); return true; } return false; @@ -258,17 +245,9 @@ public class PermanentCard extends PermanentImpl { card.adjustChoices(ability, game); } - @Override - public void setFaceDown(boolean value) { - super.setFaceDown(value); - if (card != null) { - card.setFaceDown(value); - } - } - @Override public ManaCosts getManaCost() { - if (isFaceDown()) { // face down permanent has always {0} mana costs + if (faceDown) { // face down permanent has always {0} mana costs manaCost.clear(); return manaCost; } diff --git a/Mage/src/mage/game/permanent/PermanentImpl.java b/Mage/src/mage/game/permanent/PermanentImpl.java index e8f3f50d36..bc407e2fb1 100644 --- a/Mage/src/mage/game/permanent/PermanentImpl.java +++ b/Mage/src/mage/game/permanent/PermanentImpl.java @@ -93,6 +93,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent { protected boolean controlledFromStartOfControllerTurn; protected int turnsOnBattlefield; protected boolean phasedIn = true; + protected boolean faceDown; protected boolean attacking; protected int blocking; // number of creatures the permanent can block @@ -139,6 +140,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent { this.controlledFromStartOfControllerTurn = permanent.controlledFromStartOfControllerTurn; this.turnsOnBattlefield = permanent.turnsOnBattlefield; this.phasedIn = permanent.phasedIn; + this.faceDown = permanent.faceDown; this.attacking = permanent.attacking; this.blocking = permanent.blocking; this.maxBlocks = permanent.maxBlocks; @@ -431,6 +433,16 @@ public abstract class PermanentImpl extends CardImpl implements Permanent { return false; } + @Override + public void setFaceDown(boolean value, Game game) { + this.faceDown = value; + } + + @Override + public boolean isFaceDown(Game game) { + return faceDown; + } + @Override public boolean isFlipped() { return flipped; @@ -838,7 +850,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent { @Override public void entersBattlefield(UUID sourceId, Game game, Zone fromZone, boolean fireEvent) { controlledFromStartOfControllerTurn = false; - if (this.isFaceDown()) { + if (this.isFaceDown(game)) { // remove some attributes here, bceause first apply effects comes later otherwise abilities (e.g. color related) will unintended trigger MorphAbility.setPermanentToFaceDownCreature(this); } @@ -1226,7 +1238,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent { @Override public String getLogName() { if (name.isEmpty()) { - if (isFaceDown()) { + if (faceDown) { return "face down creature"; } else { return "a creature without name"; diff --git a/Mage/src/mage/game/stack/Spell.java b/Mage/src/mage/game/stack/Spell.java index 23ed93bdae..026576123d 100644 --- a/Mage/src/mage/game/stack/Spell.java +++ b/Mage/src/mage/game/stack/Spell.java @@ -267,10 +267,7 @@ public class Spell implements StackObject, Card { } } else { updateOptionalCosts(0); - if (isFaceDown()) { - card.setFaceDown(true); - } - result = card.putOntoBattlefield(game, fromZone, ability.getSourceId(), controllerId); + result = card.putOntoBattlefield(game, fromZone, ability.getSourceId(), controllerId, false, faceDown); return result; } } @@ -628,7 +625,7 @@ public class Spell implements StackObject, Card { @Override public int getConvertedManaCost() { int cmc = 0; - if (this.isMorphCard() && this.isFaceDown()) { + if (faceDown) { return 0; } for (Ability spellAbility: spellAbilities) { @@ -717,24 +714,24 @@ public class Spell implements StackObject, Card { } @Override - public void setFaceDown(boolean value) { + public void setFaceDown(boolean value, Game game) { faceDown = value; } @Override public boolean turnFaceUp(Game game, UUID playerId) { - setFaceDown(false); + setFaceDown(false, game); return true; } @Override public boolean turnFaceDown(Game game, UUID playerId) { - setFaceDown(true); + setFaceDown(true, game); return true; } @Override - public boolean isFaceDown() { + public boolean isFaceDown(Game game) { return faceDown; } @@ -855,7 +852,12 @@ public class Spell implements StackObject, Card { } @Override - public boolean putOntoBattlefield(Game game, Zone fromZone, UUID sourceId, UUID controllerId, boolean tapped, ArrayList appliedEffects) { + public boolean putOntoBattlefield(Game game, Zone fromZone, UUID sourceId, UUID controllerId, boolean tapped, boolean facedown) { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean putOntoBattlefield(Game game, Zone fromZone, UUID sourceId, UUID controllerId, boolean tapped, boolean facedown, ArrayList appliedEffects) { throw new UnsupportedOperationException("Not supported yet."); } @@ -869,11 +871,6 @@ public class Spell implements StackObject, Card { return card.getUsesVariousArt(); } - @Override - public void setUsesVariousArt(boolean usesVariousArt) { - card.setUsesVariousArt(usesVariousArt); - } - @Override public List getMana() { return card.getMana(); @@ -973,16 +970,6 @@ public class Spell implements StackObject, Card { return card; } - @Override - public void setMorphCard(boolean morphCard) { - throw new UnsupportedOperationException("Not supported"); - } - - @Override - public boolean isMorphCard() { - return card.isMorphCard(); - } - @Override public Card getMainCard() { return card.getMainCard(); diff --git a/Mage/src/mage/players/Player.java b/Mage/src/mage/players/Player.java index cedc5c8a30..1719996dca 100644 --- a/Mage/src/mage/players/Player.java +++ b/Mage/src/mage/players/Player.java @@ -498,6 +498,19 @@ public interface Player extends MageItem, Copyable { * @return */ boolean putOntoBattlefieldWithInfo(Card card, Game game, Zone fromZone, UUID sourceId, boolean tapped); + + /** + * Uses putOntoBattlefield and posts also a info message about in the game log + * + * @param card + * @param game + * @param fromZone + * @param sourceId + * @param tapped the card enters the battlefield tapped + * @param facedown the card enters the battlefield facedown + * @return + */ + boolean putOntoBattlefieldWithInfo(Card card, Game game, Zone fromZone, UUID sourceId, boolean tapped, boolean facedown); /** * Checks if the playerToCheckId is from an opponent in range diff --git a/Mage/src/mage/players/PlayerImpl.java b/Mage/src/mage/players/PlayerImpl.java index c311b8d567..6349b1526a 100644 --- a/Mage/src/mage/players/PlayerImpl.java +++ b/Mage/src/mage/players/PlayerImpl.java @@ -2835,13 +2835,18 @@ public abstract class PlayerImpl implements Player, Serializable { @Override public boolean putOntoBattlefieldWithInfo(Card card, Game game, Zone fromZone, UUID sourceId) { - return this.putOntoBattlefieldWithInfo(card, game, fromZone, sourceId, false); + return this.putOntoBattlefieldWithInfo(card, game, fromZone, sourceId, false, false); } @Override public boolean putOntoBattlefieldWithInfo(Card card, Game game, Zone fromZone, UUID sourceId, boolean tapped) { + return this.putOntoBattlefieldWithInfo(card, game, fromZone, sourceId, tapped, false); + } + + @Override + public boolean putOntoBattlefieldWithInfo(Card card, Game game, Zone fromZone, UUID sourceId, boolean tapped, boolean facedown) { boolean result = false; - if (card.putOntoBattlefield(game, fromZone, sourceId, this.getId(), tapped)) { + if (card.putOntoBattlefield(game, fromZone, sourceId, this.getId(), tapped, facedown)) { game.informPlayers(new StringBuilder(this.getName()) .append(" puts ").append(card.getLogName()) .append(" from ").append(fromZone.toString().toLowerCase(Locale.ENGLISH)).append(" ") diff --git a/Utils/mtg-cards-data.txt b/Utils/mtg-cards-data.txt index 0a599a2667..1ba5b35419 100644 --- a/Utils/mtg-cards-data.txt +++ b/Utils/mtg-cards-data.txt @@ -25673,7 +25673,7 @@ Arashin Foremost|Dragons of Tarkir|3|R|{1}{W}{W}|Creature - Human Warrior|2|2|Do Artful Maneuver|Dragons of Tarkir|4|C|{1}{W}|Instant|||Target creature gets +2/+2 until end of turn.$Rebound (If you cast this spell from your hand, exile it as it resolves. At the beginning of your next upkeep, you may cast this card from exile without paying its mana cost.)| Aven Sunstriker|Dragons of Tarkir|5|U|{1}{W}{W}|Creature - Bird Warrior|1|1|Flying$Double strike (This creature deals both first-strike and regular combat damage.)$Megamorph {4}{W} (You may cast this card face down as a 2/2 creature for {3}. Turn it face up any time for its megamorph cost and put a +1/+1 counter on it.)| Hidden Dragonslayer|Dragons of Tarkir|23|R|{1}{W}|Creature - Human Warrior|2|1|Lifelink$Megamorph {2}{W} (You may cast this card face down as a 2/2 creature for {3}. Turn it face up any time for its megamorph cost and put a +1/+1 counter on it.)$When Hidden Dragonslayer is turned face up, destroy target creature with power 4 or greater an opponent controls.| -Myth Realize|Dragons of Tarkir|26|R|Enchantment|||Whenever you cast a noncreature spell, put a lore counter on Myth Realized.${2}{W}: Put a lore counter on Myth Realized.${W}: Until end of turn, Myth Realized becomes a Monk Avatar creature in addition to its other types and gains "This creature's power and toughness are each equal to the number of lore counters on it."| +Myth Realized|Dragons of Tarkir|26|R|Enchantment|||Whenever you cast a noncreature spell, put a lore counter on Myth Realized.${2}{W}: Put a lore counter on Myth Realized.${W}: Until end of turn, Myth Realized becomes a Monk Avatar creature in addition to its other types and gains "This creature's power and toughness are each equal to the number of lore counters on it."| Ojutai Exemplars|Dragons of Tarkir|27|M|{2}{W}{W}|Creature - Human Monk|4|4|Whenever you cast a noncreature spell, choose one - Tap target creature; Ojutai Exemplars gain first strike and lifelink until end of turn; or Exile Ojutai Exemplars, then return it to the battlefield tapped under its owner's control.| Orator of Ojutai|Dragons of Tarkir|29|U|{1}{W}|Creature - Bird Monk|0|4|Defneder, flying$As an additional cost to cast Orator of Ojutai, you may reveal a Dragon card from your hand.$When Orator of Ojutai enters the battlefield, if you revealed a Dragon card or controlled a Dragon as you cast Orator of Ojutai, draw a card.| Profound Journey|Dragons of Tarkir|30|R|{5}{W}{W}|Sorcery|||Return target permanent card from your graveyard to the battlefield.$Rebound (If you cast this spell from your hand, exile it as it resolves. At the beginning of your next upkeep, you may cast this card from exile without paying its mana cost.)|