mirror of
https://github.com/magefree/mage.git
synced 2026-01-24 20:29:19 -08:00
Displaying top revealed card in client. PlayWithTheTopCardRevealedEffect.
This commit is contained in:
parent
8b415e2296
commit
31d849ef46
9 changed files with 160 additions and 20 deletions
|
|
@ -1,9 +1,11 @@
|
|||
package mage.cards;
|
||||
|
||||
import java.awt.Image;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import mage.cards.action.ActionCallback;
|
||||
import mage.view.CardView;
|
||||
|
||||
public abstract class MageCard extends JPanel {
|
||||
|
|
@ -18,9 +20,11 @@ public abstract class MageCard extends JPanel {
|
|||
abstract public CardView getOriginal();
|
||||
abstract public void setCardBounds(int x, int y, int width, int height);
|
||||
abstract public void update(CardView card);
|
||||
abstract public void updateImage();
|
||||
abstract public Image getImage();
|
||||
abstract public void setFoil(boolean foil);
|
||||
abstract public boolean isFoil();
|
||||
abstract public void setZone(String zone);
|
||||
abstract public String getZone();
|
||||
abstract public void updateCallback(ActionCallback callback, UUID gameId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -145,6 +145,14 @@ public class CardView extends SimpleCardView {
|
|||
super(null, "", 0, false);
|
||||
}
|
||||
|
||||
public CardView(boolean empty) {
|
||||
super(null, "", 0, false);
|
||||
if (!empty) {
|
||||
throw new IllegalArgumentException("Not supported.");
|
||||
}
|
||||
fillEmpty();
|
||||
}
|
||||
|
||||
private void fillEmpty() {
|
||||
this.name = "Face Down";
|
||||
this.rules = new ArrayList<String>();
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ public class PlayerView implements Serializable {
|
|||
private ManaPoolView manaPool;
|
||||
private SimpleCardsView graveyard = new SimpleCardsView();
|
||||
private Map<UUID, PermanentView> battlefield = new HashMap<UUID, PermanentView>();
|
||||
private CardView topCard;
|
||||
|
||||
public PlayerView(Player player, GameState state, Game game) {
|
||||
this.playerId = player.getId();
|
||||
|
|
@ -77,6 +78,8 @@ public class PlayerView implements Serializable {
|
|||
battlefield.put(view.getId(), view);
|
||||
}
|
||||
}
|
||||
this.topCard = player.isTopCardRevealed() && player.getLibrary().size() > 0 ?
|
||||
new CardView(player.getLibrary().getFromTop(game)) : null;
|
||||
}
|
||||
|
||||
private boolean showInBattlefield(Permanent permanent, GameState state) {
|
||||
|
|
@ -136,4 +139,8 @@ public class PlayerView implements Serializable {
|
|||
public boolean hasLeft() {
|
||||
return this.hasLeft;
|
||||
}
|
||||
|
||||
public CardView getTopCard() {
|
||||
return this.topCard;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue