mirror of
https://github.com/magefree/mage.git
synced 2025-12-24 20:41:58 -08:00
* Fixed wrong timer handling while other player controlled a player's turn. Attackers now marked with blue frame. Playable cards have a violet frame. If a player has to select cards from hand, the possible cards are marked yellow now. Discard of multiple cards now marks already selected cards and happens in one selection.
This commit is contained in:
parent
194efe6237
commit
67479bb5a4
20 changed files with 205 additions and 163 deletions
|
|
@ -110,6 +110,7 @@ import static mage.constants.PhaseStep.FIRST_COMBAT_DAMAGE;
|
|||
import static mage.constants.PhaseStep.UNTAP;
|
||||
import static mage.constants.PhaseStep.UPKEEP;
|
||||
import mage.constants.PlayerAction;
|
||||
import mage.constants.Zone;
|
||||
import mage.remote.Session;
|
||||
import mage.view.AbilityPickerView;
|
||||
import mage.view.CardView;
|
||||
|
|
@ -813,6 +814,26 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
*/
|
||||
public void pickTarget(String message, CardsView cardView, GameView gameView, Set<UUID> targets, boolean required, Map<String, Serializable> options, int messageId) {
|
||||
ShowCardsDialog dialog = null;
|
||||
if (options != null && options.containsKey("targetZone")) {
|
||||
if (Zone.HAND.equals(options.get("targetZone"))) { // mark selectable target cards in hand
|
||||
List<UUID> choosen = null;
|
||||
if (options.containsKey("chosen")) {
|
||||
choosen = (List<UUID>) options.get("chosen");
|
||||
}
|
||||
for(CardView card: gameView.getHand().values()) {
|
||||
if (targets == null || targets.isEmpty()) {
|
||||
card.setPlayable(false);
|
||||
card.setChoosable(true);
|
||||
} else if (targets.contains(card.getId())) {
|
||||
card.setPlayable(false);
|
||||
card.setChoosable(true);
|
||||
}
|
||||
if (choosen != null && choosen.contains(card.getId())) {
|
||||
card.setSelected(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
updateGame(gameView);
|
||||
Map<String, Serializable> options0 = options == null ? new HashMap<String, Serializable>() : options;
|
||||
if (cardView != null && cardView.size() > 0) {
|
||||
|
|
|
|||
|
|
@ -243,7 +243,7 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
|||
this.avatar.setTopText(priorityTimeValue);
|
||||
this.timerLabel.setText(priorityTimeValue);
|
||||
}
|
||||
if (player.hasPriority()) {
|
||||
if (player.isTimerActive()) {
|
||||
this.timer.resume();
|
||||
} else {
|
||||
this.timer.pause();
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
|||
private boolean isSelected;
|
||||
private boolean isPlayable;
|
||||
private boolean isChoosable;
|
||||
private boolean canAttack;
|
||||
private boolean canAttack;
|
||||
private boolean showCastingCost;
|
||||
private boolean hasImage = false;
|
||||
private float alpha = 1.0f;
|
||||
|
|
@ -501,19 +501,17 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
|||
} else if (isChoosable) {
|
||||
g2d.setColor(new Color(250, 250, 0, 230));
|
||||
g2d.fillRoundRect(cardXOffset + 1, cardYOffset + 1, cardWidth - 2, cardHeight - 2, cornerSize, cornerSize);
|
||||
}
|
||||
|
||||
if (isPlayable) {
|
||||
g2d.setColor(new Color(250, 250, 0, 200));
|
||||
g2d.fillRoundRect(cardXOffset + 1, cardYOffset + 1, cardWidth - 2, cardHeight - 2, cornerSize, cornerSize);
|
||||
} else if (isPlayable) {
|
||||
g2d.setColor(new Color(153, 102, 204, 200));
|
||||
//g2d.fillRoundRect(cardXOffset + 1, cardYOffset + 1, cardWidth - 2, cardHeight - 2, cornerSize, cornerSize);
|
||||
g2d.fillRoundRect(cardXOffset, cardYOffset , cardWidth , cardHeight , cornerSize, cornerSize);
|
||||
}
|
||||
|
||||
if (canAttack) {
|
||||
g2d.setColor(new Color(255, 0, 0, 230));
|
||||
g2d.setColor(new Color(0, 0, 255, 230));
|
||||
g2d.fillRoundRect(cardXOffset + 1, cardYOffset + 1, cardWidth - 2, cardHeight - 2, cornerSize, cornerSize);
|
||||
}
|
||||
|
||||
|
||||
//TODO:uncomment
|
||||
/*
|
||||
if (gameCard.isAttacking()) {
|
||||
|
|
@ -589,7 +587,7 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
|||
ptText.setVisible(showText);
|
||||
|
||||
int titleX = Math.round(cardWidth * (20f / 480));
|
||||
int titleY = Math.round(cardHeight * (9f / 680)) + 10;
|
||||
int titleY = Math.round(cardHeight * (9f / 680)) + 10; // TODO: Set to 0 if it's a card selection with small card offset (ike library search)
|
||||
titleText.setBounds(cardXOffset + titleX, cardYOffset + titleY, cardWidth - titleX, cardHeight - titleY);
|
||||
|
||||
Dimension ptSize = ptText.getPreferredSize();
|
||||
|
|
@ -803,6 +801,7 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
|||
this.isPlayable = card.isPlayable();
|
||||
this.isChoosable = card.isChoosable();
|
||||
this.canAttack = card.isCanAttack();
|
||||
this.isSelected = card.isSelected();
|
||||
|
||||
boolean updateImage = !gameCard.getName().equals(card.getName()) || gameCard.isFaceDown() != card.isFaceDown(); // update after e.g. turning a night/day card
|
||||
this.gameCard = card;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue