if (t.getSensorHits() > 0) { critVal = critVal.concat(" sensors=\""); critVal = critVal.concat(Integer.toString(t.getSensorHits())); critVal = critVal.concat("\""); if (t.isEngineHit()) { critVal = critVal.concat(" engine=\""); critVal = critVal.concat("hit"); if (t.isDriverHit()) { critVal = critVal.concat(" driver=\""); critVal = critVal.concat("hit"); if (t.isCommanderHit()) { critVal = critVal.concat(" commander=\""); critVal = critVal.concat("hit"); critVal = critVal.concat("\""); } else if (t.isUsingConsoleCommander()) { critVal = critVal.concat(" commander=\""); critVal = critVal.concat("console");
im = e.isImmobile(); } catch (NullPointerException ex) { retVal = retVal.concat("immobile"); } else { retVal = retVal.concat(Integer.toString(e.getOriginalWalkMP())); retVal = retVal.concat(Integer.toString(e.getMotiveDamage())); retVal = retVal.concat("\" penalty=\""); retVal = retVal.concat(Integer.toString(e.getMotivePenalty())); retVal = retVal.concat("\"/>\n");
public boolean isTurretLocked(int turret) { if (turret == getLocTurret()) { return m_bTurretLocked || m_bTurretJammed; } else if (turret == getLocTurret2()) { return m_bDualTurretLocked || m_bDualTurretJammed; } return false; }
@Override public boolean canChangeSecondaryFacing() { return !m_bHasNoTurret && !isTurretLocked(getLocTurret()); }
/** * Determine if the unit can be repaired, or only harvested for spares. * * @return A <code>boolean</code> that is <code>true</code> if the unit can * be repaired (given enough time and parts); if this value is * <code>false</code>, the unit is only a source of spares. * @see Entity#isSalvage() */ @Override public boolean isRepairable() { // A tank is repairable if it is salvageable, // and none of its body internals are gone. boolean retval = isSalvage(); int loc = Tank.LOC_FRONT; while (retval && (loc < getLocTurret())) { int loc_is = this.getInternal(loc); loc++; retval = (loc_is != IArmorState.ARMOR_DOOMED) && (loc_is != IArmorState.ARMOR_DESTROYED); } return retval; }
if (isCarcass() && !ignorePilot) { return 0; bvText.append(getChassis()); bvText.append(" "); bvText.append(getModel()); bvText.append("</b></CENTER>"); bvText.append(nl); if (hasWorkingMisc(MiscType.F_BLUE_SHIELD)) { blueShield = true; for (int loc = 1; loc < locations(); loc++) { int modularArmor = 0; for (Mounted mounted : getEquipment()) { if ((mounted.getType() instanceof MiscType) && mounted.getType().hasFlag(MiscType.F_MODULAR_ARMOR) switch (getArmorType(loc)) { case EquipmentType.T_ARMOR_COMMERCIAL: armorMultiplier = 0.5; if (hasWorkingMisc(MiscType.F_BLUE_SHIELD)) { armorMultiplier += 0.2; int armor = getArmor(loc) + modularArmor; bvText.append("Total Armor " + this.getLocationAbbr(loc) + " (" + armor + ") x "); bvText.append(armorMultiplier);
@Override public double getCost(boolean ignoreAmmo) { double[] costs = new double[13 + locations()]; int i = 0; if (isSupportVehicle()) { double chassisCost = 2500 * SupportVeeStructure.getWeightStructure(this); if (hasMisc(MiscType.F_AMPHIBIOUS)) { chassisCost *= 1.25; if (hasMisc(MiscType.F_ARMORED_CHASSIS)) { chassisCost *= 2.0; if (hasMisc(MiscType.F_BICYCLE)) { chassisCost *= 0.75; if (hasMisc(MiscType.F_CONVERTIBLE)) { chassisCost *= 1.1; if (hasMisc(MiscType.F_DUNE_BUGGY)) { chassisCost *= 1.25; if (hasMisc(MiscType.F_ENVIRONMENTAL_SEALING)) { chassisCost *= 1.75; if (hasMisc(MiscType.F_HYDROFOIL)) { chassisCost *= 1.1; if (hasMisc(MiscType.F_MONOCYCLE)) { chassisCost *= 1.3;
&& !getOverThresh() && !damagedByFire)) { return CRIT_NONE; switch (roll) { case 6: if (!getCrew().isDead() && !getCrew().isDoomed()) { if (!isDriverHit()) { return CRIT_DRIVER; } else if (!isCommanderHit()) { return CRIT_CREW_STUNNED; } else { for (Mounted m : getWeaponList()) { if ((m.getLocation() == loc) && !m.isDestroyed() && !m.isJammed() && !m.isHit() if (!isStabiliserHit(loc)) { for (Mounted m : getWeaponList()) { if (m.getLocation() == loc) { return CRIT_STABILIZER; if (getSensorHits() < 4) { return CRIT_SENSOR; if (!getCrew().isDead() && !getCrew().isDoomed()) { if (!isCommanderHit()) { return CRIT_COMMANDER; } else if (!isDriverHit()) { return CRIT_CREW_STUNNED;
+ "</b><br></html>"), gridBagConstraints); int lock = 0; if (tank.isTurretLocked(0)) { lock = 1; panSystem.add(new JLabel("<html><b>" + "Engine" + "</b><br></html>"), gridBagConstraints); engineCrit = new CheckCritPanel(1, tank.getEngineHits()); gridBagConstraints.gridx = 1; gridBagConstraints.weightx = 1.0; panSystem.add(new JLabel("<html><b>" + "Sensor" + "</b><br></html>"), gridBagConstraints); sensorCrit = new CheckCritPanel(4, tank.getSensorHits()); gridBagConstraints.gridx = 1; gridBagConstraints.weightx = 1.0; if (tank.isImmobile()) { motiveHits = 4; } else if (tank.hasHeavyMovementDamage()) { motiveHits = 3; } else if (tank.hasModerateMovementDamage()) { motiveHits = 2; } else if (tank.hasMinorMovementDamage()) { motiveHits = 1; stabilizerCrits = new CheckCritPanel[tank.locations()]; for (int loc = 0; loc < tank.locations(); loc++) { if ((loc == Tank.LOC_BODY) || (loc == tank.getLocTurret())
if (null != engineCrit) { if (engineCrit.getHits() > 0) { tank.engineHit(); } else { tank.engineFix(); tank.lockTurret(0); } else { tank.unlockTurret(); tank.setSensorHits(sensorCrit.getHits()); tank.resetMovementDamage(); tank.addMovementDamage(motiveCrit.getHits()); tank.setStabiliserHit(VTOL.LOC_ROTOR); } else { tank.clearStabiliserHit(VTOL.LOC_ROTOR); for (int loc = 0; loc < tank.locations(); loc++) { CheckCritPanel stabCrit = stabilizerCrits[loc]; if (null == stabCrit) { tank.setStabiliserHit(loc); } else { tank.clearStabiliserHit(loc);
@Override public boolean isCrippled(boolean checkCrew) { if ((getArmor(LOC_FRONT) < 1) && (getOArmor(LOC_FRONT) > 0)) { if (PreferenceManager.getClientPreferences().debugOutputOn()) { System.out.println(getDisplayName() + " CRIPPLED: Front armor destroyed."); if ((getArmor(LOC_RIGHT) < 1) && (getOArmor(LOC_RIGHT) > 0)) { if (PreferenceManager.getClientPreferences().debugOutputOn()) { System.out.println(getDisplayName() + " CRIPPLED: Right armor destroyed."); if ((getArmor(LOC_LEFT) < 1) && (getOArmor(LOC_LEFT) > 0)) { if (PreferenceManager.getClientPreferences().debugOutputOn()) { System.out.println(getDisplayName() + " CRIPPLED: Left armor destroyed."); if (!hasNoTurret() && ((getArmor(getLocTurret()) < 1) && (getOArmor(getLocTurret()) > 0))) { if (PreferenceManager.getClientPreferences().debugOutputOn()) { System.out.println(getDisplayName() + " CRIPPLED: Turret destroyed."); if (!hasNoDualTurret() && ((getArmor(getLocTurret2()) < 1) && (getOArmor(getLocTurret2()) > 0))) { if (PreferenceManager.getClientPreferences().debugOutputOn()) { System.out.println(getDisplayName() + " CRIPPLED: Front Turret destroyed."); if ((getArmor(LOC_REAR) < 1) && (getOArmor(LOC_REAR) > 0)) { if (PreferenceManager.getClientPreferences().debugOutputOn()) { System.out.println(getDisplayName()
/** * Parse a tankCrit tag for the given <code>Entity</code>. * * @param tankCrit * @param entity */ private void parseTankCrit(Element tankCrit, Entity entity){ String sensors = tankCrit.getAttribute(SENSORS); String engine = tankCrit.getAttribute(ENGINE); String driver = tankCrit.getAttribute(DRIVER); String commander = tankCrit.getAttribute(COMMANDER); Tank t = (Tank) entity; if (sensors.length() > 0) { t.setSensorHits(Integer.parseInt(sensors)); } if (engine.equalsIgnoreCase("hit")) { t.engineHit(); t.applyDamage(); } if (driver.equalsIgnoreCase("hit")) { t.setDriverHit(true); } if (commander.equalsIgnoreCase("console")) { t.setUsingConsoleCommander(true); } else if (commander.equalsIgnoreCase("hit")) { t.setCommanderHit(true); } }
if ((tank.getMovementMode() == EntityMovementMode.VTOL) || (tank.getMovementMode() == EntityMovementMode.WIGE) || (tank.getMovementMode() == EntityMovementMode.HOVER)) { for (int i = 0; i < tank.locations(); i++) { if (tank.getArmorType(i) == EquipmentType.T_ARMOR_HARDENED) { buff.append("Hardened armor can't be mounted on WiGE/Hover/Wheeled vehicles\n"); illegal = true; if (tank.isOmni()) { for (Mounted m : tank.getEquipment()) { if ((m.getLocation() == tank.getLocTurret2()) && !(m.getType() instanceof AmmoType)) { turret2Weight += m.getType().getTonnage(tank); if ((m.getLocation() == tank.getLocTurret()) && !(m.getType() instanceof AmmoType)) { turretWeight += m.getType().getTonnage(tank); if (tank.isSupportVehicle()) { if (getEntity().getWeight() < 5) { turretWeight = TestEntity.ceil(turretWeight, Ceil.KILO); if ((tank.getBaseChassisTurretWeight() >= 0) && (turretWeight > tank.getBaseChassisTurretWeight())) { buff.append("Unit has more weight in the turret than allowed " + "by base chassis! Current weight: " + turretWeight + ", base chassis turret weight: " + tank.getBaseChassisTurretWeight() + "\n");
toHit = new ToHitData(8, "fire extinguisher"); if (((target instanceof Entity) && ((Entity) target).infernos.isStillBurning()) || ((target instanceof Tank) && ((Tank) target).isInfernoFire())) { toHit.addModifier(2, "inferno fire"); if (tank.isCommanderHit()) { if (ae instanceof VTOL) { toHit.addModifier(+1, "copilot injured"); int sensors = tank.getSensorHits(); if (sensors > 0) { toHit.addModifier(sensors, "sensor damage"); if (tank.isStabiliserHit(weapon.getLocation())) { toHit.addModifier(Compute.getAttackerMovementModifier(game, tank.getId()).getValue(), "stabiliser damage"); if (!((Tank) te).isBackedIntoHullDown()) { moveInDirection = ToHitData.SIDE_FRONT; } else {
boolean ignoreTurret = m_bHasNoTurret || (table == ToHitData.HIT_UNDERWATER); int motiveMod = getMotiveSideMod(side); setPotCrit(HitData.EFFECT_NONE); if (isHullDown()) { if (!hasNoDualTurret()) { int roll = Compute.d6() - 2; if (roll <= 3) { nArmorLoc = getLocTurret2(); } else { nArmorLoc = getLocTurret(); nArmorLoc = getLocTurret(); case 2: if (game.getOptions().booleanOption(OptionsConstants.ADVCOMBAT_VEHICLES_THRESHOLD)) { setPotCrit(HitData.EFFECT_CRITICAL); } else { rv.setEffect(HitData.EFFECT_CRITICAL); case 3: if (game.getOptions().booleanOption(OptionsConstants.ADVCOMBAT_VEHICLES_THRESHOLD)) { setPotCrit(HitData.EFFECT_VEHICLE_MOVE_DAMAGED); } else { rv.setEffect(HitData.EFFECT_VEHICLE_MOVE_DAMAGED); case 4: if (game.getOptions().booleanOption(OptionsConstants.ADVCOMBAT_VEHICLES_THRESHOLD)) {
/** * apply the effects of an "engine hit" crit */ public void engineHit() { engineHit = true; immobilize(); lockTurret(getLocTurret()); lockTurret(getLocTurret2()); for (Mounted m : getWeaponList()) { WeaponType wtype = (WeaponType) m.getType(); if (wtype.hasFlag(WeaponType.F_ENERGY) // Chemical lasers still work even after an engine hit. && !(wtype instanceof CLChemicalLaserWeapon) // And presumably vehicle flamers should, too; we can always // remove this again if ruled otherwise. && !(wtype instanceof VehicleFlamerWeapon)) { m.setBreached(true); // not destroyed, just unpowered } } }
break; if (!((Tank) target).hasNoTurret()) { max_index++; armor_values[max_index] = target.getArmor(((Tank) target).getLocTurret()); if (!((Tank) target).hasNoDualTurret()) { max_index++; armor_values[max_index] = target.getArmor(((Tank) target).getLocTurret2());
private static String getMovementString(Tank e) { String retVal = " <motive damage=\""; retVal = retVal.concat(Integer.toString(e.getMotiveDamage())); retVal = retVal.concat("\" penalty=\""); retVal = retVal.concat(Integer.toString(e.getMotivePenalty())); retVal = retVal.concat("\"/>\n"); return retVal; }
@Override public void updateConditionFromPart() { if(null != unit && unit.getEntity() instanceof Tank) { if(hits > 0 && !((Tank)unit.getEntity()).isStabiliserHit(loc)) { ((Tank)unit.getEntity()).setStabiliserHit(loc); } else if(hits == 0 && ((Tank)unit.getEntity()).isStabiliserHit(loc)) { ((Tank)unit.getEntity()).clearStabiliserHit(loc); } } }