mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 13:02:06 -08:00
Implemented banding (#41)
This commit is contained in:
parent
adec5cf88b
commit
e7301e2c08
24 changed files with 708 additions and 136 deletions
|
|
@ -423,6 +423,7 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis
|
|||
tooltipShowing = false;
|
||||
ArrowBuilder.getBuilder().removeArrowsByType(gameId, ArrowBuilder.Type.TARGET);
|
||||
ArrowBuilder.getBuilder().removeArrowsByType(gameId, ArrowBuilder.Type.PAIRED);
|
||||
ArrowBuilder.getBuilder().removeArrowsByType(gameId, ArrowBuilder.Type.BANDED);
|
||||
ArrowBuilder.getBuilder().removeArrowsByType(gameId, ArrowBuilder.Type.SOURCE);
|
||||
ArrowBuilder.getBuilder().removeArrowsByType(gameId, ArrowBuilder.Type.ENCHANT_PLAYERS);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -379,6 +379,7 @@ public class MageActionCallback implements ActionCallback {
|
|||
ArrowUtil.drawArrowsForTargets(data, parentPoint);
|
||||
ArrowUtil.drawArrowsForSource(data, parentPoint);
|
||||
ArrowUtil.drawArrowsForPairedCards(data, parentPoint);
|
||||
ArrowUtil.drawArrowsForBandedCards(data, parentPoint);
|
||||
ArrowUtil.drawArrowsForEnchantPlayers(data, parentPoint);
|
||||
tooltipCard = data.card;
|
||||
showTooltipPopup(data, parentComponent, parentPoint);
|
||||
|
|
@ -441,6 +442,7 @@ public class MageActionCallback implements ActionCallback {
|
|||
public void hideGameUpdate(UUID gameId) {
|
||||
ArrowBuilder.getBuilder().removeArrowsByType(gameId, ArrowBuilder.Type.TARGET);
|
||||
ArrowBuilder.getBuilder().removeArrowsByType(gameId, ArrowBuilder.Type.PAIRED);
|
||||
ArrowBuilder.getBuilder().removeArrowsByType(gameId, ArrowBuilder.Type.BANDED);
|
||||
ArrowBuilder.getBuilder().removeArrowsByType(gameId, ArrowBuilder.Type.SOURCE);
|
||||
ArrowBuilder.getBuilder().removeArrowsByType(gameId, ArrowBuilder.Type.ENCHANT_PLAYERS);
|
||||
}
|
||||
|
|
@ -452,6 +454,7 @@ public class MageActionCallback implements ActionCallback {
|
|||
if (gameId != null) {
|
||||
ArrowBuilder.getBuilder().removeArrowsByType(gameId, ArrowBuilder.Type.TARGET);
|
||||
ArrowBuilder.getBuilder().removeArrowsByType(gameId, ArrowBuilder.Type.PAIRED);
|
||||
ArrowBuilder.getBuilder().removeArrowsByType(gameId, ArrowBuilder.Type.BANDED);
|
||||
ArrowBuilder.getBuilder().removeArrowsByType(gameId, ArrowBuilder.Type.SOURCE);
|
||||
ArrowBuilder.getBuilder().removeArrowsByType(gameId, ArrowBuilder.Type.ENCHANT_PLAYERS);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ public class ArrowBuilder {
|
|||
private int currentHeight;
|
||||
|
||||
public enum Type {
|
||||
PAIRED, SOURCE, TARGET, COMBAT, ENCHANT_PLAYERS
|
||||
PAIRED, BANDED, SOURCE, TARGET, COMBAT, ENCHANT_PLAYERS
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -34,6 +34,23 @@ public final class ArrowUtil {
|
|||
}
|
||||
}
|
||||
|
||||
public static void drawArrowsForBandedCards(TransferData data, Point parentPoint) {
|
||||
if (data.card.getBandedCards() != null && !data.card.getBandedCards().isEmpty()) {
|
||||
Point me = new Point(data.locationOnScreen);
|
||||
me.translate(-parentPoint.x, -parentPoint.y);
|
||||
for (PlayAreaPanel pa : MageFrame.getGame(data.gameId).getPlayers().values()) {
|
||||
for (UUID uuid : data.card.getBandedCards()) {
|
||||
MagePermanent permanent = pa.getBattlefieldPanel().getPermanents().get(uuid);
|
||||
if (permanent != null) {
|
||||
Point target = permanent.getLocationOnScreen();
|
||||
target.translate(-parentPoint.x, -parentPoint.y);
|
||||
ArrowBuilder.getBuilder().addArrow(data.gameId, (int) me.getX() + 35, (int) me.getY(), (int) target.getX() + 40, (int) target.getY() + 10, Color.yellow, ArrowBuilder.Type.BANDED);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void drawArrowsForEnchantPlayers(TransferData data, Point parentPoint) {
|
||||
if (data.gameId != null && MageFrame.getGame(data.gameId) != null) {
|
||||
for (PlayAreaPanel pa : MageFrame.getGame(data.gameId).getPlayers().values()) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue