@Override protected double getConvInfantryStandardDamage(int range, Infantry inf) { if (inf.getPrimaryWeapon() == null) { return inf.getDamagePerTrooper() * TROOP_FACTOR[Math.min(inf.getShootingStrength(), 30)] / 10.0; } else { return 0; } }
/** * Damage that the specified platoon does with explosives */ public static int getDamageFor(Entity entity) { if (!(entity instanceof Infantry)) return 0; Infantry inf = (Infantry) entity; InfantryWeapon srmWeap = (InfantryWeapon) EquipmentType .get("SRM Launcher (Std, Two-Shot)"); int dmg = (int) Math.round(srmWeap.getInfantryDamage() * inf.getShootingStrength()); int numTurns = Math.min(6, inf.turnsLayingExplosives); return dmg * numTurns; }
private void initInfantryArmorPanel() { GridBagConstraints gridBagConstraints; Infantry infantry = (Infantry) entity; panArmor = new JPanel(new GridBagLayout()); panArmor.setBorder(BorderFactory.createTitledBorder("Troopers Left")); spnArmor = new JSpinner[entity.locations()]; spnInternal = new JSpinner[entity.locations()]; spnRear = new JSpinner[entity.locations()]; int men = Math.max(infantry.getShootingStrength(), 0); spnInternal[0] = new JSpinner(new SpinnerNumberModel(men, 0, infantry.getSquadN() * infantry.getSquadSize(), 1)); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.insets = new Insets(1, 10, 1, 1); gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; panArmor.add(new JLabel("Men Left"), gridBagConstraints); gridBagConstraints.gridx = 1; panArmor.add(spnInternal[0], gridBagConstraints); }
protected int calcAttackValue() { int av = 0; //Sigh, another rules oversight - nobody bothered to figure this out //To be consistent with other cluster weapons we will assume 60% hit double damage = ((InfantryWeapon)wtype).getInfantryDamage(); if((ae instanceof Infantry) && !(ae instanceof BattleArmor)) { damage = ((Infantry)ae).getDamagePerTrooper(); av = (int) Math.round(damage * 0.6 * ((Infantry)ae).getShootingStrength()); } if(bDirect) { av = Math.min(av+(toHit.getMoS()/3), av*2); } if(bGlancing) { av = (int) Math.floor(av / 2.0); } return av; }
protected double getConvInfantryStandardDamage(int range, Infantry inf) { if (inf.getPrimaryWeapon() == null) { int baseDamage = (int)Math.ceil(inf.getDamagePerTrooper() * inf.getShootingStrength()); return Compute.calculateClusterHitTableAmount(7, baseDamage) / 10.0; } else { return 0; } }
/** * Returns the value of the armor in the indicated location. Conventional * infantry and battle armor behave differently than other units. Armor is * in integer units. */ protected int getArmorValue(int loc, boolean rear) { int result = entity.getArmor(loc, rear); // Conventional infantry don't have armor (yet), so use the number of // troopers // TODO: This will probably need some revamping when Total Warfare is // released. if ((entity instanceof Infantry) & !(entity instanceof BattleArmor)) { result = ((Infantry) entity).getShootingStrength(); } // Battle armor has armor per trooper; treat each trooper as a // "location" if (entity instanceof BattleArmor) { result = ((BattleArmor) entity).getArmor(loc, false); } if (result <= 0) { result = 0; } return result; }
public boolean hasActiveFieldArtillery() { boolean hasArtillery = false; double smallestGun = 100.0; for(Mounted wpn : getWeaponList()) { if(wpn.getLocation() != LOC_FIELD_GUNS) { continue; } if(wpn.getType().hasFlag(WeaponType.F_ARTILLERY)) { hasArtillery = true; if(wpn.getType().getTonnage(this) < smallestGun) { smallestGun = wpn.getType().getTonnage(this); } } } //you must have enough men to fire at least the smallest piece return hasArtillery && (getShootingStrength() >= smallestGun); }
if (inf.getShootingStrength() > max) { buff.append("Maximum platoon size is " + max + "\n\n"); correct = false;
public static ArrayList<Person> doCrewInjuries(Entity e, Campaign c, ArrayList<Person> newCrew) { int casualties = 0; if(null != e && e instanceof Infantry) { e.applyDamage(); casualties = newCrew.size() - ((Infantry)e).getShootingStrength(); for (Person p : newCrew) { for (int i = 0; i < casualties; i++) { if(Compute.d6(2) >= 7) { int hits = c.getCampaignOptions().getMinimumHitsForVees(); if (c.getCampaignOptions().useAdvancedMedical() || c.getCampaignOptions().useRandomHitsForVees()) { int range = 6 - hits; hits = hits + Compute.randomInt(range); } p.setHits(hits); } else { p.setHits(6); } } } } return newCrew; }
int ratedDamage = ba.getShootingStrength(); server.artilleryDamageArea(coords, ae.getPosition(), (AmmoType) ammo.getType(), subjectId, ae, ratedDamage * 2,
int lastStrength = inf.getShootingStrength(); final double dpt = Math.round(inf.getDamagePerTrooper() * lastStrength) / (double) lastStrength; int lastDamage = (int) Math.round(dpt * lastStrength); for (int strength = inf.getShootingStrength(); strength >= 0; strength--) { final int damage = (int) Math.round(dpt * strength); if (damage < lastDamage) {
troopersHit = ((Infantry)ae).getShootingStrength(); } else if (!(ae instanceof Infantry)) { troopersHit = 1; } else { troopersHit = Compute.missilesHit(((Infantry) ae) .getShootingStrength(), nHitMod, bGlancing);
toReturn = new ToHitData(inf.getCrew().getPiloting(), "anti-mech skill", ToHitData.HIT_KICK, ToHitData.SIDE_FRONT); int men = inf.getShootingStrength(); int modifier = TargetRoll.IMPOSSIBLE; if (men >= 22) {
if(en instanceof Infantry) { en.applyDamage(); int strength = ((Infantry)en).getShootingStrength(); casualties = crew.size() - strength;
Infantry inf = (Infantry) attacker; toReturn = new ToHitData(inf.getCrew().getPiloting(), "anti-mech skill"); int men = inf.getShootingStrength(); int modifier = TargetRoll.IMPOSSIBLE; if (men >= 22) {
infantry.applyDamage(); int strength = Math.min(((Infantry)infantry).getShootingStrength(), crew.size()); casualties = crew.size() - strength; if (ustatus.isTotalLoss()) {
if(fieldGunMassAlreadyFired + fieldGunMass <= ((Infantry)shooter).getShootingStrength()) { fieldGuns.add(weaponFireInfo); fieldGunMassAlreadyFired += fieldGunMass;
* inf_attacker.getShootingStrength(); * inf_attacker.getShootingStrength(); if (inf_attacker.getShootingStrength() > 0) { fDamage = Math.min(inf_attacker.getShootingStrength(), fDamage);
number_of_shooters = ((Infantry) entity).getShootingStrength();
armor_values[0] = ((Infantry) target).getShootingStrength();