protected int upgradeHP() {
    if (upgrades == null) return 0 ;
    int numUsed = 0 ;
    for (int i = 0 ; i < upgrades.length ; i++) {
      if (upgrades[i] != null && upgradeStates[i] != STATE_INSTALL) numUsed++ ;
    }
    if (numUsed == 0) return 0 ;
    return (int) (baseIntegrity * UPGRADE_HP_BONUSES[numUsed]) ;
  }