mirror of
https://github.com/magefree/mage.git
synced 2025-12-21 11:02:00 -08:00
Fixed Issue#438: Enchanted permanent can't be clicked because out of sight
This commit is contained in:
parent
045a81e66a
commit
2b76bbf2c6
2 changed files with 30 additions and 6 deletions
|
|
@ -157,6 +157,7 @@ public class CardPluginImpl implements CardPlugin {
|
|||
|
||||
Row allCreatures = new Row(permanents, RowType.creature);
|
||||
Row allOthers = new Row(permanents, RowType.other);
|
||||
Row allAttached = new Row(permanents, RowType.attached);
|
||||
|
||||
boolean othersOnTheRight = true;
|
||||
if (options != null && options.containsKey("nonLandPermanentsInOnePile")) {
|
||||
|
|
@ -268,6 +269,14 @@ public class CardPluginImpl implements CardPlugin {
|
|||
y = rowBottom;
|
||||
}
|
||||
|
||||
// we need this only for defining card size
|
||||
// attached permanents will be handled separately
|
||||
for (Stack stack : allAttached) {
|
||||
for (MagePermanent panel : stack) {
|
||||
panel.setCardBounds(0, 0, cardWidth, cardHeight);
|
||||
}
|
||||
}
|
||||
|
||||
return y;
|
||||
}
|
||||
|
||||
|
|
@ -340,7 +349,7 @@ public class CardPluginImpl implements CardPlugin {
|
|||
}
|
||||
|
||||
private static enum RowType {
|
||||
land, creature, other;
|
||||
land, creature, other, attached;
|
||||
|
||||
public boolean isType(MagePermanent card) {
|
||||
switch (this) {
|
||||
|
|
@ -350,6 +359,8 @@ public class CardPluginImpl implements CardPlugin {
|
|||
return CardUtil.isCreature(card);
|
||||
case other:
|
||||
return !CardUtil.isLand(card) && !CardUtil.isCreature(card);
|
||||
case attached:
|
||||
return card.getOriginalPermanent().isAttachedTo();
|
||||
default:
|
||||
throw new RuntimeException("Unhandled type: " + this);
|
||||
}
|
||||
|
|
@ -373,6 +384,10 @@ public class CardPluginImpl implements CardPlugin {
|
|||
if (!type.isType(panel)) {
|
||||
continue;
|
||||
}
|
||||
// all attached permanents are grouped separately later
|
||||
if (!type.equals(RowType.attached) && RowType.attached.isType(panel)) {
|
||||
continue;
|
||||
}
|
||||
Stack stack = new Stack();
|
||||
stack.add(panel);
|
||||
if (panel.getOriginalPermanent().getAttachments() != null) {
|
||||
|
|
|
|||
|
|
@ -28,9 +28,6 @@
|
|||
|
||||
package mage.view;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.TurnFaceUpAbility;
|
||||
import mage.abilities.common.TurnedFaceUpTriggeredAbility;
|
||||
|
|
@ -38,10 +35,13 @@ import mage.cards.Card;
|
|||
import mage.constants.Rarity;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.PermanentCard;
|
||||
import mage.game.permanent.PermanentToken;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
|
|
@ -59,6 +59,7 @@ public class PermanentView extends CardView {
|
|||
private final boolean copy;
|
||||
private final String nameOwner; // only filled if != controller
|
||||
private final boolean controlled;
|
||||
private UUID attachedTo;
|
||||
|
||||
public PermanentView(Permanent permanent, Card card, UUID createdForPlayerId, Game game) {
|
||||
super(permanent, null, permanent.getControllerId().equals(createdForPlayerId));
|
||||
|
|
@ -73,6 +74,7 @@ public class PermanentView extends CardView {
|
|||
attachments = new ArrayList<>();
|
||||
attachments.addAll(permanent.getAttachments());
|
||||
}
|
||||
this.attachedTo = permanent.getAttachedTo();
|
||||
if (isToken()) {
|
||||
original = new CardView(((PermanentToken)permanent).getToken());
|
||||
original.expansionSetCode = permanent.getExpansionSetCode();
|
||||
|
|
@ -179,5 +181,12 @@ public class PermanentView extends CardView {
|
|||
public boolean isControlled() {
|
||||
return controlled;
|
||||
}
|
||||
|
||||
|
||||
public UUID getAttachedTo() {
|
||||
return attachedTo;
|
||||
}
|
||||
|
||||
public boolean isAttachedTo() {
|
||||
return attachedTo != null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue