return LIVESTOCK_CARGO; } else if (bay instanceof InfantryBay) { InfantryBay.PlatoonType ptype = ((InfantryBay) bay).getPlatoonType(); if (ptype == InfantryBay.PlatoonType.JUMP) { return INFANTRY_JUMP;
@Override public double getUnusedSlots() { return currentSpace / platoonType.getWeight() - getBayDamage(); }
/** * Determines if this object can accept the given unit. The unit may not be * of the appropriate type or there may be no room for the unit. * * @param unit * - the <code>Entity</code> to be loaded. * @return <code>true</code> if the unit can be loaded, <code>false</code> * otherwise. */ @Override public boolean canLoad(Entity unit) { // Only infantry boolean result = unit.hasETypeFlag(Entity.ETYPE_INFANTRY); // We must have enough space for the new troops. // POSSIBLE BUG: we may have to take the Math.ceil() of the weight. if (getUnused() < spaceForUnit(unit)) { result = false; } // is the door functional if (currentdoors < loadedThisTurn) { result = false; } // Return our result. return result; }
@Override public String getUnusedString(boolean showrecovery) { StringBuilder sb = new StringBuilder(); sb.append("Infantry Bay ").append(numDoorsString()).append(" - ") .append(getUnusedSlots()) .append(" ").append(platoonType.toString()); if (platoonType != PlatoonType.MECHANIZED) { sb.append(" platoon"); } else { sb.append(" squad"); } if (getUnusedSlots() != 1) { sb.append("s"); } return sb.toString(); }
@Test public void identifyFootInfantryBay() { Bay bay = new InfantryBay(1, 1, 0, InfantryBay.PlatoonType.FOOT); assertEquals(BayData.getBayType(bay), BayData.INFANTRY_FOOT); }
} else if (t instanceof InfantryBay) { specialAbilities.merge(BattleForceSPA.IT, (int)((InfantryBay)t).getCapacity(), Integer::sum); } else if (t instanceof MechBay) { specialAbilities.merge(BattleForceSPA.MT, (int)((MechBay)t).getCapacity(), Integer::sum);
@Test public void parseFootInfantryBay() { Bay bay = new InfantryBay(2.0, 1, 0, InfantryBay.PlatoonType.FOOT); ParsedBayInfo pbi = new BLKFile.ParsedBayInfo(getBayNumbers(bay), new HashSet<>()); assertEquals(pbi.getPlatoonType(), InfantryBay.PlatoonType.FOOT); }
@Test public void identifyMotorizedInfantryBay() { Bay bay = new InfantryBay(1, 1, 0, InfantryBay.PlatoonType.MOTORIZED); assertEquals(BayData.getBayType(bay), BayData.INFANTRY_MOTORIZED); }
public int getInfantryCapacity() { int bays = 0; for (Bay b : getEntity().getTransportBays()) { if (b instanceof InfantryBay) { bays += b.getCapacity() / ((InfantryBay) b).getPlatoonType().getWeight(); } } return bays; }
@Test public void identifyMechanizedInfantryBay() { Bay bay = new InfantryBay(1, 1, 0, InfantryBay.PlatoonType.MECHANIZED); assertEquals(BayData.getBayType(bay), BayData.INFANTRY_MECHANIZED); }
return VEHICLE_SH; } else if (bay instanceof InfantryBay) { switch (((InfantryBay) bay).getPlatoonType()) { case JUMP: return INFANTRY_JUMP;
@Test public void parseJumpInfantryBay() { Bay bay = new InfantryBay(2.0, 1, 0, InfantryBay.PlatoonType.JUMP); ParsedBayInfo pbi = new BLKFile.ParsedBayInfo(getBayNumbers(bay), new HashSet<>()); assertEquals(pbi.getPlatoonType(), InfantryBay.PlatoonType.JUMP); }
private void updateBayCount(Dropship ds) { // ToDo Superheavy Bays. for (Bay bay : ds.getTransportBays()) { if (bay instanceof MechBay) { setMechBayCount(getMechBayCount() + (int)bay.getCapacity()); } else if (bay instanceof BattleArmorBay) { setBaBayCount(getBaBayCount() + (int)bay.getCapacity()); } else if (bay instanceof InfantryBay) { setInfantryBayCount(getInfantryBayCount() + (int) (bay.getCapacity() / ((InfantryBay) bay).getPlatoonType().getWeight())); } else if (bay instanceof LightVehicleBay) { setLightVeeBayCount(getLightVeeBayCount() + (int) bay.getCapacity()); } else if (bay instanceof HeavyVehicleBay) { setHeavyVeeBayCount(getHeavyVeeBayCount() + (int) bay.getCapacity()); } else if (bay instanceof ASFBay) { setFighterBayCount(getFighterBayCount() + (int) bay.getCapacity()); } else if (bay instanceof SmallCraftBay) { setSmallCraftBayCount(getSmallCraftBayCount() + (int) bay.getCapacity()); } } }
@Test public void parseMechanizedInfantryBay() { Bay bay = new InfantryBay(2.0, 1, 0, InfantryBay.PlatoonType.MECHANIZED); ParsedBayInfo pbi = new BLKFile.ParsedBayInfo(getBayNumbers(bay), new HashSet<>()); assertEquals(pbi.getPlatoonType(), InfantryBay.PlatoonType.MECHANIZED); }
@Test public void identifyJumpInfantryBay() { Bay bay = new InfantryBay(1, 1, 0, InfantryBay.PlatoonType.JUMP); assertEquals(BayData.getBayType(bay), BayData.INFANTRY_JUMP); }
@Test public void parseMotorizedInfantryBay() { Bay bay = new InfantryBay(2.0, 1, 0, InfantryBay.PlatoonType.MOTORIZED); ParsedBayInfo pbi = new BLKFile.ParsedBayInfo(getBayNumbers(bay), new HashSet<>()); assertEquals(pbi.getPlatoonType(), InfantryBay.PlatoonType.MOTORIZED); }
String numbers = transporter.substring(12); ParsedBayInfo pbi = new ParsedBayInfo(numbers, usedBayNumbers); e.addTransporter(new InfantryBay(pbi.getSize(), pbi.getDoors(), pbi.getBayNumber(), pbi.getPlatoonType())); } else if (transporter.startsWith("battlearmorbay:", 0)) { String numbers = transporter.substring(15);
transportBay = new LightVehicleBay(22, 0, 3); bayList.add(transportBay); transportBay = new InfantryBay(4.0, 0, 4, InfantryBay.PlatoonType.FOOT); bayList.add(transportBay); when(mockSeeker.getTransportBays()).thenReturn(bayList);