show correct amount for charge counter, +1/+1, and -1/-1 counters when there
are more than nine counters fixes issue 367master
parent
ed430f3285
commit
e12f89dbfc
|
@ -109,44 +109,45 @@ public class ImageDrawingUtils {
|
||||||
for (final MagicCounterType counterType : MagicCounterType.values()) {
|
for (final MagicCounterType counterType : MagicCounterType.values()) {
|
||||||
int amount = permanent.getCounters(counterType);
|
int amount = permanent.getCounters(counterType);
|
||||||
if (amount > 0) {
|
if (amount > 0) {
|
||||||
if (amount > 9) {
|
final String str = Integer.toString(amount);
|
||||||
amount = 9;
|
final int inc = 16 + 8 * (str.length() - 1);
|
||||||
}
|
|
||||||
if (counterType == MagicCounterType.Charge) {
|
if (counterType == MagicCounterType.Charge) {
|
||||||
g.drawImage(IconImages.CHARGE.getImage(),ax,ay,observer);
|
g.drawImage(IconImages.CHARGE.getImage(),ax,ay,observer);
|
||||||
g.setColor(Color.DARK_GRAY);
|
drawStringWithOutline(g, str, ax+5, ay+14, observer);
|
||||||
g.drawString(Integer.toString(amount),ax+5,ay+14);
|
ax+=inc;
|
||||||
ax+=16;
|
} else if (counterType == MagicCounterType.PlusOne) {
|
||||||
}
|
g.drawImage(IconImages.PLUS.getImage(),ax,ay,observer);
|
||||||
if (counterType == MagicCounterType.Feather) {
|
drawStringWithOutline(g, str, ax+6, ay+14, observer);
|
||||||
|
ax+=inc;
|
||||||
|
} else if (counterType == MagicCounterType.MinusOne) {
|
||||||
|
g.drawImage(IconImages.MINUS.getImage(),ax,ay,observer);
|
||||||
|
drawStringWithOutline(g, str, ax+6, ay+14, observer);
|
||||||
|
ax+=inc;
|
||||||
|
} else if (counterType == MagicCounterType.Feather) {
|
||||||
g.drawImage(IconImages.FEATHER.getImage(),ax,ay,observer);
|
g.drawImage(IconImages.FEATHER.getImage(),ax,ay,observer);
|
||||||
ax+=16;
|
ax+=16;
|
||||||
}
|
} else if (counterType == MagicCounterType.Gold) {
|
||||||
if (counterType == MagicCounterType.Gold) {
|
|
||||||
g.drawImage(IconImages.GOLDCOUNTER.getImage(),ax,ay,observer);
|
g.drawImage(IconImages.GOLDCOUNTER.getImage(),ax,ay,observer);
|
||||||
ax+=16;
|
ax+=16;
|
||||||
}
|
} else if (counterType == MagicCounterType.Bribery) {
|
||||||
if (counterType == MagicCounterType.Bribery) {
|
|
||||||
g.drawImage(IconImages.BRIBECOUNTER.getImage(),ax,ay,observer);
|
g.drawImage(IconImages.BRIBECOUNTER.getImage(),ax,ay,observer);
|
||||||
ax+=16;
|
ax+=16;
|
||||||
}
|
}
|
||||||
if (counterType == MagicCounterType.PlusOne) {
|
|
||||||
g.drawImage(IconImages.PLUS.getImage(),ax,ay,observer);
|
|
||||||
g.setColor(Color.DARK_GRAY);
|
|
||||||
g.drawString(Integer.toString(amount),ax+6,ay+14);
|
|
||||||
ax+=16;
|
|
||||||
}
|
|
||||||
if (counterType == MagicCounterType.MinusOne) {
|
|
||||||
g.drawImage(IconImages.MINUS.getImage(),ax,ay,observer);
|
|
||||||
g.setColor(Color.DARK_GRAY);
|
|
||||||
g.drawString(Integer.toString(amount),ax+6,ay+14);
|
|
||||||
ax+=16;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ax;
|
return ax;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void drawStringWithOutline(final Graphics g, final String str, int x, int y, final ImageObserver observer) {
|
||||||
|
g.setColor(FontsAndBorders.GRAY2);
|
||||||
|
g.drawString(str,x+1,y);
|
||||||
|
g.drawString(str,x-1,y);
|
||||||
|
g.drawString(str,x,y+1);
|
||||||
|
g.drawString(str,x,y-1);
|
||||||
|
g.setColor(Color.DARK_GRAY);
|
||||||
|
g.drawString(str,x,y);
|
||||||
|
}
|
||||||
|
|
||||||
public static void drawCreatureInfo(
|
public static void drawCreatureInfo(
|
||||||
final Graphics g,
|
final Graphics g,
|
||||||
final FontMetrics metrics,
|
final FontMetrics metrics,
|
||||||
|
|
Loading…
Reference in New Issue