@caiomeirelles/

# Calculadora de stats em Zandor

## No description

Files
• main.py
main.py
```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
102
103
104
105
106
107
108
109
110
111
112
113
```
```import math

##################################
#DECLARAÇÃO VARIÁVEIS
##################################

total_points = 36									#CONSTANTE

stat_names = {	0:"str",							#CONSTANTE
1:"dex",							#
2:"con",							#
3:"int",							#
4:"wis",							#
5:"cha" }							#fim stat_names

point_cost =   {8:0,								#CONSTANTE
9:1,								#
10:2,								#
11:3,								#
12:4,								#
13:5,								#
14:7,								#
15:9,								#
16:12,								#
17:15,								#
18:19}								#fim point_cost

current_points = 36
stats = [8,8,8,8,8,8]

##################################
# TIPOS DE ERRO
##################################

def erro():
print("Valor inválido")

def erroPoucosPontos():
print("Pontos insuficientes")

##################################
# MOSTRA STATS E CURRENT POINTS NA TELA
##################################

def printStats():
print ("\nSTATS:")
for i in stat_names:
print (stat_names[i]," ",stats[i]," ",math.floor((stats[i]-10)/2))
print("Pontos disponíveis: ",current_points)

##################################
# ATUALIZA STATS E CURRENT POINTS
##################################

def update_value(stat,target):
global current_points
aux_pontos = current_points + point_cost[stats[stat]]
if aux_pontos < point_cost[target]:
erroPoucosPontos()
return
aux_pontos = aux_pontos - point_cost[target]
stats[stat] = target
current_points = aux_pontos
printStats()

##################################
# INÍCIO
##################################

print("Bem vindo à calculadora de pontos!")

printStats()

##################################
# MAIN LOOP
##################################

while 1:
print("\nPara ajustar")
for i in stat_names:
print(stat_names[i],", digite ",i+1)

while 1:
try:
stat_to_change = int(input("\nQual o stat a alterar? "))
if stat_to_change > 0 and stat_to_change < 7:
break
else:
erro()

except ValueError:
erro()

while 1:
try:
value_update = int(input("\nDigite o valor desejado: "))
if value_update	> 7 and value_update < 19:
update_value(stat_to_change-1,value_update)
break
else:
erro()
except ValueError:
erro()

if current_points == 0:
aux = input("Para continuar, aperte enter, ou digite 0 para sair: ")
if aux == "0":
break

```