* @param height
* The drawn entity height.
*/
protected void drawCombat(final Graphics2D g2d, final int x,
final int y, final int width, final int height) {
RPEntity rpentity = (RPEntity) entity;
Rectangle2D wrect = rpentity.getArea();
final Rectangle srect = new Rectangle((int) (wrect.getX() * IGameScreen.SIZE_UNIT_PIXELS),
(int) (wrect.getY() * IGameScreen.SIZE_UNIT_PIXELS),
(int) (wrect.getWidth() * IGameScreen.SIZE_UNIT_PIXELS),
(int) (wrect.getHeight() * IGameScreen.SIZE_UNIT_PIXELS));
final double DIVISOR = 1.414213562; // sqrt(2)
if (rpentity.isBeingAttacked()) {
// Draw red box around
//g2d.setColor(Color.white);
//g2d.drawRect(srect.x + 1, srect.y + 1, srect.width - 2, srect.height - 2);
g2d.setColor(Color.red);
int circleHeight = (int) ((srect.height - 2) / DIVISOR);
// Avoid showing much smaller area than the creature covers
circleHeight = Math.max(circleHeight, srect.height - IGameScreen.SIZE_UNIT_PIXELS / 2);
g2d.drawArc(srect.x, (int) (srect.y + srect.height - circleHeight),
srect.width + 0, circleHeight, 0, 360);
}
if (rpentity.isAttacking(User.get())) {
// Draw orange box around
//g2d.setColor(Color.white);
//g2d.drawRect(srect.x + 2, srect.y + 2, srect.width - 4, srect.height - 4);
g2d.setColor(Color.orange);
int circleHeight = (int) ((srect.height - 4) / DIVISOR);
// Avoid showing much smaller area than the creature covers
circleHeight = Math.max(circleHeight, srect.height - IGameScreen.SIZE_UNIT_PIXELS / 2 - 2);
g2d.drawArc(srect.x + 1, (int) (srect.y + srect.height - circleHeight - 1),
srect.width - 2, circleHeight, 0, 360);
}
drawAttack(g2d, x, y, width, height);
if (rpentity.isDefending()) {
// Draw bottom right combat icon
final int sx = srect.x + srect.width - ICON_OFFSET;
final int sy = y + height - 2 * ICON_OFFSET;
switch (rpentity.getResolution()) {
case BLOCKED:
blockedSprite.draw(g2d, sx, sy);
break;
case MISSED: