def approachBall(player): """ Once we are aligned with the ball, approach it """ # Switch to other states if we should if player.penaltyKicking and \ player.brain.ball.inOppGoalBox(): return player.goNow('penaltyBallInOppGoalbox') elif player.brain.tracker.activeLocOn: if transitions.shouldScanFindBallActiveLoc(player): return player.goLater('scanFindBall') elif transitions.shouldScanFindBall(player): return player.goLater('scanFindBall') elif player.brain.play.isRole(GOALIE) and goalTran.dangerousBall(player): return player.goNow('approachDangerousBall') elif transitions.shouldDribble(player): return player.goNow('dribble') elif transitions.shouldSpinToBallClose(player): return player.goNow('spinToBallClose') elif transitions.shouldStopBeforeKick(player): return player.goNow('stopBeforeKick') elif transitions.shouldPositionForKick(player): return player.goNow('decideKick') if player.firstFrame(): player.brain.nav.chaseBall() player.hasAlignedOnce = False player.brain.tracker.trackBall() return player.stay()
def goalieChase(player): """ TODO: make goalie more aggressive (different transitions?) """ # Check in order of importance if transitions.shouldScanFindBall(player): return player.goNow('scanFindBall') elif transitions.shouldSpinToBallClose(player): return player.goNow('spinToBallClose') elif transitions.shouldStopBeforeKick(player): return player.goNow('stopBeforeKick') elif transitions.shouldPositionForKick(player): return player.goNow('decideKick') elif transitions.shouldApproachBall(player): return player.goNow('approachBall') else: return player.goNow('scanFindBall')
def goalieChase(player): """ TODO: make goalie more aggressive (different transitions?) """ # Check in order of importance #tells the goalie what state its in if player.firstFrame(): player.isChasing = True player.isPositioning = False player.isSaving = False if transitions.shouldScanFindBall(player): return player.goNow('scanFindBall') elif transitions.shouldSpinToBallClose(player): return player.goNow('spinToBallClose') elif transitions.shouldStopBeforeKick(player): return player.goNow('stopBeforeKick') elif transitions.shouldPositionForKick(player): return player.goNow('decideKick') elif transitions.shouldApproachBall(player): return player.goNow('approachBall') else: return player.goNow('scanFindBall')