mirror of
https://github.com/correl/mage.git
synced 2024-11-28 19:19:55 +00:00
* UI: added playable card marks in look-at windows;
This commit is contained in:
parent
ff1299cca9
commit
cde9957f54
15 changed files with 200 additions and 122 deletions
|
@ -517,7 +517,7 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setSelected(boolean selected) {
|
public void setSelected(boolean isSelected) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1205,11 +1205,11 @@ public final class GamePanel extends javax.swing.JPanel {
|
||||||
needSelectable = new HashSet<>();
|
needSelectable = new HashSet<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
Set<UUID> needPlayable;
|
Map<UUID, Integer> needPlayable;
|
||||||
if (showPlayable && gameView.getCanPlayObjects() != null) {
|
if (showPlayable && gameView.getCanPlayObjects() != null) {
|
||||||
needPlayable = gameView.getCanPlayObjects();
|
needPlayable = gameView.getCanPlayObjects();
|
||||||
} else {
|
} else {
|
||||||
needPlayable = new HashSet<>();
|
needPlayable = new HashMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (needChoosen.isEmpty() && needSelectable.isEmpty() && needPlayable.isEmpty()) {
|
if (needChoosen.isEmpty() && needSelectable.isEmpty() && needPlayable.isEmpty()) {
|
||||||
|
@ -1225,8 +1225,9 @@ public final class GamePanel extends javax.swing.JPanel {
|
||||||
if (needChoosen.contains(card.getId())) {
|
if (needChoosen.contains(card.getId())) {
|
||||||
card.setSelected(true);
|
card.setSelected(true);
|
||||||
}
|
}
|
||||||
if (needPlayable.contains(card.getId())) {
|
if (needPlayable.containsKey(card.getId())) {
|
||||||
card.setPlayable(true);
|
card.setPlayable(true);
|
||||||
|
card.setPlayableAmount(needPlayable.get(card.getId()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1254,8 +1255,9 @@ public final class GamePanel extends javax.swing.JPanel {
|
||||||
if (needChoosen.contains(perm.getKey())) {
|
if (needChoosen.contains(perm.getKey())) {
|
||||||
perm.getValue().setSelected(true);
|
perm.getValue().setSelected(true);
|
||||||
}
|
}
|
||||||
if (needPlayable.contains(perm.getKey())) {
|
if (needPlayable.containsKey(perm.getKey())) {
|
||||||
perm.getValue().setPlayable(true);
|
perm.getValue().setPlayable(true);
|
||||||
|
perm.getValue().setPlayableAmount(needPlayable.get(perm.getKey()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1271,8 +1273,9 @@ public final class GamePanel extends javax.swing.JPanel {
|
||||||
if (needChoosen.contains(card.getKey())) {
|
if (needChoosen.contains(card.getKey())) {
|
||||||
card.getValue().setSelected(true);
|
card.getValue().setSelected(true);
|
||||||
}
|
}
|
||||||
if (needPlayable.contains(card.getKey())) {
|
if (needPlayable.containsKey(card.getKey())) {
|
||||||
card.getValue().setPlayable(true);
|
card.getValue().setPlayable(true);
|
||||||
|
card.getValue().setPlayableAmount(needPlayable.get(card.getKey()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1288,8 +1291,9 @@ public final class GamePanel extends javax.swing.JPanel {
|
||||||
if (needChoosen.contains(card.getKey())) {
|
if (needChoosen.contains(card.getKey())) {
|
||||||
card.getValue().setSelected(true);
|
card.getValue().setSelected(true);
|
||||||
}
|
}
|
||||||
if (needPlayable.contains(card.getKey())) {
|
if (needPlayable.containsKey(card.getKey())) {
|
||||||
card.getValue().setPlayable(true);
|
card.getValue().setPlayable(true);
|
||||||
|
card.getValue().setPlayableAmount(needPlayable.get(card.getKey()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1305,8 +1309,9 @@ public final class GamePanel extends javax.swing.JPanel {
|
||||||
if (needChoosen.contains(com.getId())) {
|
if (needChoosen.contains(com.getId())) {
|
||||||
com.setSelected(true);
|
com.setSelected(true);
|
||||||
}
|
}
|
||||||
if (needPlayable.contains(com.getId())) {
|
if (needPlayable.containsKey(com.getId())) {
|
||||||
com.setPlayable(true);
|
com.setPlayable(true);
|
||||||
|
com.setPlayableAmount(needPlayable.get(com.getId()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1321,8 +1326,19 @@ public final class GamePanel extends javax.swing.JPanel {
|
||||||
if (needChoosen.contains(card.getKey())) {
|
if (needChoosen.contains(card.getKey())) {
|
||||||
card.getValue().setSelected(true);
|
card.getValue().setSelected(true);
|
||||||
}
|
}
|
||||||
if (needPlayable.contains(card.getKey())) {
|
if (needPlayable.containsKey(card.getKey())) {
|
||||||
card.getValue().setPlayable(true);
|
card.getValue().setPlayable(true);
|
||||||
|
card.getValue().setPlayableAmount(needPlayable.get(card.getKey()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// looked at
|
||||||
|
for (LookedAtView look : gameView.getLookedAt()) {
|
||||||
|
for (Map.Entry<UUID, SimpleCardView> card : look.getCards().entrySet()) {
|
||||||
|
if (needPlayable.containsKey(card.getKey())) {
|
||||||
|
card.getValue().setPlayable(true);
|
||||||
|
card.getValue().setPlayableAmount(needPlayable.get(card.getKey()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -142,7 +142,7 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
||||||
// can play
|
// can play
|
||||||
if (gameView != null && gameView.getCanPlayObjects() != null && !gameView.getCanPlayObjects().isEmpty()) {
|
if (gameView != null && gameView.getCanPlayObjects() != null && !gameView.getCanPlayObjects().isEmpty()) {
|
||||||
for (CardView card : cards) {
|
for (CardView card : cards) {
|
||||||
if (gameView.getCanPlayObjects().contains(card.getId())) {
|
if (gameView.getCanPlayObjects().containsKey(card.getId())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -239,7 +239,7 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
||||||
|
|
||||||
Color commandColor = Color.BLACK;
|
Color commandColor = Color.BLACK;
|
||||||
for (CommandObjectView com : player.getCommandObjectList()) {
|
for (CommandObjectView com : player.getCommandObjectList()) {
|
||||||
if (game != null && game.getCanPlayObjects() != null && game.getCanPlayObjects().contains(com.getId())) {
|
if (game != null && game.getCanPlayObjects() != null && game.getCanPlayObjects().containsKey(com.getId())) {
|
||||||
commandColor = activeValueColor;
|
commandColor = activeValueColor;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -269,7 +269,7 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
||||||
|
|
||||||
if (!MageFrame.isLite()) {
|
if (!MageFrame.isLite()) {
|
||||||
int id = player.getUserData().getAvatarId();
|
int id = player.getUserData().getAvatarId();
|
||||||
if (!(id >= 1000) && (id <= 0 || (id <= MIN_AVATAR_ID && id > MAX_AVATAR_ID))) {
|
if (!(id > 1000) && (id != 64) && (id < MIN_AVATAR_ID || id > MAX_AVATAR_ID)) {
|
||||||
id = DEFAULT_AVATAR_ID;
|
id = DEFAULT_AVATAR_ID;
|
||||||
}
|
}
|
||||||
if (id != avatarId) {
|
if (id != avatarId) {
|
||||||
|
|
|
@ -20,7 +20,7 @@ public final class CardsViewUtil {
|
||||||
CardInfo cardInfo = CardRepository.instance.findCard(simple.getExpansionSetCode(), simple.getCardNumber());
|
CardInfo cardInfo = CardRepository.instance.findCard(simple.getExpansionSetCode(), simple.getCardNumber());
|
||||||
Card card = cardInfo != null ? cardInfo.getMockCard() : null;
|
Card card = cardInfo != null ? cardInfo.getMockCard() : null;
|
||||||
if (card != null) {
|
if (card != null) {
|
||||||
cards.put(simple.getId(), new CardView(card, simple.getId()));
|
cards.put(simple.getId(), new CardView(card, simple));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ public final class CardsViewUtil {
|
||||||
loadedCards.put(key, card);
|
loadedCards.put(key, card);
|
||||||
}
|
}
|
||||||
if (card != null) {
|
if (card != null) {
|
||||||
cards.put(simple.getId(), new CardView(card, simple.getId()));
|
cards.put(simple.getId(), new CardView(card, simple));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ import java.util.stream.Collectors;
|
||||||
/**
|
/**
|
||||||
* @author BetaSteward_at_googlemail.com
|
* @author BetaSteward_at_googlemail.com
|
||||||
*/
|
*/
|
||||||
public class CardView extends SimpleCardView implements SelectableObjectView {
|
public class CardView extends SimpleCardView {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ -104,9 +104,6 @@ public class CardView extends SimpleCardView implements SelectableObjectView {
|
||||||
protected boolean rotate;
|
protected boolean rotate;
|
||||||
protected boolean hideInfo; // controls if the tooltip window is shown (eg. controlled face down morph card)
|
protected boolean hideInfo; // controls if the tooltip window is shown (eg. controlled face down morph card)
|
||||||
|
|
||||||
protected boolean isPlayable;
|
|
||||||
protected boolean isChoosable;
|
|
||||||
protected boolean selected;
|
|
||||||
protected boolean canAttack;
|
protected boolean canAttack;
|
||||||
protected boolean canBlock;
|
protected boolean canBlock;
|
||||||
protected boolean inViewerOnly;
|
protected boolean inViewerOnly;
|
||||||
|
@ -117,9 +114,13 @@ public class CardView extends SimpleCardView implements SelectableObjectView {
|
||||||
this(card, null, false);
|
this(card, null, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CardView(Card card, UUID cardId) {
|
public CardView(Card card, SimpleCardView simpleCardView) {
|
||||||
this(card, null, false);
|
this(card, null, false);
|
||||||
this.id = cardId;
|
this.id = simpleCardView.getId();
|
||||||
|
|
||||||
|
this.isPlayable = simpleCardView.isPlayable;
|
||||||
|
this.isChoosable = simpleCardView.isChoosable;
|
||||||
|
this.isSelected = simpleCardView.isSelected;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CardView(Card card, Game game, UUID cardId) {
|
public CardView(Card card, Game game, UUID cardId) {
|
||||||
|
@ -128,10 +129,12 @@ public class CardView extends SimpleCardView implements SelectableObjectView {
|
||||||
}
|
}
|
||||||
|
|
||||||
public CardView(CardView cardView) {
|
public CardView(CardView cardView) {
|
||||||
super(cardView.id, cardView.expansionSetCode, cardView.cardNumber, cardView.usesVariousArt, cardView.tokenSetCode, cardView.gameObject, cardView.tokenDescriptor);
|
super(cardView);
|
||||||
this.originalCard = cardView.originalCard;
|
this.originalCard = cardView.originalCard;
|
||||||
|
|
||||||
|
// generetate new ID
|
||||||
this.id = UUID.randomUUID();
|
this.id = UUID.randomUUID();
|
||||||
|
|
||||||
this.parentId = cardView.parentId;
|
this.parentId = cardView.parentId;
|
||||||
this.name = cardView.name;
|
this.name = cardView.name;
|
||||||
this.displayName = cardView.displayName;
|
this.displayName = cardView.displayName;
|
||||||
|
@ -198,9 +201,6 @@ public class CardView extends SimpleCardView implements SelectableObjectView {
|
||||||
this.rotate = cardView.rotate;
|
this.rotate = cardView.rotate;
|
||||||
this.hideInfo = cardView.hideInfo;
|
this.hideInfo = cardView.hideInfo;
|
||||||
|
|
||||||
this.isPlayable = cardView.isPlayable;
|
|
||||||
this.isChoosable = cardView.isChoosable;
|
|
||||||
this.selected = cardView.selected;
|
|
||||||
this.canAttack = cardView.canAttack;
|
this.canAttack = cardView.canAttack;
|
||||||
this.canBlock = cardView.canBlock;
|
this.canBlock = cardView.canBlock;
|
||||||
this.inViewerOnly = cardView.inViewerOnly;
|
this.inViewerOnly = cardView.inViewerOnly;
|
||||||
|
@ -468,8 +468,6 @@ public class CardView extends SimpleCardView implements SelectableObjectView {
|
||||||
|
|
||||||
// Get starting loyalty
|
// Get starting loyalty
|
||||||
this.startingLoyalty = "" + card.getStartingLoyalty();
|
this.startingLoyalty = "" + card.getStartingLoyalty();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public CardView(MageObject object) {
|
public CardView(MageObject object) {
|
||||||
|
@ -964,30 +962,6 @@ public class CardView extends SimpleCardView implements SelectableObjectView {
|
||||||
return hideInfo;
|
return hideInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPlayable() {
|
|
||||||
return isPlayable;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPlayable(boolean isPlayable) {
|
|
||||||
this.isPlayable = isPlayable;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isChoosable() {
|
|
||||||
return isChoosable;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setChoosable(boolean isChoosable) {
|
|
||||||
this.isChoosable = isChoosable;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isSelected() {
|
|
||||||
return selected;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSelected(boolean selected) {
|
|
||||||
this.selected = selected;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isCanAttack() {
|
public boolean isCanAttack() {
|
||||||
return canAttack;
|
return canAttack;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ public class EmblemView implements CommandObjectView, Serializable {
|
||||||
protected String expansionSetCode;
|
protected String expansionSetCode;
|
||||||
protected List<String> rules;
|
protected List<String> rules;
|
||||||
protected boolean isPlayable = false;
|
protected boolean isPlayable = false;
|
||||||
|
protected int playableAmount = 0;
|
||||||
|
|
||||||
public EmblemView(Emblem emblem, Card sourceCard) {
|
public EmblemView(Emblem emblem, Card sourceCard) {
|
||||||
this.id = emblem.getId();
|
this.id = emblem.getId();
|
||||||
|
@ -67,6 +68,16 @@ public class EmblemView implements CommandObjectView, Serializable {
|
||||||
this.isPlayable = isPlayable;
|
this.isPlayable = isPlayable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setPlayableAmount(int playableAmount) {
|
||||||
|
this.playableAmount = playableAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getPlayableAmount() {
|
||||||
|
return playableAmount;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isChoosable() {
|
public boolean isChoosable() {
|
||||||
// unsupported
|
// unsupported
|
||||||
|
@ -85,7 +96,7 @@ public class EmblemView implements CommandObjectView, Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setSelected(boolean selected) {
|
public void setSelected(boolean isSelected) {
|
||||||
// unsupported
|
// unsupported
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,10 @@ import mage.watchers.common.CastSpellLastTurnWatcher;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author BetaSteward_at_googlemail.com
|
* @author BetaSteward_at_googlemail.com
|
||||||
|
@ -39,7 +42,7 @@ public class GameView implements Serializable {
|
||||||
private final int priorityTime;
|
private final int priorityTime;
|
||||||
private final List<PlayerView> players = new ArrayList<>();
|
private final List<PlayerView> players = new ArrayList<>();
|
||||||
private CardsView hand;
|
private CardsView hand;
|
||||||
private Set<UUID> canPlayObjects;
|
private Map<UUID, Integer> canPlayObjects;
|
||||||
private Map<String, SimpleCardsView> opponentHands;
|
private Map<String, SimpleCardsView> opponentHands;
|
||||||
private Map<String, SimpleCardsView> watchedHands;
|
private Map<String, SimpleCardsView> watchedHands;
|
||||||
private final CardsView stack = new CardsView();
|
private final CardsView stack = new CardsView();
|
||||||
|
@ -300,11 +303,11 @@ public class GameView implements Serializable {
|
||||||
return isPlayer;
|
return isPlayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<UUID> getCanPlayObjects() {
|
public Map<UUID, Integer> getCanPlayObjects() {
|
||||||
return canPlayObjects;
|
return canPlayObjects;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCanPlayObjects(Set<UUID> canPlayObjects) {
|
public void setCanPlayObjects(Map<UUID, Integer> canPlayObjects) {
|
||||||
this.canPlayObjects = canPlayObjects;
|
this.canPlayObjects = canPlayObjects;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ public class PlaneView implements CommandObjectView, Serializable {
|
||||||
protected List<String> rules;
|
protected List<String> rules;
|
||||||
|
|
||||||
protected boolean isPlayable = false;
|
protected boolean isPlayable = false;
|
||||||
|
protected int playableAmount = 0;
|
||||||
|
|
||||||
public PlaneView(Plane plane, Card sourceCard) {
|
public PlaneView(Plane plane, Card sourceCard) {
|
||||||
this.id = plane.getId();
|
this.id = plane.getId();
|
||||||
|
@ -67,6 +68,16 @@ public class PlaneView implements CommandObjectView, Serializable {
|
||||||
this.isPlayable = isPlayable;
|
this.isPlayable = isPlayable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setPlayableAmount(int playableAmount) {
|
||||||
|
this.playableAmount = playableAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getPlayableAmount() {
|
||||||
|
return playableAmount;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isChoosable() {
|
public boolean isChoosable() {
|
||||||
// unsupported
|
// unsupported
|
||||||
|
@ -85,7 +96,7 @@ public class PlaneView implements CommandObjectView, Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setSelected(boolean selected) {
|
public void setSelected(boolean isSelected) {
|
||||||
// unsupported
|
// unsupported
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,11 +9,15 @@ public interface SelectableObjectView {
|
||||||
|
|
||||||
void setPlayable(boolean isPlayable);
|
void setPlayable(boolean isPlayable);
|
||||||
|
|
||||||
|
void setPlayableAmount(int playableAmount);
|
||||||
|
|
||||||
|
int getPlayableAmount();
|
||||||
|
|
||||||
boolean isChoosable();
|
boolean isChoosable();
|
||||||
|
|
||||||
void setChoosable(boolean isChoosable);
|
void setChoosable(boolean isChoosable);
|
||||||
|
|
||||||
boolean isSelected();
|
boolean isSelected();
|
||||||
|
|
||||||
void setSelected(boolean selected);
|
void setSelected(boolean isSelected);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
|
|
||||||
|
|
||||||
package mage.view;
|
package mage.view;
|
||||||
|
|
||||||
import com.google.gson.annotations.Expose;
|
import com.google.gson.annotations.Expose;
|
||||||
|
@ -8,10 +6,9 @@ import java.io.Serializable;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author BetaSteward_at_googlemail.com
|
* @author BetaSteward_at_googlemail.com
|
||||||
*/
|
*/
|
||||||
public class SimpleCardView implements Serializable {
|
public class SimpleCardView implements Serializable, SelectableObjectView {
|
||||||
@Expose
|
@Expose
|
||||||
protected UUID id;
|
protected UUID id;
|
||||||
protected String expansionSetCode;
|
protected String expansionSetCode;
|
||||||
|
@ -21,9 +18,30 @@ public class SimpleCardView implements Serializable {
|
||||||
protected boolean usesVariousArt;
|
protected boolean usesVariousArt;
|
||||||
protected boolean gameObject;
|
protected boolean gameObject;
|
||||||
|
|
||||||
|
protected boolean isPlayable;
|
||||||
|
protected boolean isChoosable;
|
||||||
|
protected boolean isSelected;
|
||||||
|
protected int playableAmount; // playable abilities count on object
|
||||||
|
|
||||||
|
public SimpleCardView(final SimpleCardView view) {
|
||||||
|
this.id = view.id;
|
||||||
|
this.expansionSetCode = view.expansionSetCode;
|
||||||
|
this.tokenSetCode = view.tokenSetCode;
|
||||||
|
this.tokenDescriptor = view.tokenDescriptor;
|
||||||
|
this.cardNumber = view.cardNumber;
|
||||||
|
this.usesVariousArt = view.usesVariousArt;
|
||||||
|
this.gameObject = view.gameObject;
|
||||||
|
|
||||||
|
this.isPlayable = view.isPlayable;
|
||||||
|
this.isChoosable = view.isChoosable;
|
||||||
|
this.isSelected = view.isSelected;
|
||||||
|
this.playableAmount = view.playableAmount;
|
||||||
|
}
|
||||||
|
|
||||||
public SimpleCardView(UUID id, String expansionSetCode, String cardNumber, boolean usesVariousArt, String tokenSetCode, String tokenDescriptor) {
|
public SimpleCardView(UUID id, String expansionSetCode, String cardNumber, boolean usesVariousArt, String tokenSetCode, String tokenDescriptor) {
|
||||||
this(id, expansionSetCode, cardNumber, usesVariousArt, tokenSetCode, false, tokenDescriptor);
|
this(id, expansionSetCode, cardNumber, usesVariousArt, tokenSetCode, false, tokenDescriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SimpleCardView(UUID id, String expansionSetCode, String cardNumber, boolean usesVariousArt, String tokenSetCode, boolean isGameObject, String tokenDescriptor) {
|
public SimpleCardView(UUID id, String expansionSetCode, String cardNumber, boolean usesVariousArt, String tokenSetCode, boolean isGameObject, String tokenDescriptor) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.expansionSetCode = expansionSetCode;
|
this.expansionSetCode = expansionSetCode;
|
||||||
|
@ -53,12 +71,52 @@ public class SimpleCardView implements Serializable {
|
||||||
public String getTokenSetCode() {
|
public String getTokenSetCode() {
|
||||||
return tokenSetCode;
|
return tokenSetCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTokenDescriptor() {
|
public String getTokenDescriptor() {
|
||||||
return tokenDescriptor;
|
return tokenDescriptor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isGameObject() {
|
public boolean isGameObject() {
|
||||||
return gameObject;
|
return gameObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isPlayable() {
|
||||||
|
return isPlayable;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setPlayable(boolean isPlayable) {
|
||||||
|
this.isPlayable = isPlayable;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setPlayableAmount(int playableAmount) {
|
||||||
|
this.playableAmount = playableAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getPlayableAmount() {
|
||||||
|
return playableAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isChoosable() {
|
||||||
|
return isChoosable;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setChoosable(boolean isChoosable) {
|
||||||
|
this.isChoosable = isChoosable;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSelected() {
|
||||||
|
return isSelected;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setSelected(boolean isSelected) {
|
||||||
|
this.isSelected = isSelected;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -182,7 +182,7 @@ class WordOfCommandEffect extends OneShotEffect {
|
||||||
} else { // Word of Command allows the chosen card to be played "as if it had flash" so we need to invoke such effect to bypass the check
|
} else { // Word of Command allows the chosen card to be played "as if it had flash" so we need to invoke such effect to bypass the check
|
||||||
AsThoughEffectImpl effect2 = new WordOfCommandTestFlashEffect();
|
AsThoughEffectImpl effect2 = new WordOfCommandTestFlashEffect();
|
||||||
game.addEffect(effect2, source);
|
game.addEffect(effect2, source);
|
||||||
if (targetPlayer.getPlayableObjects(game, Zone.HAND).contains(card.getId())) {
|
if (targetPlayer.getPlayableObjects(game, Zone.HAND).containsKey(card.getId())) {
|
||||||
canPlay = true;
|
canPlay = true;
|
||||||
}
|
}
|
||||||
for (AsThoughEffect eff : game.getContinuousEffects().getApplicableAsThoughEffects(AsThoughEffectType.CAST_AS_INSTANT, game)) {
|
for (AsThoughEffect eff : game.getContinuousEffects().getApplicableAsThoughEffects(AsThoughEffectType.CAST_AS_INSTANT, game)) {
|
||||||
|
|
|
@ -2899,7 +2899,7 @@ public class TestPlayer implements Player {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<UUID> getPlayableObjects(Game game, Zone zone) {
|
public Map<UUID, Integer> getPlayableObjects(Game game, Zone zone) {
|
||||||
return computerPlayer.getPlayableObjects(game, zone);
|
return computerPlayer.getPlayableObjects(game, zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1048,7 +1048,7 @@ public class PlayerStub implements Player {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<UUID> getPlayableObjects(Game game, Zone zone) {
|
public Map<UUID, Integer> getPlayableObjects(Game game, Zone zone) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -637,7 +637,7 @@ public interface Player extends MageItem, Copyable<Player> {
|
||||||
|
|
||||||
List<Ability> getPlayableOptions(Ability ability, Game game);
|
List<Ability> getPlayableOptions(Ability ability, Game game);
|
||||||
|
|
||||||
Set<UUID> getPlayableObjects(Game game, Zone zone);
|
Map<UUID, Integer> getPlayableObjects(Game game, Zone zone);
|
||||||
|
|
||||||
LinkedHashMap<UUID, ActivatedAbility> getUseableActivatedAbilities(MageObject object, Zone zone, Game game);
|
LinkedHashMap<UUID, ActivatedAbility> getUseableActivatedAbilities(MageObject object, Zone zone, Game game);
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
package mage.players;
|
package mage.players;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
import mage.ConditionalMana;
|
import mage.ConditionalMana;
|
||||||
import mage.MageObject;
|
import mage.MageObject;
|
||||||
import mage.MageObjectReference;
|
import mage.MageObjectReference;
|
||||||
|
@ -68,6 +65,10 @@ import mage.util.GameLog;
|
||||||
import mage.util.RandomUtil;
|
import mage.util.RandomUtil;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
public abstract class PlayerImpl implements Player, Serializable {
|
public abstract class PlayerImpl implements Player, Serializable {
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(PlayerImpl.class);
|
private static final Logger logger = Logger.getLogger(PlayerImpl.class);
|
||||||
|
@ -618,7 +619,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
if (abilities.containsKey(HexproofAbility.getInstance().getId())) {
|
if (abilities.containsKey(HexproofAbility.getInstance().getId())) {
|
||||||
if (sourceControllerId != null && this.hasOpponent(sourceControllerId, game)
|
if (sourceControllerId != null && this.hasOpponent(sourceControllerId, game)
|
||||||
&& null == game.getContinuousEffects().asThough(this.getId(),
|
&& null == game.getContinuousEffects().asThough(this.getId(),
|
||||||
AsThoughEffectType.HEXPROOF, null, sourceControllerId, game)) {
|
AsThoughEffectType.HEXPROOF, null, sourceControllerId, game)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -626,7 +627,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
if (abilities.containsKey(HexproofFromWhiteAbility.getInstance().getId())) {
|
if (abilities.containsKey(HexproofFromWhiteAbility.getInstance().getId())) {
|
||||||
if (sourceControllerId != null && this.hasOpponent(sourceControllerId, game)
|
if (sourceControllerId != null && this.hasOpponent(sourceControllerId, game)
|
||||||
&& null == game.getContinuousEffects().asThough(this.getId(),
|
&& null == game.getContinuousEffects().asThough(this.getId(),
|
||||||
AsThoughEffectType.HEXPROOF, null, sourceControllerId, game)
|
AsThoughEffectType.HEXPROOF, null, sourceControllerId, game)
|
||||||
&& source.getColor(game).isWhite()) {
|
&& source.getColor(game).isWhite()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -635,7 +636,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
if (abilities.containsKey(HexproofFromBlueAbility.getInstance().getId())) {
|
if (abilities.containsKey(HexproofFromBlueAbility.getInstance().getId())) {
|
||||||
if (sourceControllerId != null && this.hasOpponent(sourceControllerId, game)
|
if (sourceControllerId != null && this.hasOpponent(sourceControllerId, game)
|
||||||
&& null == game.getContinuousEffects().asThough(this.getId(),
|
&& null == game.getContinuousEffects().asThough(this.getId(),
|
||||||
AsThoughEffectType.HEXPROOF, null, sourceControllerId, game)
|
AsThoughEffectType.HEXPROOF, null, sourceControllerId, game)
|
||||||
&& source.getColor(game).isBlue()) {
|
&& source.getColor(game).isBlue()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -644,7 +645,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
if (abilities.containsKey(HexproofFromBlackAbility.getInstance().getId())) {
|
if (abilities.containsKey(HexproofFromBlackAbility.getInstance().getId())) {
|
||||||
if (sourceControllerId != null && this.hasOpponent(sourceControllerId, game)
|
if (sourceControllerId != null && this.hasOpponent(sourceControllerId, game)
|
||||||
&& null == game.getContinuousEffects().asThough(this.getId(),
|
&& null == game.getContinuousEffects().asThough(this.getId(),
|
||||||
AsThoughEffectType.HEXPROOF, null, sourceControllerId, game)
|
AsThoughEffectType.HEXPROOF, null, sourceControllerId, game)
|
||||||
&& source.getColor(game).isBlack()) {
|
&& source.getColor(game).isBlack()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -653,7 +654,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
if (abilities.containsKey(HexproofFromMonocoloredAbility.getInstance().getId())) {
|
if (abilities.containsKey(HexproofFromMonocoloredAbility.getInstance().getId())) {
|
||||||
if (sourceControllerId != null && this.hasOpponent(sourceControllerId, game)
|
if (sourceControllerId != null && this.hasOpponent(sourceControllerId, game)
|
||||||
&& null == game.getContinuousEffects().asThough(this.getId(),
|
&& null == game.getContinuousEffects().asThough(this.getId(),
|
||||||
AsThoughEffectType.HEXPROOF, null, sourceControllerId, game)
|
AsThoughEffectType.HEXPROOF, null, sourceControllerId, game)
|
||||||
&& !source.getColor(game).isColorless()
|
&& !source.getColor(game).isColorless()
|
||||||
&& !source.getColor(game).isMulticolored()) {
|
&& !source.getColor(game).isMulticolored()) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -696,7 +697,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
game.informPlayers(getLogName() + " discards down to "
|
game.informPlayers(getLogName() + " discards down to "
|
||||||
+ this.maxHandSize
|
+ this.maxHandSize
|
||||||
+ (this.maxHandSize == 1
|
+ (this.maxHandSize == 1
|
||||||
? " hand card" : " hand cards"));
|
? " hand card" : " hand cards"));
|
||||||
}
|
}
|
||||||
discard(hand.size() - this.maxHandSize, null, game);
|
discard(hand.size() - this.maxHandSize, null, game);
|
||||||
}
|
}
|
||||||
|
@ -814,7 +815,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
if (card != null) {
|
if (card != null) {
|
||||||
GameEvent gameEvent = GameEvent.getEvent(GameEvent.EventType.DISCARD_CARD,
|
GameEvent gameEvent = GameEvent.getEvent(GameEvent.EventType.DISCARD_CARD,
|
||||||
card.getId(), source == null
|
card.getId(), source == null
|
||||||
? null : source.getSourceId(), playerId);
|
? null : source.getSourceId(), playerId);
|
||||||
gameEvent.setFlag(source != null); // event from effect or from cost (source == null)
|
gameEvent.setFlag(source != null); // event from effect or from cost (source == null)
|
||||||
if (!game.replaceEvent(gameEvent, source)) {
|
if (!game.replaceEvent(gameEvent, source)) {
|
||||||
// write info to game log first so game log infos from triggered or replacement effects follow in the game log
|
// write info to game log first so game log infos from triggered or replacement effects follow in the game log
|
||||||
|
@ -829,7 +830,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
// So discard is also successful if card is moved to another zone by replacement effect!
|
// So discard is also successful if card is moved to another zone by replacement effect!
|
||||||
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.DISCARDED_CARD,
|
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.DISCARDED_CARD,
|
||||||
card.getId(), source == null
|
card.getId(), source == null
|
||||||
? null : source.getSourceId(), playerId));
|
? null : source.getSourceId(), playerId));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1517,7 +1518,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
// Also called on the whole split card but only passing the fuse ability and other whole-split-card shared abilities
|
// Also called on the whole split card but only passing the fuse ability and other whole-split-card shared abilities
|
||||||
// as candidates.
|
// as candidates.
|
||||||
private void getUseableActivatedAbilitiesHalfImpl(MageObject object, Zone zone, Game game, Abilities<Ability> candidateAbilites,
|
private void getUseableActivatedAbilitiesHalfImpl(MageObject object, Zone zone, Game game, Abilities<Ability> candidateAbilites,
|
||||||
LinkedHashMap<UUID, ActivatedAbility> output) {
|
LinkedHashMap<UUID, ActivatedAbility> output) {
|
||||||
boolean canUse = !(object instanceof Permanent) || ((Permanent) object).canUseActivatedAbilities(game);
|
boolean canUse = !(object instanceof Permanent) || ((Permanent) object).canUseActivatedAbilities(game);
|
||||||
ManaOptions availableMana = null;
|
ManaOptions availableMana = null;
|
||||||
// ManaOptions availableMana = getManaAvailable(game); // can only be activated if mana calculation works flawless otherwise player can't play spells they could play if calculation would work correctly
|
// ManaOptions availableMana = getManaAvailable(game); // can only be activated if mana calculation works flawless otherwise player can't play spells they could play if calculation would work correctly
|
||||||
|
@ -1566,10 +1567,10 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
!= null
|
!= null
|
||||||
// if anyone sees an issue with this code, please report it. Worked in my testing.
|
// if anyone sees an issue with this code, please report it. Worked in my testing.
|
||||||
|| game.getContinuousEffects().asThough(object.getId(),
|
|| game.getContinuousEffects().asThough(object.getId(),
|
||||||
AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE,
|
AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE,
|
||||||
ability,
|
ability,
|
||||||
this.getId(),
|
this.getId(),
|
||||||
game)
|
game)
|
||||||
!= null) {
|
!= null) {
|
||||||
if (canUse
|
if (canUse
|
||||||
|| ability.getAbilityType() == AbilityType.SPECIAL_ACTION) {
|
|| ability.getAbilityType() == AbilityType.SPECIAL_ACTION) {
|
||||||
|
@ -1924,9 +1925,9 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Permanent> getPermanentsThatCanBeUntapped(Game game,
|
private List<Permanent> getPermanentsThatCanBeUntapped(Game game,
|
||||||
List<Permanent> canBeUntapped,
|
List<Permanent> canBeUntapped,
|
||||||
RestrictionUntapNotMoreThanEffect handledEffect,
|
RestrictionUntapNotMoreThanEffect handledEffect,
|
||||||
Map<Entry<RestrictionUntapNotMoreThanEffect, Set<Ability>>, Integer> notMoreThanEffectsUsage) {
|
Map<Entry<RestrictionUntapNotMoreThanEffect, Set<Ability>>, Integer> notMoreThanEffectsUsage) {
|
||||||
List<Permanent> leftForUntap = new ArrayList<>();
|
List<Permanent> leftForUntap = new ArrayList<>();
|
||||||
// select permanents that can still be untapped
|
// select permanents that can still be untapped
|
||||||
for (Permanent permanent : canBeUntapped) {
|
for (Permanent permanent : canBeUntapped) {
|
||||||
|
@ -2634,7 +2635,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean searchLibrary(TargetCardInLibrary target, Ability source, Game game, UUID targetPlayerId,
|
public boolean searchLibrary(TargetCardInLibrary target, Ability source, Game game, UUID targetPlayerId,
|
||||||
boolean triggerEvents) {
|
boolean triggerEvents) {
|
||||||
//20091005 - 701.14c
|
//20091005 - 701.14c
|
||||||
Library searchedLibrary = null;
|
Library searchedLibrary = null;
|
||||||
String searchInfo = null;
|
String searchInfo = null;
|
||||||
|
@ -2838,7 +2839,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
/**
|
/**
|
||||||
* @param game
|
* @param game
|
||||||
* @param appliedEffects
|
* @param appliedEffects
|
||||||
* @param numSides Number of sides the dice has
|
* @param numSides Number of sides the dice has
|
||||||
* @return the number that the player rolled
|
* @return the number that the player rolled
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -2875,16 +2876,16 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
/**
|
/**
|
||||||
* @param game
|
* @param game
|
||||||
* @param appliedEffects
|
* @param appliedEffects
|
||||||
* @param numberChaosSides The number of chaos sides the planar die
|
* @param numberChaosSides The number of chaos sides the planar die
|
||||||
* currently has (normally 1 but can be 5)
|
* currently has (normally 1 but can be 5)
|
||||||
* @param numberPlanarSides The number of chaos sides the planar die
|
* @param numberPlanarSides The number of chaos sides the planar die
|
||||||
* currently has (normally 1)
|
* currently has (normally 1)
|
||||||
* @return the outcome that the player rolled. Either ChaosRoll, PlanarRoll
|
* @return the outcome that the player rolled. Either ChaosRoll, PlanarRoll
|
||||||
* or NilRoll
|
* or NilRoll
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public PlanarDieRoll rollPlanarDie(Game game, ArrayList<UUID> appliedEffects, int numberChaosSides,
|
public PlanarDieRoll rollPlanarDie(Game game, ArrayList<UUID> appliedEffects, int numberChaosSides,
|
||||||
int numberPlanarSides) {
|
int numberPlanarSides) {
|
||||||
int result = RandomUtil.nextInt(9) + 1;
|
int result = RandomUtil.nextInt(9) + 1;
|
||||||
PlanarDieRoll roll = PlanarDieRoll.NIL_ROLL;
|
PlanarDieRoll roll = PlanarDieRoll.NIL_ROLL;
|
||||||
if (numberChaosSides + numberPlanarSides > 9) {
|
if (numberChaosSides + numberPlanarSides > 9) {
|
||||||
|
@ -3041,7 +3042,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param ability
|
* @param ability
|
||||||
* @param available if null, it won't be checked if enough mana is available
|
* @param available if null, it won't be checked if enough mana is available
|
||||||
* @param sourceObject
|
* @param sourceObject
|
||||||
* @param game
|
* @param game
|
||||||
* @return
|
* @return
|
||||||
|
@ -3346,8 +3347,8 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
if (ability instanceof ActivatedAbility) {
|
if (ability instanceof ActivatedAbility) {
|
||||||
if (!(ability instanceof PlayLandAbility)
|
if (!(ability instanceof PlayLandAbility)
|
||||||
|| !game.getContinuousEffects().preventedByRuleModification(
|
|| !game.getContinuousEffects().preventedByRuleModification(
|
||||||
GameEvent.getEvent(GameEvent.EventType.PLAY_LAND, ability.getSourceId(),
|
GameEvent.getEvent(GameEvent.EventType.PLAY_LAND, ability.getSourceId(),
|
||||||
ability.getSourceId(), playerId), ability, game, true)) {
|
ability.getSourceId(), playerId), ability, game, true)) {
|
||||||
if (canPlay((ActivatedAbility) ability, availableMana, card, game)) {
|
if (canPlay((ActivatedAbility) ability, availableMana, card, game)) {
|
||||||
playable.add(ability);
|
playable.add(ability);
|
||||||
}
|
}
|
||||||
|
@ -3461,24 +3462,24 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
/**
|
/**
|
||||||
* Creates a list of card ids that are currently playable.<br>
|
* Creates a list of card ids that are currently playable.<br>
|
||||||
* Used to mark the playable cards in GameView
|
* Used to mark the playable cards in GameView
|
||||||
|
* Also contains number of playable abilities for that object (it's just info, server decides to show choose dialog or not)
|
||||||
*
|
*
|
||||||
* @param game
|
* @param game
|
||||||
* @return A Set of cardIds that are playable
|
* @return A Set of cardIds that are playable and amount of playable abilities
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Set<UUID> getPlayableObjects(Game game, Zone zone) {
|
public Map<UUID, Integer> getPlayableObjects(Game game, Zone zone) {
|
||||||
|
List<Ability> playableAbilities = getPlayable(game, true, zone, false); // do not hide duplicated abilities/cards
|
||||||
List<Ability> playableAbilities = getPlayable(game, true, zone, false); // do not hide duplicated abilities
|
Map<UUID, Integer> playableObjects = new HashMap<>();
|
||||||
Set<UUID> playableObjects = new HashSet<>();
|
|
||||||
for (Ability ability : playableAbilities) {
|
for (Ability ability : playableAbilities) {
|
||||||
if (ability.getSourceId() != null) {
|
if (ability.getSourceId() != null) {
|
||||||
playableObjects.add(ability.getSourceId());
|
playableObjects.put(ability.getSourceId(), playableObjects.getOrDefault(ability.getSourceId(), 0) + 1);
|
||||||
|
|
||||||
// main card must be marked playable in GUI
|
// main card must be marked playable in GUI
|
||||||
Card card = game.getCard(ability.getSourceId());
|
Card card = game.getCard(ability.getSourceId());
|
||||||
if (card != null && card.getMainCard().getId() != card.getId()) {
|
if (card != null && card.getMainCard().getId() != card.getId()) {
|
||||||
UUID mainCardId = card.getMainCard().getId();
|
UUID mainCardId = card.getMainCard().getId();
|
||||||
playableObjects.add(mainCardId);
|
playableObjects.put(mainCardId, playableObjects.getOrDefault(mainCardId, 0) + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3668,7 +3669,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPaySacrificeCost(Permanent permanent, UUID sourceId,
|
public boolean canPaySacrificeCost(Permanent permanent, UUID sourceId,
|
||||||
UUID controllerId, Game game
|
UUID controllerId, Game game
|
||||||
) {
|
) {
|
||||||
return sacrificeCostFilter == null || !sacrificeCostFilter.match(permanent, sourceId, controllerId, game);
|
return sacrificeCostFilter == null || !sacrificeCostFilter.match(permanent, sourceId, controllerId, game);
|
||||||
}
|
}
|
||||||
|
@ -3822,8 +3823,8 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean moveCards(Card card, Zone toZone,
|
public boolean moveCards(Card card, Zone toZone,
|
||||||
Ability source, Game game,
|
Ability source, Game game,
|
||||||
boolean tapped, boolean faceDown, boolean byOwner, List<UUID> appliedEffects
|
boolean tapped, boolean faceDown, boolean byOwner, List<UUID> appliedEffects
|
||||||
) {
|
) {
|
||||||
Set<Card> cardList = new HashSet<>();
|
Set<Card> cardList = new HashSet<>();
|
||||||
if (card != null) {
|
if (card != null) {
|
||||||
|
@ -3834,22 +3835,22 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean moveCards(Cards cards, Zone toZone,
|
public boolean moveCards(Cards cards, Zone toZone,
|
||||||
Ability source, Game game
|
Ability source, Game game
|
||||||
) {
|
) {
|
||||||
return moveCards(cards.getCards(game), toZone, source, game);
|
return moveCards(cards.getCards(game), toZone, source, game);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean moveCards(Set<Card> cards, Zone toZone,
|
public boolean moveCards(Set<Card> cards, Zone toZone,
|
||||||
Ability source, Game game
|
Ability source, Game game
|
||||||
) {
|
) {
|
||||||
return moveCards(cards, toZone, source, game, false, false, false, null);
|
return moveCards(cards, toZone, source, game, false, false, false, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean moveCards(Set<Card> cards, Zone toZone,
|
public boolean moveCards(Set<Card> cards, Zone toZone,
|
||||||
Ability source, Game game,
|
Ability source, Game game,
|
||||||
boolean tapped, boolean faceDown, boolean byOwner, List<UUID> appliedEffects
|
boolean tapped, boolean faceDown, boolean byOwner, List<UUID> appliedEffects
|
||||||
) {
|
) {
|
||||||
if (cards.isEmpty()) {
|
if (cards.isEmpty()) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -3944,8 +3945,8 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean moveCardsToExile(Card card, Ability source,
|
public boolean moveCardsToExile(Card card, Ability source,
|
||||||
Game game, boolean withName, UUID exileId,
|
Game game, boolean withName, UUID exileId,
|
||||||
String exileZoneName
|
String exileZoneName
|
||||||
) {
|
) {
|
||||||
Set<Card> cards = new HashSet<>();
|
Set<Card> cards = new HashSet<>();
|
||||||
cards.add(card);
|
cards.add(card);
|
||||||
|
@ -3954,8 +3955,8 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean moveCardsToExile(Set<Card> cards, Ability source,
|
public boolean moveCardsToExile(Set<Card> cards, Ability source,
|
||||||
Game game, boolean withName, UUID exileId,
|
Game game, boolean withName, UUID exileId,
|
||||||
String exileZoneName
|
String exileZoneName
|
||||||
) {
|
) {
|
||||||
if (cards.isEmpty()) {
|
if (cards.isEmpty()) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -3971,14 +3972,14 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean moveCardToHandWithInfo(Card card, UUID sourceId,
|
public boolean moveCardToHandWithInfo(Card card, UUID sourceId,
|
||||||
Game game
|
Game game
|
||||||
) {
|
) {
|
||||||
return this.moveCardToHandWithInfo(card, sourceId, game, true);
|
return this.moveCardToHandWithInfo(card, sourceId, game, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean moveCardToHandWithInfo(Card card, UUID sourceId,
|
public boolean moveCardToHandWithInfo(Card card, UUID sourceId,
|
||||||
Game game, boolean withName
|
Game game, boolean withName
|
||||||
) {
|
) {
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
Zone fromZone = game.getState().getZone(card.getId());
|
Zone fromZone = game.getState().getZone(card.getId());
|
||||||
|
@ -4003,7 +4004,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<Card> moveCardsToGraveyardWithInfo(Set<Card> allCards, Ability source,
|
public Set<Card> moveCardsToGraveyardWithInfo(Set<Card> allCards, Ability source,
|
||||||
Game game, Zone fromZone
|
Game game, Zone fromZone
|
||||||
) {
|
) {
|
||||||
UUID sourceId = source == null ? null : source.getSourceId();
|
UUID sourceId = source == null ? null : source.getSourceId();
|
||||||
Set<Card> movedCards = new LinkedHashSet<>();
|
Set<Card> movedCards = new LinkedHashSet<>();
|
||||||
|
@ -4011,7 +4012,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
// identify cards from one owner
|
// identify cards from one owner
|
||||||
Cards cards = new CardsImpl();
|
Cards cards = new CardsImpl();
|
||||||
UUID ownerId = null;
|
UUID ownerId = null;
|
||||||
for (Iterator<Card> it = allCards.iterator(); it.hasNext();) {
|
for (Iterator<Card> it = allCards.iterator(); it.hasNext(); ) {
|
||||||
Card card = it.next();
|
Card card = it.next();
|
||||||
if (cards.isEmpty()) {
|
if (cards.isEmpty()) {
|
||||||
ownerId = card.getOwnerId();
|
ownerId = card.getOwnerId();
|
||||||
|
@ -4074,7 +4075,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean moveCardToGraveyardWithInfo(Card card, UUID sourceId,
|
public boolean moveCardToGraveyardWithInfo(Card card, UUID sourceId,
|
||||||
Game game, Zone fromZone
|
Game game, Zone fromZone
|
||||||
) {
|
) {
|
||||||
if (card == null) {
|
if (card == null) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -4103,8 +4104,8 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean moveCardToLibraryWithInfo(Card card, UUID sourceId,
|
public boolean moveCardToLibraryWithInfo(Card card, UUID sourceId,
|
||||||
Game game, Zone fromZone,
|
Game game, Zone fromZone,
|
||||||
boolean toTop, boolean withName
|
boolean toTop, boolean withName
|
||||||
) {
|
) {
|
||||||
if (card == null) {
|
if (card == null) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -4138,7 +4139,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean moveCardToExileWithInfo(Card card, UUID exileId, String exileName, UUID sourceId,
|
public boolean moveCardToExileWithInfo(Card card, UUID exileId, String exileName, UUID sourceId,
|
||||||
Game game, Zone fromZone, boolean withName) {
|
Game game, Zone fromZone, boolean withName) {
|
||||||
if (card == null) {
|
if (card == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -4161,7 +4162,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
game.informPlayers(this.getLogName() + " moves " + (withName ? card.getLogName()
|
game.informPlayers(this.getLogName() + " moves " + (withName ? card.getLogName()
|
||||||
+ (card.isCopy() ? " (Copy)" : "") : "a card face down") + ' '
|
+ (card.isCopy() ? " (Copy)" : "") : "a card face down") + ' '
|
||||||
+ (fromZone != null ? "from " + fromZone.toString().toLowerCase(Locale.ENGLISH)
|
+ (fromZone != null ? "from " + fromZone.toString().toLowerCase(Locale.ENGLISH)
|
||||||
+ ' ' : "") + "to the exile zone");
|
+ ' ' : "") + "to the exile zone");
|
||||||
|
|
||||||
}
|
}
|
||||||
result = true;
|
result = true;
|
||||||
|
|
Loading…
Reference in a new issue