Class AreaEffectHelper
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidapplyExplosionClusterDamageToEntity(Entity entity, int damage, int clusterAmt, Coords position, Vector<Report> vDesc, TWGameManager gameManager) Apply a series of cluster hits to the given entity, as from an explosion at a particular position.static voidartilleryDamageEntity(Entity entity, int damage, IBuilding bldg, int bldgAbsorbs, boolean variableDamage, boolean asfFlak, boolean flak, int altitude, Coords attackSource, AmmoType ammo, Coords coords, boolean isFuelAirBomb, Entity killer, Hex hex, int subjectId, Vector<Report> vPhaseReport, TWGameManager gameManager) Worker function that does artillery damage to an entity.static DamageFalloffcalculateDamageFallOff(AmmoType ammo, int attackingBA, boolean mineClear) Calculate the damage and falloff for a particular ammo type, taking into account whether the attack is being carried out by a battle armor squad or a mine clearance attack.static voidcheckInfantryDestruction(Coords coords, int distFromCenter, Entity attacker, Vector<Integer> alreadyHit, Vector<Report> vPhaseReport, Game game, TWGameManager gameManager) Worker function that checks for and implements instant infantry destruction due to fuel air ordnance, if necessary.static voidcheckInfantryDestruction(Entity entity, int distFromCenter, Entity attacker, Vector<Integer> alreadyHit, Vector<Report> vPhaseReport, Game game, TWGameManager gameManager) Worker function that checks for and implements instant infantry destruction due to fuel air ordnance, if necessary.static voidclearMineFields(Coords targetPos, int targetNum, Entity ae, Vector<Report> vPhaseReport, Game game, TWGameManager gameManager) Worker function that clears minefields.static voiddoNuclearExplosion(Entity entity, Coords coords, int nukeType, Vector<Report> vPhaseReport, TWGameManager gameManager) Abbreviated nuclear explosion logic when the weapon is targeted at a single off-board entity.static intGet the blast radius of a particular equipment type, given the internal name.static NukeStatsgetNukeStats(int nukeType) Helper function that retrieves the stat block for a particular type of nuke, or null if such a type is not defined.processFuelAirDamage(Coords center, int boardId, int height, AmmoType ammo, Entity attacker, Vector<Report> vPhaseReport, TWGameManager gameManager) Helper function that processes damage for fuel-air explosives.processFuelAirDamage(Coords center, int height, AmmoType ammo, Entity attacker, Vector<Report> vPhaseReport, TWGameManager gameManager) static voidprocessFuelAirDamage(Entity target, Coords center, EquipmentType ordnanceType, Entity attacker, Vector<Report> vPhaseReport, TWGameManager gameManager) Helper function that processes damage for fuel-air explosives.shapeBlast(AmmoType ammo, Coords center, int height, boolean artillery, boolean flak, boolean asfFlak, Game game, boolean excludeCenter) Computes the semi-3D blast shapes of AE and Artillery explosions using rules from: - Total Warfare pp.shapeBlast(AmmoType ammo, Coords center, int boardId, DamageFalloff falloff, int height, boolean artillery, boolean flak, boolean asfFlak, Game game, boolean excludeCenter) shapeBlast(AmmoType ammo, Coords center, DamageFalloff falloff, int height, boolean artillery, boolean flak, boolean asfFlak, Game game, boolean excludeCenter) shapeBlastRing(Coords center, DamageFalloff falloff, int height, boolean excludeCenter)
-
Constructor Details
-
AreaEffectHelper
public AreaEffectHelper()
-
-
Method Details
-
getFuelAirBlastRadiusIndex
Get the blast radius of a particular equipment type, given the internal name. -
processFuelAirDamage
public static void processFuelAirDamage(Entity target, Coords center, EquipmentType ordnanceType, Entity attacker, Vector<Report> vPhaseReport, TWGameManager gameManager) Helper function that processes damage for fuel-air explosives. Single-entity version. -
processFuelAirDamage
-
processFuelAirDamage
public static Vector<Integer> processFuelAirDamage(Coords center, int boardId, int height, AmmoType ammo, Entity attacker, Vector<Report> vPhaseReport, TWGameManager gameManager) Helper function that processes damage for fuel-air explosives. -
checkInfantryDestruction
public static void checkInfantryDestruction(Coords coords, int distFromCenter, Entity attacker, Vector<Integer> alreadyHit, Vector<Report> vPhaseReport, Game game, TWGameManager gameManager) Worker function that checks for and implements instant infantry destruction due to fuel air ordnance, if necessary. Checks all units at given coords. -
checkInfantryDestruction
public static void checkInfantryDestruction(Entity entity, int distFromCenter, Entity attacker, Vector<Integer> alreadyHit, Vector<Report> vPhaseReport, Game game, TWGameManager gameManager) Worker function that checks for and implements instant infantry destruction due to fuel air ordnance, if necessary. Single-entity version. -
clearMineFields
public static void clearMineFields(Coords targetPos, int targetNum, Entity ae, Vector<Report> vPhaseReport, Game game, TWGameManager gameManager) Worker function that clears minefields. -
artilleryDamageEntity
public static void artilleryDamageEntity(Entity entity, int damage, IBuilding bldg, int bldgAbsorbs, boolean variableDamage, boolean asfFlak, boolean flak, int altitude, Coords attackSource, AmmoType ammo, Coords coords, boolean isFuelAirBomb, Entity killer, Hex hex, int subjectId, Vector<Report> vPhaseReport, TWGameManager gameManager) Worker function that does artillery damage to an entity. Extracted from Server.artilleryDamageHex()- Parameters:
entity- The entity to damagedamage- The amount of damage to dobldg- The building, if any, in that hexbldgAbsorbs- How much damage, if any, the building will absorbvariableDamage- Whether to roll a d6 for the number of hitsasfFlak- Whether we are making a flak attack against an aerospace unitflak- Whether we are making a flak attackaltitude- Altitude of the attackattackSource- The coordinates at which the shell was targeted, for hit table resolutionammo- The ammo type usedcoords- The coordinates where the shell actually landedisFuelAirBomb- Whether we are making a fuel-air attackkiller- The entity that initiated the attackhex- The hex, if any, where the shell landedsubjectId- The ID of the entity carrying out the attack, for reporting in double-blind gamesvPhaseReport- Vector of reports to which we append reportsgameManager- GameManager object for invocation of various methods
-
calculateDamageFallOff
public static DamageFalloff calculateDamageFallOff(AmmoType ammo, int attackingBA, boolean mineClear) Calculate the damage and falloff for a particular ammo type, taking into account whether the attack is being carried out by a battle armor squad or a mine clearance attack. Also sets a "cluster munitions" flag as appropriate.- Parameters:
ammo- AmmoType being used for the attackattackingBA- How many BA suits are in the squad if this is a BA Tube arty attack, -1 otherwisemineClear- Whether we're clearing a minefield- Returns:
- A DamageFalloff object containing the damage and falloff values and if it is cluster or not
-
doNuclearExplosion
public static void doNuclearExplosion(Entity entity, Coords coords, int nukeType, Vector<Report> vPhaseReport, TWGameManager gameManager) Abbreviated nuclear explosion logic when the weapon is targeted at a single off-board entity. -
applyExplosionClusterDamageToEntity
public static void applyExplosionClusterDamageToEntity(Entity entity, int damage, int clusterAmt, Coords position, Vector<Report> vDesc, TWGameManager gameManager) Apply a series of cluster hits to the given entity, as from an explosion at a particular position. Generate reports for each cluster. -
getNukeStats
Helper function that retrieves the stat block for a particular type of nuke, or null if such a type is not defined. -
shapeBlast
public static HashMap<Map.Entry<Integer,Coords>, shapeBlastInteger> (AmmoType ammo, Coords center, int height, boolean artillery, boolean flak, boolean asfFlak, Game game, boolean excludeCenter) Computes the semi-3D blast shapes of AE and Artillery explosions using rules from: - Total Warfare pp. 173, XXX, and - Tactical Operations: Advanced Rules pp. 150, YYYThe shape of an Area Effect explosion always includes a ring, but may have radius 0. In this case only units in the hit hex are affected. Additionally, an AE attack that hits a building or water hex deals damage above and below the level that was hit: - For R0 AE attacks: 1/2 to the level above, and 1/2 damage to the level below, the level that was hit/targeted in the central hex. E.g. a WiGE vehicle at elevation 1 in a water hex would take 1/2 damage from any AE attack that targeted and hit that hex. Any underwater vehicle at depth 1 below the surface, likewise. - For R1 and larger: full damage to 1 level above and below the targeted level in that hex. 1/2 damage to the levels 2 above and 2 below the level hit. Also, 1/2 damage in an R1 ring at 1 level above and 1 level below.
Further, cumulatively, Artillery attacks deal extra damage above the hexes they hit no matter what type of hex they are (except Building and Mobile Structures): - For any Artillery: apply base damage - (10 * level) for every level above the base hex until no damage would be dealt. Each unit hit can only be hit once by this damage - For Flak Artillery: apply base damage - (10 * level) for every level below the target's elevation as well.
We do not currently support artillery flak fire at Low-Altitude units.
Specific edge cases to consider: 1. Counter-battery fire - only worry about the ring at surface level.
- Parameters:
ammo- AmmoType of the attack.center- Coordinates of center of blast.height- Elevation/level of target, or Altitude if firing on ASFsartillery- true if artillery attack; false if other AE attackflak- true if flak attack.asfFlak- true if flak attack on an Aerospace unit.game- Reference to game, for terrain checksexcludeCenter- Used for creating all height, hex values but the center- Returns:
- (height, Coords): damage map.
-
shapeBlast
-
shapeBlast
public static HashMap<Map.Entry<Integer,Coords>, shapeBlastInteger> (@Nullable AmmoType ammo, Coords center, int boardId, DamageFalloff falloff, int height, boolean artillery, boolean flak, boolean asfFlak, Game game, boolean excludeCenter) - Parameters:
ammo- AmmoType of the attack.center- Coordinates of center of blast.falloff- Preset falloff to use for this blast; mainly for BA Tube attack.height- Elevation/level of target, or Altitude if firing on ASFsartillery- true if artillery attack; false if other AE attackflak- true if flak attack.asfFlak- true if flak attack on an Aerospace unit.game- Reference to game, for terrain checksexcludeCenter- Used for creating all height, hex values but the center- Returns:
- (height, Coords): damage map.
-
shapeBlastRing
-