melee stroke

A sword stroke you can cut short or chain. A swing that must play to its last frame before the next one makes you wait through a follow-through that does nothing. So a press during a stroke is read by where the stroke is (progress, 0 to 1), with three tunable marks:

Holding the trigger chains too: a held stroke starts the next at chainFrom. The blow lands once per stroke, when it passes hitAt (default 0.4); a stroke cancelled before then never lands.

strokeStep(state, input, rules) is the whole clock, pure: the biped feeds it the trigger and the frame's step, and plays a new stroke when it says start, deals the blow when it says hit. meleeTargets picks what a blow reaches: within reach metres and arc degrees of the way the swinger faces, nearest first.