mirror of
https://github.com/correl/mage.git
synced 2025-04-05 09:12:29 -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
|
||||
counterPanel = new JPanel();
|
||||
counterPanel.setLayout(null);
|
||||
counterPanel.setOpaque(false);
|
||||
add(counterPanel);
|
||||
plusCounterLabel = new JLabel("");
|
||||
plusCounterLabel.setToolTipText("+1/+1");
|
||||
counterPanel.add(plusCounterLabel);
|
||||
|
||||
plusCounterLabel = new JLabel("");
|
||||
plusCounterLabel.setToolTipText("+1/+1");
|
||||
counterPanel.add(plusCounterLabel);
|
||||
minusCounterLabel = new JLabel("");
|
||||
minusCounterLabel.setToolTipText("-1/-1");
|
||||
counterPanel.add(minusCounterLabel);
|
||||
|
||||
minusCounterLabel = new JLabel("");
|
||||
minusCounterLabel.setToolTipText("-1/-1");
|
||||
counterPanel.add(minusCounterLabel);
|
||||
loyaltyCounterLabel = new JLabel("");
|
||||
loyaltyCounterLabel.setToolTipText("loyalty");
|
||||
counterPanel.add(loyaltyCounterLabel);
|
||||
|
||||
loyaltyCounterLabel = new JLabel("");
|
||||
loyaltyCounterLabel.setToolTipText("loyalty");
|
||||
counterPanel.add(loyaltyCounterLabel);
|
||||
|
||||
otherCounterLabel = new JLabel("");
|
||||
counterPanel.add(otherCounterLabel);
|
||||
|
||||
counterPanel.setVisible(false);
|
||||
otherCounterLabel = new JLabel("");
|
||||
counterPanel.add(otherCounterLabel);
|
||||
|
||||
counterPanel.setVisible(false);
|
||||
}
|
||||
if (newGameCard.isAbility()) {
|
||||
if (AbilityType.TRIGGERED.equals(newGameCard.getAbilityType())) {
|
||||
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()) {
|
||||
String name = "";
|
||||
if (lastCardWidth != cardWidth) {
|
||||
|
@ -890,8 +897,8 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
|||
otherCounterLabel.setVisible(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
counterPanel.setVisible(true);
|
||||
} else {
|
||||
plusCounterLabel.setVisible(false);
|
||||
|
@ -899,8 +906,8 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
|||
loyaltyCounterLabel.setVisible(false);
|
||||
otherCounterLabel.setVisible(false);
|
||||
counterPanel.setVisible(false);
|
||||
}
|
||||
repaint();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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) {
|
||||
|
|
|
@ -68,27 +68,34 @@ public class CardsView extends LinkedHashMap<UUID, CardView> {
|
|||
for ( Ability ability : abilities ) {
|
||||
MageObject sourceObject = null;
|
||||
AbilityView abilityView = null;
|
||||
boolean isCard = false;
|
||||
boolean isPermanent = false;
|
||||
switch ( ability.getZone() ) {
|
||||
case ALL:
|
||||
case EXILED:
|
||||
case GRAVEYARD:
|
||||
sourceObject = game.getCard(ability.getSourceId());
|
||||
isCard = true;
|
||||
break;
|
||||
case BATTLEFIELD:
|
||||
sourceObject = game.getPermanent(ability.getSourceId());
|
||||
if (sourceObject == null) {
|
||||
sourceObject = (Permanent)game.getLastKnownInformation(ability.getSourceId(), Zone.BATTLEFIELD);
|
||||
}
|
||||
isPermanent = true;
|
||||
break;
|
||||
case STACK:
|
||||
sourceObject = game.getObject(ability.getSourceId());
|
||||
if (sourceObject instanceof Card) {
|
||||
isCard = true;
|
||||
}
|
||||
break;
|
||||
case COMMAND:
|
||||
sourceObject = game.getObject(ability.getSourceId());
|
||||
if (sourceObject instanceof Emblem) {
|
||||
if (sourceObject instanceof Emblem) {
|
||||
Card planeswalkerCard = game.getCard(((Emblem)sourceObject).getSourceId());
|
||||
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.setExpansionSetCode(planeswalkerCard.getExpansionSetCode());
|
||||
} else {
|
||||
|
@ -99,7 +106,15 @@ public class CardsView extends LinkedHashMap<UUID, CardView> {
|
|||
}
|
||||
if (sourceObject != 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) {
|
||||
abilityView.setTargets(ability.getTargets());
|
||||
|
|
Loading…
Add table
Reference in a new issue