More minor optimizations

This commit is contained in:
Asriel Camora
2023-06-21 06:16:57 -07:00
parent fc0ffc11f3
commit 0b2b80d6b5
10 changed files with 76 additions and 64 deletions
+5 -5
View File
@@ -2,12 +2,12 @@ using Craftimizer.Simulator.Actions;
namespace Craftimizer.Simulator;
public record struct ActionStates
public struct ActionStates
{
public byte TouchComboIdx { get; set; }
public byte CarefulObservationCount { get; set; }
public bool UsedHeartAndSoul { get; set; }
public bool Observed { get; set; }
public byte TouchComboIdx;
public byte CarefulObservationCount;
public bool UsedHeartAndSoul;
public bool Observed;
public void MutateState(ActionType action)
{
+14 -14
View File
@@ -1,17 +1,17 @@
namespace Craftimizer.Simulator;
public record struct Effects
public struct Effects
{
public byte InnerQuiet { get; set; }
public byte WasteNot { get; set; }
public byte Veneration { get; set; }
public byte GreatStrides { get; set; }
public byte Innovation { get; set; }
public byte FinalAppraisal { get; set; }
public byte WasteNot2 { get; set; }
public byte MuscleMemory { get; set; }
public byte Manipulation { get; set; }
public bool HeartAndSoul { get; set; }
public byte InnerQuiet;
public byte WasteNot;
public byte Veneration;
public byte GreatStrides;
public byte Innovation;
public byte FinalAppraisal;
public byte WasteNot2;
public byte MuscleMemory;
public byte Manipulation;
public bool HeartAndSoul;
public void SetDuration(EffectType effect, byte duration)
{
@@ -57,7 +57,7 @@ public record struct Effects
InnerQuiet++;
}
public byte GetDuration(EffectType effect) =>
public readonly byte GetDuration(EffectType effect) =>
effect switch
{
EffectType.InnerQuiet => (byte)(InnerQuiet != 0 ? 1 : 0),
@@ -73,11 +73,11 @@ public record struct Effects
_ => 0
};
public byte GetStrength(EffectType effect) =>
public readonly byte GetStrength(EffectType effect) =>
effect == EffectType.InnerQuiet ? InnerQuiet :
(byte)(GetDuration(effect) != 0 ? 1 : 0);
public bool HasEffect(EffectType effect) =>
public readonly bool HasEffect(EffectType effect) =>
GetDuration(effect) != 0;
public void DecrementDuration()
+1 -1
View File
@@ -1,6 +1,6 @@
namespace Craftimizer.Simulator;
public record SimulationInput
public sealed class SimulationInput
{
public CharacterStats Stats { get; }
public RecipeInfo Recipe { get; }
+1 -3
View File
@@ -1,8 +1,6 @@
using Craftimizer.Simulator.Actions;
namespace Craftimizer.Simulator;
public readonly record struct SimulationState
public readonly struct SimulationState
{
public SimulationInput Input { get; init; }