From ed22000186cbd2a87f0cfc87def5c2b91b8d5f6d Mon Sep 17 00:00:00 2001 From: Aspergerli Date: Thu, 7 May 2026 11:32:14 +0200 Subject: [PATCH] fix: made Ungenufe winner evaluation work chore: added short before cards get taken in --- scenes/schematic.tscn | 4 ++- scripts/point_saver.gd | 5 +++ scripts/point_saver.gd.uid | 1 + scripts/schematic_setup.gd | 65 ++++++++++++++++++++++++++++++++++---- 4 files changed, 67 insertions(+), 8 deletions(-) create mode 100644 scripts/point_saver.gd create mode 100644 scripts/point_saver.gd.uid diff --git a/scenes/schematic.tscn b/scenes/schematic.tscn index 9002358..cced51b 100644 --- a/scenes/schematic.tscn +++ b/scenes/schematic.tscn @@ -86,6 +86,8 @@ offset_right = 405.0 offset_bottom = 435.0 script = ExtResource("7_rwigh") card_face_up = false +allow_card_movement = false +enable_drop_zone = false sensor_texture = SubResource("CanvasTexture_unpya") metadata/_custom_type_script = "uid://6ams8uvg43gu" @@ -120,7 +122,7 @@ offset_right = 1365.0 offset_bottom = 435.0 script = ExtResource("7_rwigh") card_face_up = false -allow_card_movement = false +enable_drop_zone = false metadata/_custom_type_script = "uid://6ams8uvg43gu" [node name="Player3Hand" type="Control" parent="CardManager" unique_id=1841661362] diff --git a/scripts/point_saver.gd b/scripts/point_saver.gd new file mode 100644 index 0000000..b058642 --- /dev/null +++ b/scripts/point_saver.gd @@ -0,0 +1,5 @@ +extends Resource +class_name Points + +var team_1_points +var team_2_points diff --git a/scripts/point_saver.gd.uid b/scripts/point_saver.gd.uid new file mode 100644 index 0000000..56a6660 --- /dev/null +++ b/scripts/point_saver.gd.uid @@ -0,0 +1 @@ +uid://dwabqnrusgyob diff --git a/scripts/schematic_setup.gd b/scripts/schematic_setup.gd index ea35302..7d78415 100644 --- a/scripts/schematic_setup.gd +++ b/scripts/schematic_setup.gd @@ -16,8 +16,12 @@ extends Node2D @onready var first_player = $CardManager/Player1PlayPile var trump : String var rounds_played : int -signal dealt +var team_1_points :int = 0 +var team_2_points :int = 0 +const DEAL_PAUSE = 0.5 + +signal dealt func _ready(): trumpbuttons.trump.connect(define_trump.bind()) player_1_pile.enable_drop_zone = false @@ -40,7 +44,7 @@ func setup_game(): player_4_hand.allow_movement = true # Deal initial hand - const DEAL_PAUSE = 0.5 + var deal_r: int =1 while true: deal_cards_to_hand(3, player_1_hand) @@ -98,10 +102,57 @@ func turn(player): func count_points(): for i in team_1_stiche._held_cards: + match i[0].card_info["value"]: + 6: + if trump == "Down": + team_1_points += 11 + 8: + if trump == "Top" or trump == "Down": + team_1_points += 8 + 9: + if i.card_info.suit == trump: + team_1_points += 14 + 10: + team_1_points += 10 + 11: + if i.card_info.suit == trump: + team_1_points += 20 + else: + team_1_points += 2 + 12: + team_1_points += 3 + 13: + team_1_points += 4 + 14: + if trump != "Down": + team_1_points += 11 + print(team_1_points) + for i in team_2_stiche._held_cards: match i.card_info["value"]: - pass - print("end of round") - + 6: + if trump == "Down": + team_2_points += 11 + 8: + if trump == "Top" or trump == "Down": + team_2_points += 8 + 9: + if i.card_info.suit == trump: + team_2_points += 14 + 10: + team_2_points += 10 + 11: + if i.card_info.suit == trump: + team_2_points += 20 + else: + team_2_points += 2 + 12: + team_2_points += 3 + 13: + team_2_points += 4 + 14: + if trump != "Down": + team_2_points += 11 + print(team_2_points) func get_turn_winner(): var cards = { @@ -130,13 +181,13 @@ func get_turn_winner(): var played_suit = first_player.get_top_cards(1)[0].card_info.suit var highest_card: int - var highest_value: int + var highest_value: int = -15 for i in cards: var card = cards[i] if card["suit"] == played_suit and card["value"] > highest_value or card["suit"] == trump and card["value"] > highest_value: highest_value = card["value"] highest_card = i - + await get_tree().create_timer(DEAL_PAUSE).timeout match highest_card: 1: first_player = player_1_pile