Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
self.player[player_int].character = enums.Character(temp)
except ValueError:
self.player[player_int].character = enums.Character.UNKNOWN_CHARACTER
return False
if label == "cursor_x":
self.player[player_int].cursor_x = unpack('> 8
self.player[player_int].action_counter = temp
return False
if label == "action_frame":
temp = unpack('
def multishine(ai_state, controller):
#If standing, shine
if ai_state.action == enums.Action.STANDING:
controller.press_button(enums.Button.BUTTON_B)
controller.tilt_analog(enums.Button.BUTTON_MAIN, .5, 0)
return
#Shine on frame 3 of knee bend, else nothing
if ai_state.action == enums.Action.KNEE_BEND:
if ai_state.action_frame == 3:
controller.press_button(enums.Button.BUTTON_B)
controller.tilt_analog(enums.Button.BUTTON_MAIN, .5, 0)
return
else:
controller.empty_input()
return
isInShineStart = (ai_state.action == enums.Action.DOWN_B_STUN or
ai_state.action == enums.Action.DOWN_B_GROUND_START)
def __init__(self):
#read the character data
self.data = dict()
path = os.path.dirname(os.path.realpath(__file__))
with open(path + "/characterdata.csv") as csvfile:
reader = csv.DictReader(csvfile)
for line in reader:
del line["Character"]
#Convert all fields to numbers
for key, value in line.items():
line[key] = float(value)
self.data[enums.Character(line["CharacterIndex"])] = line
self.player[player_int].stock = self.player[player_int].stock >> 24
return False
if label == "facing":
self.player[player_int].facing = unpack('> 31)
return False
if label == "x":
self.player[player_int].next_x = unpack('> 24
try:
self.player[player_int].character = enums.Character(temp)
except ValueError:
self.player[player_int].character = enums.Character.UNKNOWN_CHARACTER
return False
if label == "cursor_x":
self.player[player_int].cursor_x = unpack('
#release start in addition to anything else
controller.release_button(enums.Button.BUTTON_START)
#If we're in the right area, select the character
if isOverCharacter:
#If we're over the character, but it isn't selected,
# then the coin must be somewhere else.
# Press B to reclaim the coin
controller.tilt_analog(enums.Button.BUTTON_MAIN, .5, .5)
if (ai_state.character != character) and (ai_state.coin_down):
controller.press_button(enums.Button.BUTTON_B)
return
#Press A to select our character
else:
if controller.prev.button[enums.Button.BUTTON_A] == False:
controller.press_button(enums.Button.BUTTON_A)
return
else:
controller.release_button(enums.Button.BUTTON_A)
return
else:
#Move in
controller.release_button(enums.Button.BUTTON_A)
#Move up if we're too low
if ai_state.cursor_y < target_y - wiggleroom:
controller.tilt_analog(enums.Button.BUTTON_MAIN, .5, 1)
return
#Move down if we're too high
if ai_state.cursor_y > target_y + wiggleroom:
controller.tilt_analog(enums.Button.BUTTON_MAIN, .5, 0)
return
#Move right if we're too left