Permalink
Browse files

After orbiting, decides if we should change which foot we kick with.

  • Loading branch information...
1 parent f67d8a7 commit 1b90a5aa7c7257e19bf3ddd3369536e3a19c55f8 @jzalinger jzalinger committed Jun 14, 2012
Showing with 34 additions and 0 deletions.
  1. +33 −0 src/man/noggin/kickDecider/HackKickInformation.py
  2. +1 −0 src/man/noggin/players/ChaseBallStates.py
@@ -370,6 +370,39 @@ def kickWithLeftFoot(self):
else:
return False
+ def checkKickingFoot(self, kick):
+ """
+ Takes a kick and decides which foot to use.
+ """
+ if kick == kicks.RIGHT_SIDE_KICK or \
+ kick == kicks.LEFT_SIDE_KICK:
+ # Side kicks can't change which foot they use.
+ return kick
+ elif kick == kicks.LEFT_SHORT_STRAIGHT_KICK or \
+ kick == kicks.RIGHT_SHORT_STRAIGHT_KICK:
+ if kickWithLeftFoot():
+ kick = kicks.LEFT_SHORT_STRAIGHT_KICK
+ else:
+ kick = kicks.RIGHT_SHORT_STRAIGHT_KICK
+ return kick
+ elif kick == kicks.LEFT_STRAIGHT_KICK or \
+ kick == kicks.RIGHT_STRAIGHT_KICK:
+ if kickWithLeftFoot():
+ kick = kicks.LEFT_STRAIGHT_KICK
+ else:
+ kick = kicks.RIGHT_STRAIGHT_KICK
+ return kick
+ elif kick == kicks.LEFT_SHORT_BACK_KICK or \
+ kick == kicks.RIGHT_SHORT_BACK_KICK:
+ if kickWithLeftFoot():
+ kick = kicks.LEFT_SHORT_BACK_KICK
+ else:
+ kick = kicks.RIGHT_SHORT_BACK_KICK
+ return kick
+ else:
+ # If the case was missed, just return the original kick.
+ return kick
+
def __str__(self):
s = ""
if self.farLeftPostBearing is not None:
@@ -174,6 +174,7 @@ def orbitBall(player):
if player.kick == kicks.ORBIT_KICK_POSITION:
return player.goLater('prepareForKick')
else:
+ player.kick = prepareForKick.hackKick.checkKickingFoot(player.kick)
return player.goLater('positionForKick')
return player.stay()

0 comments on commit 1b90a5a

Please sign in to comment.