/** * Set the troopers in the unit to the given values. */ public void setInternal(int value) { // Initialize the troopers. for (int loop = 1; loop < locations(); loop++) { initializeInternal(value, loop); } }
public int getNumberActiverTroopers() { int count = 0; // Initialize the troopers. for (int loop = 1; loop < locations(); loop++) { if (isTrooperActive(loop)) { count++; } } return count; }
/** * Set the troopers in the unit to the appropriate values. */ @Override public void autoSetInternal() { // No troopers in the squad location. initializeInternal(IArmorState.ARMOR_NA, LOC_SQUAD); // Initialize the troopers. for (int loop = 1; loop < locations(); loop++) { initializeInternal(1, loop); } // Set the initial number of troopers that can shoot // to one less than the number of locations in the unit. troopersShooting = locations() - 1; }
public int getRandomTrooper() { Vector<Integer> activeTroops = new Vector<Integer>(); for (int loop = 1; loop < locations(); loop++) { if (isTrooperActive(loop)) { activeTroops.add(loop); } } int locInt = Compute.randomInt(activeTroops.size()); return activeTroops.elementAt(locInt); }
private static String formatArmorBattleArmor(BattleArmor b) { StringBuffer sb = new StringBuffer(32); for (int i = 1; i < b.locations(); i++) { sb.append("Trooper ").append(i).append(": ") .append(renderArmor(b.getArmor(i))).append(" / ") .append(renderArmor(b.getInternal(i))); sb.append(CommonConstants.NL); } return sb.toString(); }
@Override public int getBattleForceArmorPoints() { double armor = 0; for (int i = 1; i < locations(); i++) { if (armorType[i] == EquipmentType.T_ARMOR_BA_REACTIVE || armorType[i] == EquipmentType.T_ARMOR_BA_REFLECTIVE) { armor += getArmor(i) * 0.75; } else { armor += getArmor(i); } } return (int)Math.round(armor / 30.0); }
/** * Update the unit to reflect damages taken in this phase. */ @Override public void applyDamage() { super.applyDamage(); int troopersAlive = 0; for (int i = 0; i < locations(); i++) { if (getInternal(i) > 0) { troopersAlive++; } } troopersShooting = troopersAlive; }
/** * Checks to see if this unit has valid armor assignment. * * @param buff * @return */ public boolean correctArmor(StringBuffer buff) { boolean correct = true; int maxArmorPoints = ba.getMaximumArmorPoints(); for (int loc = 0; loc < ba.locations(); loc++) { if (ba.getOArmor(loc) > maxArmorPoints) { buff.append(printArmorLocation(loc)) .append(printArmorLocProp(loc, maxArmorPoints)) .append("\n"); correct = false; } } return correct; }
/** * Battle Armor units don't transfer damage. */ @Override public HitData getTransferLocation(HitData hit) { // If any trooper lives, the unit isn't destroyed. for (int loop = 1; loop < locations(); loop++) { if (0 < this.getInternal(loop)) { return new HitData(Entity.LOC_NONE); } } // No surviving troopers, so we're toast. return new HitData(Entity.LOC_DESTROYED); }
buff.append(newline); for (int i = 0; i < locations(); i++) { boolean found = false; for (Mounted m : getEquipment()) {
Mockito.when(mockBA.locations()).thenReturn(5); Mockito.when(mockBA.getArmor(Mockito.anyInt())).thenReturn(5); Mockito.when(mockBA.getCrew()).thenReturn(mockCrew);
for (int t = 0; t < ba.locations(); t++) { numAMWeapons[t][BattleArmor.MOUNT_LOC_BODY] += numAMWeapons[t][BattleArmor.MOUNT_LOC_TURRET]; numAPWeapons[t][BattleArmor.MOUNT_LOC_BODY] += numAPWeapons[t][BattleArmor.MOUNT_LOC_TURRET];
while ((loc >= locations()) || (IArmorState.ARMOR_NA == this.getInternal(loc)) || (IArmorState.ARMOR_DESTROYED == this.getInternal(loc))
for (int i = 1; i < locations(); i++) { if (this.getInternal(i) <= 0) { continue;