private void drawCombat(final Graphics2D g2d,final int x,final int y,final int width,final int height){
  Rectangle2D wrect=entity.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));
  int circleHeight=(int)((srect.height - 2) / SQRT2);
  circleHeight=Math.max(circleHeight,srect.height - IGameScreen.SIZE_UNIT_PIXELS / 2);
  if (entity.isAttacking(User.get())) {
    g2d.setColor(RING_COLOR_ORANGE);
    g2d.drawOval(srect.x - 1,srect.y + srect.height - circleHeight,srect.width,circleHeight);
    g2d.drawOval(srect.x,srect.y + srect.height - circleHeight,srect.width,circleHeight);
    g2d.drawOval(srect.x + 1,srect.y + srect.height - circleHeight,srect.width,circleHeight);
    drawShadedOval(g2d,srect.x + 1,srect.y + srect.height - circleHeight + 1,srect.width - 2,circleHeight - 2,RING_COLOR_ORANGE,true,false);
  }
  if (entity.isBeingAttacked()) {
    Color lineColor;
    g2d.setColor(RING_COLOR_RED);
    if (entity.isAttacking(User.get())) {
      lineColor=RING_COLOR_RED;
      drawShadedOval(g2d,srect.x - 1,srect.y + srect.height - circleHeight - 1,srect.width + 2,circleHeight + 2,RING_COLOR_RED,false,true);
    }
 else {
      lineColor=RING_COLOR_DARK_RED;
      g2d.drawOval(srect.x - 1,srect.y + srect.height - circleHeight,srect.width,circleHeight);
      g2d.drawOval(srect.x,srect.y + srect.height - circleHeight,srect.width,circleHeight);
      g2d.drawOval(srect.x + 1,srect.y + srect.height - circleHeight,srect.width,circleHeight);
      drawShadedOval(g2d,srect.x + 1,srect.y + srect.height - circleHeight + 1,srect.width - 2,circleHeight - 2,RING_COLOR_RED,true,false);
      drawShadedOval(g2d,srect.x - 1,srect.y + srect.height - circleHeight - 1,srect.width + 2,circleHeight + 2,RING_COLOR_ORANGE,false,false);
    }
    EnumSet<Direction> directions=EnumSet.noneOf(Direction.class);
    for (    Entity attacker : entity.getAttackers()) {
      directions.add(Direction.getAreaDirectionTowardsArea(entity.getArea(),attacker.getArea()));
    }
    drawArrows(g2d,srect.x - 1,srect.y + srect.height - circleHeight - 1,srect.width + 2,circleHeight + 2,directions,lineColor);
  }
 else   if (entity.isAttacking(User.get())) {
    drawShadedOval(g2d,srect.x - 1,srect.y + srect.height - circleHeight - 1,srect.width + 2,circleHeight + 2,RING_COLOR_ORANGE,false,false);
  }
  drawAttack(g2d,x,y,width,height);
  if (entity.isDefending()) {
    final int sx=srect.x + srect.width - ICON_OFFSET;
    final int sy=y + height - 2 * ICON_OFFSET;
switch (entity.getResolution()) {
case BLOCKED:
      blockedSprite.draw(g2d,sx,sy);
    break;
case MISSED:
  missedSprite.draw(g2d,sx,sy);
break;
case HIT:
hitSprite.draw(g2d,sx,sy);
break;
default :
}
}
}

private void drawCombat ( final Graphics2D g2d , final int x , final int y , final int width , final int height ) { Rectangle2D wrect = entity . 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 ) ) ; int circleHeight = ( int ) ( ( srect . height - 2 ) / SQRT2 ) ; circleHeight = Math . max ( circleHeight , srect . height - IGameScreen . SIZE_UNIT_PIXELS / 2 ) ; if ( entity . isAttacking ( User . get ( ) ) ) { g2d . setColor ( RING_COLOR_ORANGE ) ; g2d . drawOval ( srect . x - 1 , srect . y + srect . height - circleHeight , srect . width , circleHeight ) ; g2d . drawOval ( srect . x , srect . y + srect . height - circleHeight , srect . width , circleHeight ) ; g2d . drawOval ( srect . x + 1 , srect . y + srect . height - circleHeight , srect . width , circleHeight ) ; drawShadedOval ( g2d , srect . x + 1 , srect . y + srect . height - circleHeight + 1 , srect . width - 2 , circleHeight - 2 , RING_COLOR_ORANGE , true , false ) ; } if ( entity . isBeingAttacked ( ) ) { Color lineColor ; g2d . setColor ( RING_COLOR_RED ) ; if ( entity . isAttacking ( User . get ( ) ) ) { lineColor = RING_COLOR_RED ; drawShadedOval ( g2d , srect . x - 1 , srect . y + srect . height - circleHeight - 1 , srect . width + 2 , circleHeight + 2 , RING_COLOR_RED , false , true ) ; } else { lineColor = RING_COLOR_DARK_RED ; g2d . drawOval ( srect . x - 1 , srect . y + srect . height - circleHeight , srect . width , circleHeight ) ; g2d . drawOval ( srect . x , srect . y + srect . height - circleHeight , srect . width , circleHeight ) ; g2d . drawOval ( srect . x + 1 , srect . y + srect . height - circleHeight , srect . width , circleHeight ) ; drawShadedOval ( g2d , srect . x + 1 , srect . y + srect . height - circleHeight + 1 , srect . width - 2 , circleHeight - 2 , RING_COLOR_RED , true , false ) ; drawShadedOval ( g2d , srect . x - 1 , srect . y + srect . height - circleHeight - 1 , srect . width + 2 , circleHeight + 2 , RING_COLOR_ORANGE , false , false ) ; } EnumSet < Direction > directions = EnumSet . noneOf ( Direction . class ) ; for ( Entity attacker : entity . getAttackers ( ) ) { directions . add ( Direction . getAreaDirectionTowardsArea ( entity . getArea ( ) , attacker . getArea ( ) ) ) ; } drawArrows ( g2d , srect . x - 1 , srect . y + srect . height - circleHeight - 1 , srect . width + 2 , circleHeight + 2 , directions , lineColor ) ; } else if ( entity . isAttacking ( User . get ( ) ) ) { drawShadedOval ( g2d , srect . x - 1 , srect . y + srect . height - circleHeight - 1 , srect . width + 2 , circleHeight + 2 , RING_COLOR_ORANGE , false , false ) ; } drawAttack ( g2d , x , y , width , height ) ; if ( entity . isDefending ( ) ) { final int sx = srect . x + srect . width - ICON_OFFSET ; final int sy = y + height - 2 * ICON_OFFSET ; switch ( entity . getResolution ( ) ) { case BLOCKED : blockedSprite . draw ( g2d , sx , sy ) ; break ; case MISSED : missedSprite . draw ( g2d , sx , sy ) ; break ; case HIT : hitSprite . draw ( g2d , sx , sy ) ; break ; default : } } }
draw the combat indicators .
