Update samples with new entities system
This commit is contained in:
parent
92d27edc3d
commit
134393ec60
|
@ -1,19 +1,19 @@
|
|||
from asci import *
|
||||
from asci_v2 import *
|
||||
|
||||
monde = (r"""
|
||||
_ ###
|
||||
/o\__ #####
|
||||
|_ <>\ ###
|
||||
|^|__| /_\
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|==|==|==|==|==|==|==|""",
|
||||
# Entités
|
||||
{
|
||||
"sdf": ["*", 2, 5]
|
||||
},
|
||||
[
|
||||
("sdf", "*", 2, 5, "stand by")
|
||||
],
|
||||
# Portes
|
||||
(1, 3, 1, 5, 7))
|
||||
|
||||
|
@ -27,47 +27,35 @@ maison = (r"""
|
|||
+--/ \--------/ \--+
|
||||
| |
|
||||
+---|^|--------------+""",
|
||||
{},
|
||||
[],
|
||||
(5, 7, 0, 1, 3))
|
||||
|
||||
carte_monde = (monde, maison)
|
||||
|
||||
|
||||
|
||||
def pnj(data, stat, identifiant):
|
||||
if identifiant == "sdf": 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: [6, "Radin !"],
|
||||
2: [1, "Merci !", 0, (1, -1)], # 0 réponse possibles, -1 Argent
|
||||
def pnj(data, stat, entites, identifiant):
|
||||
xp = data[0]["main"]
|
||||
|
||||
3: [0, "Hmm ?\n1. Arretez de me suivre !\n2. Non rien.", 2],
|
||||
4: [2, "Soit..."],
|
||||
5: [-2, "Bien"],
|
||||
if identifiant == "sdf":
|
||||
if xp == 2: entites["sdf"].change_behavior("follow")
|
||||
elif xp == 4: entites["sdf"].change_behavior("stand by")
|
||||
|
||||
"base": [0, "Hmm ?"]
|
||||
}
|
||||
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 ?"]
|
||||
|
||||
|
||||
def routine(data, stat):
|
||||
if data[0]["main"] == 3:
|
||||
if not "sdf" in carte_monde[data[1]][1]: carte_monde[data[1]][1]["sdf"] = ["*", data[2] + 1, data[3]]
|
||||
|
||||
if data[4] == 1: carte_monde[data[1]][1]["sdf"] = ["*", data[2] + 1, data[3]]
|
||||
elif data[4] == 2: carte_monde[data[1]][1]["sdf"] = ["*", data[2], data[3] - 1]
|
||||
elif data[4] == 3: carte_monde[data[1]][1]["sdf"] = ["*", data[2] - 1, data[3]]
|
||||
elif data[4] == 5: carte_monde[data[1]][1]["sdf"] = ["*", data[2], data[3] + 1]
|
||||
|
||||
elif data[0]["main"] == 6:
|
||||
for i in range(len(carte_monde)):
|
||||
if "sdf" in carte_monde[i][1]: carte_monde[i][1].pop("sdf")
|
||||
|
||||
carte_monde[0][1]["sdf"] = ["*", 2, 5]
|
||||
|
||||
data[0]["main"] = 0
|
||||
|
||||
|
||||
|
||||
def affichage_stat(data, stat):
|
||||
pv, argent = stat
|
||||
|
@ -83,4 +71,4 @@ touche = {6: affichage_stat}
|
|||
|
||||
def mon_jeu():
|
||||
rpg_python = Asci(carte_monde, evenements, touche)
|
||||
rpg_python.mainloop(7, stat=[100, 5], routine=routine)
|
||||
rpg_python.mainloop(7, stat=[100, 5], data=[{"main": 0}, 0, 10, 3])
|
|
@ -12,7 +12,9 @@ cartes = (
|
|||
|
||||
|
||||
|==|==|==|==|==|==|==|""",
|
||||
{1: ["*", 2, 5]},
|
||||
[
|
||||
(1, "*", 2, 5, "stand by")
|
||||
],
|
||||
(1, 3, 1, 5, 7)),
|
||||
|
||||
(r"""
|
||||
|
@ -24,13 +26,15 @@ cartes = (
|
|||
+--/ \--------/ \--+
|
||||
| |
|
||||
+---|^|--------------+""",
|
||||
{"habitant": ["?", 9, 1],
|
||||
"voleur": ["?", 20, 1]},
|
||||
[
|
||||
("habitant", "?", 9, 1, "stand by"),
|
||||
("voleur", "?", 20, 1, "stand by")
|
||||
],
|
||||
(5, 7, 0, 1, 3))
|
||||
)
|
||||
|
||||
|
||||
def pnj(data, stat, identifiant):
|
||||
def pnj(data, stat, entites, identifiant):
|
||||
carte_actuelle = data[1]
|
||||
|
||||
if carte_actuelle == 0:
|
||||
|
|
|
@ -15,11 +15,11 @@ cartes = (
|
|||
#### |<> <>| ####
|
||||
## |_________| ##
|
||||
|| ||""",
|
||||
{
|
||||
"medecin": ["*", 24, 4],
|
||||
"ami": ["*", 16, 1],
|
||||
"bandit": ["$", 4, 7]
|
||||
},
|
||||
[
|
||||
("medecin", "*", 24, 4, "stand by"),
|
||||
("ami", "*", 16, 1, "stand by"),
|
||||
("bandit", "$", 4, 7, "walk", 0, ((4, 7), (3, 7), (3, 6), (4, 6)))
|
||||
],
|
||||
(1, 3, 1, 5, 7),
|
||||
(19, 4, 2, 4, 4)),
|
||||
|
||||
|
@ -32,7 +32,7 @@ cartes = (
|
|||
+--/ \--------/ \--+
|
||||
| |
|
||||
+---|^|--------------+""",
|
||||
{0: ["*", 5, 5]},
|
||||
[(0, "*", 5, 5, "stand by")],
|
||||
(5, 7, 0, 1, 3)),
|
||||
|
||||
(r"""
|
||||
|
@ -42,12 +42,12 @@ cartes = (
|
|||
| |
|
||||
+--|^|--+
|
||||
""",
|
||||
{},
|
||||
[],
|
||||
(4, 4, 0, 19, 4))
|
||||
)
|
||||
|
||||
|
||||
def pnj(data, stat, identifiant):
|
||||
def pnj(data, stat, entites, identifiant):
|
||||
carte_actuelle = data[1]
|
||||
xp = data[0]["main"]
|
||||
|
||||
|
@ -80,7 +80,7 @@ def pnj(data, stat, identifiant):
|
|||
return [0, "Hmm ?"]
|
||||
|
||||
|
||||
def ennemi(data, stat, identifiant):
|
||||
def ennemi(data, stat, entites, identifiant):
|
||||
carte_actuelle = data[1]
|
||||
coords = data[2], data[3]
|
||||
xp = data[0]["main"]
|
||||
|
|
|
@ -12,9 +12,9 @@ cartes = (
|
|||
|
||||
|
||||
|==|==|==|==|==|==|==|""",
|
||||
{
|
||||
"pnj": ["?", 2, 5]
|
||||
},
|
||||
[
|
||||
("pnj", "?", 2, 5, "stand by")
|
||||
],
|
||||
(1, 3, 1, 5, 7)),
|
||||
|
||||
(r"""
|
||||
|
@ -26,15 +26,15 @@ cartes = (
|
|||
+--/ \--------/ \--+
|
||||
| |
|
||||
+---|^|--------------+""",
|
||||
{
|
||||
"boulanger": ["?", 9, 1],
|
||||
"kiosque": ["?", 20, 1],
|
||||
},
|
||||
[
|
||||
("boulanger", "?", 9, 1, "stand by"),
|
||||
("kiosque", "?", 20, 1, "stand by")
|
||||
],
|
||||
(5, 7, 0, 1, 3))
|
||||
)
|
||||
|
||||
|
||||
def pnj(data, stat, identifiant):
|
||||
def pnj(data, stat, entites, identifiant):
|
||||
if identifiant == "pnj":
|
||||
# Si les deux quêtes annexes sont terminées, on incrémente la quête principale
|
||||
if "pain" in data[0] and "journal" in data[0] and data[0]["pain"] == 3 and data[0]["journal"] == 3:
|
||||
|
@ -57,7 +57,6 @@ def pnj(data, stat, identifiant):
|
|||
4: [1, "Merci, pour ces commissions !"] # Si le joueur a terminé la quête
|
||||
}
|
||||
|
||||
|
||||
elif identifiant == "boulanger":
|
||||
if "pain" in data[0] and data[0]["pain"] == 1: return "pain", [1, "Tient voila pour toi ! [+PAIN]"]
|
||||
else: return [0, "Je suis boulanger mon jeune ami !"]
|
||||
|
|
Loading…
Reference in New Issue