minor:refactor for tool to lava/water distances for clarity

This commit is contained in:
Louis Hong
2024-11-21 12:53:41 -08:00
parent 1ece6c01d4
commit 22108a330f
2 changed files with 16 additions and 15 deletions

View File

@@ -121,15 +121,6 @@ public class HeatActionSolver
}; };
// index 1 is stage, ordinal order
// index 2 [0] = lava [1] = waterfall
// in units of tiles
public static final int[][] DISTANCE_TO_STAGE = new int[][] {
new int[] {4, 14},
new int[] {7, 9},
new int[] {12, 10}
};
// index is stage, ordinal order // index is stage, ordinal order
public static final int[] TOOL_TICK_CYCLE = new int[] { public static final int[] TOOL_TICK_CYCLE = new int[] {
5, 5,
@@ -368,9 +359,15 @@ public class HeatActionSolver
private static int solveTravelTicks(boolean isRunning, Stage stage, boolean isLava) private static int solveTravelTicks(boolean isRunning, Stage stage, boolean isLava)
{ {
final int index1 = stage.ordinal(); final int distance;
final int index2 = isLava ? 0 : 1; if (isLava)
final int distance = DISTANCE_TO_STAGE[index1][index2]; {
distance = stage.getDistanceToLava();
}
else
{
distance = stage.getDistanceToWaterfall();
}
if (isRunning) if (isRunning)
{ {

View File

@@ -7,15 +7,18 @@ import lombok.Getter;
@AllArgsConstructor @AllArgsConstructor
public enum Stage public enum Stage
{ {
TRIP_HAMMER("Hammer", Heat.HIGH, 20, -25), TRIP_HAMMER("Hammer", Heat.HIGH, 20, -25, 4, 14),
GRINDSTONE("Grind", Heat.MED, 10, 15), GRINDSTONE("Grind", Heat.MED, 10, 15, 7, 19),
POLISHING_WHEEL("Polish", Heat.LOW, 10, -17); POLISHING_WHEEL("Polish", Heat.LOW, 10, -17, 12, 10);
private final String name; private final String name;
private final Heat heat; private final Heat heat;
private final int progressPerAction; private final int progressPerAction;
private final int heatChange; private final int heatChange;
private final int distanceToLava;
private final int distanceToWaterfall;
public boolean isHeating() public boolean isHeating()
{ {
return heatChange > 0; return heatChange > 0;
@@ -25,4 +28,5 @@ public enum Stage
{ {
return heatChange < 0; return heatChange < 0;
} }
} }