Skip to content

Commit

Permalink
Fix combo action heuristics
Browse files Browse the repository at this point in the history
  • Loading branch information
WorkingRobot committed Jul 1, 2024
1 parent 480cc15 commit e67f263
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
3 changes: 2 additions & 1 deletion Simulator/Actions/AdvancedTouchCombo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ internal sealed class AdvancedTouchCombo() : BaseComboAction<StandardTouchCombo,
ActionType.StandardTouchCombo, ActionType.AdvancedTouch, 18 * 3
)
{

public override bool CouldUse(Simulator s) =>
BaseCouldUse(s) && VerifyDurability3(s, StandardTouchCombo.ActionA.DurabilityCost, StandardTouchCombo.ActionB.DurabilityCost);
}
5 changes: 3 additions & 2 deletions Simulator/Actions/BaseComboAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ public static bool VerifyDurability3(int durabilityA, int durabilityB, int durab

if (!perfection)
{
durability -= (int)MathF.Ceiling(durabilityA * wasteNots > 0 ? .5f : 1f);
durability -= (int)MathF.Ceiling(durabilityA * (wasteNots > 0 ? .5f : 1f));

if (durability <= 0)
return false;
}
Expand All @@ -54,7 +55,7 @@ public static bool VerifyDurability3(int durabilityA, int durabilityB, int durab
if (wasteNots > 0)
wasteNots--;

durability -= (int)MathF.Ceiling(durabilityB * wasteNots > 0 ? .5f : 1f);
durability -= (int)MathF.Ceiling(durabilityB * (wasteNots > 0 ? .5f : 1f));

if (durability <= 0)
return false;
Expand Down
4 changes: 2 additions & 2 deletions Simulator/Simulator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ private ActionResponse Execute(ActionType action)
return ActionResponse.ActionNotUnlocked;
if (action == ActionType.Manipulation && !Input.Stats.CanUseManipulation)
return ActionResponse.ActionNotUnlocked;
if (action is ActionType.CarefulObservation or ActionType.HeartAndSoul && !Input.Stats.IsSpecialist)
if (action is ActionType.CarefulObservation or ActionType.HeartAndSoul or ActionType.QuickInnovation && !Input.Stats.IsSpecialist)
return ActionResponse.ActionNotUnlocked;
if (baseAction.CPCost(this) > CP)
if (CalculateCPCost(baseAction.CPCost(this)) > CP)
return ActionResponse.NotEnoughCP;
return ActionResponse.CannotUseAction;
}
Expand Down

1 comment on commit e67f263

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark

Benchmark suite Current: e67f263 Previous: 7ad073a Ratio
Craftimizer.Benchmark.Bench.Solve(State: 006E4F24, Config: 81686DB4) 104068146.66666667 ns (± 961061.836531914)
Craftimizer.Benchmark.Bench.Solve(State: 4CD0EDD1, Config: 81686DB4) 94112731.11111112 ns (± 795441.4926372613)

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.