/** * The crew is considered dead as a whole if all members are dead. * @return Whether all members of the crew are dead. */ public boolean isDead() { for (int i = 0; i < this.getSlotCount(); i++) { if (!dead[i]) { return false; } } return true; }
/** * Doomed status only applies to the crew as a whole. * @param doomed Whether the crew is scheduled to die at the end of the phase. */ public void setDoomed(boolean doomed) { // Ejected pilots stop taking hits. if (!ejected) { this.doomed = doomed; if (doomed) { for (int i = 0; i < getSlotCount(); i++) { hits[i] = 6; } } } }
/** * Use the first assigned slot as a general id for the crew. * @return The id of the first slot that is not set to "-1" */ public String getExternalIdAsString() { for (int i = 0; i < getSlotCount(); i++) { if (!externalId[i].equals("-1")) { return externalId[i]; } } return "-1"; }
/** * The crew as a whole is considered active if any member is active. * @return Whether the crew has at least one active member. */ public boolean isActive() { for (int i = 0; i < getSlotCount(); i++) { if (isActive(i)) { return true; } } return false; }
/** * The crew as a whole is considered ko this round if all active members are ko this round. * @return */ public boolean isKoThisRound() { for (int i = 0; i < getSlotCount(); i++) { if (isActive(i) && !koThisRound[i]) { return false; } } return true; }
public void setUnconscious(boolean unconscious) { for (int i = 0; i < getSlotCount(); i++) { setUnconscious(unconscious, i); } }
public void setUnconscious(boolean unconscious, int pos) { this.unconscious[pos] = unconscious; if (getSlotCount() > 1) { activeStatusChanged(); } }
public void setDead(boolean dead) { if (!ejected) { for (int i = 0; i < getSlotCount(); i++) { setDead(dead, i); } } }
public void setDead(boolean dead, int pos) { // Ejected pilots stop taking hits. if (!ejected && !missing[pos]) { this.dead[pos] = dead; if (dead) { hits[pos] = 6; } if (getSlotCount() > 1) { activeStatusChanged(); } } }
public int getBackup() { if (null != cbBackup.getSelectedItem()) { for (int i = 0; i < entity.getCrew().getSlotCount(); i++) { if (cbBackup.getSelectedItem().equals(entity.getCrew().getCrewType().getRoleName(i))) { return i; } } } return -1; }
/** * @param pos The slot index for multi-crewed cockpits * @return For multi-slot crews, the crew member's name followed by the role. For-slot crews, the * crew name only. */ public String getNameAndRole(int pos) { if (getSlotCount() < 2) { return getName(pos); } return getName(pos) + " (" + crewType.getRoleName(pos) + ")"; }
private static String formatHeader(Entity e) { StringBuffer sb = new StringBuffer(1024); sb.append("Model: ").append(e.getChassis()).append(" - ") .append(e.getModel()).append(CommonConstants.NL); for (int i = 0; i < e.getCrew().getSlotCount(); i++) { if (e.getCrew().isMissing(i)) { sb.append("No ").append(e.getCrew().getCrewType().getRoleName(i)); } else { sb.append(e.getCrew().getCrewType().getRoleName(i)).append(": ") .append(e.getCrew().getName(i)); sb.append(" (").append(e.getCrew().getGunnery(i)).append("/") .append(e.getCrew().getPiloting(i)).append(")"); } sb.append(CommonConstants.NL); } if (e.isCaptured()) { sb.append(" *** CAPTURED BY THE ENEMY ***"); sb.append(CommonConstants.NL); } return sb.toString(); }
int pos = -1; if (!missing[crewType.getPilotPos()]) { for (int i = 0; i < getSlotCount(); i++) { if (piloting[i] < lowest) { lowest = piloting[i]; pos = -1; if (!missing[crewType.getGunnerPos()]) { for (int i = 0; i < getSlotCount(); i++) { if (gunnery[i] < lowest) { lowest = gunnery[i];
if (crew.getSlotCount() > 1) { int dead = 0; for (int i = 0; i < crew.getSlotCount(); i++) { if (crew.isDead(i)) { dead++;
/** * updates fields for the specified mech */ public void displayMech(Entity en) { entity = en; pi.setEntity(en); if (en.getCrew().getSlotCount() > 1) { cbCrewSlot.removeAllItems(); for (int i = 0; i < en.getCrew().getSlotCount(); i++) { cbCrewSlot.addItem(en.getCrew().getCrewType().getRoleName(i)); } cbCrewSlot.setVisible(true); } else { cbCrewSlot.setVisible(false); } if (entity.getCrew().getCrewType().equals(CrewType.COMMAND_CONSOLE)) { btnSwapRoles.setSelected(entity.getCrew().getSwapConsoleRoles()); btnSwapRoles.setEnabled(entity.getCrew().isActive(0) && entity.getCrew().isActive(1)); btnSwapRoles.setVisible(true); updateSwapButtonText(); } else { btnSwapRoles.setVisible(false); } onResize(); update(); }
if (!blindDrop && pilot.getSlotCount() > 1) { for (int i = 0; i < pilot.getSlotCount(); i++) { if (pilot.isMissing(i)) { value += "<b>No " + pilot.getCrewType().getRoleName(i) + "</b>";
if (originalRide.getCrew().getSlotCount() > 1) { int dead = 0; for (int i = 0; i < originalRide.getCrew().getSlotCount(); i++) { if (originalRide.getCrew().isDead(i)) { dead++;
public static CrewRole getCrewRole(Person p, Unit u) { if (u.usesSoloPilot()) { return PILOT; } else if (u.isCommander(p) && u.getEntity().getCrew().getSlotCount() == 1) { return COMMANDER; } else if (u.getEntity() instanceof Tank && u.isTechOfficer(p)) { return CONSOLE_CMDR; } else if (u.isDriver(p)) { if (u.getEntity() instanceof VTOL || u.getEntity() instanceof Aero) { return PILOT; } else { return DRIVER; } } else if (u.isNavigator(p)) { return NAVIGATOR; } else if (u.isGunner(p)) { return GUNNER; } else if (u.isTechOfficer(p)) { return TECH_OFFICER; } else { return CREW; } }
private void autoSetSkillsAndName(Entity e) { IClientPreferences cs = PreferenceManager.getClientPreferences(); for (int i = 0; i < e.getCrew().getSlotCount(); i++) { if(cs.useAverageSkills()) { int skills[] = m_client.getRandomSkillsGenerator().getRandomSkills(e, true); int gunnery = skills[0]; int piloting = skills[1]; e.getCrew().setGunnery(gunnery, i); e.getCrew().setPiloting(piloting, i); if (e.getCrew() instanceof LAMPilot) { skills = m_client.getRandomSkillsGenerator().getRandomSkills(e, true); ((LAMPilot)e.getCrew()).setGunneryAero(skills[0]); ((LAMPilot)e.getCrew()).setPilotingAero(skills[1]); } } e.getCrew().sortRandomSkills(); if(cs.generateNames()) { e.getCrew().setName(m_client.getRandomNameGenerator().generate(), i); } } }
private void autoSetSkillsAndName(Entity e) { IClientPreferences cs = PreferenceManager.getClientPreferences(); for (int i = 0; i < e.getCrew().getSlotCount(); i++) { if (cs.useAverageSkills()) { int skills[] = client.getRandomSkillsGenerator().getRandomSkills(e, true); int gunnery = skills[0]; int piloting = skills[1]; e.getCrew().setGunnery(gunnery, i); // For infantry, piloting doubles as antimek skill, and this is // set based on whether the unit has antimek training, which gets // set in the BLK file, so we should ignore the defaults if (!(e instanceof Infantry)) { e.getCrew().setPiloting(piloting, i); } if (e.getCrew() instanceof LAMPilot) { skills = client.getRandomSkillsGenerator().getRandomSkills(e, true); ((LAMPilot)e.getCrew()).setGunneryAero(skills[0]); ((LAMPilot)e.getCrew()).setPilotingAero(skills[1]); } } if(cs.generateNames()) { e.getCrew().setName(client.getRandomNameGenerator().generate(), i); } } e.getCrew().sortRandomSkills(); }