Asci/samples/sample_1.py

84 lines
1.7 KiB
Python
Raw Normal View History

2022-01-28 23:12:59 +01:00
from asci import *
2021-08-14 17:13:34 +02:00
2022-02-27 09:38:05 +01:00
exterieur = (r"""
2021-08-14 17:13:34 +02:00
_ ###
/o\__ #####
|_ <>\ ###
|^|__| /_\
2021-08-14 17:13:34 +02:00
|==|==|==|==|==|==|==|""",
# Entités
[
("sdf", "*", 2, 5, "stand by")
2022-02-27 09:38:05 +01:00
],
2021-08-14 17:13:34 +02:00
2022-02-27 09:38:05 +01:00
# Points de passage
(1, 3, 1, 3, 5))
2021-08-14 17:13:34 +02:00
2022-02-27 09:38:05 +01:00
interieur = (r"""
+----------+
| |
| |
| |
| |
+-|^|------+
""",
# Entités
[],
# Points de passage
(3, 5, 0, 1, 3))
carte_monde = (exterieur, interieur)
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":
2022-02-27 09:38:05 +01:00
if xp in (2, 7): entites["sdf"].change_behavior("follow")
elif xp == 4: entites["sdf"].change_behavior("stand by")
2022-02-27 09:38:05 +01:00
elif xp == 6:
entites["sdf"].change_behavior("stand by")
entites["sdf"].teleport(1, 2, 2)
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
2022-02-27 09:38:05 +01:00
3: [0, "Hmm ?\n1.Arretez de me suivre !\n2.Non rien.\n3.Attendez-moi a l'intérieur, j'en ai pour une minute.", 3],
4: [2, "Soit..."],
2022-02-27 09:38:05 +01:00
5: [-2, "Bien."],
6: [1, "Soit."],
7: [-4, "Je vous suis !"],
"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-02-27 09:38:05 +01:00
rpg_python.mainloop(10, stat=[100, 5], data=[{"main": 0}, 0, 10, 3])