This repository has been archived by the owner on Dec 12, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
hra.gd
101 lines (93 loc) · 2.35 KB
/
hra.gd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
extends Panel
var chosse = randi() % 2
var hraje
var faze = "I"
var karta
var scoreOn = 0
var scoreOna = 0
var vyberOn
var vyberOna
var minulafaze = "start"
var cil = global.fin
var path = alternative
var ukol
var end = "ne"
var je
func kolo(): #old_ok
get_node("hraje").set_text(hraje)
jefaze()
balicek()
tik() #old_kolo
end()
get_node("on").set_text(str(scoreOn))
get_node("ona").set_text(str(scoreOna))
func ok(): ##button #tlaÄÃtko "SplnÄ›no"
bod()
kolo()
func jefaze(): #set phase of game to "faze" #vybárá fázy
minulafaze=faze
if (scoreOn > cil/3) or (scoreOna > cil/3):
faze = "R"
if (scoreOn > (cil/3)*2) or (scoreOna > (cil/3)*2):
faze = "V"
if (scoreOn < cil/3) or (scoreOna < cil/3):
faze = "I"
print(faze)
func balicek(): #set card deck ## zjistà dostupné karty a obnovà balÃÄek pÅ™i zmÄ›nÄ› fázÃ
if not(faze==minulafaze): ##new phase = new deck
je=path.get(faze + "Ona")
vyberOna=range(1, (je.size()))
je=path.get(faze + "On")
vyberOn=range(1, (je.size()))
print("novü†¼²„ý balÃÄek oba")
elif vyberOna.size()==0: #empty deck Ona
je=path.get(faze + "Ona")
vyberOna=range(1, (je.size()))
print("nový balÃÄek ona")
elif vyberOn.size()==0: #empty deck On
je = path.get(faze + "On")
vyberOn=range(1, (je.size()))
print("nový balÃÄek On")
func tik(): #old_kolo ## roound cycle ##konec tahu
if hraje == "On":
karta = (randi() % vyberOn.size())
vyberOn.remove(karta)
ukol = path.get(faze + hraje)[karta]
hraje = "Ona"
else:
karta = (randi() % vyberOna.size())
vyberOna.remove(karta)
ukol = path.get(faze + hraje)[karta]
hraje = "On"
get_node("screen/ukol").set_text(str(ukol))
randomize() #randomseed
print("tak")
func bod(): #add score ##poÄÃtánà bodů
if hraje == "Ona":
scoreOna+=1
else:
scoreOn+=1
func end(): ##check end conditions
if scoreOn > cil or scoreOna > cil:
if end == "ne":
print("end")
get_node("popend").popup()
var odmena =path.get(hraje)
karta = (randi() % odmena.size())
get_node("popend/odmena").set_text(str(odmena[karta]))
end = "ano"
func _ready():
if global.balik == "basic":
path = basic
if global.balik == "alternative":
path = alternative
balicek()
get_node("fant").connect("pressed",self,"kolo")
get_node("ok").connect("pressed",self,"ok")
randomize()
var choose = randi() % 2
if choose == 1:
hraje = "On"
else:
hraje = "Ona"
pass