mirror of
https://github.com/magefree/mage.git
synced 2025-12-23 20:11:59 -08:00
Displaying tooltips and green arrows for paired creatures
This commit is contained in:
parent
36c2b240fb
commit
1bf0e216de
4 changed files with 37 additions and 42 deletions
|
|
@ -34,46 +34,6 @@
|
|||
|
||||
package mage.client.cards;
|
||||
|
||||
import static mage.constants.Constants.CONTENT_MAX_XOFFSET;
|
||||
import static mage.constants.Constants.FRAME_MAX_HEIGHT;
|
||||
import static mage.constants.Constants.FRAME_MAX_WIDTH;
|
||||
import static mage.constants.Constants.NAME_FONT_MAX_SIZE;
|
||||
import static mage.constants.Constants.NAME_MAX_YOFFSET;
|
||||
import static mage.constants.Constants.POWBOX_TEXT_MAX_LEFT;
|
||||
import static mage.constants.Constants.POWBOX_TEXT_MAX_TOP;
|
||||
import static mage.constants.Constants.SYMBOL_MAX_XOFFSET;
|
||||
import static mage.constants.Constants.SYMBOL_MAX_YOFFSET;
|
||||
import static mage.constants.Constants.TYPE_MAX_YOFFSET;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Image;
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.RenderingHints;
|
||||
import java.awt.event.ComponentEvent;
|
||||
import java.awt.event.ComponentListener;
|
||||
import java.awt.event.FocusEvent;
|
||||
import java.awt.event.FocusListener;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseListener;
|
||||
import java.awt.event.MouseMotionListener;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.Popup;
|
||||
import javax.swing.PopupFactory;
|
||||
import javax.swing.text.BadLocationException;
|
||||
import javax.swing.text.Style;
|
||||
import javax.swing.text.StyleConstants;
|
||||
import javax.swing.text.StyleContext;
|
||||
import javax.swing.text.StyledDocument;
|
||||
|
||||
import mage.Constants.CardType;
|
||||
import mage.cards.CardDimensions;
|
||||
import mage.cards.MagePermanent;
|
||||
|
|
@ -81,17 +41,27 @@ import mage.cards.TextPopup;
|
|||
import mage.cards.action.ActionCallback;
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.game.PlayAreaPanel;
|
||||
import mage.remote.Session;
|
||||
import mage.client.util.Config;
|
||||
import mage.client.util.DefaultActionCallback;
|
||||
import mage.client.util.ImageHelper;
|
||||
import mage.client.util.gui.ArrowBuilder;
|
||||
import mage.remote.Session;
|
||||
import mage.sets.Sets;
|
||||
import mage.view.AbilityView;
|
||||
import mage.view.CardView;
|
||||
import mage.view.PermanentView;
|
||||
import mage.view.StackAbilityView;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.text.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import static mage.constants.Constants.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
|
|
|
|||
|
|
@ -114,6 +114,21 @@ public class MageActionCallback implements ActionCallback {
|
|||
}
|
||||
}
|
||||
|
||||
// Draw Arrows for paired cards
|
||||
if (data.card.getPairedCard() != null) {
|
||||
Point me = new Point(data.locationOnScreen);
|
||||
me.translate(-parentPoint.x, -parentPoint.y);
|
||||
UUID uuid = data.card.getPairedCard();
|
||||
for (PlayAreaPanel pa : MageFrame.getGame(data.gameId).getPlayers().values()) {
|
||||
MagePermanent permanent = pa.getBattlefieldPanel().getPermanents().get(uuid);
|
||||
if (permanent != null) {
|
||||
Point target = permanent.getLocationOnScreen();
|
||||
target.translate(-parentPoint.x, -parentPoint.y);
|
||||
ArrowBuilder.addArrow((int) me.getX() + 35, (int) me.getY(), (int) target.getX() + 40, (int) target.getY() + 10, Color.green);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
showPopup(data, parentComponent, parentPoint);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -57,6 +57,9 @@ public class CardInfoPaneImpl extends JEditorPane implements CardInfoPane {
|
|||
List<String> rulings = new ArrayList<String>(rules);
|
||||
|
||||
if (card instanceof PermanentView) {
|
||||
if (card.getPairedCard() != null) {
|
||||
rulings.add("<span color='green'><i>Paired with another creature</i></span>");
|
||||
}
|
||||
List<CounterView> counters = ((PermanentView) card).getCounters();
|
||||
int count = counters != null ? counters.size() : 0;
|
||||
if (count > 0) {
|
||||
|
|
|
|||
|
|
@ -71,7 +71,9 @@ public class CardView extends SimpleCardView {
|
|||
protected CardView secondCardFace;
|
||||
protected boolean transformed;
|
||||
|
||||
public List<UUID> targets;
|
||||
protected List<UUID> targets;
|
||||
|
||||
protected UUID pairedCard;
|
||||
|
||||
public CardView(Card card, UUID cardId) {
|
||||
this(card);
|
||||
|
|
@ -93,6 +95,7 @@ public class CardView extends SimpleCardView {
|
|||
this.power = Integer.toString(card.getPower().getValue());
|
||||
this.toughness = Integer.toString(card.getToughness().getValue());
|
||||
this.loyalty = Integer.toString(((Permanent) card).getCounters().getCount(CounterType.LOYALTY));
|
||||
this.pairedCard = ((Permanent)card).getPairedCard();
|
||||
} else {
|
||||
this.power = card.getPower().toString();
|
||||
this.toughness = card.getToughness().toString();
|
||||
|
|
@ -356,4 +359,8 @@ public class CardView extends SimpleCardView {
|
|||
public boolean isTransformed() {
|
||||
return this.transformed;
|
||||
}
|
||||
|
||||
public UUID getPairedCard() {
|
||||
return pairedCard;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue