示例#1
0
 /**
  * Calculates the weighted value of the unit based on if it is Infantry, Battle Armor or something
  * else.
  *
  * @param u The {@code Unit} to be evaluated.
  * @return
  */
 protected BigDecimal getUnitValue(Unit u) {
   BigDecimal value = BigDecimal.ONE;
   if (isConventionalInfanry(u) && (((Infantry) u.getEntity()).getSquadN() == 1)) {
     value = new BigDecimal("0.25");
   }
   return value;
 }
示例#2
0
 /**
  * Adds the tech level of the passed unit to the number of Clan or IS Advanced units in the list
  * (as appropriate).
  *
  * @param u The {@code Unit} to be evaluated.
  * @param value The unit's value. Most have a value of '1' but infantry and battle armor are less.
  */
 protected void updateAdvanceTechCount(Unit u, BigDecimal value) {
   int techLevel = u.getEntity().getTechLevel();
   if (techLevel > TechConstants.T_INTRO_BOXSET) {
     if (TechConstants.isClan(techLevel)) {
       setNumberClan(getNumberClan().add(value));
       if (!isConventionalInfanry(u)) {
         setCountClan(getCountClan() + 1);
       }
     } else {
       setNumberIS2(getNumberIS2().add(value));
       if (!isConventionalInfanry(u)) {
         setCountIS2(getCountIS2() + 1);
       }
     }
   }
 }
示例#3
0
 protected boolean isConventionalInfanry(Unit u) {
   return (u.getEntity() instanceof Infantry) && !(u.getEntity() instanceof BattleArmor);
 }