protected float calculateDefense(final RPEntity entity){
  float potential;
  float min;
  float score;
  final float armor=entity.getItemDef() + 1.0f;
  final int def=entity.getDef();
  if (logger.isDebugEnabled()) {
    logger.debug("defender has " + def + " and uses a armor of "+ armor);
  }
  potential=((float)Level.getWisdom(def)) * 2.0f * armor;
  min=(float)Level.getWisdom(entity.getLevel()) * 0.60f;
  score=((rand.nextFloat() * (1.0f - min)) + min) * potential;
  score+=((float)entity.useKarma(0.1) * potential);
  if (logger.isDebugEnabled()) {
    logger.debug("DEF MAX: " + potential + "  DEF SCORE: "+ score);
  }
  return score;
}

protected float calculateDefense ( final RPEntity entity ) { float potential ; float min ; float score ; final float armor = entity . getItemDef ( ) + 1.0f ; final int def = entity . getDef ( ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "defender has " + def + " and uses a armor of " + armor ) ; } potential = ( ( float ) Level . getWisdom ( def ) ) * 2.0f * armor ; min = ( float ) Level . getWisdom ( entity . getLevel ( ) ) * 0.60f ; score = ( ( rand . nextFloat ( ) * ( 1.0f - min ) ) + min ) * potential ; score += ( ( float ) entity . useKarma ( 0.1 ) * potential ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "DEF MAX: " + potential + "  DEF SCORE: " + score ) ; } return score ; }
calculate the entity ' s final defense value . taken from new ( potential replacement ) combat code .
