export type ActorAnimationState = "idle" | "walk" | "run" | "attack" | "cast" | "hit" | "death";

export function isActorAnimationOneShot(state: ActorAnimationState) {
  return state === "attack" || state === "cast" || state === "hit" || state === "death";
}

export function shouldStartActorAnimation(
  activeState: ActorAnimationState | undefined,
  activeTrigger: number,
  nextState: ActorAnimationState,
  nextTrigger: number,
) {
  if (activeState !== nextState) return true;
  if (nextState === "death" || !isActorAnimationOneShot(nextState)) return false;
  return activeTrigger !== nextTrigger;
}
