Class ASDamageConverter
java.lang.Object
megamek.common.alphaStrike.conversion.ASDamageConverter
- Direct Known Subclasses:
ASArcedDamageConverter,ASBattleArmorDamageConverter,ASConvInfantryDamageConverter
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AlphaStrikeElementprotected Entityprotected ASDamageprotected ASDamageprotected ASDamageprotected ASDamageprotected final booleanprotected doubleprotected doubleprotected doubleprotected String[]protected ASSpecialAbilityCollection[]protected booleanprotected doubleprotected static final Stringprotected static final Stringprotected intprotected CalculationReportprotected static final int[]protected intprotected List<WeaponMounted> -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedASDamageConverter(Entity entity, AlphaStrikeElement element, CalculationReport report) Do not call this directly. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected doubleassembleFrontDamage(int range) Sums up the front-facing damage values for the given range and reports the counted weapons.protected int[]assembleHeatDamage(int location) protected double[]assembleSpecialDamage(BattleForceSUA dmgType, int location) Sums up the damage values for all ranges and reports the counted weapons.protected voidassignSpecialAbilities(Mounted<?> weapon, WeaponType weaponType) protected voidassignToLocations(Mounted<?> weapon, BattleForceSUA sua) Checks the location multiplier for all locations and assigns the given SUA to any location where the multiplier is not zero, i.e.protected voidassignToLocations(Mounted<?> weapon, BattleForceSUA sua, int abilityValue) Checks the location multiplier for all locations and assigns the given SUA with the given ability value to any location where the multiplier is not zero, i.e.protected voidprotected booleancountsForSpecial(Mounted<?> weapon, BattleForceSUA dmgType) protected doubledetermineDamage(Mounted<?> weapon, int range) Returns the damage value to be used for the given weapon at the given range.protected voiddetermineFinalHT(int[] heatDamageValues, int location) protected doubledetermineSpecialsDamage(WeaponType weaponType, Mounted<?> linked, int range, BattleForceSUA dmgType) protected StringformatAsVector(double... damage) protected StringformatAsVector(double s, double m, double l, double e, BattleForceSUA dmgType) protected static BattleForceSUAgetArtilleryType(WeaponType weaponType) Translates an Artillery WeaponType to the AlphaStrike Special Unit Ability, if any can be found.protected doublegetDamageMultiplier(Mounted<?> weapon, WeaponType weaponType) protected intReturns the heat dissipation for Meks and AFs, according to ASC - Converting Heat Errata v1.2.protected intgetHeatGeneration(boolean onlyRear, boolean onlyLongRange) Returns the total generated heat (weapons and movement) for a Mek or Aero for the purpose of finding OV / OVL values.protected intprotected intprotected StringgetWeaponDesc(Mounted<?> weapon) protected static booleanisArtilleryCannon(WeaponType weapon) protected voidprocessAMS(Mounted<?> weapon, WeaponType weaponType) protected voidprocessArtillery(Mounted<?> weapon, WeaponType weaponType) protected voidprotected voidprotected voidprocessFrontSpecialDamage(BattleForceSUA dmgType) Processes damage values for special abilities such as LRM, but not REAR and not TUR.protected voidDetermines if the element has the HT ability and what the value is.protected voidprocessHT(int location) Determines if the element has the HT ability and what the value is.protected voidprotected voidprotected voidprocessNarc(Mounted<?> weapon, WeaponType weaponType) protected voidprotected voidprotected voidprocessSpecialDamage(BattleForceSUA dmgType, int location) Processes damage values.protected voidprocessTaser(Mounted<?> weapon, WeaponType weaponType) protected voidprotected static booleanqualifiesForSpecial(double[] damage, BattleForceSUA dmgType) Returns true when the heat-adjusted and tenth-rounded damage values in the List allow the given spa.protected intrangesForSpecial(BattleForceSUA dmgType) protected voidreportAssignToLocations(Mounted<?> weapon, BattleForceSUA sua, String abilityValue, int loc) static doubleroundUpToTenth(double number) Returns the given number, rounded up to the nearest tenth.protected intweaponHeat(Mounted<?> weapon, boolean onlyRear, boolean onlyLongRange) protected static intweaponHeat(WeaponType weaponType) protected void
-
Field Details
-
TROOP_FACTOR
protected static final int[] TROOP_FACTOR -
rdUp
- See Also:
-
rdNm
- See Also:
-
entity
-
element
-
report
-
locations
-
locationNames
-
rearLocation
protected int rearLocation -
turretLocation
protected int turretLocation -
hasTargetingComputer
protected final boolean hasTargetingComputer -
weaponsList
-
rawSDamage
protected double rawSDamage -
needsHeatAdjustment
protected boolean needsHeatAdjustment -
heatAdjustFactor
protected double heatAdjustFactor -
heatAdjustFactorLE
protected double heatAdjustFactorLE -
heatAdjustFactorREAR
protected double heatAdjustFactorREAR -
finalSDamage
-
finalMDamage
-
finalLDamage
-
finalEDamage
-
-
Constructor Details
-
ASDamageConverter
Do not call this directly. Use the static getASDamageConverter instead. Constructs a damage converter for ground units.- Parameters:
entity- The entity to convert damage forelement- The partially-converted element corresponding to the entityreport- The calculation report to write to
-
-
Method Details
-
processSpecialAbilities
protected void processSpecialAbilities() -
processDamage
protected void processDamage() -
processTurrets
protected void processTurrets() -
calculateHeatAdjustment
protected void calculateHeatAdjustment() -
assembleFrontDamage
protected double assembleFrontDamage(int range) Sums up the front-facing damage values for the given range and reports the counted weapons. Includes modifiers for low ammo, AES etc. and the location multiplier (0.5 for some Aero arcs)- Parameters:
range- The range, e.g. AlphaStrikeElement.MEDIUM_RANGE- Returns:
- The raw damage sum
-
determineDamage
Returns the damage value to be used for the given weapon at the given range. Overridden for special treatment and possibly ignoring some weapons.- Parameters:
weapon- The weapon Mountedrange- The range value (not bracket)- Returns:
- the damage to be used
-
processSDamage
protected void processSDamage() -
processMDamage
protected void processMDamage() -
processLDamage
protected void processLDamage() -
processEDamage
protected void processEDamage() -
getDamageMultiplier
-
assembleAmmoCounts
protected void assembleAmmoCounts() -
assignSpecialAbilities
-
processNarc
-
processTaser
-
processAMS
-
processArtillery
-
assignToLocations
Checks the location multiplier for all locations and assigns the given SUA to any location where the multiplier is not zero, i.e. to any location that the weapon is counted towards.- Parameters:
weapon- The weapon to checksua- The special unit ability to add
-
assignToLocations
Checks the location multiplier for all locations and assigns the given SUA with the given ability value to any location where the multiplier is not zero, i.e. to any location that the weapon is counted towards. If the SUA is already present, the ability value is added.- Parameters:
weapon- The weapon to checksua- The special unit ability to addabilityValue- The ability value to add
-
reportAssignToLocations
protected void reportAssignToLocations(Mounted<?> weapon, BattleForceSUA sua, String abilityValue, int loc) -
processHT
protected void processHT()Determines if the element has the HT ability and what the value is. Overridden for CI. -
processHT
protected void processHT(int location) Determines if the element has the HT ability and what the value is. Overridden for CI. -
assembleHeatDamage
protected int[] assembleHeatDamage(int location) -
determineFinalHT
protected void determineFinalHT(int[] heatDamageValues, int location) -
processFrontSpecialDamage
Processes damage values for special abilities such as LRM, but not REAR and not TUR. -
processSpecialDamage
Processes damage values. The dmgType indicates the special ability for which this is (LRM, REAR, etc.). location indicates the target of this damage, i.e. if it is the unit's standard damage and standard ability block, the REAR ability or the TUR block, see ASLocationMapper. When the location is rearLocation, dmgType must be REAR (as REAR has no LRM damage or the like) When the location is turretLocation, TUR indicates it's the TUR's standard damage, LRM indicates it's the LRM damage within the TUR block. -
assembleSpecialDamage
Sums up the damage values for all ranges and reports the counted weapons. The dmgType indicates the special ability for which this sum is (LRM, REAR, etc.). location indicates the target of this damage, i.e. if it is the unit's standard damage and standard ability block, the REAR ability or the TUR block, see ASLocationMapper. When the location is rearLocation, dmgType must be REAR (as REAR has no LRM damage or the like) When the location is turretLocation, TUR indicates it's the TUR's standard damage, LRM indicates it's the LRM damage within the TUR block.- Returns:
- The raw damage sums for the four ranges
-
determineSpecialsDamage
protected double determineSpecialsDamage(WeaponType weaponType, Mounted<?> linked, int range, BattleForceSUA dmgType) -
qualifiesForSpecial
Returns true when the heat-adjusted and tenth-rounded damage values in the List allow the given spa. Only used for the damage specials LRM, SRM, TOR, IATM, AC, FLK -
rangesForSpecial
-
formatAsVector
-
formatAsVector
-
countsForSpecial
-
isArtilleryCannon
-
getArtilleryType
Translates an Artillery WeaponType to the AlphaStrike Special Unit Ability, if any can be found. -
roundUpToTenth
public static double roundUpToTenth(double number) Returns the given number, rounded up to the nearest tenth. ASC Converting Heat Errata v1.2: A value of 0.401 -> 0.5; i.e. any fraction will make it round up, not just the second digit. -
getRearLocation
protected int getRearLocation() -
getTurretLocation
protected int getTurretLocation() -
getHeatGeneration
protected int getHeatGeneration(boolean onlyRear, boolean onlyLongRange) Returns the total generated heat (weapons and movement) for a Mek or Aero for the purpose of finding OV / OVL values. If onlyRear is true, only rear-facing weapons are included, otherwise only front-facing weapons are included! If onlyLongRange is true, only weapons with an L damage value are included. -
weaponHeat
-
weaponHeat
-
getHeatCapacity
protected int getHeatCapacity()Returns the heat dissipation for Meks and AFs, according to ASC - Converting Heat Errata v1.2. -
getWeaponDesc
-
writeLocationsToElement
protected void writeLocationsToElement()
-