public boolean usesSoloPilot() { //return Compute.getFullCrewSize(entity) == 1; //Taharqa: I dont think we should do it based on computed size, but whether the unit logically //is the type of unit that has only one pilot. This is partly because there may be some vees //that only have one pilot and this is also a problem for BA units with only one active suit return ((entity instanceof Mech) || (entity instanceof Protomech) || (entity instanceof Aero && !(entity instanceof SmallCraft) && !(entity instanceof Jumpship))) && (entity.getCrew().getCrewType().getPilotPos() == entity.getCrew().getCrewType().getGunnerPos()); }
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; }
public boolean canTakeTechOfficer() { return techOfficer == null && (entity.getCrew().getCrewType().getTechPos() >= 0 //Use techOfficer field for secondary commander || (entity instanceof Tank && entity.hasWorkingMisc(MiscType.F_COMMAND_CONSOLE))); }
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(); }
public static int getTotalDriverNeeds(Entity entity) { //Fix for MHQ Bug #3. Space stations have as much need for pilots as jumpships do. if (entity instanceof SpaceStation) { return 2; } if (entity instanceof SmallCraft || entity instanceof Jumpship) { //its not at all clear how many pilots dropships and jumpships //should have, but the old BattleSpace book suggests they should //be able to get by with 2. For warships, lets go with 2 per shift // so 6. if (entity instanceof Warship) { return 6; } if (entity instanceof SmallCraft) { return 3; } return 2; } if (entity.getCrew().getCrewType() == CrewType.COMMAND_CONSOLE) { return 2; } if (entity instanceof Mech || entity instanceof Tank || entity instanceof Aero || entity instanceof Protomech) { //only one driver please return 1; } else if (entity instanceof Infantry) { return getFullCrewSize(entity); } return 0; }
crew = new Crew(entity.getCrew().getCrewType()); } else { crew = new Crew(CrewType.SINGLE);
public static int getTotalGunnerNeeds(Entity entity) { if (entity instanceof SmallCraft || entity instanceof Jumpship) { int nStandardW = 0; int nCapitalW = 0; for (Mounted m : entity.getTotalWeaponList()) { EquipmentType type = m.getType(); if (type instanceof BayWeapon) { continue; } if (type instanceof WeaponType) { if (((WeaponType) type).isCapital()) { nCapitalW++; } else { nStandardW++; } } } return nCapitalW + (int) Math.ceil(nStandardW / 6.0); } else if (entity instanceof Tank) { return (getFullCrewSize(entity) - 1); } else if (entity instanceof Infantry) { return getFullCrewSize(entity); } else if (entity.getCrew().getCrewType().getGunnerPos() > 0) { //Tripod, QuadVee, or dual cockpit return 1; } return 0; }
public void addPilotOrSoldier(Person p, boolean useTransfers) { ensurePersonIsRegistered(p); drivers.add(p.getId()); //Multi-crew cockpits should not set the pilot to the gunner position if (entity.getCrew().getCrewType().getPilotPos() == entity.getCrew().getCrewType().getGunnerPos()) { gunners.add(p.getId()); } p.setUnitId(getId()); resetPilotAndEntity(); if (useTransfers) { ServiceLogger.reassignedTo(p, campaign.getDate(), getName()); } else { ServiceLogger.assignedTo(p, campaign.getDate(), getName()); } MekHQ.triggerEvent(new PersonCrewAssignmentEvent(p, this)); }
e.setCrew(new Crew(e.getCrew().getCrewType(), parts[1], 1, Integer.parseInt(parts[2]), Integer.parseInt(parts[3]))); if(parts.length >= 7) {
/** * 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(); }
for (int i = 0; i < entity.getCrew().getSlotCount(); i++) { if (i != slot) { cbBackup.addItem(entity.getCrew().getCrewType().getRoleName(i)); if (slot == entity.getCrew().getCrewType().getPilotPos()) { label = new JLabel(Messages.getString("CustomMechDialog.labBackupPilot"), SwingConstants.RIGHT); //$NON-NLS-1$ add(label, GBC.std()); add(cbBackup, GBC.eop()); cbBackup.setToolTipText(Messages.getString("CustomMechDialog.tooltipBackupPilot")); cbBackup.setSelectedItem(entity.getCrew().getCrewType().getRoleName(entity.getCrew().getBackupPilotPos())); } else if (slot == entity.getCrew().getCrewType().getGunnerPos()) { label = new JLabel(Messages.getString("CustomMechDialog.labBackupGunner"), SwingConstants.RIGHT); //$NON-NLS-1$ add(label, GBC.std()); add(cbBackup, GBC.eop()); cbBackup.setToolTipText(Messages.getString("CustomMechDialog.tooltipBackupGunner")); cbBackup.setSelectedItem(entity.getCrew().getCrewType().getRoleName(entity.getCrew().getBackupGunnerPos()));
for (int i = 0; i < pilot.getSlotCount(); i++) { if (pilot.isMissing(i)) { value += "<b>No " + pilot.getCrewType().getRoleName(i) + "</b>"; } else { value += "<b>" + pilot.getDesc(i) + "</b> (" + pilot.getCrewType().getRoleName(i) + "): "; value += pilot.getSkillsAsString(i);
/** * @param boardView1 * @param mp */ public MovementModifierEnvelopeSprite(BoardView1 boardView1, MovePath mp) { super(boardView1, mp.getFinalCoords()); facing = Facing.valueOfInt(mp.getFinalFacing()); int modi = Compute.getTargetMovementModifier(mp.getHexesMoved(), mp.isJumping(), mp.getEntity() instanceof VTOL, boardView1.game).getValue(); //Add evasion bonus for 'Mech with dual cockpit if (mp.getEntity().getCrew().getCrewType().equals(CrewType.DUAL) && mp.getEntity().getCrew().hasDedicatedPilot() && !mp.isJumping() && mp.getHexesMoved() > 0) { modi++; } float hue = 0.7f - 0.15f * modi; color = new Color(Color.HSBtoRGB(hue, 1, 1)); modifier = String.format("%+d", modi); }
en.setCrew(new Crew(en.getCrew().getCrewType(), rng.generate(), Compute.getFullCrewSize(en), skills[0], skills[1]));
en.setCrew(new Crew(en.getCrew().getCrewType(), crewName, Compute.getFullCrewSize(en), skills[0], skills[1]));
+ tgtEnt.getCrew().getCrewType().toString().toLowerCase() + "\" size=\"" + tgtEnt.getCrew().getSize(); if (tgtEnt.getCrew().getInitBonus() != 0) {
if (attacker.getCrew().getCrewType().getMaxPrimaryTargets() < 0) { return null; maxPrimary = attacker.getCrew().getCrewType().getMaxPrimaryTargets();
en.setCrew(new Crew(en.getCrew().getCrewType(), crewName, Compute.getFullCrewSize(en), skills[0], skills[1]));
en.setCrew(new Crew(en.getCrew().getCrewType(), rng.generate(), Compute.getFullCrewSize(en), skills[0], skills[1]));
if (getCrew().getCurrentPilotIndex() != getCrew().getCrewType().getPilotPos()) { roll.addModifier(1, "dual cockpit without active pilot"); } else if (getCrew().hasDedicatedGunner() || !isAttackingThisTurn()) {