public int getGunneryMech() { return super.getGunnery(0); }
/** * 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); }
/** * Returns whether this pilot has non-standard piloting or gunnery values */ public boolean isCustom() { return (getGunnery() != 4) || (getPiloting() != 5); }
LAMPilot pilot = new LAMPilot(lam, crew.getName(), crew.getGunnery(), crew.getPiloting(), crew.getGunnery(), crew.getPiloting()); pilot.setNickname(crew.getNickname(), 0);
/** * @param showPiloting if false, only the gunnery skill is shown (used for protomechs; may be ignored * for other unit types) * @return a String showing the skills for a particular slot in the format gunnery/piloting */ public String getSkillsAsString(int pos, boolean showPiloting) { StringBuilder sb = new StringBuilder(); sb.append(getGunnery(pos)); if (showPiloting) { sb.append("/").append(getPiloting(pos)); } return sb.toString(); }
/** * @param showPiloting if false, only the gunnery skill is shown (used for protomechs; may be ignored * for other unit types) * @return a String showing the overall skills in the format gunnery/piloting */ public String getSkillsAsString(boolean showPiloting) { StringBuilder sb = new StringBuilder(); sb.append(getGunnery()); if (showPiloting) { sb.append("/").append(getPiloting()); } return sb.toString(); }
/** * for sensor ops, so these might be easily expanded later for rpg */ public int getSensorOps() { if (getPiloting() > -1) { return getPiloting(); } return getGunnery(); }
private int calcExperienceMod(Entity unit, StringBuilder logMsg) { final float greenThreshold = 5.5F; final float regularThreshold = 4.0F; final float veteranThreshold = 2.5F; float skillAverage; if (unit instanceof Infantry || unit instanceof Protomech) { skillAverage = unit.getCrew().getGunnery(); } else { skillAverage = (unit.getCrew().getGunnery() + unit.getCrew().getPiloting()) / 2F; } if (skillAverage >= greenThreshold) { logMsg.append("\n\t\tGreen unit (+0)"); return 0; } if (skillAverage >= regularThreshold) { logMsg.append("\n\t\tRegular unit (-1)"); return -1; } if (skillAverage >= veteranThreshold) { logMsg.append("\n\t\tVeteran unit (-2)"); return -2; } logMsg.append("\n\t\tElite unit (-3)"); return -3; }
case UnitType.VTOL: case UnitType.TANK: gunnery = crew.getGunnery(); piloting = crew.getPiloting(); hasPilot = true; break; case UnitType.PROTOMEK: gunnery = crew.getGunnery(); break; default:
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(); }
private void updateTotalSkill(Infantry infantry) { Crew crew = infantry.getCrew(); if (null == crew) { return; } int gunnery = crew.getGunnery(); int antiMek = infantry.getAntiMekSkill(); if (antiMek == 0 || antiMek == 8) { antiMek = gunnery + 1; } BigDecimal skillLevel = BigDecimal.valueOf(gunnery) .add(BigDecimal.valueOf(antiMek)); incrementSkillRatingCounts(getExperienceLevelName(skillLevel)); setTotalSkillLevels(getTotalSkillLevels(false).add(skillLevel)); }
/** * 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 ArrayList<String> generateEntityStub(ArrayList<Entity> entities) { ArrayList<String> stub = new ArrayList<String>(); for (Entity en : entities) { if (null == en) { stub.add("<html><font color='red'>No random assignment table found for faction</font></html>"); } else { stub.add("<html>" + en.getCrew().getName() + " (" + en.getCrew().getGunnery() + "/" + en.getCrew().getPiloting() + "), " + "<i>" + en.getShortName() + "</i>" + "</html>"); } } return stub; }
combatSkillAverage = new BigDecimal(p.getGunnery()); combatSkillAverage = BigDecimal.valueOf(p.getGunnery() + p.getPiloting()) .divide(BigDecimal.valueOf(2),
public String getPilotDesc() { if (hasPilot()) { return entity.getCrew().getName() + " " + entity.getCrew().getGunnery() + "/" + entity.getCrew().getPiloting(); } return "NO PILOT"; }
r.add(getCrew().getGunnery()); r.newlines = 0; vDesc.addElement(r);
@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))); } }
@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++) { 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 = new ArrayList<Entity>(); enemyEntities.add(en); getSpecMissionEnemies().add(enemyEntities); } addBotForce(getEnemyBotForce(getContract(campaign), enemyStart, getSpecMissionEnemies().get(0))); } }
private String getUnitDescription(Unit u) { String name = "<font color='red'>No Crew</font>"; String uname = ""; Person pp = u.getCommander(); if(null != pp) { name = pp.getFullTitle(); name += " (" + u.getEntity().getCrew().getGunnery() + "/" + u.getEntity().getCrew().getPiloting() + ")"; if(pp.needsFixing()) { name = "<font color='red'>" + name + "</font>"; } } uname = "<i>" + u.getName() + "</i>"; if(u.isDamaged()) { uname = "<font color='red'>" + uname + "</font>"; } return "<html>" + name + ", " + uname + "</html>"; }
int artySkill = aaa.getEntity(operator.getGame()).getCrew().getGunnery(); if(operator.getGame().getOptions().booleanOption(OptionsConstants.RPG_ARTILLERY_SKILL)) { artySkill = aaa.getEntity(operator.getGame()).getCrew().getArtillery();