-- Punch repeat falloff, from Second Wind Boxing -- trulyagents / Redact Studios -- -- Players found they could hold jab and stunlock people: a jab took 0.28s to -- throw again and stunned for 0.25s, so the other boxer never got a turn. -- I shortened the jab stun, and on top of that the same punch thrown again -- quickly loses some damage and stun each time. Mixing punches resets it. -- This runs on the server when a punch reaches its target. --!strict local REPEAT_WINDOW = 1.2 -- seconds between throws that still count as "again" local FALLOFF = 0.15 -- lost per repeat local FLOOR = 0.4 -- never weaker than this type Fighter = { RepeatMove: string?, RepeatCount: number, RepeatAt: number, } -- returns how hard this punch lands, 1 is full strength local function freshness(attacker: Fighter, move: string, isSpecial: boolean): number -- specials are built as chains on purpose, leave them alone if isSpecial then return 1 end local now = os.clock() if attacker.RepeatMove == move and now - attacker.RepeatAt < REPEAT_WINDOW then attacker.RepeatCount += 1 else attacker.RepeatMove = move attacker.RepeatCount = 0 end attacker.RepeatAt = now return math.max(FLOOR, 1 - FALLOFF * attacker.RepeatCount) end -- in the hit code: -- local fresh = freshness(attacker, baseMoveName, move.Special == true) -- damage *= fresh -- stun(target, move.Hitstun * fresh) -- and a test I run before every push, so no basic punch can stunlock again: -- for name, move in Config.Moves do -- if not move.Special then -- assert(move.Hitstun < move.Startup + move.Recovery - 0.05, name .. " can stunlock") -- end -- end return freshness