Fixed Issue#438: Enchanted permanent can't be clicked because out of sight

This commit is contained in:
magenoxx 2014-07-11 14:40:37 +04:00
parent 045a81e66a
commit 2b76bbf2c6
2 changed files with 30 additions and 6 deletions

View file

@ -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) {