Skip to content

Commit

Permalink
Merge pull request #6308 from psikomonkie/issue-6271-artillery-travel…
Browse files Browse the repository at this point in the history
…-time

Issue 6271: Offboard units to the North and West will be placed properly
  • Loading branch information
HoneySkull authored Dec 25, 2024
2 parents 90b1a03 + 837ceda commit 6480c6d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 17 deletions.
2 changes: 1 addition & 1 deletion megamek/src/megamek/common/Compute.java
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
4 changes: 2 additions & 2 deletions megamek/src/megamek/common/Entity.java
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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;
Expand Down
15 changes: 1 addition & 14 deletions megamek/src/megamek/common/actions/ArtilleryAttackAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 6480c6d

Please sign in to comment.