* Fixed handling of enlarged view for manifested and morphed cards.

This commit is contained in:
LevelX2 2015-01-24 19:43:53 +01:00
parent ba8290a0c0
commit 001e17a73e
17 changed files with 196 additions and 102 deletions

View file

@ -310,11 +310,7 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
} }
BufferedImage srcImage; BufferedImage srcImage;
if (gameCard.isFaceDown()) { if (gameCard.isFaceDown()) {
if (gameCard.isMorphCard()) { srcImage = getFaceDownImage();
srcImage = ImageCache.getMorphImage();
}else {
srcImage = ImageCache.loadImage(new TFile(DirectLinksForDownload.outDir + File.separator + DirectLinksForDownload.cardbackFilename));
}
} else { } else {
srcImage = ImageCache.getImage(gameCard, getCardWidth(), getCardHeight()); srcImage = ImageCache.getImage(gameCard, getCardWidth(), getCardHeight());
} }
@ -705,11 +701,7 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
flippedAngle = isFlipped() ? CardPanel.FLIPPED_ANGLE : 0; flippedAngle = isFlipped() ? CardPanel.FLIPPED_ANGLE : 0;
BufferedImage srcImage; BufferedImage srcImage;
if (gameCard.isFaceDown()) { if (gameCard.isFaceDown()) {
if (gameCard.isMorphCard()) { srcImage = getFaceDownImage();
srcImage = ImageCache.getMorphImage();
} else {
srcImage = ImageCache.loadImage(new TFile(DirectLinksForDownload.outDir + File.separator + DirectLinksForDownload.cardbackFilename));
}
} else { } else {
srcImage = ImageCache.getThumbnail(gameCard); 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 @Override
public List<MagePermanent> getLinks() { public List<MagePermanent> getLinks() {
return links; return links;
@ -942,8 +950,8 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
@Override @Override
public Image getImage() { public Image getImage() {
if (this.hasImage) { if (this.hasImage) {
if (gameCard.isMorphCard() && gameCard.isFaceDown()) { if (gameCard.isFaceDown()) {
return ImageCache.getMorphImage(); return getFaceDownImage();
} else { } else {
return ImageCache.getImageOriginal(gameCard); return ImageCache.getImageOriginal(gameCard);
} }

View file

@ -139,6 +139,14 @@ public class ImageCache {
return loadImage(file); 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) { private static String buildThumbnailPath(String path) {
String thumbnailPath; String thumbnailPath;
if (PreferencesDialog.isSaveImagesToZip()) { if (PreferencesDialog.isSaveImagesToZip()) {

View file

@ -136,13 +136,14 @@ public class CardView extends SimpleCardView {
// no information available for face down cards as long it's not a controlled face down morph card // 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 // 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()) { if (card.isMorphCard()) {
// special handling for Morph cards // special handling for casting of Morph cards
this.fillEmpty(card, controlled);
if (card instanceof Spell /*|| card instanceof Card*/) { if (card instanceof Spell /*|| card instanceof Card*/) {
if (controlled) { if (controlled) {
this.name = card.getName(); this.name = card.getName();
this.displayName = card.getName(); this.displayName = card.getName();
this.alternateName = card.getName();
} }
this.power = "2"; this.power = "2";
this.toughness = "2"; this.toughness = "2";
@ -151,14 +152,11 @@ public class CardView extends SimpleCardView {
return; return;
} }
} else { } else {
if (card instanceof Permanent) { if (card instanceof Permanent) {
this.fillEmpty(card, controlled);
this.power = Integer.toString(card.getPower().getValue()); this.power = Integer.toString(card.getPower().getValue());
this.toughness = Integer.toString(card.getToughness().getValue()); this.toughness = Integer.toString(card.getToughness().getValue());
this.cardTypes = card.getCardType(); this.cardTypes = card.getCardType();
} else { } else {
this.fillEmpty(card, false);
this.hideInfo = true; this.hideInfo = true;
return; return;
} }

View file

@ -28,6 +28,9 @@
package mage.view; package mage.view;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.TurnFaceUpAbility; import mage.abilities.common.TurnFaceUpAbility;
import mage.cards.Card; import mage.cards.Card;
@ -36,10 +39,6 @@ import mage.game.permanent.Permanent;
import mage.game.permanent.PermanentToken; import mage.game.permanent.PermanentToken;
import mage.players.Player; import mage.players.Player;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
/** /**
* *
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
@ -58,6 +57,8 @@ public class PermanentView extends CardView {
private final String nameOwner; // only filled if != controller private final String nameOwner; // only filled if != controller
private final boolean controlled; private final boolean controlled;
private final UUID attachedTo; private final UUID attachedTo;
private final boolean morphed;
private final boolean manifested;
public PermanentView(Permanent permanent, Card card, UUID createdForPlayerId, Game game) { public PermanentView(Permanent permanent, Card card, UUID createdForPlayerId, Game game) {
super(permanent, null, permanent.getControllerId().equals(createdForPlayerId)); super(permanent, null, permanent.getControllerId().equals(createdForPlayerId));
@ -67,6 +68,8 @@ public class PermanentView extends CardView {
this.flipped = permanent.isFlipped(); this.flipped = permanent.isFlipped();
this.phasedIn = permanent.isPhasedIn(); this.phasedIn = permanent.isPhasedIn();
this.summoningSickness = permanent.hasSummoningSickness(); this.summoningSickness = permanent.hasSummoningSickness();
this.morphed = permanent.isMorphed();
this.manifested = permanent.isManifested();
this.damage = permanent.getDamage(); this.damage = permanent.getDamage();
if (permanent.getAttachments().size() > 0) { if (permanent.getAttachments().size() > 0) {
attachments = new ArrayList<>(); attachments = new ArrayList<>();
@ -79,7 +82,11 @@ public class PermanentView extends CardView {
tokenSetCode = original.getTokenSetCode(); tokenSetCode = original.getTokenSetCode();
} else { } else {
if (card != null) { if (card != null) {
// original may not be face down
boolean wasfaceDown = card.isFaceDown();
card.setFaceDown(false);
original = new CardView(card); original = new CardView(card);
card.setFaceDown(wasfaceDown);
} else { } else {
original = null; original = null;
} }
@ -93,7 +100,8 @@ public class PermanentView extends CardView {
this.alternateName = permanent.getFlipCardName(); this.alternateName = permanent.getFlipCardName();
this.originalName = this.getName(); this.originalName = this.getName();
} else { } 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.alternateName = original.getName();
this.originalName = this.getName(); this.originalName = this.getName();
} }
@ -110,44 +118,32 @@ public class PermanentView extends CardView {
this.nameOwner = ""; this.nameOwner = "";
} }
if (permanent.isFaceDown()) { if (permanent.isFaceDown() && card != null) {
if (permanent.isMorphCard()){ if (controlled){
// add morph rule text // must be a morphed or manifested card
if (card != null) { for (Ability permanentAbility : permanent.getAbilities()) {
if (controlled) { if (permanentAbility instanceof TurnFaceUpAbility && !permanentAbility.getRuleVisible()) {
for (Ability permanentAbility : permanent.getAbilities()) { this.rules.add(permanentAbility.getRule(true));
if (permanentAbility instanceof TurnFaceUpAbility && !permanentAbility.getRuleVisible()) { }
this.rules.add(permanentAbility.getRule(true)); if (permanentAbility.getWorksFaceDown()) {
} this.rules.add(permanentAbility.getRule());
if (permanentAbility.getWorksFaceDown()) { }
this.rules.add(permanentAbility.getRule()); }
} this.name = card.getName();
} this.displayName = card.getName();
this.name = card.getName(); this.expansionSetCode = card.getExpansionSetCode();
this.expansionSetCode = card.getExpansionSetCode(); this.cardNumber = card.getCardNumber();
this.cardNumber = card.getCardNumber(); } else{
} else { if (permanent.isMorphed()) {
this.rules.add("If the controller has priority, he or she may turn this permanent face up." + 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," + " 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."); " then turns this permanent face up.");
} }else if (permanent.isManifested()) {
} this.rules.add("A manifested creature card can be turned face up any time for it's mana cost." +
} else{ " A face-down card can also be turned face up for its morph cost.");
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();
} }
} }
} }
} }
public boolean isTapped() { public boolean isTapped() {
@ -201,4 +197,11 @@ public class PermanentView extends CardView {
public boolean isAttachedTo() { public boolean isAttachedTo() {
return attachedTo != null; return attachedTo != null;
} }
public boolean isMorphed() {
return morphed;
}
public boolean isManifested() {
return manifested;
}
} }

View file

@ -37,6 +37,7 @@ import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.ContinuousEffect; import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continious.BecomesFaceDownCreatureEffect; import mage.abilities.effects.common.continious.BecomesFaceDownCreatureEffect;
import mage.abilities.effects.common.continious.BecomesFaceDownCreatureEffect.FaceDownType;
import mage.cards.Card; import mage.cards.Card;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType; import mage.constants.CardType;
@ -127,7 +128,7 @@ class GhastlyConscriptionEffect extends OneShotEffect {
manaCosts = new ManaCostsImpl<>("{0}"); 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())); effect.setTargetPointer(new FixedTarget(card.getId()));
game.addEffect(effect, source); game.addEffect(effect, source);
game.informPlayers(controller.getName() + " puts facedown card from exile onto the battlefield"); game.informPlayers(controller.getName() + " puts facedown card from exile onto the battlefield");

View file

@ -45,6 +45,7 @@ import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.combat.UnblockableSourceEffect; import mage.abilities.effects.common.combat.UnblockableSourceEffect;
import mage.abilities.effects.common.continious.BecomesFaceDownCreatureEffect; import mage.abilities.effects.common.continious.BecomesFaceDownCreatureEffect;
import mage.abilities.effects.common.continious.BecomesFaceDownCreatureEffect.FaceDownType;
import mage.cards.Card; import mage.cards.Card;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType; import mage.constants.CardType;
@ -148,7 +149,7 @@ class JeskaiInfiltratorEffect extends OneShotEffect {
manaCosts = new ManaCostsImpl<>("{0}"); 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())); effect.setTargetPointer(new FixedTarget(card.getId()));
game.addEffect(effect, source); game.addEffect(effect, source);
game.informPlayers(new StringBuilder(player.getName()) game.informPlayers(new StringBuilder(player.getName())

View file

@ -36,9 +36,6 @@ public class DevotionCount implements DynamicValue {
public int calculate(Game game, Ability sourceAbility, Effect effect) { public int calculate(Game game, Ability sourceAbility, Effect effect) {
int devotion = 0; int devotion = 0;
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(sourceAbility.getControllerId())) { 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(ManaCost manaCost :permanent.getManaCost()) {
for(ColoredManaSymbol coloredManaSymbol: devotionColors) { for(ColoredManaSymbol coloredManaSymbol: devotionColors) {
if (manaCost.containsColor(coloredManaSymbol)) { if (manaCost.containsColor(coloredManaSymbol)) {

View file

@ -59,33 +59,40 @@ import mage.game.permanent.Permanent;
public class BecomesFaceDownCreatureEffect extends ContinuousEffectImpl implements SourceEffect { public class BecomesFaceDownCreatureEffect extends ContinuousEffectImpl implements SourceEffect {
public enum FaceDownType {
MORPHED,
MANIFESTED
}
protected int zoneChangeCounter; protected int zoneChangeCounter;
protected Ability turnFaceUpAbility = null; protected Ability turnFaceUpAbility = null;
protected boolean useTargetPointer; protected boolean useTargetPointer;
protected boolean foundPermanent; protected boolean foundPermanent;
protected FaceDownType faceDownType;
public BecomesFaceDownCreatureEffect(Costs<Cost> morphCosts) { public BecomesFaceDownCreatureEffect(Costs<Cost> turnFaceUpCosts, FaceDownType faceDownType){
this(morphCosts, false); this(turnFaceUpCosts, false, faceDownType);
} }
public BecomesFaceDownCreatureEffect(Costs<Cost> morphCosts, boolean useTargetPointer) { public BecomesFaceDownCreatureEffect(Costs<Cost> turnFaceUpCosts, boolean useTargetPointer, FaceDownType faceDownType) {
this(morphCosts, useTargetPointer, Duration.WhileOnBattlefield); this(turnFaceUpCosts, useTargetPointer, Duration.WhileOnBattlefield, faceDownType);
} }
public BecomesFaceDownCreatureEffect(Cost cost, boolean useTargetPointer, Duration duration) { public BecomesFaceDownCreatureEffect(Cost cost, boolean useTargetPointer, Duration duration, FaceDownType faceDownType) {
this(createCosts(cost), useTargetPointer, duration); this(createCosts(cost), useTargetPointer, duration, faceDownType);
} }
public BecomesFaceDownCreatureEffect(Costs<Cost> morphCosts, boolean useTargetPointer, Duration duration) { public BecomesFaceDownCreatureEffect(Costs<Cost> turnFaceUpCosts, boolean useTargetPointer, Duration duration, FaceDownType faceDownType) {
super(duration, Outcome.BecomeCreature); super(duration, Outcome.BecomeCreature);
this.useTargetPointer = useTargetPointer; this.useTargetPointer = useTargetPointer;
this.zoneChangeCounter = Integer.MIN_VALUE; this.zoneChangeCounter = Integer.MIN_VALUE;
if (morphCosts != null) { if (turnFaceUpCosts != null) {
this.turnFaceUpAbility = new TurnFaceUpAbility(morphCosts); 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"; staticText = "{this} becomes a 2/2 face-down creature, with no text, no name, no subtypes, and no mana cost";
foundPermanent = false; foundPermanent = false;
this.faceDownType = faceDownType;
} }
@ -97,6 +104,7 @@ public class BecomesFaceDownCreatureEffect extends ContinuousEffectImpl implemen
} }
this.useTargetPointer = effect.useTargetPointer; this.useTargetPointer = effect.useTargetPointer;
this.foundPermanent = effect.foundPermanent; this.foundPermanent = effect.foundPermanent;
this.faceDownType = effect.faceDownType;
} }
@Override @Override
@ -123,7 +131,17 @@ public class BecomesFaceDownCreatureEffect extends ContinuousEffectImpl implemen
} }
if (permanent != null && permanent.isFaceDown()) { 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) { switch (layer) {
case TypeChangingEffects_4: case TypeChangingEffects_4:
permanent.setName(""); permanent.setName("");

View file

@ -34,12 +34,14 @@ import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.ContinuousEffect; import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continious.BecomesFaceDownCreatureEffect; import mage.abilities.effects.common.continious.BecomesFaceDownCreatureEffect;
import mage.abilities.effects.common.continious.BecomesFaceDownCreatureEffect.FaceDownType;
import mage.cards.Card; import mage.cards.Card;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.Zone; import mage.constants.Zone;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
import mage.util.CardUtil; import mage.util.CardUtil;
@ -76,18 +78,22 @@ public class ManifestEffect extends OneShotEffect {
for (Card card: cards) { for (Card card: cards) {
card.setFaceDown(true); card.setFaceDown(true);
controller.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId()); controller.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId());
ManaCosts manaCosts = null; Permanent permanent = game.getPermanent(card.getId());
if (card.getCardType().contains(CardType.CREATURE)) { if (permanent != null) {
manaCosts = card.getSpellAbility().getManaCosts(); permanent.setManifested(true);
if (manaCosts == null) { ManaCosts manaCosts = null;
manaCosts = new ManaCostsImpl("{0}"); 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 true;
} }
return false; return false;

View file

@ -34,12 +34,14 @@ import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.ContinuousEffect; import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continious.BecomesFaceDownCreatureEffect; import mage.abilities.effects.common.continious.BecomesFaceDownCreatureEffect;
import mage.abilities.effects.common.continious.BecomesFaceDownCreatureEffect.FaceDownType;
import mage.cards.Card; import mage.cards.Card;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.Zone; import mage.constants.Zone;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
import mage.util.CardUtil; import mage.util.CardUtil;
@ -80,17 +82,20 @@ public class ManifestTargetPlayerEffect extends OneShotEffect {
for (Card card: cards) { for (Card card: cards) {
card.setFaceDown(true); card.setFaceDown(true);
targetPlayer.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId()); targetPlayer.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId());
ManaCosts manaCosts = null; Permanent permanent = game.getPermanent(card.getId());
if (card.getCardType().contains(CardType.CREATURE)) { if (permanent != null) {
manaCosts = card.getSpellAbility().getManaCosts(); permanent.setManifested(true);
if (manaCosts == null) { ManaCosts manaCosts = null;
manaCosts = new ManaCostsImpl("{0}"); 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);
ContinuousEffect effect = new BecomesFaceDownCreatureEffect(manaCosts, true, Duration.Custom); effect.setTargetPointer(new FixedTarget(card.getId()));
effect.setTargetPointer(new FixedTarget(card.getId())); game.addEffect(effect, source);
game.addEffect(effect, source); } }
}
return true; return true;
} }
return false; return false;

View file

@ -42,6 +42,7 @@ import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.costs.mana.ManaCost; import mage.abilities.costs.mana.ManaCost;
import mage.abilities.costs.mana.ManaCosts; import mage.abilities.costs.mana.ManaCosts;
import mage.abilities.effects.common.continious.BecomesFaceDownCreatureEffect; import mage.abilities.effects.common.continious.BecomesFaceDownCreatureEffect;
import mage.abilities.effects.common.continious.BecomesFaceDownCreatureEffect.FaceDownType;
import mage.cards.Card; import mage.cards.Card;
import mage.constants.AbilityType; import mage.constants.AbilityType;
import mage.constants.CardType; import mage.constants.CardType;
@ -124,7 +125,7 @@ public class MorphAbility extends StaticAbility implements AlternativeSourceCost
sb.append(REMINDER_TEXT); sb.append(REMINDER_TEXT);
ruleText = sb.toString(); 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); ability.setRuleVisible(false);
card.addAbility(ability); card.addAbility(ability);
@ -269,7 +270,7 @@ public class MorphAbility extends StaticAbility implements AlternativeSourceCost
return alternateCosts; return alternateCosts;
} }
public static void setPermanentToMorph(Permanent permanent) { public static void setPermanentToFaceDownCreature(Permanent permanent) {
permanent.getPower().initValue(2); permanent.getPower().initValue(2);
permanent.getToughness().initValue(2); permanent.getToughness().initValue(2);
permanent.getAbilities().clear(); permanent.getAbilities().clear();

View file

@ -150,6 +150,7 @@ public abstract class CardImpl extends MageObjectImpl implements Card {
cardNumber = card.cardNumber; cardNumber = card.cardNumber;
expansionSetCode = card.expansionSetCode; expansionSetCode = card.expansionSetCode;
rarity = card.rarity; rarity = card.rarity;
this.watchers.clear();
for (Watcher watcher: (List<Watcher>)card.getWatchers()) { for (Watcher watcher: (List<Watcher>)card.getWatchers()) {
watchers.add(watcher.copy()); watchers.add(watcher.copy());
} }

View file

@ -1283,8 +1283,8 @@ public abstract class GameImpl implements Game, Serializable {
//getState().addCard(permanent); //getState().addCard(permanent);
permanent.reset(this); permanent.reset(this);
if (copyFromPermanent.isMorphCard() && copyFromPermanent.isFaceDown()) { if (copyFromPermanent.isMorphed() || copyFromPermanent.isManifested()) {
MorphAbility.setPermanentToMorph(permanent); MorphAbility.setPermanentToFaceDownCreature(permanent);
} }
permanent.assignNewId(); permanent.assignNewId();
if (copyFromPermanent.isTransformed()) { if (copyFromPermanent.isTransformed()) {

View file

@ -247,6 +247,12 @@ public interface Permanent extends Card, Controllable {
*/ */
void clearPairedCard(); void clearPairedCard();
void setMorphed(boolean value);
boolean isMorphed();
void setManifested(boolean value);
boolean isManifested();
@Override @Override
Permanent copy(); Permanent copy();

View file

@ -31,6 +31,9 @@ package mage.game.permanent;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.UUID; import java.util.UUID;
import mage.abilities.Ability; 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.Card;
import mage.cards.LevelerCard; import mage.cards.LevelerCard;
import mage.constants.Zone; import mage.constants.Zone;
@ -116,7 +119,6 @@ public class PermanentCard extends PermanentImpl {
} }
this.flipCard = card.isFlipCard(); this.flipCard = card.isFlipCard();
this.flipCardName = card.getFlipCardName(); this.flipCardName = card.getFlipCardName();
this.morphCard = card.isMorphCard();
this.faceDown = card.isFaceDown(); this.faceDown = card.isFaceDown();
} }
@ -218,6 +220,8 @@ public class PermanentCard extends PermanentImpl {
@Override @Override
public boolean turnFaceUp(Game game, UUID playerId) { public boolean turnFaceUp(Game game, UUID playerId) {
if (super.turnFaceUp(game, playerId)) { if (super.turnFaceUp(game, playerId)) {
setManifested(false);
setMorphed(false);
card.setFaceDown(false); card.setFaceDown(false);
return true; return true;
} }
@ -256,4 +260,14 @@ public class PermanentCard extends PermanentImpl {
} }
} }
@Override
public ManaCosts<ManaCost> getManaCost() {
if (isFaceDown()) { // face down permanent has always {0} mana costs
manaCost.clear();
manaCost.add(new GenericManaCost(0));
}
return super.getManaCost();
}
} }

View file

@ -37,7 +37,6 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
import mage.MageObject; import mage.MageObject;
import mage.MageObjectReference;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.effects.ContinuousEffect; import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.Effect; import mage.abilities.effects.Effect;
@ -80,6 +79,8 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
protected boolean flipped; protected boolean flipped;
protected boolean transformed; protected boolean transformed;
protected boolean monstrous; protected boolean monstrous;
protected boolean manifested = false;
protected boolean morphed = false;
protected UUID originalControllerId; protected UUID originalControllerId;
protected UUID controllerId; protected UUID controllerId;
protected UUID beforeResetControllerId; protected UUID beforeResetControllerId;
@ -152,6 +153,9 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
this.monstrous = permanent.monstrous; this.monstrous = permanent.monstrous;
this.pairedCard = permanent.pairedCard; this.pairedCard = permanent.pairedCard;
this.timesLoyaltyUsed = permanent.timesLoyaltyUsed; this.timesLoyaltyUsed = permanent.timesLoyaltyUsed;
this.morphed = permanent.morphed;
this.manifested = permanent.manifested;
} }
@Override @Override
@ -1146,4 +1150,24 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
return name; 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;
}
} }

View file

@ -87,6 +87,9 @@ git log c370189787cff7fc129b1ccf1b223807143460de..HEAD --diff-filter=A --name-st
since 1.3.0-2014-11-29v8 (2015-01-17) 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 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 3. Copy added_cards.txt to trunk\Utils folder
4. Run script: 4. Run script:
> perl extract_in_wiki_format.perl > perl extract_in_wiki_format.perl