public void addResistance(Rectangle2D area,int resistance){
  final double x=area.getX();
  final double y=area.getY();
  double w=area.getWidth();
  double h=area.getHeight();
  final int startx=(int)Math.max(0,x);
  final int endx=(int)Math.min(width,x + w);
  final int starty=(int)Math.max(0,y);
  final int endy=(int)Math.min(height,y + h);
  for (int k=startx; k < endx; k++) {
    for (int i=starty; i < endy; i++) {
      int old=map[k][i];
      map[k][i]=100 - ((100 - old) * (100 - resistance)) / 100;
    }
  }
}

public void addResistance ( Rectangle2D area , int resistance ) { final double x = area . getX ( ) ; final double y = area . getY ( ) ; double w = area . getWidth ( ) ; double h = area . getHeight ( ) ; final int startx = ( int ) Math . max ( 0 , x ) ; final int endx = ( int ) Math . min ( width , x + w ) ; final int starty = ( int ) Math . max ( 0 , y ) ; final int endy = ( int ) Math . min ( height , y + h ) ; for ( int k = startx ; k < endx ; k ++ ) { for ( int i = starty ; i < endy ; i ++ ) { int old = map [ k ] [ i ] ; map [ k ] [ i ] = 100 - ( ( 100 - old ) * ( 100 - resistance ) ) / 100 ; } } }
add resistance of an area to the entity .
