* Activate spell's ability on the stack - fixed that it can't be activated by humans (example: Lightning Storm);

This commit is contained in:
Oleg Agafonov 2020-12-22 17:13:00 +04:00
parent 3f7b26f60b
commit 0ac4a9d87a
4 changed files with 48 additions and 26 deletions

View file

@ -88,7 +88,7 @@ public final class GamePanel extends javax.swing.JPanel {
private String chosenHandKey = "You";
private boolean smallMode = false;
private boolean initialized = false;
private skipButtonsList skipButtons = new skipButtonsList();
private final skipButtonsList skipButtons = new skipButtonsList();
private boolean menuNameSet = false;
private boolean handCardsOfOpponentAvailable = false;
@ -102,7 +102,7 @@ public final class GamePanel extends javax.swing.JPanel {
private boolean initComponents;
private Timer resizeTimer;
private final Timer resizeTimer;
private enum PopUpMenuType {
TRIGGER_ORDER
@ -1289,7 +1289,11 @@ public final class GamePanel extends javax.swing.JPanel {
if (needChoosen.contains(card.getKey())) {
card.getValue().setSelected(true);
}
// play from stack unsupported
// users can activate abilities of the spell on the stack (example: Lightning Storm);
if (needPlayable.containsKey(card.getKey())) {
card.getValue().setPlayable(true);
card.getValue().setPlayableAmount(needPlayable.get(card.getKey()));
}
}
}
@ -2537,7 +2541,7 @@ public final class GamePanel extends javax.swing.JPanel {
// Event listener for the ShowCardsDialog
private Listener<Event> getShowCardsEventListener(final ShowCardsDialog dialog) {
return (Listener<Event>) event -> {
return event -> {
if (event.getEventType() == ClientEventType.SHOW_POP_UP_MENU) {
if (event.getComponent() != null && event.getComponent() instanceof CardPanel) {
JPopupMenu menu = ((CardPanel) event.getComponent()).getPopupMenu();

View file

@ -143,21 +143,24 @@ public class PlayerPanelExt extends javax.swing.JPanel {
}
private boolean isCardsPlayable(Collection<CardView> cards, GameView gameView, Set<UUID> possibleTargets) {
if (cards != null) {
// can play
if (gameView != null && gameView.getCanPlayObjects() != null && !gameView.getCanPlayObjects().isEmpty()) {
for (CardView card : cards) {
if (gameView.getCanPlayObjects().containsKey(card.getId())) {
return true;
}
if (cards == null || gameView == null) {
return false;
}
// can play
if (gameView.getCanPlayObjects() != null && !gameView.getCanPlayObjects().isEmpty()) {
for (CardView card : cards) {
if (gameView.getCanPlayObjects().containsKey(card.getId())) {
return true;
}
}
// can select
if (possibleTargets != null && !possibleTargets.isEmpty()) {
for (CardView card : cards) {
if (possibleTargets.contains(card.getId())) {
return true;
}
}
// can select
if (possibleTargets != null && !possibleTargets.isEmpty()) {
for (CardView card : cards) {
if (possibleTargets.contains(card.getId())) {
return true;
}
}
}