added feather and gold counters to be shown in image mode
parent
b4ae7c96aa
commit
af7354935b
|
@ -4,7 +4,9 @@ import magic.data.IconImages;
|
||||||
import magic.model.MagicAbility;
|
import magic.model.MagicAbility;
|
||||||
import magic.model.MagicCardDefinition;
|
import magic.model.MagicCardDefinition;
|
||||||
import magic.model.MagicColor;
|
import magic.model.MagicColor;
|
||||||
|
import magic.model.MagicCounterType;
|
||||||
import magic.model.MagicManaCost;
|
import magic.model.MagicManaCost;
|
||||||
|
import magic.model.MagicPermanent;
|
||||||
import magic.ui.widget.FontsAndBorders;
|
import magic.ui.widget.FontsAndBorders;
|
||||||
|
|
||||||
import javax.swing.ImageIcon;
|
import javax.swing.ImageIcon;
|
||||||
|
@ -90,6 +92,34 @@ public class ImageDrawingUtils {
|
||||||
return ax;
|
return ax;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int drawCountersInfo(
|
||||||
|
final Graphics g,
|
||||||
|
final ImageObserver observer,
|
||||||
|
final MagicPermanent permanent,
|
||||||
|
int ax,
|
||||||
|
final int ay) {
|
||||||
|
for (final MagicCounterType counterType : MagicCounterType.values()) {
|
||||||
|
final int amount = permanent.getCounters(counterType);
|
||||||
|
if (amount > 0) {
|
||||||
|
if (counterType == MagicCounterType.Charge) {
|
||||||
|
g.drawImage(IconImages.CHARGE.getImage(),ax,ay,observer);
|
||||||
|
g.setColor(Color.DARK_GRAY);
|
||||||
|
g.drawString(Integer.toString(amount),ax+5,ay+14);
|
||||||
|
ax+=16;
|
||||||
|
}
|
||||||
|
if (counterType == MagicCounterType.Feather) {
|
||||||
|
g.drawImage(IconImages.FEATHER.getImage(),ax,ay,observer);
|
||||||
|
ax+=16;
|
||||||
|
}
|
||||||
|
if (counterType == MagicCounterType.Gold) {
|
||||||
|
g.drawImage(IconImages.GOLDCOUNTER.getImage(),ax,ay,observer);
|
||||||
|
ax+=16;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ax;
|
||||||
|
}
|
||||||
|
|
||||||
public static void drawCreatureInfo(
|
public static void drawCreatureInfo(
|
||||||
final Graphics g,
|
final Graphics g,
|
||||||
final FontMetrics metrics,
|
final FontMetrics metrics,
|
||||||
|
|
|
@ -196,13 +196,10 @@ public class ImagePermanentViewer extends JPanel {
|
||||||
|
|
||||||
int ax=x1+1;
|
int ax=x1+1;
|
||||||
final int ay=y2-17;
|
final int ay=y2-17;
|
||||||
// Charge counters
|
// Counters
|
||||||
if (linkedInfo.chargeCounters>0) {
|
if (permanentInfo.permanent.hasCounters()) {
|
||||||
g.drawImage(IconImages.CHARGE.getImage(),ax,ay,this);
|
ax=ImageDrawingUtils.drawCountersInfo(g,this,permanentInfo.permanent,ax,ay);
|
||||||
g.setColor(Color.DARK_GRAY);
|
}
|
||||||
g.drawString(String.valueOf(linkedInfo.chargeCounters),ax+5,ay+14);
|
|
||||||
ax+=16;
|
|
||||||
}
|
|
||||||
if (permanentInfo.creature) {
|
if (permanentInfo.creature) {
|
||||||
// Common combat ability icons.
|
// Common combat ability icons.
|
||||||
final long abilityFlags=linkedInfo.abilityFlags;
|
final long abilityFlags=linkedInfo.abilityFlags;
|
||||||
|
|
Loading…
Reference in New Issue