Asci/samples/sample_1.py

60 lines
1.3 KiB
Python
Raw Permalink Normal View History

2022-01-28 23:12:59 +01:00
from asci import *
2021-08-14 17:13:34 +02:00
2022-01-28 23:12:59 +01:00
maison = (r"""
2021-08-14 17:13:34 +02:00
_ ###
/o\__ #####
2022-01-28 23:12:59 +01:00
| <>\ ###
|____| /_\
2021-08-14 17:13:34 +02:00
|==|==|==|==|==|==|==|""",
# Entités
[
("sdf", "*", 2, 5, "stand by")
2022-01-28 23:12:59 +01:00
])
2021-08-14 17:13:34 +02:00
2022-01-28 23:12:59 +01:00
carte_monde = (maison,)
2021-08-14 17:13:34 +02:00
def pnj(data, stat, entites, identifiant):
xp = data[0]["main"]
2021-08-14 17:13:34 +02:00
if identifiant == "sdf":
if xp == 2: entites["sdf"].change_behavior("follow")
elif xp == 4: entites["sdf"].change_behavior("stand by")
2021-08-14 17:13:34 +02:00
return {
0: [0, "Mon bon monsieur, vous n'auriez pas quelques sous pour moi ?\n1. He non mon brave...\n2. Mais si, bien sur, tenez.", 2],
1: [5, "Radin !"],
2: [1, "Merci !", 0, (1, -1)], # 0 réponse possibles, -1 Argent
3: [0, "Hmm ?\n1. Arretez de me suivre !\n2. Non rien.", 2],
4: [2, "Soit..."],
5: [-2, "Bien"],
"base": [0, "Hmm ?"]
}
return [0, "Hmm ?"]
2021-10-31 21:28:48 +01:00
def affichage_stat(data, stat):
pv, argent = stat
2021-08-14 17:13:34 +02:00
print("Statistiques")
print("PV : {}".format(pv))
print("Argent : {}".format(argent))
2021-08-25 22:56:21 +02:00
input()
2021-08-14 17:13:34 +02:00
2021-08-25 22:56:21 +02:00
evenements = {"*": pnj}
touche = {6: affichage_stat}
2021-08-15 17:27:58 +02:00
2021-08-14 17:13:34 +02:00
def mon_jeu():
2021-08-25 22:56:21 +02:00
rpg_python = Asci(carte_monde, evenements, touche)
2022-01-28 23:12:59 +01:00
rpg_python.mainloop(7, stat=[100, 5], data=[{"main": 0}, 0, 10, 3])