mirror of
https://github.com/correl/mage.git
synced 2025-04-10 17:00:08 -09:00
* Fixed some problems with order selection of triggered abilities not showing the card images.
This commit is contained in:
parent
a60ba1b20f
commit
2723bf6cb7
2 changed files with 50 additions and 28 deletions
|
@ -194,30 +194,30 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (!newGameCard.isAbility()) {
|
||||||
|
// panel to show counters on the card
|
||||||
|
counterPanel = new JPanel();
|
||||||
|
counterPanel.setLayout(null);
|
||||||
|
counterPanel.setOpaque(false);
|
||||||
|
add(counterPanel);
|
||||||
|
|
||||||
// panel to show counters on the card
|
plusCounterLabel = new JLabel("");
|
||||||
counterPanel = new JPanel();
|
plusCounterLabel.setToolTipText("+1/+1");
|
||||||
counterPanel.setLayout(null);
|
counterPanel.add(plusCounterLabel);
|
||||||
counterPanel.setOpaque(false);
|
|
||||||
add(counterPanel);
|
|
||||||
|
|
||||||
plusCounterLabel = new JLabel("");
|
minusCounterLabel = new JLabel("");
|
||||||
plusCounterLabel.setToolTipText("+1/+1");
|
minusCounterLabel.setToolTipText("-1/-1");
|
||||||
counterPanel.add(plusCounterLabel);
|
counterPanel.add(minusCounterLabel);
|
||||||
|
|
||||||
minusCounterLabel = new JLabel("");
|
loyaltyCounterLabel = new JLabel("");
|
||||||
minusCounterLabel.setToolTipText("-1/-1");
|
loyaltyCounterLabel.setToolTipText("loyalty");
|
||||||
counterPanel.add(minusCounterLabel);
|
counterPanel.add(loyaltyCounterLabel);
|
||||||
|
|
||||||
loyaltyCounterLabel = new JLabel("");
|
otherCounterLabel = new JLabel("");
|
||||||
loyaltyCounterLabel.setToolTipText("loyalty");
|
counterPanel.add(otherCounterLabel);
|
||||||
counterPanel.add(loyaltyCounterLabel);
|
|
||||||
|
|
||||||
otherCounterLabel = new JLabel("");
|
|
||||||
counterPanel.add(otherCounterLabel);
|
|
||||||
|
|
||||||
counterPanel.setVisible(false);
|
|
||||||
|
|
||||||
|
counterPanel.setVisible(false);
|
||||||
|
}
|
||||||
if (newGameCard.isAbility()) {
|
if (newGameCard.isAbility()) {
|
||||||
if (AbilityType.TRIGGERED.equals(newGameCard.getAbilityType())) {
|
if (AbilityType.TRIGGERED.equals(newGameCard.getAbilityType())) {
|
||||||
setTypeIcon(ImageManagerImpl.getInstance().getTriggeredAbilityImage(),"Triggered Ability");
|
setTypeIcon(ImageManagerImpl.getInstance().getTriggeredAbilityImage(),"Triggered Ability");
|
||||||
|
@ -841,7 +841,14 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (counterPanel != null) {
|
||||||
|
updateCounters(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
repaint();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateCounters(CardView card) {
|
||||||
if (card.getCounters() != null && !card.getCounters().isEmpty()) {
|
if (card.getCounters() != null && !card.getCounters().isEmpty()) {
|
||||||
String name = "";
|
String name = "";
|
||||||
if (lastCardWidth != cardWidth) {
|
if (lastCardWidth != cardWidth) {
|
||||||
|
@ -890,8 +897,8 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
||||||
otherCounterLabel.setVisible(true);
|
otherCounterLabel.setVisible(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
counterPanel.setVisible(true);
|
counterPanel.setVisible(true);
|
||||||
} else {
|
} else {
|
||||||
plusCounterLabel.setVisible(false);
|
plusCounterLabel.setVisible(false);
|
||||||
|
@ -899,8 +906,8 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
||||||
loyaltyCounterLabel.setVisible(false);
|
loyaltyCounterLabel.setVisible(false);
|
||||||
otherCounterLabel.setVisible(false);
|
otherCounterLabel.setVisible(false);
|
||||||
counterPanel.setVisible(false);
|
counterPanel.setVisible(false);
|
||||||
}
|
}
|
||||||
repaint();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ImageIcon getCounterImageWithAmount(int amount, BufferedImage image, int cardWidth) {
|
private static ImageIcon getCounterImageWithAmount(int amount, BufferedImage image, int cardWidth) {
|
||||||
|
@ -1064,7 +1071,7 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return sbType.toString();
|
return sbType.toString().trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final String getText(String cardType, CardView card) {
|
protected final String getText(String cardType, CardView card) {
|
||||||
|
|
|
@ -68,27 +68,34 @@ public class CardsView extends LinkedHashMap<UUID, CardView> {
|
||||||
for ( Ability ability : abilities ) {
|
for ( Ability ability : abilities ) {
|
||||||
MageObject sourceObject = null;
|
MageObject sourceObject = null;
|
||||||
AbilityView abilityView = null;
|
AbilityView abilityView = null;
|
||||||
|
boolean isCard = false;
|
||||||
|
boolean isPermanent = false;
|
||||||
switch ( ability.getZone() ) {
|
switch ( ability.getZone() ) {
|
||||||
case ALL:
|
case ALL:
|
||||||
case EXILED:
|
case EXILED:
|
||||||
case GRAVEYARD:
|
case GRAVEYARD:
|
||||||
sourceObject = game.getCard(ability.getSourceId());
|
sourceObject = game.getCard(ability.getSourceId());
|
||||||
|
isCard = true;
|
||||||
break;
|
break;
|
||||||
case BATTLEFIELD:
|
case BATTLEFIELD:
|
||||||
sourceObject = game.getPermanent(ability.getSourceId());
|
sourceObject = game.getPermanent(ability.getSourceId());
|
||||||
if (sourceObject == null) {
|
if (sourceObject == null) {
|
||||||
sourceObject = (Permanent)game.getLastKnownInformation(ability.getSourceId(), Zone.BATTLEFIELD);
|
sourceObject = (Permanent)game.getLastKnownInformation(ability.getSourceId(), Zone.BATTLEFIELD);
|
||||||
}
|
}
|
||||||
|
isPermanent = true;
|
||||||
break;
|
break;
|
||||||
case STACK:
|
case STACK:
|
||||||
sourceObject = game.getObject(ability.getSourceId());
|
sourceObject = game.getObject(ability.getSourceId());
|
||||||
|
if (sourceObject instanceof Card) {
|
||||||
|
isCard = true;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case COMMAND:
|
case COMMAND:
|
||||||
sourceObject = game.getObject(ability.getSourceId());
|
sourceObject = game.getObject(ability.getSourceId());
|
||||||
if (sourceObject instanceof Emblem) {
|
if (sourceObject instanceof Emblem) {
|
||||||
Card planeswalkerCard = game.getCard(((Emblem)sourceObject).getSourceId());
|
Card planeswalkerCard = game.getCard(((Emblem)sourceObject).getSourceId());
|
||||||
if (planeswalkerCard != null) {
|
if (planeswalkerCard != null) {
|
||||||
abilityView = new AbilityView(ability, "Emblem " + planeswalkerCard.getName(), new CardView(sourceObject));
|
abilityView = new AbilityView(ability, "Emblem " + planeswalkerCard.getName(), new CardView(new EmblemView((Emblem)sourceObject, planeswalkerCard)));
|
||||||
abilityView.setName("Emblem " + planeswalkerCard.getName());
|
abilityView.setName("Emblem " + planeswalkerCard.getName());
|
||||||
abilityView.setExpansionSetCode(planeswalkerCard.getExpansionSetCode());
|
abilityView.setExpansionSetCode(planeswalkerCard.getExpansionSetCode());
|
||||||
} else {
|
} else {
|
||||||
|
@ -99,7 +106,15 @@ public class CardsView extends LinkedHashMap<UUID, CardView> {
|
||||||
}
|
}
|
||||||
if (sourceObject != null) {
|
if (sourceObject != null) {
|
||||||
if (abilityView == null) {
|
if (abilityView == null) {
|
||||||
abilityView = new AbilityView(ability, sourceObject.getLogName(), new CardView(sourceObject));
|
CardView sourceCardView;
|
||||||
|
if (isPermanent) {
|
||||||
|
sourceCardView = new CardView((Permanent)sourceObject);
|
||||||
|
} else if (isCard) {
|
||||||
|
sourceCardView = new CardView((Card)sourceObject);
|
||||||
|
} else {
|
||||||
|
sourceCardView = new CardView(sourceObject);
|
||||||
|
}
|
||||||
|
abilityView = new AbilityView(ability, sourceObject.getLogName(), sourceCardView);
|
||||||
}
|
}
|
||||||
if (ability.getTargets().size() > 0) {
|
if (ability.getTargets().size() > 0) {
|
||||||
abilityView.setTargets(ability.getTargets());
|
abilityView.setTargets(ability.getTargets());
|
||||||
|
|
Loading…
Add table
Reference in a new issue