LAMPilot pilot = new LAMPilot(lam, crew.getName(), crew.getGunnery(), crew.getPiloting(), crew.getGunnery(), crew.getPiloting()); pilot.setNickname(crew.getNickname(), 0); pilot.setGunneryL(crew.getGunneryL(), 0); pilot.setGunneryB(crew.getGunneryB(), 0); pilot.setGunneryM(crew.getGunneryM(), 0); pilot.setGunneryAeroL(crew.getGunneryL()); pilot.setGunneryAeroB(crew.getGunneryB()); pilot.setGunneryAeroM(crew.getGunneryM()); pilot.setHits(crew.getHits(0), 0); pilot.setUnconscious(crew.isUnconscious(0), 0); pilot.setDead(crew.isDead(0), 0); pilot.setDoomed(crew.isDoomed()); pilot.setEjected(crew.isEjected()); pilot.setFatigue(crew.getFatigue()); pilot.setArtillery(crew.getArtillery(), 0); pilot.setInitBonus(crew.getInitBonus()); pilot.setCommandBonus(crew.getCommandBonus()); pilot.setToughness(crew.getToughness(0), 0); pilot.setPortraitCategory(crew.getPortraitCategory(0), 0); pilot.setPortraitFileName(crew.getPortraitFileName(0), 0); pilot.setOptions(crew.getOptions()); pilot.setExternalIdAsString(crew.getExternalIdAsString(0), 0);
crew = new Crew(entity.getCrew().getCrewType()); } else { crew = new Crew(CrewType.SINGLE); Crew aeroCrew = new Crew(CrewType.SINGLE); Map<String,String> aeroAttributes = new HashMap<>(attributes); for (String key : attributes.keySet()) { ((LAMPilot)crew).setGunneryAero(aeroCrew.getGunnery()); ((LAMPilot)crew).setGunneryAeroM(aeroCrew.getGunneryM()); ((LAMPilot)crew).setGunneryAeroB(aeroCrew.getGunneryB()); ((LAMPilot)crew).setGunneryAeroL(aeroCrew.getGunneryL()); ((LAMPilot)crew).setPilotingAero(aeroCrew.getPiloting()); entity.setCrew(crew);
/** * Returns the BV multiplier for this pilot's gunnery/piloting * * @param usePiloting whether or not to use the default value non-anti-mech * infantry/BA should not use the anti-mech skill * @param game */ public double getBVSkillMultiplier(boolean usePiloting, IGame game) { int pilotVal = getPiloting(); if (!usePiloting) { pilotVal = 5; } return getBVImplantMultiplier() * getBVSkillMultiplier(getGunnery(), pilotVal, game); }
public boolean isGunneryFatigued() { if (getPiloting() < 2) { return false; } return fatigueCount >= getGunneryFatigueTurn(); }
/** * Returns whether this pilot has non-standard piloting or gunnery values */ public boolean isCustom() { return (getGunnery() != 4) || (getPiloting() != 5); }
+ tgtEnt.getCrew().getCrewType().toString().toLowerCase() + "\" size=\"" + tgtEnt.getCrew().getSize(); if (tgtEnt.getCrew().getInitBonus() != 0) { crew += "\" initB=\"" + String.valueOf(tgtEnt.getCrew().getInitBonus()); if (tgtEnt.getCrew().getCommandBonus() != 0) { crew += "\" commandB=\"" + String.valueOf(tgtEnt.getCrew().getCommandBonus()); crew += "\" ejected=\"" + tgtEnt.getCrew().isEjected() + "\">\n"; for (int i = 0; i < tgtEnt.getCrew().getSlotCount(); i++) { crew += MekHqXmlUtil.indentStr(indentLvl+2) + "<crewMember slot=\"" + i + "\" name=\"" + MekHqXmlUtil.escape(tgtEnt.getCrew().getName(i)) + "\" nick=\"" + MekHqXmlUtil.escape(tgtEnt.getCrew().getNickname(i)) + "\" gunnery=\"" + tgtEnt.getCrew().getGunnery(i) + "\" piloting=\"" + tgtEnt.getCrew().getPiloting(i); if (tgtEnt.getCrew().getToughness(i) != 0) { crew += "\" toughness=\"" + String.valueOf(tgtEnt.getCrew().getToughness(i)); if (tgtEnt.getCrew().isDead(i) || tgtEnt.getCrew().getHits(i) >= Crew.DEATH) { crew +="\" hits=\"Dead"; } else if (tgtEnt.getCrew().getHits(i) > 0) {
output.write("\" name=\"" + crew.getName(pos).replaceAll("\"", """)); output.write("\" nick=\""); output.write(crew.getNickname(pos).replaceAll("\"", """)); output.write("\" gunnery=\""); output.write(String.valueOf(crew.getGunnery(pos))); if ((null != entity.getGame()) && entity.getGame().getOptions() .booleanOption(OptionsConstants.RPG_RPG_GUNNERY)) { output.write("\" gunneryL=\""); output.write(String.valueOf(crew.getGunneryL(pos))); output.write("\" gunneryM=\""); output.write(String.valueOf(crew.getGunneryM(pos))); output.write("\" gunneryB=\""); output.write(String.valueOf(crew.getGunneryB(pos))); output.write(String.valueOf(crew.getPiloting(pos))); if (crew instanceof LAMPilot) { writeLAMAeroAttributes(output, (LAMPilot)crew, .booleanOption(OptionsConstants.RPG_ARTILLERY_SKILL)) { output.write("\" artillery=\""); output.write(String.valueOf(crew.getArtillery(pos))); if (crew.getToughness(0) != 0) { output.write("\" toughness=\""); output.write(String.valueOf(crew.getToughness(pos))); if (crew.isDead(pos) || (crew.getHits(pos) > 5)) { output.write("\" hits=\"Dead");
if (en.getCrew().isMissing(slot)) { nameL.setString(Messages.getString("PilotMapSet.empty")); nickL.setString(""); gunneryBR.setVisible(false); } else { nameL.setString(en.getCrew().getName(slot)); nickL.setString(en.getCrew().getNickname(slot)); pilotR.setString(Integer.toString(en.getCrew().getPiloting(slot))); gunneryR.setString(Integer.toString(en.getCrew().getGunnery(slot))); pilotL.setVisible(true); pilotR.setVisible(true); gunneryLR.setString(Integer.toString(en.getCrew().getGunneryL(slot))); gunneryMR.setString(Integer.toString(en.getCrew().getGunneryM(slot))); gunneryBR.setString(Integer.toString(en.getCrew().getGunneryB(slot))); gunneryL.setVisible(false); gunneryR.setVisible(false); && !en.getCrew().isMissing(slot)) { toughBR.setString(Integer.toString(en.getCrew().getToughness(slot))); } else { toughBL.setVisible(false); && !en.getCrew().isMissing(slot)) { initBR.setString(Integer.toString(en.getCrew().getInitBonus())); } else { initBL.setVisible(false);
/** * update the skills for this squadron */ public void updateSkills() { List<Entity> activeFighters = getActiveSubEntities().orElse(Collections.emptyList()); if(activeFighters.isEmpty()) { return; } int pilotingTotal = 0; int gunneryTotal = 0; int gunneryLTotal = 0; int gunneryMTotal = 0; int gunneryBTotal = 0; for(Entity fighter : activeFighters) { pilotingTotal += fighter.getCrew().getPiloting(); gunneryTotal += fighter.getCrew().getGunnery(); gunneryLTotal += fighter.getCrew().getGunneryL(); gunneryMTotal += fighter.getCrew().getGunneryM(); gunneryBTotal += fighter.getCrew().getGunneryB(); } getCrew().setPiloting(pilotingTotal / activeFighters.size(), 0); getCrew().setGunnery(gunneryTotal / activeFighters.size(), 0); getCrew().setGunneryL(gunneryLTotal / activeFighters.size(), 0); getCrew().setGunneryM(gunneryMTotal / activeFighters.size(), 0); getCrew().setGunneryB(gunneryBTotal / activeFighters.size(), 0); }
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 String formatPilotTooltip(Crew pilot, boolean command, boolean init, boolean tough) { value += "<b>" + pilot.getDesc() + "</b><br>"; if (pilot.getNickname().length() > 0) { value += "<i>" + pilot.getNickname() + "</i><br>"; if (pilot.getHits() > 0) { value += "<font color='red'>" + Messages.getString("ChatLounge.Hits") + pilot.getHits() + "</font><br>"; value += "" + pilot.getSkillsAsString() + "<br>"; if (tough) { value += Messages.getString("ChatLounge.Tough") + pilot.getToughness(0) + "<br>"; value += Messages.getString("ChatLounge.Command") + pilot.getCommandBonus() + "<br>"; value += Messages.getString("ChatLounge.Initiative") + pilot.getInitBonus() + "<br>"; for (Enumeration<IOptionGroup> advGroups = pilot.getOptions().getGroups(); advGroups.hasMoreElements();) { IOptionGroup advGroup = advGroups.nextElement(); if (pilot.countOptions(advGroup.getKey()) > 0) { value += "<b>" + advGroup.getDisplayableName() + "</b><br>"; for (Enumeration<IOption> advs = advGroup.getOptions(); advs.hasMoreElements();) {
@Override public void setExtraMissionForces(Campaign campaign, ArrayList<Entity> allyEntities, ArrayList<Entity> enemyEntities) { setStart(startPos[Compute.randomInt(4)]); int enemyStart = getStart() + 4; if (enemyStart > 8) { enemyStart -= 8; } for (int weight = EntityWeightClass.WEIGHT_LIGHT; weight <= EntityWeightClass.WEIGHT_ASSAULT; weight++) { enemyEntities = new ArrayList<Entity>(); Entity en = getEntity(getContract(campaign).getEnemyCode(), getContract(campaign).getEnemySkill(), getContract(campaign).getEnemyQuality(), UnitType.MEK, Math.min(weight + 1, EntityWeightClass.WEIGHT_ASSAULT), campaign); if (weight == EntityWeightClass.WEIGHT_ASSAULT) { en.getCrew().setGunnery(en.getCrew().getGunnery() - 1); en.getCrew().setPiloting(en.getCrew().getPiloting() - 1); } enemyEntities.add(en); getSpecMissionEnemies().add(enemyEntities); } addBotForce(getEnemyBotForce(getContract(campaign), enemyStart, getSpecMissionEnemies().get(0))); } }
Objects.requireNonNull(u.getEntity(), "Unit needs to have a valid Entity attached"); Crew oldCrew = u.getEntity().getCrew(); String commanderName = oldCrew.getName(); int averageGunnery = 0; int averagePiloting = 0; if (u.getEntity() instanceof LandAirMech) { p = c.newPerson(Person.T_MECHWARRIOR, factionCode); p.addSkill(SkillType.S_PILOT_MECH, SkillType.getType(SkillType.S_PILOT_MECH).getTarget() - oldCrew.getPiloting(), 0); p.addSkill(SkillType.S_GUN_MECH, SkillType.getType(SkillType.S_GUN_MECH).getTarget() - oldCrew.getGunnery(), 0); p.addSkill(SkillType.S_PILOT_AERO, SkillType.getType(SkillType.S_PILOT_AERO).getTarget() - oldCrew.getPiloting(), 0); p.addSkill(SkillType.S_GUN_AERO, SkillType.getType(SkillType.S_GUN_AERO).getTarget() - oldCrew.getGunnery(), 0); p.setSecondaryRole(Person.T_AERO_PILOT); } else if (u.getEntity() instanceof Mech) { p = c.newPerson(Person.T_MECHWARRIOR, factionCode); p.addSkill(SkillType.S_PILOT_MECH, SkillType.getType(SkillType.S_PILOT_MECH).getTarget() - oldCrew.getPiloting(), 0); p.addSkill(SkillType.S_GUN_MECH, SkillType.getType(SkillType.S_GUN_MECH).getTarget() - oldCrew.getGunnery(), 0); } else if (u.getEntity() instanceof Aero) { p = c.newPerson(Person.T_AERO_PILOT, factionCode); p.addSkill(SkillType.S_PILOT_AERO, SkillType.getType(SkillType.S_PILOT_AERO).getTarget() - oldCrew.getPiloting(), 0); p.addSkill(SkillType.S_GUN_AERO, SkillType.getType(SkillType.S_GUN_AERO).getTarget() - oldCrew.getGunnery(), 0); } else if (u.getEntity() instanceof ConvFighter) { p = c.newPerson(Person.T_CONV_PILOT, factionCode); p.addSkill(SkillType.S_PILOT_JET, SkillType.getType(SkillType.S_PILOT_JET).getTarget() - oldCrew.getPiloting(), 0); p.addSkill(SkillType.S_GUN_JET, SkillType.getType(SkillType.S_GUN_JET).getTarget() - oldCrew.getPiloting(), 0); } else if (u.getEntity() instanceof Protomech) { p = c.newPerson(Person.T_PROTO_PILOT, factionCode); p.addSkill(SkillType.S_GUN_PROTO, SkillType.getType(SkillType.S_GUN_PROTO).getTarget() - oldCrew.getGunnery(), 0);
public String getPilotDesc() { if (hasPilot()) { return entity.getCrew().getName() + " " + entity.getCrew().getGunnery() + "/" + entity.getCrew().getPiloting(); } return "NO PILOT"; }
if (!en.getCrew().getExternalIdAsString().equals("-1")) { ejected = enemyEjections.get(UUID.fromString(en.getCrew().getExternalIdAsString())); && en.getCrew().isEjected()) { continue; int currentHits = 0; if(null != u.getEntity().getCrew()) { existingHits = u.getEntity().getCrew().getHits(); currentHits = en.getCrew().getHits(); for (int pos = 0; pos < pilot.getSlotCount(); pos++) { if (p.getId().toString().equals(pilot.getExternalIdAsString(pos))) { slot = pos; break; status.setHits(pilot.getHits(slot)); } else { if(destroyed || null == en.getCrew() || en.getCrew().isDead()) { if (Compute.d6(2) >= 7) { wounded = true;
panCrewMember = new CustomPilotView[entity.getCrew().getSlotCount()]; for (int i = 0; i < panCrewMember.length; i++) { panCrewMember[i] = new CustomPilotView(this, entity, i, editable); if (panCrewMember.length > 1) { for (int i = 0; i < panCrewMember.length; i++) { tabAll.addTab(entity.getCrew().getCrewType().getRoleName(i), new JScrollPane(panCrewMember[i])); options = entity.getCrew().getOptions(); partReps = entity.getPartialRepairs(); for (Mounted m : entity.getWeaponList()) { fldFatigue.setToolTipText(Messages.getString("CustomMechDialog.labFatigueToolTip")); fldFatigue.setText(Integer.toString(entity.getCrew().getFatigue())); fldInit.setText(Integer.toString(entity.getCrew().getInitBonus())); .getCommandBonus()));
public int getPilotingMech() { return super.getPiloting(0); }
public boolean hasEdgeRemaining() { return (getOptions().intOption(OptionsConstants.EDGE) > 0); }
public static String formatPilotHTML(Crew pilot, boolean blindDrop) { int crewAdvCount = pilot.countOptions(PilotOptions.LVL3_ADVANTAGES); int implants = pilot.countOptions(PilotOptions.MD_ADVANTAGES); 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>"; } else { value += "<b>" + pilot.getDesc(i) + "</b> (" + pilot.getCrewType().getRoleName(i) + "): "; value += pilot.getSkillsAsString(i); value += "<b>" + Messages.getString("ChatLounge.Unknown") + "</b><br/>"; } else { value += "<b>" + pilot.getDesc() + "</b><br/>"; value += "" + pilot.getSkillsAsString();
/** * @return A description of the status of a single crew member */ public String getStatusDesc(int pos) { if (isMissing(pos)) { return "Missing"; } String s = new String(""); if (getHits(pos) > 0) { s += hits[pos] + " hits"; if (isUnconscious(pos)) { s += " (KO)"; } else if (isDead(pos)) { s += " (dead)"; } } return s; }