private void drawStrike(final Graphics2D g2d, final RPEntity entity,
final int x, final int y, final int width, final int height) {
Nature damageType = entity.getShownDamageType();
if (damageType != null) {
final Sprite sprite = bladeStrikeSprites.get(damageType).get(getState(entity))[frameBladeStrike];
final int spriteWidth = sprite.getWidth();
final int spriteHeight = sprite.getHeight();
int sx;
int sy;
/*
* Align swipe image to be 16 px past the facing edge, centering
* in other axis.
*
* Swipe image is 3x4 tiles, but really only uses partial areas.
* Adjust positions to match (or fix images to be
* uniform/centered).
*/
switch (entity.getDirection()) {
case UP:
sx = x + ((width - spriteWidth) / 2) + 16;
sy = y - 16 - 32;
break;
case DOWN:
sx = x + ((width - spriteWidth) / 2);
sy = y + height - spriteHeight + 16;
break;
case LEFT:
sx = x - 16;
sy = y + ((height - spriteHeight) / 2) - 16;
break;
case RIGHT:
sx = x + width - spriteWidth + 16;
sy = y + ((height - spriteHeight) / 2) - ICON_OFFSET;
break;
default:
sx = x + ((width - spriteWidth) / 2);
sy = y + ((height - spriteHeight) / 2);
}
sprite.draw(g2d, sx, sy);
}
}