card picker is always picking void card

This commit is contained in:
betalars 2023-07-19 22:44:07 +02:00
parent e3e98a05f2
commit 111b39c5c3
1 changed files with 14 additions and 7 deletions

View File

@ -125,13 +125,19 @@ func pick(id: int):
options.remove_at(id)
anim_players.remove_at(id)
randomize()
var winning_id = randi() % options.size()
print("Winning ID ", id)
if winning_id == sibling_id:
winning_id = (winning_id + 1) % options.size()
var winning_id
if options[1].text == "" and not id == 1:
randomize()
winning_id = randi() % options.size()
print("Winning ID ", id)
if winning_id == sibling_id:
winning_id = (winning_id + 1) % options.size()
elif options[0].text == "":
winning_id = 0
else:
winning_id = 1
output.append(options.pop_at(winning_id))
anim_players.pop_at(winning_id).play("shuffle")
@ -176,6 +182,7 @@ func handle_mouse_button(new_selection: Node, button_event: InputEventMouseButto
func scene_finished(id: int, repeat):
print(name, id, repeat)
if not repeat:
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
fill_card_slots(id)
State.transition_stage_to(self)
selection_state = CARDS