-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplayer.py
92 lines (84 loc) · 3.21 KB
/
player.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
import json
class Player:
def __init__(self):
self.name = 'Inconnu'
self.title = 'Postulant'
self.level = 0
self.state = 'En super forme'
self.combat_skill = 0
self.combat_skill_bonus = 0
self.combat_skill_malus = 0
self.endurance = 0
self.endurance_max = 0
self.kai_discipline = []
self.weapon_skill = ''
self.weapon1 = 'Hache'
self.weapon2 = 'Poignard'
self.belt_pouch = {"pièces d'or": 0, 'pierres précieuses': 0}
self.backpack = []
self.meals = 0
self.special_items = []
self.current_chapter = 1
self.chapter_path = []
def weapon_skill_text(self):
text = ''
if self.weapon_skill == 'Hache':
text = 'Maîtrise de la hache'
elif self.weapon_skill == 'Poignard':
text = 'Maîtrise du poignard'
elif self.weapon_skill == 'Lance':
text = 'Maîtrise de la lance'
elif self.weapon_skill == "Masse d'armes":
text = "Maîtrise de la masse d'armes"
elif self.weapon_skill == 'Sabre':
text = 'Maîtrise du sabre'
elif self.weapon_skill == 'Marteau':
text = 'Maîtrise du marteau de guerre'
elif self.weapon_skill == 'Epée':
text = "Maîtrise de l'épée"
elif self.weapon_skill == 'Bâton':
text = 'Maîtrise du bâton'
elif self.weapon_skill == 'Glaive':
text = 'Maîtrise du glaive'
else:
text = ''
return text
def print(self):
print('DESCRIPTION DU PROFIL JOUEUR')
print(f'Nom : {self.name}')
print(f'Rang: {self.title} de niveau {self.level}')
print(f'Etat: {self.state}')
print(f'Habilité: {self.combat_skill}')
print(f'Bonus habilité: {self.combat_skill_bonus}')
print(f'Malus habilité: {self.combat_skill_malus}')
print(f'Endurance maxi: {self.endurance_max}')
print(f'Endurance courante: {self.endurance}')
print('')
print(f'Dsisciplines:')
for kd in self.kai_discipline:
if kd == 'Maîtrise des armes':
print(f"{kd}: {self.weapon_skill}")
else:
print(kd)
print('')
print(f'Bourse: {self.belt_pouch}')
print(f'Sac à dos - objets: {self.backpack}')
print(f'Sac à dos - repas: {self.meals}')
print(f'Objets spéciaux: {self.special_items}')
def loadfile(self, filename):
# load the json file
with open(filename, encoding='utf-8') as json_file:
data = json.load(json_file)
self.name = data['name']
self.title = data['title']
self.level = data['level']
self.state = data['state']
self.combat_skill = data['combat_skill']
self.combat_skill_bonus = data['combat_skill_bonus']
self.combat_skill_malus = data['combat_skill_malus']
self.endurance_max = data['endurance_max']
self.endurance = data['endurance']
self.meals = data['meals']
self.kai_discipline = data['kai_discipline']
self.weapon_skill = data['weapon_skill']
self.current_chapter = data['current_chapter']