mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 10:40:06 -08:00
[ZNR] Improved GUI for modal double faces cards (#7012)
This commit is contained in:
parent
c60bf3ccef
commit
898d271c36
4 changed files with 34 additions and 7 deletions
|
|
@ -579,7 +579,10 @@ public class MageActionCallback implements ActionCallback {
|
||||||
break;
|
break;
|
||||||
case ALTERNATE:
|
case ALTERNATE:
|
||||||
if (cardView.getAlternateName() != null) {
|
if (cardView.getAlternateName() != null) {
|
||||||
if (cardView instanceof PermanentView && !cardView.isFlipCard() && !cardView.canTransform() && ((PermanentView) cardView).isCopy()) {
|
if (cardView instanceof PermanentView
|
||||||
|
&& !cardView.isFlipCard()
|
||||||
|
&& !cardView.canTransform()
|
||||||
|
&& ((PermanentView) cardView).isCopy()) {
|
||||||
image = ImageCache.getImageOriginal(((PermanentView) cardView).getOriginal());
|
image = ImageCache.getImageOriginal(((PermanentView) cardView).getOriginal());
|
||||||
} else {
|
} else {
|
||||||
image = ImageCache.getImageOriginalAlternateName(cardView);
|
image = ImageCache.getImageOriginalAlternateName(cardView);
|
||||||
|
|
|
||||||
|
|
@ -819,9 +819,12 @@ public abstract class CardPanel extends MagePermanent implements MouseListener,
|
||||||
this.setTemporary(null);
|
this.setTemporary(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// switch card names for render
|
||||||
String temp = this.getGameCard().getAlternateName();
|
String temp = this.getGameCard().getAlternateName();
|
||||||
this.getGameCard().setAlternateName(this.getGameCard().getOriginalName());
|
this.getGameCard().setAlternateName(this.getGameCard().getOriginalName());
|
||||||
this.getGameCard().setOriginalName(temp);
|
this.getGameCard().setOriginalName(temp);
|
||||||
|
|
||||||
updateArtImage();
|
updateArtImage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ public class CardView extends SimpleCardView {
|
||||||
protected CardView ability;
|
protected CardView ability;
|
||||||
protected int type;
|
protected int type;
|
||||||
|
|
||||||
protected boolean transformable;
|
protected boolean transformable; // can toggle one card side to another (transformable cards, modal double faces)
|
||||||
protected CardView secondCardFace;
|
protected CardView secondCardFace;
|
||||||
protected boolean transformed;
|
protected boolean transformed;
|
||||||
|
|
||||||
|
|
@ -444,18 +444,29 @@ public class CardView extends SimpleCardView {
|
||||||
this.isToken = false;
|
this.isToken = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// transformable, double faces cards
|
||||||
Card secondSideCard = card.getSecondCardFace();
|
Card secondSideCard = card.getSecondCardFace();
|
||||||
if (secondSideCard != null) {
|
if (secondSideCard != null) {
|
||||||
this.secondCardFace = new CardView(secondSideCard);
|
this.secondCardFace = new CardView(secondSideCard);
|
||||||
this.alternateName = secondCardFace.getName();
|
this.alternateName = secondCardFace.getName();
|
||||||
this.originalName = card.getName();
|
this.originalName = card.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.flipCard = card.isFlipCard();
|
this.flipCard = card.isFlipCard();
|
||||||
if (card.isFlipCard() && card.getFlipCardName() != null) {
|
if (card.isFlipCard() && card.getFlipCardName() != null) {
|
||||||
this.alternateName = card.getFlipCardName();
|
this.alternateName = card.getFlipCardName();
|
||||||
this.originalName = card.getName();
|
this.originalName = card.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
if (card instanceof ModalDoubleFacesCard) {
|
||||||
|
ModalDoubleFacesCard mdfCard = (ModalDoubleFacesCard) card;
|
||||||
|
this.secondCardFace = new CardView(mdfCard.getRightHalfCard());
|
||||||
|
this.alternateName = mdfCard.getRightHalfCard().getName();
|
||||||
|
this.originalName = card.getName();
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
if (card instanceof Spell) {
|
if (card instanceof Spell) {
|
||||||
this.mageObjectType = MageObjectType.SPELL;
|
this.mageObjectType = MageObjectType.SPELL;
|
||||||
Spell spell = (Spell) card;
|
Spell spell = (Spell) card;
|
||||||
|
|
@ -887,7 +898,7 @@ public class CardView extends SimpleCardView {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Name of the other side (transform), flipped, or copying card name.
|
* Name of the other side (transform), flipped, modal double faces card or copying card name.
|
||||||
*
|
*
|
||||||
* @return name
|
* @return name
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import mage.abilities.costs.mana.ManaCost;
|
||||||
import mage.abilities.costs.mana.ManaCosts;
|
import mage.abilities.costs.mana.ManaCosts;
|
||||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
|
import mage.cards.ModalDoubleFacesCard;
|
||||||
import mage.cards.repository.CardInfo;
|
import mage.cards.repository.CardInfo;
|
||||||
import mage.cards.repository.CardRepository;
|
import mage.cards.repository.CardRepository;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
@ -31,7 +32,7 @@ public class MockCard extends CardImpl {
|
||||||
protected ManaCosts<ManaCost> manaCostLeft;
|
protected ManaCosts<ManaCost> manaCostLeft;
|
||||||
protected ManaCosts<ManaCost> manaCostRight;
|
protected ManaCosts<ManaCost> manaCostRight;
|
||||||
protected String adventureSpellName;
|
protected String adventureSpellName;
|
||||||
protected String modalDoubleFacesSecondSideName;
|
protected boolean isModalDoubleFacesCard;
|
||||||
|
|
||||||
public MockCard(CardInfo card) {
|
public MockCard(CardInfo card) {
|
||||||
super(null, card.getName());
|
super(null, card.getName());
|
||||||
|
|
@ -68,7 +69,10 @@ public class MockCard extends CardImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (card.isModalDoubleFacesCard()) {
|
if (card.isModalDoubleFacesCard()) {
|
||||||
this.modalDoubleFacesSecondSideName = card.getModalDoubleFacesSecondSideName();
|
ModalDoubleFacesCard mdfCard = (ModalDoubleFacesCard) card.getCard();
|
||||||
|
CardInfo mdfSecondSide = new CardInfo(mdfCard.getRightHalfCard());
|
||||||
|
this.secondSideCard = new MockCard(mdfSecondSide);
|
||||||
|
this.isModalDoubleFacesCard = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.isPlaneswalker()) {
|
if (this.isPlaneswalker()) {
|
||||||
|
|
@ -128,8 +132,8 @@ public class MockCard extends CardImpl {
|
||||||
|
|
||||||
if (adventureSpellName != null) {
|
if (adventureSpellName != null) {
|
||||||
return getName() + ADVENTURE_NAME_SEPARATOR + adventureSpellName;
|
return getName() + ADVENTURE_NAME_SEPARATOR + adventureSpellName;
|
||||||
} else if (modalDoubleFacesSecondSideName != null) {
|
} else if (isModalDoubleFacesCard) {
|
||||||
return getName() + MODAL_DOUBLE_FACES_NAME_SEPARATOR + modalDoubleFacesSecondSideName;
|
return getName() + MODAL_DOUBLE_FACES_NAME_SEPARATOR + this.secondSideCard.getName();
|
||||||
} else {
|
} else {
|
||||||
return getName();
|
return getName();
|
||||||
}
|
}
|
||||||
|
|
@ -156,4 +160,10 @@ public class MockCard extends CardImpl {
|
||||||
private Ability textAbilityFromString(final String text) {
|
private Ability textAbilityFromString(final String text) {
|
||||||
return new MockAbility(text);
|
return new MockAbility(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isTransformable() {
|
||||||
|
// must enable toggle mode in deck editor (switch between card sides);
|
||||||
|
return super.isTransformable() || this.isModalDoubleFacesCard;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue