Add multi-execution helper for simulator

This commit is contained in:
Asriel Camora
2023-10-10 00:40:33 -07:00
parent 7327a1a844
commit 65adab7740
+14
View File
@@ -73,6 +73,20 @@ public class Simulator
return ActionResponse.UsedAction; return ActionResponse.UsedAction;
} }
public (ActionResponse Response, SimulationState NewState, int FailedActionIdx) ExecuteMultiple(SimulationState state, IEnumerable<ActionType> 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] [Pure]
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public int GetEffectStrength(EffectType effect) => public int GetEffectStrength(EffectType effect) =>