heat solver: decay calculations now considers distances to tools. can now use 0 padding without issues.
This commit is contained in:
@@ -520,15 +520,15 @@ public interface EasyGiantsFoundryConfig extends Config
|
|||||||
max = 50
|
max = 50
|
||||||
)
|
)
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "heatActionBuffer", // renamed to reset player's settings for previous bugged implementation
|
keyName = "paddingTicks", // renamed to reset player's settings for previous bugged implementation
|
||||||
name = "Lava/Waterfall Padding Ticks",
|
name = "Padding Ticks",
|
||||||
description = "Units in ticks; buffers more than optimal heat when in lava/waterfall calculations to compensate for heat decay when the player is afk or running/walking slower than optimal.",
|
description = "Number of inefficient idle ticks between actions; calculations will pad more than optimal heat compensate for heat decay during idle/afk.",
|
||||||
position = 0,
|
position = 0,
|
||||||
section = advancedSettings
|
section = advancedSettings
|
||||||
)
|
)
|
||||||
default int heatActionPadTicks()
|
default int heatActionPadTicks()
|
||||||
{
|
{
|
||||||
return 4;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
|
|||||||
@@ -49,6 +49,8 @@ public class EasyGiantsFoundryState
|
|||||||
private final List<Stage> stages = new ArrayList<>();
|
private final List<Stage> stages = new ArrayList<>();
|
||||||
private double heatRangeRatio = 0;
|
private double heatRangeRatio = 0;
|
||||||
|
|
||||||
|
public final HeatActionStateMachine heatActionStateMachine = new HeatActionStateMachine();
|
||||||
|
|
||||||
public void reset()
|
public void reset()
|
||||||
{
|
{
|
||||||
stages.clear();
|
stages.clear();
|
||||||
@@ -335,5 +337,9 @@ public class EasyGiantsFoundryState
|
|||||||
return actions;
|
return actions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HeatActionStateMachine heatActionStateMachine = new HeatActionStateMachine();
|
|
||||||
|
public boolean isPlayerRunning()
|
||||||
|
{
|
||||||
|
return client.getVarpValue(173) == 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -230,7 +230,8 @@ public class FoundryOverlay3D extends Overlay
|
|||||||
state.getHeatAmount(),
|
state.getHeatAmount(),
|
||||||
true,
|
true,
|
||||||
isLava,
|
isLava,
|
||||||
config.heatActionPadTicks() * 2
|
config.heatActionPadTicks(),
|
||||||
|
state.isPlayerRunning()
|
||||||
);
|
);
|
||||||
|
|
||||||
final int fastDuration = fastResult.getDuration();
|
final int fastDuration = fastResult.getDuration();
|
||||||
@@ -242,7 +243,8 @@ public class FoundryOverlay3D extends Overlay
|
|||||||
state.getHeatAmount(),
|
state.getHeatAmount(),
|
||||||
false,
|
false,
|
||||||
isLava,
|
isLava,
|
||||||
config.heatActionPadTicks() * 2
|
config.heatActionPadTicks(),
|
||||||
|
state.isPlayerRunning()
|
||||||
);
|
);
|
||||||
final int slowDuration = slowResult.getDuration();
|
final int slowDuration = slowResult.getDuration();
|
||||||
|
|
||||||
|
|||||||
@@ -119,6 +119,24 @@ public class HeatActionSolver
|
|||||||
95,
|
95,
|
||||||
91, // last one will always overshoot 1000
|
91, // last one will always overshoot 1000
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// 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
|
||||||
|
public static final int[] TOOL_TICK_CYCLE = new int[] {
|
||||||
|
5,
|
||||||
|
2,
|
||||||
|
2
|
||||||
|
};
|
||||||
|
|
||||||
public static final int MAX_INDEX = DX_1.length;
|
public static final int MAX_INDEX = DX_1.length;
|
||||||
public static final int FAST_INDEX = 10;
|
public static final int FAST_INDEX = 10;
|
||||||
|
|
||||||
@@ -206,16 +224,24 @@ public class HeatActionSolver
|
|||||||
int start,
|
int start,
|
||||||
boolean isFast,
|
boolean isFast,
|
||||||
boolean isActionHeating,
|
boolean isActionHeating,
|
||||||
int padding)
|
int paddingTicks,
|
||||||
|
boolean isRunning)
|
||||||
{
|
{
|
||||||
|
|
||||||
final boolean isStageHeating = stage.isHeating();
|
final boolean isStageHeating = stage.isHeating();
|
||||||
|
// adding tool cycle ticks because the first cycle at a tool is almost always nulled
|
||||||
|
// (unless manually reaching the tile, then clicking the tool)
|
||||||
|
final int toolDelay = TOOL_TICK_CYCLE[stage.ordinal()];
|
||||||
|
final int travelTicks = solveTravelTicks(isRunning, stage, isActionHeating) + toolDelay;
|
||||||
|
final int travelDecay = (int) Math.ceil((double) travelTicks / 2);
|
||||||
|
|
||||||
|
final int paddingDecay = (int) Math.ceil((double) paddingTicks / 2);
|
||||||
|
|
||||||
// adding 2.4s/8ticks worth of padding so preform doesn't decay out of range
|
// adding 2.4s/8ticks worth of padding so preform doesn't decay out of range
|
||||||
// average distance from lava+waterfall around 8 ticks
|
// average distance from lava+waterfall around 8 ticks
|
||||||
// preform decays 1 heat every 2 ticks
|
// preform decays 1 heat every 2 ticks
|
||||||
final int min = Math.max(0, Math.min(1000, range[0] + padding));
|
final int min = Math.max(0, Math.min(1000, range[0] + paddingDecay + travelDecay));
|
||||||
final int max = Math.max(0, Math.min(1000, range[1] + padding));
|
final int max = Math.max(0, Math.min(1000, range[1] + paddingDecay + travelDecay));
|
||||||
|
|
||||||
final int actionsLeft_DeltaHeat = actionLeftInStage * stage.getHeatChange();
|
final int actionsLeft_DeltaHeat = actionLeftInStage * stage.getHeatChange();
|
||||||
|
|
||||||
@@ -340,5 +366,23 @@ public class HeatActionSolver
|
|||||||
return DurationResult.of(estimatedDuration, goalInRange, overshoot, start + dx0);
|
return DurationResult.of(estimatedDuration, goalInRange, overshoot, start + dx0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static int solveTravelTicks(boolean isRunning, Stage stage, boolean isLava)
|
||||||
|
{
|
||||||
|
final int index1 = stage.ordinal();
|
||||||
|
final int index2 = isLava ? 0 : 1;
|
||||||
|
final int distance = DISTANCE_TO_STAGE[index1][index2];
|
||||||
|
|
||||||
|
if (isRunning)
|
||||||
|
{
|
||||||
|
// for odd distances, like 7
|
||||||
|
// 7 / 2 = 3.5
|
||||||
|
// rounded to 4
|
||||||
|
return (int) Math.ceil((double) distance / 2);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return distance;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -121,7 +121,8 @@ public class HeatActionStateMachine
|
|||||||
getStartingHeat(),
|
getStartingHeat(),
|
||||||
actionFast,
|
actionFast,
|
||||||
isHeating(),
|
isHeating(),
|
||||||
config.heatActionPadTicks() * 2
|
config.heatActionPadTicks(),
|
||||||
|
state.isPlayerRunning()
|
||||||
);
|
);
|
||||||
|
|
||||||
goalInRange = result.isGoalInRange();
|
goalInRange = result.isGoalInRange();
|
||||||
|
|||||||
Reference in New Issue
Block a user