From 837ceda69026d881f6626f5ba99787026d1bdf0b Mon Sep 17 00:00:00 2001 From: psikomonkie <189469115+psikomonkie@users.noreply.github.com> Date: Mon, 23 Dec 2024 12:46:50 -0500 Subject: [PATCH] Issue 6271: Offboard units to the North and West will be placed properly; use one method for determining artillery travel time --- megamek/src/megamek/common/Compute.java | 2 +- megamek/src/megamek/common/Entity.java | 4 ++-- .../common/actions/ArtilleryAttackAction.java | 15 +-------------- 3 files changed, 4 insertions(+), 17 deletions(-) diff --git a/megamek/src/megamek/common/Compute.java b/megamek/src/megamek/common/Compute.java index f3a6bf40647..b4b70b22cdc 100644 --- a/megamek/src/megamek/common/Compute.java +++ b/megamek/src/megamek/common/Compute.java @@ -7636,7 +7636,7 @@ public static boolean isFlakAttack(Entity attacker, Entity target) { public static int turnsTilHit(int distance) { final int turnsTilHit; - // See indirect flight times table, TO p181 + // See indirect flight times table, TO:AR p149 if (distance <= Board.DEFAULT_BOARD_HEIGHT) { turnsTilHit = 0; } else if (distance <= (8 * Board.DEFAULT_BOARD_HEIGHT)) { diff --git a/megamek/src/megamek/common/Entity.java b/megamek/src/megamek/common/Entity.java index 744c06673a2..1f498414c72 100644 --- a/megamek/src/megamek/common/Entity.java +++ b/megamek/src/megamek/common/Entity.java @@ -10272,7 +10272,7 @@ public void deployOffBoard(int round) { case NORTH: setPosition(new Coords((game.getBoard().getWidth() / 2) + (game.getBoard().getWidth() % 2), - -getOffBoardDistance())); + -getOffBoardDistance() - 1)); setFacing(3); break; case SOUTH: @@ -10290,7 +10290,7 @@ public void deployOffBoard(int round) { setFacing(5); break; case WEST: - setPosition(new Coords(-getOffBoardDistance(), (game.getBoard() + setPosition(new Coords(-getOffBoardDistance() - 1, (game.getBoard() .getHeight() / 2) + (game.getBoard().getHeight() % 2))); setFacing(1); break; diff --git a/megamek/src/megamek/common/actions/ArtilleryAttackAction.java b/megamek/src/megamek/common/actions/ArtilleryAttackAction.java index 43c526b0815..89f6c53fc79 100644 --- a/megamek/src/megamek/common/actions/ArtilleryAttackAction.java +++ b/megamek/src/megamek/common/actions/ArtilleryAttackAction.java @@ -60,20 +60,7 @@ public ArtilleryAttackAction(int entityId, int targetType, int targetId, turnsTilHit = 2; } } else { - // See indirect flight times table, TO p181 - if (distance <= Board.DEFAULT_BOARD_HEIGHT) { - turnsTilHit = 0; - } else if (distance <= (8 * Board.DEFAULT_BOARD_HEIGHT)) { - turnsTilHit = 1; - } else if (distance <= (15 * Board.DEFAULT_BOARD_HEIGHT)) { - turnsTilHit = 2; - } else if (distance <= (21 * Board.DEFAULT_BOARD_HEIGHT)) { - turnsTilHit = 3; - } else if (distance <= (26 * Board.DEFAULT_BOARD_HEIGHT)) { - turnsTilHit = 4; - } else { - turnsTilHit = 5; - } + turnsTilHit = Compute.turnsTilHit(distance); } } return;