local npcBatDeg = 0 local BaseNpcBatSpeed = 1500 local npcBatSpeed = 1500 -- selene: allow(unscoped_variables) npc = {} function npc.updateBatAngle(ball, catcherThrownBall, deltaSec) if not catcherThrownBall and ball.y > 200 and ball.y < 230 and (ball.x < C.Center.x + 15) then npcBatDeg = npcBatDeg + (deltaSec * npcBatSpeed) else npcBatSpeed = (1 + math.random()) * BaseNpcBatSpeed npcBatDeg = 200 end return npcBatDeg end function npc.batSpeed() return npcBatSpeed end function npc.runningSpeed(runners) if #runners == 0 then return 0 end local touchedBase = isTouchingBase(runners[1].x, runners[1].y) if not touchedBase or touchedBase == C.Bases[C.Home] then return 10 end return 0 end if not playdate then return utils end