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
+4 -2
View File
@@ -1,8 +1,10 @@
[gd_scene load_steps=3 format=3 uid="uid://7qcsutlss3oj"] [gd_scene format=3 uid="uid://7qcsutlss3oj"]
[ext_resource type="Script" uid="uid://8n36yadkvxai" path="res://addons/card-framework/json_card_factory.gd" id="1_jlwb4"] [ext_resource type="Script" uid="uid://8n36yadkvxai" path="res://addons/card-framework/json_card_factory.gd" id="1_jlwb4"]
[ext_resource type="PackedScene" uid="uid://brjlo8xing83p" path="res://addons/card-framework/card.tscn" id="2_1mca4"] [ext_resource type="PackedScene" uid="uid://brjlo8xing83p" path="res://addons/card-framework/card.tscn" id="2_1mca4"]
[ext_resource type="Texture2D" uid="uid://c1x31m6sr2jkr" path="res://cards/images/cardBack_blue5.png" id="3_1mca4"]
[node name="CardFactory" type="Node"] [node name="CardFactory" type="Node" unique_id=1183620316]
script = ExtResource("1_jlwb4") script = ExtResource("1_jlwb4")
default_card_scene = ExtResource("2_1mca4") default_card_scene = ExtResource("2_1mca4")
back_image = ExtResource("3_1mca4")
Binary file not shown.

After

Width:  |  Height:  |  Size: 921 B

+40
View File
@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bxkq0tqgdiy61"
path="res://.godot/imported/Back.png-08c77167688145adba4bb21ec59b3650.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://cards/images/Back.png"
dest_files=["res://.godot/imported/Back.png-08c77167688145adba4bb21ec59b3650.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
+8 -8
View File
@@ -80,10 +80,10 @@ metadata/_custom_type_script = "uid://6ams8uvg43gu"
[node name="Team1Stiche" type="Control" parent="CardManager" unique_id=740577652] [node name="Team1Stiche" type="Control" parent="CardManager" unique_id=740577652]
anchors_preset = 0 anchors_preset = 0
offset_left = 790.0 offset_left = 405.0
offset_top = 880.0 offset_top = 435.0
offset_right = 790.0 offset_right = 405.0
offset_bottom = 880.0 offset_bottom = 435.0
script = ExtResource("7_rwigh") script = ExtResource("7_rwigh")
card_face_up = false card_face_up = false
sensor_texture = SubResource("CanvasTexture_unpya") sensor_texture = SubResource("CanvasTexture_unpya")
@@ -114,10 +114,10 @@ metadata/_custom_type_script = "uid://6ams8uvg43gu"
[node name="Team2Stiche" type="Control" parent="CardManager" unique_id=561191290] [node name="Team2Stiche" type="Control" parent="CardManager" unique_id=561191290]
anchors_preset = 0 anchors_preset = 0
offset_left = 980.0 offset_left = 1365.0
offset_top = -10.0 offset_top = 435.0
offset_right = 980.0 offset_right = 1365.0
offset_bottom = -10.0 offset_bottom = 435.0
script = ExtResource("7_rwigh") script = ExtResource("7_rwigh")
card_face_up = false card_face_up = false
allow_card_movement = false allow_card_movement = false
+45 -3
View File
@@ -10,9 +10,12 @@ extends Node2D
@onready var player_3_pile = $CardManager/Player3PlayPile @onready var player_3_pile = $CardManager/Player3PlayPile
@onready var player_4_hand = $CardManager/Player4Hand @onready var player_4_hand = $CardManager/Player4Hand
@onready var player_4_pile = $CardManager/Player4PlayPile @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 trumpbuttons = $ButtonsTrumpSelect
@onready var first_player = $CardManager/Player1PlayPile @onready var first_player = $CardManager/Player1PlayPile
var trump : String var trump : String
var rounds_played: int
signal dealt signal dealt
@@ -62,6 +65,10 @@ func define_trump(suit : String):
turn(first_player) turn(first_player)
func turn(first): func turn(first):
rounds_played += 1
if rounds_played == 10:
count_points()
return
first.sensor_visibility = true first.sensor_visibility = true
first.enable_drop_zone = true first.enable_drop_zone = true
first._redraw_drop_zone() first._redraw_drop_zone()
@@ -188,7 +195,8 @@ func turn(first):
player_3_hand.allow_movement = false player_3_hand.allow_movement = false
get_turn_winner() get_turn_winner()
func count_points():
print("end of round")
func get_turn_winner(): func get_turn_winner():
@@ -213,10 +221,44 @@ func get_turn_winner():
print(cards[card]["value"]) print(cards[card]["value"])
elif trump == "Down": elif trump == "Down":
for card in cards: for card in cards:
cards[card]["value"] = cards[card]["value"]*-1 cards[card]["value"] = cards[card]["value"] * (-1)
print(cards[card]["value"]) 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): 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(): func create_standard_deck():
var suits = ["Club", "Diamond", "Heart", "Spade"] var suits = ["Club", "Diamond", "Heart", "Spade"]