diff --git a/Simulator/ActionProc.cs b/Simulator/ActionProc.cs new file mode 100644 index 0000000..9fcc893 --- /dev/null +++ b/Simulator/ActionProc.cs @@ -0,0 +1,8 @@ +namespace Craftimizer.Simulator; + +public enum ActionProc : byte +{ + None, + UsedBasicTouch, + AdvancedTouch +} diff --git a/Simulator/ActionStates.cs b/Simulator/ActionStates.cs index c59f448..5d4cbe8 100644 --- a/Simulator/ActionStates.cs +++ b/Simulator/ActionStates.cs @@ -7,22 +7,21 @@ namespace Craftimizer.Simulator; [StructLayout(LayoutKind.Auto)] public record struct ActionStates { - public byte TouchComboIdx; + public ActionProc Combo; public byte CarefulObservationCount; public bool UsedHeartAndSoul; public bool UsedQuickInnovation; public bool UsedTrainedPerfection; - public bool ObserveCombo; [MethodImpl(MethodImplOptions.AggressiveInlining)] public void MutateState(BaseAction baseAction) { if (baseAction is BasicTouch) - TouchComboIdx = 1; - else if (TouchComboIdx == 1 && baseAction is StandardTouch) - TouchComboIdx = 2; + Combo = ActionProc.UsedBasicTouch; + else if ((Combo == ActionProc.UsedBasicTouch && baseAction is StandardTouch) || baseAction is Observe) + Combo = ActionProc.AdvancedTouch; else - TouchComboIdx = 0; + Combo = ActionProc.None; if (baseAction is CarefulObservation) CarefulObservationCount++; @@ -35,7 +34,5 @@ public void MutateState(BaseAction baseAction) if (baseAction is TrainedPerfection) UsedTrainedPerfection = true; - - ObserveCombo = baseAction is Observe; } } diff --git a/Simulator/Actions/AdvancedTouch.cs b/Simulator/Actions/AdvancedTouch.cs index 273ca5f..41a54b9 100644 --- a/Simulator/Actions/AdvancedTouch.cs +++ b/Simulator/Actions/AdvancedTouch.cs @@ -6,5 +6,5 @@ internal sealed class AdvancedTouch() : BaseAction( defaultCPCost: 46, defaultEfficiency: 150) { public override int CPCost(Simulator s) => - (s.ActionStates.TouchComboIdx == 2 || s.ActionStates.ObserveCombo) ? 18 : 46; + (s.ActionStates.Combo == ActionProc.AdvancedTouch) ? 18 : 46; } diff --git a/Simulator/Actions/RefinedTouch.cs b/Simulator/Actions/RefinedTouch.cs index f68c5ac..ced1f25 100644 --- a/Simulator/Actions/RefinedTouch.cs +++ b/Simulator/Actions/RefinedTouch.cs @@ -10,7 +10,7 @@ internal sealed class RefinedTouch() : BaseAction( public override void UseSuccess(Simulator s) { base.UseSuccess(s); - if (s.ActionStates.TouchComboIdx == 1) + if (s.ActionStates.Combo == ActionProc.UsedBasicTouch) s.StrengthenEffect(EffectType.InnerQuiet); } } diff --git a/Simulator/Actions/StandardTouch.cs b/Simulator/Actions/StandardTouch.cs index ca62358..b48dddd 100644 --- a/Simulator/Actions/StandardTouch.cs +++ b/Simulator/Actions/StandardTouch.cs @@ -8,5 +8,5 @@ internal sealed class StandardTouch() : BaseAction( ) { public override int CPCost(Simulator s) => - s.ActionStates.TouchComboIdx == 1 ? 18 : 32; + s.ActionStates.Combo == ActionProc.UsedBasicTouch ? 18 : 32; } diff --git a/Solver/Simulator.cs b/Solver/Simulator.cs index 7e63d3d..d32407e 100644 --- a/Solver/Simulator.cs +++ b/Solver/Simulator.cs @@ -84,12 +84,12 @@ private bool ShouldUseAction(ActionType action, BaseAction baseAction) return false; // don't allow combo actions if the combo is already in progress - if (ActionStates.TouchComboIdx != 0 && + if (ActionStates.Combo != ActionProc.None && (action is ActionType.StandardTouchCombo or ActionType.AdvancedTouchCombo or ActionType.RefinedTouchCombo)) return false; - // only allow Advanced Touch when Observing - if (ActionStates.ObserveCombo && action is not ActionType.AdvancedTouch) + // when combo'd, only allow Advanced Touch + if (ActionStates.Combo == ActionProc.AdvancedTouch && action is not ActionType.AdvancedTouch) return false; // don't allow pure quality moves under Veneration @@ -140,7 +140,7 @@ private bool ShouldUseAction(ActionType action, BaseAction baseAction) // don't allow Refined Touch without a combo if (action is ActionType.RefinedTouch && - ActionStates.TouchComboIdx != 1) + ActionStates.Combo != ActionProc.UsedBasicTouch) return false; // don't allow Immaculate Mends that are too inefficient