mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 13:19:18 -08:00
* Morph Ability - Some fixes for displaying / handling morph cards/permanents.
This commit is contained in:
parent
7cacff2ce7
commit
341db7b01f
7 changed files with 72 additions and 40 deletions
|
|
@ -50,6 +50,7 @@ import mage.target.Targets;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.game.permanent.PermanentCard;
|
||||
|
||||
/**
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
|
|
@ -86,7 +87,8 @@ public class CardView extends SimpleCardView {
|
|||
protected boolean transformed;
|
||||
|
||||
protected boolean flipCard;
|
||||
|
||||
protected boolean morphCard;
|
||||
|
||||
protected String alternateName;
|
||||
protected String originalName;
|
||||
|
||||
|
|
@ -130,14 +132,14 @@ public class CardView extends SimpleCardView {
|
|||
*/
|
||||
public CardView(Card card, UUID cardId, boolean controlled) {
|
||||
super(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.isFaceDown(), card.getUsesVariousArt(), card.getTokenSetCode());
|
||||
|
||||
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.isMorphCard()) {
|
||||
// special handling for Morph cards
|
||||
this.fillEmpty(card, controlled);
|
||||
if (card instanceof Spell) {
|
||||
if (card instanceof Spell /*|| card instanceof Card*/) {
|
||||
if (controlled) {
|
||||
this.name = card.getName();
|
||||
this.displayName = card.getName();
|
||||
|
|
@ -214,6 +216,7 @@ public class CardView extends SimpleCardView {
|
|||
this.canTransform = card.canTransform();
|
||||
this.flipCard = card.isFlipCard();
|
||||
|
||||
|
||||
if (card instanceof PermanentToken) {
|
||||
this.isToken = true;
|
||||
this.mageObjectType = MageObjectType.TOKEN;
|
||||
|
|
@ -670,6 +673,10 @@ public class CardView extends SimpleCardView {
|
|||
return flipCard;
|
||||
}
|
||||
|
||||
public boolean isMorphCard() {
|
||||
return morphCard;
|
||||
}
|
||||
|
||||
public boolean isToRotate() {
|
||||
return rotate;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@ package mage.view;
|
|||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.TurnFaceUpAbility;
|
||||
import mage.abilities.common.TurnedFaceUpSourceTriggeredAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.constants.Rarity;
|
||||
import mage.game.Game;
|
||||
|
|
@ -59,7 +58,7 @@ public class PermanentView extends CardView {
|
|||
private final boolean copy;
|
||||
private final String nameOwner; // only filled if != controller
|
||||
private final boolean controlled;
|
||||
private UUID attachedTo;
|
||||
private final UUID attachedTo;
|
||||
|
||||
public PermanentView(Permanent permanent, Card card, UUID createdForPlayerId, Game game) {
|
||||
super(permanent, null, permanent.getControllerId().equals(createdForPlayerId));
|
||||
|
|
@ -79,8 +78,7 @@ public class PermanentView extends CardView {
|
|||
original = new CardView(((PermanentToken)permanent).getToken());
|
||||
original.expansionSetCode = permanent.getExpansionSetCode();
|
||||
tokenSetCode = original.getTokenSetCode();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (card != null) {
|
||||
original = new CardView(card);
|
||||
} else {
|
||||
|
|
@ -96,8 +94,10 @@ public class PermanentView extends CardView {
|
|||
this.alternateName = permanent.getFlipCardName();
|
||||
this.originalName = this.getName();
|
||||
} else {
|
||||
this.alternateName = original.getName();
|
||||
this.originalName = this.getName();
|
||||
if (!this.isMorphCard() || controlled) {
|
||||
this.alternateName = original.getName();
|
||||
this.originalName = this.getName();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!permanent.getOwnerId().equals(permanent.getControllerId())) {
|
||||
|
|
@ -130,7 +130,6 @@ public class PermanentView extends CardView {
|
|||
this.rules.add("If the controller has priority, he or she may turn this permanent face up." +
|
||||
" This is a special action; it doesnt use the stack. To do this he or she pays the morph costs," +
|
||||
" then turns this permanent face up.");
|
||||
this.rarity = Rarity.COMMON;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ import mage.MageObject;
|
|||
import mage.abilities.Modes;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.constants.AbilityType;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.MageObjectType;
|
||||
import mage.game.Game;
|
||||
import mage.game.stack.StackAbility;
|
||||
|
|
@ -58,16 +59,37 @@ public class StackAbilityView extends CardView {
|
|||
this.sourceCard = sourceCard;
|
||||
this.sourceCard.setMageObjectType(mageObjectType);
|
||||
this.name = "Ability";
|
||||
this.rules = new ArrayList<>();
|
||||
rules.add(ability.getRule(sourceName));
|
||||
this.power = ability.getPower().toString();
|
||||
this.toughness = ability.getToughness().toString();
|
||||
this.loyalty = "";
|
||||
|
||||
this.cardTypes = ability.getCardType();
|
||||
this.subTypes = ability.getSubtype();
|
||||
this.superTypes = ability.getSupertype();
|
||||
this.color = ability.getColor();
|
||||
this.manaCost = ability.getManaCost().getSymbols();
|
||||
this.cardTypes = ability.getCardType();
|
||||
this.subTypes = ability.getSubtype();
|
||||
this.superTypes = ability.getSupertype();
|
||||
this.color = ability.getColor();
|
||||
this.manaCost = ability.getManaCost().getSymbols();
|
||||
this.power = ability.getPower().toString();
|
||||
this.toughness = ability.getToughness().toString();
|
||||
String nameToShow;
|
||||
if (sourceCard.isMorphCard() && sourceCard.isFaceDown()) {
|
||||
CardView tmpSourceCard = this.getSourceCard();
|
||||
tmpSourceCard.displayName = "Face Down";
|
||||
tmpSourceCard.superTypes.clear();
|
||||
tmpSourceCard.subTypes.clear();
|
||||
tmpSourceCard.cardTypes.clear();
|
||||
tmpSourceCard.cardTypes.add(CardType.CREATURE);
|
||||
tmpSourceCard.manaCost.clear();
|
||||
tmpSourceCard.power = "2";
|
||||
tmpSourceCard.toughness = "2";
|
||||
nameToShow = "creature without name";
|
||||
} else {
|
||||
nameToShow = sourceName;
|
||||
}
|
||||
this.rules = new ArrayList<>();
|
||||
rules.add(ability.getRule(nameToShow));
|
||||
this.counters = sourceCard.getCounters();
|
||||
|
||||
updateTargets(game, ability);
|
||||
|
|
@ -117,6 +139,7 @@ public class StackAbilityView extends CardView {
|
|||
return this.sourceCard;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbilityType getAbilityType() {
|
||||
return abilityType;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue