35 lines
1.0 KiB
C#
35 lines
1.0 KiB
C#
using Craftimizer.Simulator.Actions;
|
|
using System.Runtime.InteropServices;
|
|
|
|
namespace Craftimizer.Simulator;
|
|
|
|
[StructLayout(LayoutKind.Auto)]
|
|
public struct ActionStates
|
|
{
|
|
public byte TouchComboIdx;
|
|
public byte CarefulObservationCount;
|
|
public bool UsedHeartAndSoul;
|
|
public bool Observed;
|
|
|
|
public void MutateState(ActionType action)
|
|
{
|
|
if (action == ActionType.BasicTouch)
|
|
TouchComboIdx = 1;
|
|
else if (TouchComboIdx == 1 && action == ActionType.StandardTouch)
|
|
TouchComboIdx = 2;
|
|
else
|
|
TouchComboIdx = 0;
|
|
|
|
if (action == ActionType.CarefulObservation)
|
|
CarefulObservationCount++;
|
|
|
|
if (action == ActionType.HeartAndSoul)
|
|
UsedHeartAndSoul = true;
|
|
|
|
Observed = action == ActionType.Observe;
|
|
}
|
|
|
|
public override readonly string ToString() =>
|
|
$"ActionStates {{ TouchComboIdx = {TouchComboIdx}, CarefulObservationCount = {CarefulObservationCount}, UsedHeartAndSoul = {UsedHeartAndSoul}, Observed = {Observed} }}";
|
|
}
|