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 2daa784760..94db4f973f 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 @@ -310,11 +310,7 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti } BufferedImage srcImage; if (gameCard.isFaceDown()) { - if (gameCard.isMorphCard()) { - srcImage = ImageCache.getMorphImage(); - }else { - srcImage = ImageCache.loadImage(new TFile(DirectLinksForDownload.outDir + File.separator + DirectLinksForDownload.cardbackFilename)); - } + srcImage = getFaceDownImage(); } else { srcImage = ImageCache.getImage(gameCard, getCardWidth(), getCardHeight()); } @@ -705,11 +701,7 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti flippedAngle = isFlipped() ? CardPanel.FLIPPED_ANGLE : 0; BufferedImage srcImage; if (gameCard.isFaceDown()) { - if (gameCard.isMorphCard()) { - srcImage = ImageCache.getMorphImage(); - } else { - srcImage = ImageCache.loadImage(new TFile(DirectLinksForDownload.outDir + File.separator + DirectLinksForDownload.cardbackFilename)); - } + srcImage = getFaceDownImage(); } else { srcImage = ImageCache.getThumbnail(gameCard); } @@ -727,6 +719,22 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti }); } + private BufferedImage getFaceDownImage() { + if (isPermanent) { + if (((PermanentView) gameCard).isMorphed()) { + return ImageCache.getMorphImage(); + } else { + return ImageCache.getManifestImage(); + } + } else { + if (gameCard.isMorphCard()) { + return ImageCache.getMorphImage(); + } else { + return ImageCache.loadImage(new TFile(DirectLinksForDownload.outDir + File.separator + DirectLinksForDownload.cardbackFilename)); + } + } + } + @Override public List getLinks() { return links; @@ -942,8 +950,8 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti @Override public Image getImage() { if (this.hasImage) { - if (gameCard.isMorphCard() && gameCard.isFaceDown()) { - return ImageCache.getMorphImage(); + if (gameCard.isFaceDown()) { + return getFaceDownImage(); } else { return ImageCache.getImageOriginal(gameCard); } diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/images/ImageCache.java b/Mage.Client/src/main/java/org/mage/plugins/card/images/ImageCache.java index 0f9560ed3b..a369f7d2ce 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/images/ImageCache.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/images/ImageCache.java @@ -139,6 +139,14 @@ public class ImageCache { return loadImage(file); } + public static BufferedImage getManifestImage() { + CardDownloadData info = new CardDownloadData("Manifest", "FRF", 0, false, 0, "FRF"); + info.setToken(true); + String path = CardImageUtils.generateTokenImagePath(info); + TFile file = new TFile(path); + return loadImage(file); + } + private static String buildThumbnailPath(String path) { String thumbnailPath; if (PreferencesDialog.isSaveImagesToZip()) { diff --git a/Mage.Common/src/mage/view/CardView.java b/Mage.Common/src/mage/view/CardView.java index d836267d43..4906a185d1 100644 --- a/Mage.Common/src/mage/view/CardView.java +++ b/Mage.Common/src/mage/view/CardView.java @@ -135,14 +135,15 @@ public class CardView extends SimpleCardView { this.morphCard = card.isMorphCard(); // 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()) { + this.fillEmpty(card, controlled); if (card.isMorphCard()) { - // special handling for Morph cards - this.fillEmpty(card, controlled); + // special handling for casting of Morph cards if (card instanceof Spell /*|| card instanceof Card*/) { if (controlled) { this.name = card.getName(); this.displayName = card.getName(); + this.alternateName = card.getName(); } this.power = "2"; this.toughness = "2"; @@ -150,15 +151,12 @@ public class CardView extends SimpleCardView { " no name, no subtypes, and no mana cost by paying {3} rather than paying its mana cost."); return; } - } else { - + } else { if (card instanceof Permanent) { - this.fillEmpty(card, controlled); this.power = Integer.toString(card.getPower().getValue()); this.toughness = Integer.toString(card.getToughness().getValue()); this.cardTypes = card.getCardType(); } else { - this.fillEmpty(card, false); this.hideInfo = true; return; } diff --git a/Mage.Common/src/mage/view/PermanentView.java b/Mage.Common/src/mage/view/PermanentView.java index a3d0de3b4c..c7a4e3741f 100644 --- a/Mage.Common/src/mage/view/PermanentView.java +++ b/Mage.Common/src/mage/view/PermanentView.java @@ -28,6 +28,9 @@ package mage.view; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; import mage.abilities.Ability; import mage.abilities.common.TurnFaceUpAbility; import mage.cards.Card; @@ -36,10 +39,6 @@ import mage.game.permanent.Permanent; import mage.game.permanent.PermanentToken; import mage.players.Player; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; - /** * * @author BetaSteward_at_googlemail.com @@ -58,6 +57,8 @@ public class PermanentView extends CardView { private final String nameOwner; // only filled if != controller private final boolean controlled; private final UUID attachedTo; + private final boolean morphed; + private final boolean manifested; public PermanentView(Permanent permanent, Card card, UUID createdForPlayerId, Game game) { super(permanent, null, permanent.getControllerId().equals(createdForPlayerId)); @@ -67,6 +68,8 @@ public class PermanentView extends CardView { this.flipped = permanent.isFlipped(); this.phasedIn = permanent.isPhasedIn(); this.summoningSickness = permanent.hasSummoningSickness(); + this.morphed = permanent.isMorphed(); + this.manifested = permanent.isManifested(); this.damage = permanent.getDamage(); if (permanent.getAttachments().size() > 0) { attachments = new ArrayList<>(); @@ -79,7 +82,11 @@ public class PermanentView extends CardView { tokenSetCode = original.getTokenSetCode(); } 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; } @@ -93,7 +100,8 @@ public class PermanentView extends CardView { this.alternateName = permanent.getFlipCardName(); this.originalName = this.getName(); } else { - if (!this.isMorphCard() || controlled) { + if (controlled // controller may always know + || (!morphed && !manifested)) { // others don't know for morph or transformed cards this.alternateName = original.getName(); this.originalName = this.getName(); } @@ -110,44 +118,32 @@ public class PermanentView extends CardView { this.nameOwner = ""; } - if (permanent.isFaceDown()) { - if (permanent.isMorphCard()){ - // add morph rule text - if (card != null) { - if (controlled) { - for (Ability permanentAbility : permanent.getAbilities()) { - if (permanentAbility instanceof TurnFaceUpAbility && !permanentAbility.getRuleVisible()) { - this.rules.add(permanentAbility.getRule(true)); - } - if (permanentAbility.getWorksFaceDown()) { - this.rules.add(permanentAbility.getRule()); - } - } - this.name = card.getName(); - this.expansionSetCode = card.getExpansionSetCode(); - this.cardNumber = card.getCardNumber(); - } else { + if (permanent.isFaceDown() && card != null) { + if (controlled){ + // must be a morphed or manifested card + for (Ability permanentAbility : permanent.getAbilities()) { + if (permanentAbility instanceof TurnFaceUpAbility && !permanentAbility.getRuleVisible()) { + this.rules.add(permanentAbility.getRule(true)); + } + if (permanentAbility.getWorksFaceDown()) { + this.rules.add(permanentAbility.getRule()); + } + } + this.name = card.getName(); + this.displayName = card.getName(); + this.expansionSetCode = card.getExpansionSetCode(); + this.cardNumber = card.getCardNumber(); + } else{ + if (permanent.isMorphed()) { this.rules.add("If the controller has priority, he or she may turn this permanent face up." + " This is a special action; it doesn’t use the stack. To do this he or she pays the morph costs," + " then turns this permanent face up."); - } - } - } else{ - if (controlled && card != null) { - for (Ability permanentAbility : permanent.getAbilities()) { - if (permanentAbility instanceof TurnFaceUpAbility && !permanentAbility.getRuleVisible()) { - this.rules.add(permanentAbility.getRule(true)); - } - if (permanentAbility.getWorksFaceDown()) { - this.rules.add(permanentAbility.getRule()); - } - } - this.name = card.getName(); - this.displayName = card.getName(); - } + }else if (permanent.isManifested()) { + this.rules.add("A manifested creature card can be turned face up any time for it's mana cost." + + " A face-down card can also be turned face up for its morph cost."); + } } - } - + } } public boolean isTapped() { @@ -201,4 +197,11 @@ public class PermanentView extends CardView { public boolean isAttachedTo() { return attachedTo != null; } + + public boolean isMorphed() { + return morphed; + } + public boolean isManifested() { + return manifested; + } } diff --git a/Mage.Sets/src/mage/sets/fatereforged/GhastlyConscription.java b/Mage.Sets/src/mage/sets/fatereforged/GhastlyConscription.java index a575d94f21..f02135eedf 100644 --- a/Mage.Sets/src/mage/sets/fatereforged/GhastlyConscription.java +++ b/Mage.Sets/src/mage/sets/fatereforged/GhastlyConscription.java @@ -37,6 +37,7 @@ import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.effects.ContinuousEffect; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.continious.BecomesFaceDownCreatureEffect; +import mage.abilities.effects.common.continious.BecomesFaceDownCreatureEffect.FaceDownType; import mage.cards.Card; import mage.cards.CardImpl; import mage.constants.CardType; @@ -127,7 +128,7 @@ class GhastlyConscriptionEffect extends OneShotEffect { manaCosts = new ManaCostsImpl<>("{0}"); } } - ContinuousEffect effect = new BecomesFaceDownCreatureEffect(manaCosts, true, Duration.Custom); + ContinuousEffect effect = new BecomesFaceDownCreatureEffect(manaCosts, true, Duration.Custom, FaceDownType.MANIFESTED); effect.setTargetPointer(new FixedTarget(card.getId())); game.addEffect(effect, source); game.informPlayers(controller.getName() + " puts facedown card from exile onto the battlefield"); diff --git a/Mage.Sets/src/mage/sets/fatereforged/JeskaiInfiltrator.java b/Mage.Sets/src/mage/sets/fatereforged/JeskaiInfiltrator.java index fcac8d480c..49288ffabe 100644 --- a/Mage.Sets/src/mage/sets/fatereforged/JeskaiInfiltrator.java +++ b/Mage.Sets/src/mage/sets/fatereforged/JeskaiInfiltrator.java @@ -45,6 +45,7 @@ import mage.abilities.effects.Effect; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.combat.UnblockableSourceEffect; import mage.abilities.effects.common.continious.BecomesFaceDownCreatureEffect; +import mage.abilities.effects.common.continious.BecomesFaceDownCreatureEffect.FaceDownType; import mage.cards.Card; import mage.cards.CardImpl; import mage.constants.CardType; @@ -148,7 +149,7 @@ class JeskaiInfiltratorEffect extends OneShotEffect { manaCosts = new ManaCostsImpl<>("{0}"); } } - ContinuousEffect effect = new BecomesFaceDownCreatureEffect(manaCosts, true, Duration.Custom); + ContinuousEffect effect = new BecomesFaceDownCreatureEffect(manaCosts, true, Duration.Custom, FaceDownType.MANIFESTED); effect.setTargetPointer(new FixedTarget(card.getId())); game.addEffect(effect, source); game.informPlayers(new StringBuilder(player.getName()) diff --git a/Mage/src/mage/abilities/dynamicvalue/common/DevotionCount.java b/Mage/src/mage/abilities/dynamicvalue/common/DevotionCount.java index 9cf7c0031c..439f2146e3 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/DevotionCount.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/DevotionCount.java @@ -36,9 +36,6 @@ public class DevotionCount implements DynamicValue { public int calculate(Game game, Ability sourceAbility, Effect effect) { int devotion = 0; for (Permanent permanent : game.getBattlefield().getAllActivePermanents(sourceAbility.getControllerId())) { - if (permanent.isFaceDown()) { - continue; // workaround as long as Morph creatures are not cast as separate objects, face down creature does not have a mana cost - } for(ManaCost manaCost :permanent.getManaCost()) { for(ColoredManaSymbol coloredManaSymbol: devotionColors) { if (manaCost.containsColor(coloredManaSymbol)) { diff --git a/Mage/src/mage/abilities/effects/common/continious/BecomesFaceDownCreatureEffect.java b/Mage/src/mage/abilities/effects/common/continious/BecomesFaceDownCreatureEffect.java index 5f9f9e2ca5..96761f2529 100644 --- a/Mage/src/mage/abilities/effects/common/continious/BecomesFaceDownCreatureEffect.java +++ b/Mage/src/mage/abilities/effects/common/continious/BecomesFaceDownCreatureEffect.java @@ -59,33 +59,40 @@ import mage.game.permanent.Permanent; public class BecomesFaceDownCreatureEffect extends ContinuousEffectImpl implements SourceEffect { + public enum FaceDownType { + MORPHED, + MANIFESTED + } + protected int zoneChangeCounter; protected Ability turnFaceUpAbility = null; protected boolean useTargetPointer; protected boolean foundPermanent; + protected FaceDownType faceDownType; - public BecomesFaceDownCreatureEffect(Costs morphCosts) { - this(morphCosts, false); + public BecomesFaceDownCreatureEffect(Costs turnFaceUpCosts, FaceDownType faceDownType){ + this(turnFaceUpCosts, false, faceDownType); } - public BecomesFaceDownCreatureEffect(Costs morphCosts, boolean useTargetPointer) { - this(morphCosts, useTargetPointer, Duration.WhileOnBattlefield); + public BecomesFaceDownCreatureEffect(Costs turnFaceUpCosts, boolean useTargetPointer, FaceDownType faceDownType) { + this(turnFaceUpCosts, useTargetPointer, Duration.WhileOnBattlefield, faceDownType); } - public BecomesFaceDownCreatureEffect(Cost cost, boolean useTargetPointer, Duration duration) { - this(createCosts(cost), useTargetPointer, duration); + public BecomesFaceDownCreatureEffect(Cost cost, boolean useTargetPointer, Duration duration, FaceDownType faceDownType) { + this(createCosts(cost), useTargetPointer, duration, faceDownType); } - public BecomesFaceDownCreatureEffect(Costs morphCosts, boolean useTargetPointer, Duration duration) { + public BecomesFaceDownCreatureEffect(Costs turnFaceUpCosts, boolean useTargetPointer, Duration duration, FaceDownType faceDownType) { super(duration, Outcome.BecomeCreature); this.useTargetPointer = useTargetPointer; this.zoneChangeCounter = Integer.MIN_VALUE; - if (morphCosts != null) { - this.turnFaceUpAbility = new TurnFaceUpAbility(morphCosts); + if (turnFaceUpCosts != null) { + this.turnFaceUpAbility = new TurnFaceUpAbility(turnFaceUpCosts); } staticText = "{this} becomes a 2/2 face-down creature, with no text, no name, no subtypes, and no mana cost"; foundPermanent = false; + this.faceDownType = faceDownType; } @@ -97,6 +104,7 @@ public class BecomesFaceDownCreatureEffect extends ContinuousEffectImpl implemen } this.useTargetPointer = effect.useTargetPointer; this.foundPermanent = effect.foundPermanent; + this.faceDownType = effect.faceDownType; } @Override @@ -123,7 +131,17 @@ public class BecomesFaceDownCreatureEffect extends ContinuousEffectImpl implemen } if (permanent != null && permanent.isFaceDown()) { - foundPermanent = true; + if (!foundPermanent) { + foundPermanent = true; + switch(faceDownType) { + case MANIFESTED: + permanent.setManifested(true); + break; + case MORPHED: + permanent.setMorphed(true); + break; + } + } switch (layer) { case TypeChangingEffects_4: permanent.setName(""); diff --git a/Mage/src/mage/abilities/effects/keyword/ManifestEffect.java b/Mage/src/mage/abilities/effects/keyword/ManifestEffect.java index 4ac634ce94..66a91b550f 100644 --- a/Mage/src/mage/abilities/effects/keyword/ManifestEffect.java +++ b/Mage/src/mage/abilities/effects/keyword/ManifestEffect.java @@ -34,12 +34,14 @@ import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.effects.ContinuousEffect; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.continious.BecomesFaceDownCreatureEffect; +import mage.abilities.effects.common.continious.BecomesFaceDownCreatureEffect.FaceDownType; import mage.cards.Card; import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Outcome; import mage.constants.Zone; import mage.game.Game; +import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.targetpointer.FixedTarget; import mage.util.CardUtil; @@ -76,18 +78,22 @@ public class ManifestEffect extends OneShotEffect { for (Card card: cards) { card.setFaceDown(true); controller.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId()); - ManaCosts manaCosts = null; - if (card.getCardType().contains(CardType.CREATURE)) { - manaCosts = card.getSpellAbility().getManaCosts(); - if (manaCosts == null) { - manaCosts = new ManaCostsImpl("{0}"); + Permanent permanent = game.getPermanent(card.getId()); + if (permanent != null) { + permanent.setManifested(true); + ManaCosts manaCosts = null; + if (card.getCardType().contains(CardType.CREATURE)) { + manaCosts = card.getSpellAbility().getManaCosts(); + if (manaCosts == null) { + manaCosts = new ManaCostsImpl("{0}"); + } } + ContinuousEffect effect = new BecomesFaceDownCreatureEffect(manaCosts, true, Duration.Custom, FaceDownType.MANIFESTED); + effect.setTargetPointer(new FixedTarget(card.getId())); + game.addEffect(effect, source); } - ContinuousEffect effect = new BecomesFaceDownCreatureEffect(manaCosts, true, Duration.Custom); - effect.setTargetPointer(new FixedTarget(card.getId())); - game.addEffect(effect, source); - game.applyEffects(); // to apply nefore ETB triggered or replace Effects are executed } + game.applyEffects(); // to apply before ETB triggered or replace Effects are executed return true; } return false; diff --git a/Mage/src/mage/abilities/effects/keyword/ManifestTargetPlayerEffect.java b/Mage/src/mage/abilities/effects/keyword/ManifestTargetPlayerEffect.java index eea0163b2f..4b395e9c15 100644 --- a/Mage/src/mage/abilities/effects/keyword/ManifestTargetPlayerEffect.java +++ b/Mage/src/mage/abilities/effects/keyword/ManifestTargetPlayerEffect.java @@ -34,12 +34,14 @@ import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.effects.ContinuousEffect; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.continious.BecomesFaceDownCreatureEffect; +import mage.abilities.effects.common.continious.BecomesFaceDownCreatureEffect.FaceDownType; import mage.cards.Card; import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Outcome; import mage.constants.Zone; import mage.game.Game; +import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.targetpointer.FixedTarget; import mage.util.CardUtil; @@ -80,17 +82,20 @@ public class ManifestTargetPlayerEffect extends OneShotEffect { for (Card card: cards) { card.setFaceDown(true); targetPlayer.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId()); - ManaCosts manaCosts = null; - if (card.getCardType().contains(CardType.CREATURE)) { - manaCosts = card.getSpellAbility().getManaCosts(); - if (manaCosts == null) { - manaCosts = new ManaCostsImpl("{0}"); + Permanent permanent = game.getPermanent(card.getId()); + if (permanent != null) { + permanent.setManifested(true); + ManaCosts manaCosts = null; + if (card.getCardType().contains(CardType.CREATURE)) { + manaCosts = card.getSpellAbility().getManaCosts(); + if (manaCosts == null) { + manaCosts = new ManaCostsImpl("{0}"); + } } - } - ContinuousEffect effect = new BecomesFaceDownCreatureEffect(manaCosts, true, Duration.Custom); - effect.setTargetPointer(new FixedTarget(card.getId())); - game.addEffect(effect, source); - } + ContinuousEffect effect = new BecomesFaceDownCreatureEffect(manaCosts, true, Duration.Custom, FaceDownType.MANIFESTED); + effect.setTargetPointer(new FixedTarget(card.getId())); + game.addEffect(effect, source); + } } return true; } return false; diff --git a/Mage/src/mage/abilities/keyword/MorphAbility.java b/Mage/src/mage/abilities/keyword/MorphAbility.java index 55c0bc013a..a2c86d32bd 100644 --- a/Mage/src/mage/abilities/keyword/MorphAbility.java +++ b/Mage/src/mage/abilities/keyword/MorphAbility.java @@ -42,6 +42,7 @@ import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.costs.mana.ManaCost; import mage.abilities.costs.mana.ManaCosts; import mage.abilities.effects.common.continious.BecomesFaceDownCreatureEffect; +import mage.abilities.effects.common.continious.BecomesFaceDownCreatureEffect.FaceDownType; import mage.cards.Card; import mage.constants.AbilityType; import mage.constants.CardType; @@ -124,7 +125,7 @@ public class MorphAbility extends StaticAbility implements AlternativeSourceCost sb.append(REMINDER_TEXT); ruleText = sb.toString(); - Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new BecomesFaceDownCreatureEffect(morphCosts)); + Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new BecomesFaceDownCreatureEffect(morphCosts, FaceDownType.MORPHED)); ability.setRuleVisible(false); card.addAbility(ability); @@ -269,7 +270,7 @@ public class MorphAbility extends StaticAbility implements AlternativeSourceCost return alternateCosts; } - public static void setPermanentToMorph(Permanent permanent) { + public static void setPermanentToFaceDownCreature(Permanent permanent) { permanent.getPower().initValue(2); permanent.getToughness().initValue(2); permanent.getAbilities().clear(); diff --git a/Mage/src/mage/cards/CardImpl.java b/Mage/src/mage/cards/CardImpl.java index 287125f3c3..94edeefb39 100644 --- a/Mage/src/mage/cards/CardImpl.java +++ b/Mage/src/mage/cards/CardImpl.java @@ -150,6 +150,7 @@ public abstract class CardImpl extends MageObjectImpl implements Card { cardNumber = card.cardNumber; expansionSetCode = card.expansionSetCode; rarity = card.rarity; + this.watchers.clear(); for (Watcher watcher: (List)card.getWatchers()) { watchers.add(watcher.copy()); } diff --git a/Mage/src/mage/game/GameImpl.java b/Mage/src/mage/game/GameImpl.java index 081cb14a20..a16426c9a2 100644 --- a/Mage/src/mage/game/GameImpl.java +++ b/Mage/src/mage/game/GameImpl.java @@ -1283,8 +1283,8 @@ public abstract class GameImpl implements Game, Serializable { //getState().addCard(permanent); permanent.reset(this); - if (copyFromPermanent.isMorphCard() && copyFromPermanent.isFaceDown()) { - MorphAbility.setPermanentToMorph(permanent); + if (copyFromPermanent.isMorphed() || copyFromPermanent.isManifested()) { + MorphAbility.setPermanentToFaceDownCreature(permanent); } permanent.assignNewId(); if (copyFromPermanent.isTransformed()) { diff --git a/Mage/src/mage/game/permanent/Permanent.java b/Mage/src/mage/game/permanent/Permanent.java index 562f89ec53..586b002f5b 100644 --- a/Mage/src/mage/game/permanent/Permanent.java +++ b/Mage/src/mage/game/permanent/Permanent.java @@ -247,6 +247,12 @@ public interface Permanent extends Card, Controllable { */ void clearPairedCard(); + void setMorphed(boolean value); + boolean isMorphed(); + + void setManifested(boolean value); + boolean isManifested(); + @Override Permanent copy(); diff --git a/Mage/src/mage/game/permanent/PermanentCard.java b/Mage/src/mage/game/permanent/PermanentCard.java index 4c0c45b58b..5918fb6b85 100644 --- a/Mage/src/mage/game/permanent/PermanentCard.java +++ b/Mage/src/mage/game/permanent/PermanentCard.java @@ -31,6 +31,9 @@ package mage.game.permanent; import java.util.ArrayList; import java.util.UUID; import mage.abilities.Ability; +import mage.abilities.costs.mana.GenericManaCost; +import mage.abilities.costs.mana.ManaCost; +import mage.abilities.costs.mana.ManaCosts; import mage.cards.Card; import mage.cards.LevelerCard; import mage.constants.Zone; @@ -108,7 +111,7 @@ public class PermanentCard extends PermanentImpl { this.cardNumber = card.getCardNumber(); this.usesVariousArt = card.getUsesVariousArt(); this.zoneChangeCounter = card.getZoneChangeCounter(); - + canTransform = card.canTransform(); if (canTransform) { secondSideCard = card.getSecondCardFace(); @@ -116,7 +119,6 @@ public class PermanentCard extends PermanentImpl { } this.flipCard = card.isFlipCard(); this.flipCardName = card.getFlipCardName(); - this.morphCard = card.isMorphCard(); this.faceDown = card.isFaceDown(); } @@ -130,7 +132,7 @@ public class PermanentCard extends PermanentImpl { @Override public boolean moveToZone(Zone toZone, UUID sourceId, Game game, boolean flag, ArrayList appliedEffects) { - Zone fromZone = game.getState().getZone(objectId); + Zone fromZone = game.getState().getZone(objectId); Player controller = game.getPlayer(controllerId); if (controller != null && controller.removeFromBattlefield(this, game)) { if (isFaceDown()) { @@ -218,6 +220,8 @@ public class PermanentCard extends PermanentImpl { @Override public boolean turnFaceUp(Game game, UUID playerId) { if (super.turnFaceUp(game, playerId)) { + setManifested(false); + setMorphed(false); card.setFaceDown(false); return true; } @@ -253,7 +257,17 @@ public class PermanentCard extends PermanentImpl { super.setFaceDown(value); if (card != null) { card.setFaceDown(value); - } + } } - + + @Override + public ManaCosts getManaCost() { + if (isFaceDown()) { // face down permanent has always {0} mana costs + manaCost.clear(); + manaCost.add(new GenericManaCost(0)); + } + return super.getManaCost(); + } + + } diff --git a/Mage/src/mage/game/permanent/PermanentImpl.java b/Mage/src/mage/game/permanent/PermanentImpl.java index 432fa0631a..f872022738 100644 --- a/Mage/src/mage/game/permanent/PermanentImpl.java +++ b/Mage/src/mage/game/permanent/PermanentImpl.java @@ -37,7 +37,6 @@ import java.util.List; import java.util.Map; import java.util.UUID; import mage.MageObject; -import mage.MageObjectReference; import mage.abilities.Ability; import mage.abilities.effects.ContinuousEffect; import mage.abilities.effects.Effect; @@ -80,6 +79,8 @@ public abstract class PermanentImpl extends CardImpl implements Permanent { protected boolean flipped; protected boolean transformed; protected boolean monstrous; + protected boolean manifested = false; + protected boolean morphed = false; protected UUID originalControllerId; protected UUID controllerId; protected UUID beforeResetControllerId; @@ -152,6 +153,9 @@ public abstract class PermanentImpl extends CardImpl implements Permanent { this.monstrous = permanent.monstrous; this.pairedCard = permanent.pairedCard; this.timesLoyaltyUsed = permanent.timesLoyaltyUsed; + + this.morphed = permanent.morphed; + this.manifested = permanent.manifested; } @Override @@ -1146,4 +1150,24 @@ public abstract class PermanentImpl extends CardImpl implements Permanent { return name; } + @Override + public boolean isManifested() { + return manifested; + } + + @Override + public void setManifested(boolean value) { + manifested = value; + } + + @Override + public boolean isMorphed() { + return morphed; + } + + @Override + public void setMorphed(boolean value) { + morphed = value; + } + } diff --git a/Utils/release/getting_implemented_cards.txt b/Utils/release/getting_implemented_cards.txt index 887d71b56f..f702504aac 100644 --- a/Utils/release/getting_implemented_cards.txt +++ b/Utils/release/getting_implemented_cards.txt @@ -87,6 +87,9 @@ git log c370189787cff7fc129b1ccf1b223807143460de..HEAD --diff-filter=A --name-st since 1.3.0-2014-11-29v8 (2015-01-17) git log 79ceae999a72151e2fadd1e15ddd37ec76c3f205..HEAD --diff-filter=A --name-status | sed -ne "s/^A[^u]Mage.Sets\/src\/mage\/sets\///p" | sort > added_cards.txt +since 1.3.0-2014-11-29v10 (2015-01-23) +git log 79ceae999a72151e2fadd1e15ddd37ec76c3f205..HEAD --diff-filter=A --name-status | sed -ne "s/^A[^u]Mage.Sets\/src\/mage\/sets\///p" | sort > added_cards.txt + 3. Copy added_cards.txt to trunk\Utils folder 4. Run script: > perl extract_in_wiki_format.perl