--!strict local Capture = {} export type Status = "Idle" | "Capturing" | "Contested" | "Decaying" | "Captured" function Capture.advance(progress: number, dt: number, attack: boolean, defense: boolean, seconds: number, decay: number): (number, Status) local grows = attack and not defense local nextProgress = math.clamp(progress + dt * (if grows then 1 else -decay) / seconds, 0, 1) if nextProgress >= 1 - 1e-9 then return 1, "Captured" end if defense then return nextProgress, "Contested" end if grows then return nextProgress, "Capturing" end return nextProgress, if progress > 0 then "Decaying" else "Idle" end return Capture