Skip to content

Commit

Permalink
Move FAE Bomb handling under bomb damage handler
Browse files Browse the repository at this point in the history
  • Loading branch information
Sleet01 committed Feb 21, 2025
1 parent 5dfd0c1 commit 24f5d27
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
3 changes: 0 additions & 3 deletions megamek/src/megamek/common/weapons/BombAttackHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,6 @@ public boolean handle(GamePhase phase, Vector<Report> vPhaseReport) {
for (Coords c : hexes) {
gameManager.deliverThunderMinefield(c, ae.getOwner().getId(), 20, ae.getId());
}
} else if (type == BombType.B_FAE_SMALL || type == BombType.B_FAE_LARGE) {
hitIds = AreaEffectHelper.processFuelAirDamage(drop, dropHex.getTargetLevel(),
(BombType) EquipmentType.get(BombType.getBombInternalName(type)), ae, vPhaseReport, gameManager);
} else {
// We want to make this a HexTarget so we can ensure drifts happen at the same elevation
// (Currently this is not working correctly because we don't pass targetLevel over the wire)
Expand Down
30 changes: 18 additions & 12 deletions megamek/src/megamek/server/totalwarfare/TWGameManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -31648,18 +31648,24 @@ public Vector<Integer> deliverBombDamage(HexTarget targetHex, int type, int subj
}
}

DamageFalloff falloff = AreaEffectHelper.calculateDamageFallOff(ammo, 0, false);

HashMap<Map.Entry<Integer, Coords>, Integer> blastShape = AreaEffectHelper.shapeBlast(
ammo, center, falloff, targetLevel, false, false, false, game, false);

for (Map.Entry<Integer, Coords> entry: blastShape.keySet()) {
Coords bCoords = entry.getValue();
int bLevel = entry.getKey();
alreadyHit = artilleryDamageHex(
bCoords, center, blastShape.get(entry), ammo, subjectId, killer, null, false,
bLevel, targetLevel, vPhaseReport, false, alreadyHit, false, falloff
);
if (type == BombType.B_FAE_SMALL || type == BombType.B_FAE_LARGE) {
// pass FAE bombs with the special handler
alreadyHit = AreaEffectHelper.processFuelAirDamage(center, targetLevel,
(BombType) EquipmentType.get(BombType.getBombInternalName(type)), killer, vPhaseReport, this);
} else {
// All other damage-dealing bombs
DamageFalloff falloff = AreaEffectHelper.calculateDamageFallOff(ammo, 0, false);
HashMap<Map.Entry<Integer, Coords>, Integer> blastShape = AreaEffectHelper.shapeBlast(
ammo, center, falloff, targetLevel, false, false, false, game, false);

for (Map.Entry<Integer, Coords> entry : blastShape.keySet()) {
Coords bCoords = entry.getValue();
int bLevel = entry.getKey();
alreadyHit = artilleryDamageHex(
bCoords, center, blastShape.get(entry), ammo, subjectId, killer, null, false,
bLevel, targetLevel, vPhaseReport, false, alreadyHit, false, falloff
);
}
}

// Lets reports assess if anything was caught in area
Expand Down

0 comments on commit 24f5d27

Please sign in to comment.