feat: card evaluation at end of turn, 9 turn round

This commit is contained in:
2026-04-17 18:03:27 +02:00
parent 1958e1defd
commit e78466c44a
5 changed files with 97 additions and 13 deletions
+45 -3
View File
@@ -10,9 +10,12 @@ extends Node2D
@onready var player_3_pile = $CardManager/Player3PlayPile
@onready var player_4_hand = $CardManager/Player4Hand
@onready var player_4_pile = $CardManager/Player4PlayPile
@onready var team_1_stiche = $CardManager/Team1Stiche
@onready var team_2_stiche = $CardManager/Team2Stiche
@onready var trumpbuttons = $ButtonsTrumpSelect
@onready var first_player = $CardManager/Player1PlayPile
var trump : String
var rounds_played: int
signal dealt
@@ -62,6 +65,10 @@ func define_trump(suit : String):
turn(first_player)
func turn(first):
rounds_played += 1
if rounds_played == 10:
count_points()
return
first.sensor_visibility = true
first.enable_drop_zone = true
first._redraw_drop_zone()
@@ -188,7 +195,8 @@ func turn(first):
player_3_hand.allow_movement = false
get_turn_winner()
func count_points():
print("end of round")
func get_turn_winner():
@@ -213,10 +221,44 @@ func get_turn_winner():
print(cards[card]["value"])
elif trump == "Down":
for card in cards:
cards[card]["value"] = cards[card]["value"]*-1
cards[card]["value"] = cards[card]["value"] * (-1)
print(cards[card]["value"])
var played_suit = first_player.get_top_cards(1)[0].card_info.suit
var highest_card: int
var highest_value: int
for i in cards:
var card = cards[i]
if card["suit"] == played_suit and card["value"] > highest_value:
highest_value = card["value"]
highest_card = i
match highest_card:
1:
first_player = player_1_pile
move_to_stiche(1)
2:
first_player = player_2_pile
move_to_stiche(2)
3:
first_player = player_3_pile
move_to_stiche(1)
4:
first_player = player_4_pile
move_to_stiche(2)
func move_to_stiche(team: int):
pass
if team == 1:
team_1_stiche.move_cards(player_1_pile.get_top_cards(1))
team_1_stiche.move_cards(player_2_pile.get_top_cards(1))
team_1_stiche.move_cards(player_3_pile.get_top_cards(1))
team_1_stiche.move_cards(player_4_pile.get_top_cards(1))
else:
team_2_stiche.move_cards(player_1_pile.get_top_cards(1))
team_2_stiche.move_cards(player_2_pile.get_top_cards(1))
team_2_stiche.move_cards(player_3_pile.get_top_cards(1))
team_2_stiche.move_cards(player_4_pile.get_top_cards(1))
turn(first_player)
func create_standard_deck():
var suits = ["Club", "Diamond", "Heart", "Spade"]