mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 10:48:00 +00:00
Fix so auras properly attach to permanents
This commit is contained in:
@@ -345,13 +345,7 @@ public enum CMatchUI implements ICDoc, IMenuProvider, IMatchController {
|
|||||||
|
|
||||||
public void refreshCardDetails(final Iterable<CardView> cards) {
|
public void refreshCardDetails(final Iterable<CardView> cards) {
|
||||||
for (final CardView c : cards) {
|
for (final CardView c : cards) {
|
||||||
if (ZoneType.Battlefield.equals(c.getZone())) {
|
updateSingleCard(c);
|
||||||
PlayArea pa = getFieldViewFor(c.getController()).getTabletop();
|
|
||||||
CardPanel pnl = pa.getCardPanel(c.getId());
|
|
||||||
if (pnl != null) {
|
|
||||||
pnl.updatePTOverlay();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -645,30 +645,37 @@ public class PlayArea extends CardPanelContainer implements CardPanelMouseListen
|
|||||||
newPanels.add(placeholder);
|
newPanels.add(placeholder);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!newPanels.isEmpty()) {
|
boolean needLayoutRefresh = !newPanels.isEmpty();
|
||||||
|
for (final CardView card : modelCopy) {
|
||||||
|
if (updateCard(card, true)) {
|
||||||
|
needLayoutRefresh = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (needLayoutRefresh) {
|
||||||
doLayout();
|
doLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!newPanels.isEmpty()) {
|
||||||
for (final CardPanel toPanel : newPanels) {
|
for (final CardPanel toPanel : newPanels) {
|
||||||
scrollRectToVisible(new Rectangle(toPanel.getCardX(), toPanel.getCardY(), toPanel.getCardWidth(), toPanel.getCardHeight()));
|
scrollRectToVisible(new Rectangle(toPanel.getCardX(), toPanel.getCardY(), toPanel.getCardWidth(), toPanel.getCardHeight()));
|
||||||
Animation.moveCard(toPanel);
|
Animation.moveCard(toPanel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (final CardView card : modelCopy) {
|
|
||||||
updateCard(card, true);
|
|
||||||
}
|
|
||||||
invalidate();
|
invalidate();
|
||||||
repaint();
|
repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateCard(final CardView card, boolean fromRefresh) {
|
public boolean updateCard(final CardView card, boolean fromRefresh) {
|
||||||
final CardPanel toPanel = getCardPanel(card.getId());
|
final CardPanel toPanel = getCardPanel(card.getId());
|
||||||
if (null == toPanel) { return; }
|
if (toPanel == null) { return false; }
|
||||||
|
|
||||||
|
boolean needLayoutRefresh = false;
|
||||||
if (card.isTapped()) {
|
if (card.isTapped()) {
|
||||||
toPanel.setTapped(true);
|
toPanel.setTapped(true);
|
||||||
toPanel.setTappedAngle(forge.view.arcane.CardPanel.TAPPED_ANGLE);
|
toPanel.setTappedAngle(forge.view.arcane.CardPanel.TAPPED_ANGLE);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
toPanel.setTapped(false);
|
toPanel.setTapped(false);
|
||||||
toPanel.setTappedAngle(0);
|
toPanel.setTappedAngle(0);
|
||||||
}
|
}
|
||||||
@@ -679,6 +686,10 @@ public class PlayArea extends CardPanelContainer implements CardPanelMouseListen
|
|||||||
for (final CardView e : enchants) {
|
for (final CardView e : enchants) {
|
||||||
final CardPanel cardE = getCardPanel(e.getId());
|
final CardPanel cardE = getCardPanel(e.getId());
|
||||||
if (cardE != null) {
|
if (cardE != null) {
|
||||||
|
if (cardE.getAttachedToPanel() != toPanel) {
|
||||||
|
cardE.setAttachedToPanel(toPanel);
|
||||||
|
needLayoutRefresh = true; //ensure layout refreshed if any attachments change
|
||||||
|
}
|
||||||
toPanel.getAttachedPanels().add(cardE);
|
toPanel.getAttachedPanels().add(cardE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -689,6 +700,10 @@ public class PlayArea extends CardPanelContainer implements CardPanelMouseListen
|
|||||||
for (final CardView e : equips) {
|
for (final CardView e : equips) {
|
||||||
final CardPanel cardE = getCardPanel(e.getId());
|
final CardPanel cardE = getCardPanel(e.getId());
|
||||||
if (cardE != null) {
|
if (cardE != null) {
|
||||||
|
if (cardE.getAttachedToPanel() != toPanel) {
|
||||||
|
cardE.setAttachedToPanel(toPanel);
|
||||||
|
needLayoutRefresh = true; //ensure layout refreshed if any attachments change
|
||||||
|
}
|
||||||
toPanel.getAttachedPanels().add(cardE);
|
toPanel.getAttachedPanels().add(cardE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -699,25 +714,42 @@ public class PlayArea extends CardPanelContainer implements CardPanelMouseListen
|
|||||||
for (final CardView f : fortifications) {
|
for (final CardView f : fortifications) {
|
||||||
final CardPanel cardE = getCardPanel(f.getId());
|
final CardPanel cardE = getCardPanel(f.getId());
|
||||||
if (cardE != null) {
|
if (cardE != null) {
|
||||||
|
if (cardE.getAttachedToPanel() != toPanel) {
|
||||||
|
cardE.setAttachedToPanel(toPanel);
|
||||||
|
needLayoutRefresh = true; //ensure layout refreshed if any attachments change
|
||||||
|
}
|
||||||
toPanel.getAttachedPanels().add(cardE);
|
toPanel.getAttachedPanels().add(cardE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CardPanel attachedToPanel;
|
||||||
if (card.getEnchantingCard() != null) {
|
if (card.getEnchantingCard() != null) {
|
||||||
toPanel.setAttachedToPanel(getCardPanel(card.getEnchantingCard().getId()));
|
attachedToPanel = getCardPanel(card.getEnchantingCard().getId());
|
||||||
} else if (card.getEquipping() != null) {
|
|
||||||
toPanel.setAttachedToPanel(getCardPanel(card.getEquipping().getId()));
|
|
||||||
} else if (card.getFortifying() != null) {
|
|
||||||
toPanel.setAttachedToPanel(getCardPanel(card.getFortifying().getId()));
|
|
||||||
} else {
|
|
||||||
toPanel.setAttachedToPanel(null);
|
|
||||||
}
|
}
|
||||||
|
else if (card.getEquipping() != null) {
|
||||||
|
attachedToPanel = getCardPanel(card.getEquipping().getId());
|
||||||
|
}
|
||||||
|
else if (card.getFortifying() != null) {
|
||||||
|
attachedToPanel = getCardPanel(card.getFortifying().getId());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
attachedToPanel = null;
|
||||||
|
}
|
||||||
|
if (toPanel.getAttachedToPanel() != attachedToPanel) {
|
||||||
|
toPanel.setAttachedToPanel(attachedToPanel);
|
||||||
|
needLayoutRefresh = true; //ensure layout refreshed if any attachments change
|
||||||
|
}
|
||||||
|
|
||||||
toPanel.setCard(card);
|
toPanel.setCard(card);
|
||||||
if (fromRefresh) {
|
if (fromRefresh) {
|
||||||
toPanel.updatePTOverlay(); //ensure PT Overlay updated on refresh
|
toPanel.updatePTOverlay(); //ensure PT Overlay updated on refresh
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (needLayoutRefresh && !fromRefresh) {
|
||||||
|
doLayout(); //ensure layout refreshed here if not being called from a full refresh
|
||||||
|
}
|
||||||
|
return needLayoutRefresh;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static enum RowType {
|
private static enum RowType {
|
||||||
|
|||||||
Reference in New Issue
Block a user