This repository was archived by the owner on Jun 9, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSandBox10.py
More file actions
36 lines (32 loc) · 1.55 KB
/
SandBox10.py
File metadata and controls
36 lines (32 loc) · 1.55 KB
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
import random
create_perso = input("Voulez-vous créer un personnage ? (O/N) ")
if create_perso == "O":
perso = {}
perso['nom'] = input("Nom du personnage : ")
perso['sexe'] = input("Sexe du personnage : ")
perso['race'] = input("Race du personnage : ")
perso['classe'] = input("Classe du personnage : ")
perso['niveau'] = int(input("Niveau du personnage : "))
perso['pv'] = int(input("Points de vie du personnage : "))
perso['dv'] = int(input("Dégâts de l'arme du personnage : "))
perso_to_fight = {}
perso_to_fight['nom'] = input("Nom du personnage à combattre : ")
perso_to_fight['sexe'] = input("Sexe du personnage à combattre : ")
perso_to_fight['race'] = input("Race du personnage à combattre : ")
perso_to_fight['classe'] = input("Classe du personnage à combattre : ")
perso_to_fight['niveau'] = random.randint(1, 10)
perso_to_fight['pv'] = random.randint(1, 100)
perso_to_fight['dv'] = random.randint(1, 10)
while perso['pv'] > 0 and perso_to_fight['pv'] > 0:
perso_to_fight['pv'] -= perso['dv']
print(perso_to_fight['nom'], "a subi", perso['dv'], "points de dégâts. Il lui reste", perso_to_fight['pv'],
"points de vie.")
perso['pv'] -= perso_to_fight['dv']
print(perso['nom'], "a subi", perso_to_fight['dv'], "points de dégâts. Il lui reste", perso['pv'],
"points de vie.")
if perso['pv'] > 0:
print(perso['nom'], "a gagné !")
else:
print(perso_to_fight['nom'], "a gagné !")
else:
print("Ok, au revoir")