fix: made Ungenufe winner evaluation work

chore: added short before cards get taken in
This commit is contained in:
Aspergerli
2026-05-07 11:32:14 +02:00
parent e3e60845d6
commit ed22000186
4 changed files with 67 additions and 8 deletions
+3 -1
View File
@@ -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]
+5
View File
@@ -0,0 +1,5 @@
extends Resource
class_name Points
var team_1_points
var team_2_points
+1
View File
@@ -0,0 +1 @@
uid://dwabqnrusgyob
+58 -7
View File
@@ -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