From 65adab77405833e4b390970614491e93396fed4f Mon Sep 17 00:00:00 2001 From: Asriel Camora Date: Tue, 10 Oct 2023 00:40:33 -0700 Subject: [PATCH] Add multi-execution helper for simulator --- Simulator/Simulator.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Simulator/Simulator.cs b/Simulator/Simulator.cs index b049eb2..849c288 100644 --- a/Simulator/Simulator.cs +++ b/Simulator/Simulator.cs @@ -73,6 +73,20 @@ public class Simulator return ActionResponse.UsedAction; } + public (ActionResponse Response, SimulationState NewState, int FailedActionIdx) ExecuteMultiple(SimulationState state, IEnumerable actions) + { + State = state; + var i = 0; + foreach(var action in actions) + { + var resp = Execute(action); + if (resp != ActionResponse.UsedAction) + return (resp, State, i); + i++; + } + return (ActionResponse.UsedAction, State, -1); + } + [Pure] [MethodImpl(MethodImplOptions.AggressiveInlining)] public int GetEffectStrength(EffectType effect) =>