forked from External/mage
Face down images and cards rework (#11873)
Face down changes: * GUI: added visible face down type and real card name for controller/owner (opponent can see it after game ends); * GUI: added day/night button to view real card for controller/owner (opponent can see it after game ends); * game: fixed that faced-down card can render symbols, abilities and other hidden data from a real card; * images: added image support for normal faced-down cards; * images: added image support for morph and megamorph faced-down cards; * images: added image support for foretell faced-down cards; Other changes: * images: fixed missing tokens from DDD set; * images: no more client restart to apply newly downloaded images or render settings; * images: improved backface image quality (use main menu -> symbols to download it);
This commit is contained in:
parent
4901de12c1
commit
e38a79f231
104 changed files with 2178 additions and 1495 deletions
|
|
@ -1,17 +1,15 @@
|
|||
package mage.view;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.TurnFaceUpAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.PermanentToken;
|
||||
import mage.players.Player;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
|
|
@ -39,9 +37,8 @@ public class PermanentView extends CardView {
|
|||
private final boolean attachedControllerDiffers;
|
||||
|
||||
public PermanentView(Permanent permanent, Card card, UUID createdForPlayerId, Game game) {
|
||||
super(permanent, game, permanent.getControllerId() != null && permanent.getControllerId().equals(createdForPlayerId));
|
||||
super(permanent, game, CardUtil.canShowAsControlled(permanent, createdForPlayerId));
|
||||
this.controlled = permanent.getControllerId() != null && permanent.getControllerId().equals(createdForPlayerId);
|
||||
this.rules = permanent.getRules(game);
|
||||
this.tapped = permanent.isTapped();
|
||||
this.flipped = permanent.isFlipped();
|
||||
this.phasedIn = permanent.isPhasedIn();
|
||||
|
|
@ -52,26 +49,26 @@ public class PermanentView extends CardView {
|
|||
this.attachments = new ArrayList<>(permanent.getAttachments());
|
||||
this.attachedTo = permanent.getAttachedTo();
|
||||
|
||||
// show face down cards to all players at the game end
|
||||
boolean showFaceDownInfo = controlled || (game != null && game.hasEnded());
|
||||
|
||||
// store original card, e.g. for sides switch in GUI
|
||||
if (isToken()) {
|
||||
original = new CardView(((PermanentToken) permanent).getToken().copy(), (Game) null);
|
||||
original.expansionSetCode = permanent.getExpansionSetCode();
|
||||
original.expansionSetCode = permanent.getExpansionSetCode(); // TODO: miss card number and other?
|
||||
expansionSetCode = permanent.getExpansionSetCode();
|
||||
} else {
|
||||
// face down card must be hidden from opponent, but shown on game end for all
|
||||
boolean showFaceDownInfo = controlled || (game != null && game.hasEnded());
|
||||
if (card != null && showFaceDownInfo) {
|
||||
// face down card must be hidden from opponent, but shown on game end for all
|
||||
original = new CardView(card.copy(), (Game) null);
|
||||
} else {
|
||||
original = null;
|
||||
}
|
||||
}
|
||||
this.transformed = permanent.isTransformed();
|
||||
//this.transformed = permanent.isTransformed();
|
||||
this.copy = permanent.isCopy();
|
||||
|
||||
// for fipped, transformed or copied cards, switch the names
|
||||
if (original != null && !original.getName().equals(this.getName())) {
|
||||
// TODO: wtf, why copy check here?! Need research
|
||||
if (permanent.isCopy() && permanent.isFlipCard()) {
|
||||
this.alternateName = permanent.getFlipCardName();
|
||||
} else {
|
||||
|
|
@ -98,31 +95,16 @@ public class PermanentView extends CardView {
|
|||
}
|
||||
this.nameController = nameController;
|
||||
|
||||
// add info for face down permanents
|
||||
if (permanent.isFaceDown(game) && card != null) {
|
||||
if (showFaceDownInfo) {
|
||||
// must be a morphed or manifested card
|
||||
for (Ability permanentAbility : permanent.getAbilities(game)) {
|
||||
if (permanentAbility.getWorksFaceDown()) {
|
||||
this.rules.add(permanentAbility.getRule(true));
|
||||
} else if (permanentAbility instanceof TurnFaceUpAbility && !permanentAbility.getRuleVisible()) {
|
||||
this.rules.add(permanentAbility.getRule());
|
||||
}
|
||||
}
|
||||
this.name = card.getName();
|
||||
this.displayName = card.getName();
|
||||
this.expansionSetCode = card.getExpansionSetCode();
|
||||
this.cardNumber = card.getCardNumber();
|
||||
} 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.");
|
||||
} else if (permanent.isMorphed()) {
|
||||
this.rules.add("If the controller has priority, they may turn this permanent face up."
|
||||
+ " This is a special action; it doesn't use the stack. To do this they pay the morph costs,"
|
||||
+ " then turns this permanent face up.");
|
||||
}
|
||||
}
|
||||
// add additional info for face down permanents
|
||||
if (permanent.isFaceDown(game)) {
|
||||
//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.");
|
||||
//} else if (permanent.isMorphed()) {
|
||||
// this.rules.add("If the controller has priority, they may turn this permanent face up."
|
||||
// + " This is a special action; it doesn't use the stack. To do this they pay the morph costs,"
|
||||
// + " then turns this permanent face up.");
|
||||
//}
|
||||
}
|
||||
|
||||
// determines if shown in it's own column
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue