mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 11:32:00 -08:00
* Fixed that continuous effects of copied cards with limited duration stop to work as the copied card stops to exist.
This commit is contained in:
parent
7292a1625c
commit
d3dba58358
11 changed files with 113 additions and 38 deletions
|
|
@ -1,6 +1,6 @@
|
|||
package mage.client.util.layout;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.JLayeredPane;
|
||||
|
||||
/**
|
||||
* Interface for operations that modify cards' layout
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
package mage.client.util.layout.impl;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Rectangle;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import javax.swing.JLayeredPane;
|
||||
import mage.cards.MagePermanent;
|
||||
import mage.client.game.BattlefieldPanel;
|
||||
import mage.client.plugins.impl.Plugins;
|
||||
import mage.client.util.layout.CardLayoutStrategy;
|
||||
import mage.view.PermanentView;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Card layout for client version 1.3.0 and earlier.
|
||||
*
|
||||
|
|
@ -54,14 +54,14 @@ public class OldCardLayoutStrategy implements CardLayoutStrategy {
|
|||
}
|
||||
int position = jLayeredPane.getPosition(perm);
|
||||
perm.getLinks().clear();
|
||||
Rectangle r = perm.getBounds();
|
||||
Rectangle rectangleBaseCard = perm.getBounds();
|
||||
if (!Plugins.getInstance().isCardPluginLoaded()) {
|
||||
for (UUID attachmentId: permanent.getAttachments()) {
|
||||
MagePermanent link = permanents.get(attachmentId);
|
||||
if (link != null) {
|
||||
perm.getLinks().add(link);
|
||||
r.translate(20, 20);
|
||||
link.setBounds(r);
|
||||
rectangleBaseCard.translate(20, 20);
|
||||
link.setBounds(rectangleBaseCard);
|
||||
jLayeredPane.setPosition(link, ++position);
|
||||
}
|
||||
}
|
||||
|
|
@ -70,14 +70,14 @@ public class OldCardLayoutStrategy implements CardLayoutStrategy {
|
|||
for (UUID attachmentId: permanent.getAttachments()) {
|
||||
MagePermanent link = permanents.get(attachmentId);
|
||||
if (link != null) {
|
||||
link.setBounds(r);
|
||||
link.setBounds(rectangleBaseCard);
|
||||
perm.getLinks().add(link);
|
||||
if (index == 1) {
|
||||
r.translate(ATTACHMENTS_DX_OFFSET, ATTACHMENT_DY_OFFSET); // do it once
|
||||
rectangleBaseCard.translate(ATTACHMENTS_DX_OFFSET, ATTACHMENT_DY_OFFSET); // do it once
|
||||
} else {
|
||||
r.translate(ATTACHMENT_DX_OFFSET, ATTACHMENT_DY_OFFSET);
|
||||
rectangleBaseCard.translate(ATTACHMENT_DX_OFFSET, ATTACHMENT_DY_OFFSET);
|
||||
}
|
||||
perm.setBounds(r);
|
||||
perm.setBounds(rectangleBaseCard);
|
||||
jLayeredPane.moveToFront(link);
|
||||
jLayeredPane.moveToFront(perm);
|
||||
jPanel.setComponentZOrder(link, index);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue