From e67f26328690c0eb8ebb32bf03d20a7a2efa2b92 Mon Sep 17 00:00:00 2001 From: Asriel Camora Date: Mon, 1 Jul 2024 09:51:44 -0700 Subject: [PATCH] Fix combo action heuristics --- Simulator/Actions/AdvancedTouchCombo.cs | 3 ++- Simulator/Actions/BaseComboAction.cs | 5 +++-- Simulator/Simulator.cs | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Simulator/Actions/AdvancedTouchCombo.cs b/Simulator/Actions/AdvancedTouchCombo.cs index aa80a4b..bcd35cd 100644 --- a/Simulator/Actions/AdvancedTouchCombo.cs +++ b/Simulator/Actions/AdvancedTouchCombo.cs @@ -4,5 +4,6 @@ internal sealed class AdvancedTouchCombo() : BaseComboAction + BaseCouldUse(s) && VerifyDurability3(s, StandardTouchCombo.ActionA.DurabilityCost, StandardTouchCombo.ActionB.DurabilityCost); } diff --git a/Simulator/Actions/BaseComboAction.cs b/Simulator/Actions/BaseComboAction.cs index b7e53eb..4c32e0c 100644 --- a/Simulator/Actions/BaseComboAction.cs +++ b/Simulator/Actions/BaseComboAction.cs @@ -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; } @@ -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; diff --git a/Simulator/Simulator.cs b/Simulator/Simulator.cs index 01f10a5..67a7700 100644 --- a/Simulator/Simulator.cs +++ b/Simulator/Simulator.cs @@ -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; }