start the project redesign

This commit is contained in:
Shadow15510 2021-08-11 21:06:36 +02:00
parent 31b03655f9
commit 61b433eccb
11 changed files with 923 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
Asci/__pycache__/

101
Asci/Asci.py Executable file
View File

@ -0,0 +1,101 @@
from random import randint
from mapset import *
class Screen:
def __init__(self):
self._data = [[" " for _ in range(21)] for _ in range(6)]
def set_cell(self, x, y, value):
self._data[y][x] = value
def get_cell(self, x, y):
return self._data[y][x]
def load(self, value):
for y, line in enumerate(value.splitlines()[1:]):
for x, char in enumerate(line):
self._data[y][x] = char
def display(self):
string = ""
for line in self._data:
print("".join(line))
return input("> ")
class Asci:
def __init__(self, stat=[0, 100, 1, True], opus_nb=1):
# Load stats
self.xp = stat[0]
self.pv = stat[1]
self.current_map = stat[2]
self.outdoor = stat[3]
# Initialize player's position
self.x = 10
self.y = 5
# Misc initialisation
self.screen = Screen()
self.end = 100
def new_map(self):
self.x = 10
self.y = 5
self.current_map = randint(1, 7)
def mainloop(self):
key = key_buffer = 0
while key != 9 and self.pv > 0 and self.xp < self.end:
self.screen.load(get_map(self.current_map, self.outdoor))
self.screen.set_cell(self.x, self.y, "@")
key = convert(self.screen.display())
self.screen.set_cell(self.x, self.y, " ")
if not key: key = key_buffer
self.keyboard_input(key)
def keyboard_input(self, key):
# Left
if key == 1:
if self.x - 1 < 0: self.new_map()
else: self.x -= 1
# Right
if key == 3:
if self.x + 1 > 21: self.new_map()
else: self.x += 1
# Up
if key == 5:
if self.y - 1 < 0: self.new_map()
else: self.y -= 1
# Down
if key == 2:
if self.y + 1 > 6: self.new_map()
else: self.y += 1
# Stat
if key == 8:
pass
# Action
if key == 7:
pass
# Quit
if key == 9:
pass
def convert(n):
try: return int(n)
except: return 0
if __name__ == "__main__":
game = Asci()
game.mainloop()

132
Asci/mapset.py Executable file
View File

@ -0,0 +1,132 @@
def get_map(n, outdoor):
if outdoor:
if n == 1:
return r"""
### $ __ __
##### /<>\___/<>\
### | | | |
/_\ | | _ | |
|___|^|___|
|==|==|
"""
elif n == 2:
return r"""
__ ####
/ \__ ######
|_ \ ######
|^|___| ######
####
||
"""
elif n == 3:
return r"""
\ _
\\ / \_
\\|==|==|=|_ \
\|==|==|=|^|_|==|==|
"""
elif n == 4:
return r"""
### ### ###
##### #####*#####
### ### ###
/_\ /_\ /_\\
$
|==|==|==|==|==| |=
"""
elif n == 5:
return r"""
_ _ ### ###
/ \_/ \ ##### #####
|_ | ### ###
|^|___| /_\ /_\
|~~|~~|~~|~~|~~|~~|~~
"""
elif n == 6:
return r"""
~~~~~~~~ _ _
~~~~~~ * / \ / \
~~~~~~~ |_| |_|
~~~~~~~~~ _
~~~~ / \
~~~~~~~~ |_|
"""
elif n == 7:
return r"""
_ *
/ \_ _ _
|_ \ / \ / \ _
|^|_| |_| |_| / \
|_|
$
"""
elif n == 8:
return r"""
$ ### _
### ##### / \
##### ### |_| *
### /_\ _
/_\ / \
|_|
"""
else:
if n == 1:
return r"""
+-------------------+
| +--+ |
| * |~~| |
| +--+ |
| |
+-------| |--------+
"""
elif n == 2:
return r"""
+---------------+---+
| |* |
| +----------- | |
+- | --+
| | | |
+-----+-| |--+-----+
"""
elif n == 3:
return r"""
+-------+--+--------+
| * | |* |
| -----+ +---- --+
| |
| | | | |
+--+----| |--------+
"""
elif n == 5:
return r"""
+-------------------+
|=====/======\======|
|=====/ \==|_|=|
|==/ |_| |
| * |_| |
+-------| |--------+
"""
elif n == 7:
return r"""
+-------+--+--------+
| | | |
+-- ---+ * |
| | |
| | | |
+-------| |--------+
"""

203
old_project/Asci.py Executable file
View File

@ -0,0 +1,203 @@
from random import randint
from mapset import *
from locate import *
def convert(n):
try:
n = int(n)
except:
n = 0
return n
def opus(partie):
if partie == 1:
import Evnt1 as e
elif partie == 2:
import Evnt2 as e
elif partie == 3:
import Evnt3 as e
global evnt
evnt = e
def main (liste):
xp = liste[1]
carte = liste[2]
pv = liste[3]
fin = liste[4]
ecran = Screen()
map_no = 8
liste = [4+map_no,6+map_no,8+map_no]
if (carte > 2*map_no) or (carte <= 0) or ((carte in liste) == 1):
carte = 1
carte_chg = carte
i = 0
X = 10
Y = 5
key_buffer = 0
key = 0
test= 0
map_list = []
liste = []
while key != 9 and pv > 0 and xp < fin:
map_list = map_init(carte,map_no)
disp_vram(ecran,map_list)
ecran.locate(X,Y,"@")
key = ecran.refresh(1)
key = convert(key)
if key != 0:
key_buffer = key
else:
key = key_buffer
test = case_test([key,X,Y,ecran])
if test != 1 and test != 3:
liste = getkey([key,X,Y])
X = liste[0]
Y = liste[1]
if key==15510 and xp >= 29:
test = tport(carte,map_no)
if test != carte:
X = 10
Y = 5
carte = test
test = 0
carte_chg = carte
elif key == 7:
xp = evnt.Evnt([xp,carte,map_no])
elif key == 8:
liste = ["Palais","Thyel","Medecins","Foret","Bibliotheque","Plage","Village","Bois","Palais","Thyel","Medecins","","Bibliotheque","","Village"]
ecran.__init__()
ecran.locate(1,1,">Experience :")
ecran.locate(14,1,xp)
ecran.locate(1,2,">Pts de vie :")
ecran.locate(14,2,pv)
ecran.locate(1,3,">Qrt actuel :")
ecran.locate(14,3,carte)
ecran.locate(1,5,">Info du quartier :")
ecran.locate(1,6,liste[carte-1])
ecran.refresh(1)
if liste[2] == 1:
while carte == carte_chg:
carte_chg = randint(1,map_no)
carte = carte_chg
X = 10
Y = 5
if test == 2:
carte = carte+map_no
X = 10
Y = 6
elif test == 3:
liste = evnt.discussion(carte,map_no,xp,pv)
map_list = liste[2:]
xp += liste[0]
pv += liste[1]
disp_vram(ecran,map_list,liste[0])
ecran.refresh(1)
elif test == 4:
liste = combat(pv)
pv = liste[0]
if liste[1] == 1:
xp = evnt.Evnt([xp,carte,map_no])
if pv <= 0:
pv = 100
return [xp,carte,pv]
def disp_vram(ecran,map_list,suite=0):
ecran.__init__()
for i in range(1,len(map_list)+1):
ecran.locate(1,i,map_list[i-1])
if suite != 0:
ecran.locate(21,6,">")
def getkey(liste):
key = liste[0]
X = liste[1]
Y = liste[2]
map_chg = 0
if key==1:
X-=1
elif key==5:
Y-=1
elif key==3:
X+=1
elif key==2:
Y+=1
if X > 21:
X = 21
map_chg = 1
if X < 1:
X = 1
map_chg = 1
if Y > 6:
Y = 6
map_chg = 1
if Y < 1:
Y = 1
map_chg = 1
return [X,Y,map_chg]
def case_test(liste):
key = liste[0]
X = liste[1]
Y = liste[2]
ecran = liste[3]
liste = getkey([key,X,Y])
X = liste[0]
Y = liste[1]
cell = ecran.get_cell_content(X,Y)
if cell == " " or cell == "@":
return 0
elif cell == "^":
return 2
elif cell == "*":
return 3
elif cell == "$":
return 4
else:
return 1
def tport(actu,maxi):
code = input("Entrez le code du\nquartier:\n")
try:
code = int(code)
except:
code = actu
if code > maxi or code <= 0:
code = actu
return code
def combat(pv):
adv_pv = randint(50,100)
adv_pa = 0
degat = 0
obj = 1
test = 0
while pv > 0 and adv_pv > 0 and obj != 0:
obj = input("Entrez le code de\nl'objet: ")
obj = convert(obj)
if obj < 0:
obj = 1
adv_pa = 0
pa = 0
if obj == 666:
adv_pv -= randint(int(adv_pv/2),adv_pv)
elif obj == 295:
pv += 50
else:
pa = randint(int(obj/4),int(obj/2))
adv_pa = randint(int(pa/4),int(obj/2))
degat = (pa - adv_pa)*2
if degat >= 0:
adv_pv -= degat
print("Points de vie :\n>Vous :",pv,"\n>Adversaire :",adv_pv,"\nVous attaquez et\ninfligez",degat)
else:
pv += degat
print("Points de vie :\n>Vous :",pv,"\n>Adversaire :",adv_pv,"\nVotre ennemi se rue\nsur vous",1-degat)
if pv <= 0:
print("Vous etes mort.")
elif adv_pv <= 0:
print("Vous avez tue votre\nadversaire.")
test = 1
else:
print("Vous avez\nabandonne le combat")
input()
return [pv,test]

46
old_project/Dessins.py Executable file
View File

@ -0,0 +1,46 @@
"""
_ __
/ \_ / \__
|_ \ |_ \
|^|_| |^|___|
__ __
/<>\___/<>\
| | | |
| | _ | |
|___|^|___|
|>
|
_ _
/ \_/ \
|_ |
|^|___|
### ####
##### ######
### ######
/_\ ######
####
||
^ ^
| |
|_| |==|==|==|==|==|
|_|
|_| |~~|~~|~~|~~|~~|
|_|
\ /
\\ //
\\|~~~~~|//
\|==|==|/
+-----+
|~~~~~|
|~~~~~|
+-----+
"""

100
old_project/Evnt1.py Executable file
View File

@ -0,0 +1,100 @@
def Evnt (liste):
xp = liste[0]
carte = liste[1]
if xp == 7 and carte == 4:
xp = 8
elif xp == 27 and carte == 4:
xp = 28
return xp
def discussion(lieu,map_no,xp,pv):
if lieu == 1+map_no:
if xp == 0:
return [1,0,"La ville d'Asci est", "divisee en quartiers.", "Chaque quartier", "est separe des autres", "par des distances ", "inimaginables !"]
elif xp == 1:
return [1,0,"Une grande part", "d'aleatoire regit", "ce monde et seuls", "quelques inities", "peuvent passer outre."]
elif xp == 2:
return [0,0,"Bon courage !", "Tu peux te rendre au", "quartier 2. Il y a un", "grand arbre a l'est", "de ce quartier.", "Thyel, t'aidera."]
elif xp == 9:
return [2,0,"Ah te voila enfin !", "Bravo pour ton fait", "d'arme. Voici une", "epee neuve repondant", "a [>28]"]
elif xp == 11:
return [1,0,"J'ai besoin de toi !", "Je dois faire un", "long voyage. Aussi", "j'aimerai connaitre", "le moyen de se", "teleporter."]
elif xp == 12:
return [1,50,"Bois cela te donnera", "des forces ! La", "bibliotheque du", "quartier 5 pourra", "peut-etre t'aider."]
elif xp == 13:
return [0,0,"La bibliotheque", "regorge", "d'informations !"]
elif xp == 17:
return [2,0,"Oui c'est vrai, Thyel", "etait avec moi hier", "et nous n'avons pas", "quitte le Palais."]
elif xp == 19:
return [0,0,"Continue tes", "recherches. Tu", "avances bien.", "As-tu ete voir", "l'ancien archiviste ?"]
elif xp == 29:
return [1,0,"Ah mais tu es doue !", "Merci jeune homme !", "Je te garde a mon", "service. De ce fait", "voici ta nouvelle", "epee [>50]"]
else:
return [0,0,"Bonjour, je suis le", "Roi d'Asci.", "Que puis-je faire", "pour t'aider ?"]
elif lieu == 2+map_no:
if xp < 2:
return [0,0,"Hey ! Je suis Thyel,", "ami du Roi.", "Bienvenu dans Asci !"]
elif xp == 2:
return [2,0,"Aha, tu verras,", "Asci est une", "ville speciale. Les", "quartiers ne sont pas", "cote a cote."]
elif xp == 4:
return [1,0,"Les quartiers sont", "relies entre eux par", "des ponts aleatoires:", "quand tu quittes", "un quartier tu es", "envoye dans un autre."]
elif xp == 5:
return [1,0,"Et ce de maniere", "aleatoire ! On", "murmure qu'il est", "possible d'echapper a", "cet aleatoire."]
elif xp == 6:
return [1,0,"Il est temps", "que tu apprennes", "les armes ! Tiens", "prend cette dague,", "[>10] pour l'utiliser"]
elif xp == 7:
return [0,0,"Des maraudeurs s'en", "prennent aux", "visiteurs dans la", "foret du quartier 4.", "Reviens me voir", "apres !"]
elif xp == 8:
return [1,50,"He mais tu es blesse", "! Je t'ai gueris", "comme j'ai pu mais si", "tu as besoin il y a", "un medecin dans le", "quartier 3"]
elif xp == 9:
return [0,0,"Le Roi a eu vent", "de tes exploits, il", "veux te remercier,", "bon courage pour le", "trajet !"]
elif xp == 15:
return [2,0,"HEIN ! Je ne savais", "meme pas que la", "bibliotheque avait un", "tel ouvage !", "Quelqu'un a usurpe", "mon nom !"]
elif xp == 17:
return [0,0,"Le Roi te confirmera", "que j'etais avec lui", "tout hier."]
else:
return [0,0,"Hey !", "Tu vas bien vieux ?"]
elif lieu == 3+map_no:
if pv < 100:
return [0,100,"Ah ! Quelle idee de", "tuer quelqu'un,", "regarde tu t'es", "blesse !"]
else:
return [0,0,"Tu es en pleine", "forme !"]
elif lieu == 5+map_no:
if xp == 13:
return [1,0,"Un ouvrage sur la", "teleportation ? Oui,", "je dois avoir ca..."]
elif xp == 14:
return [1,0,"Je ne comprend pas", "il devrait etre ici.", "Le dernier emprunt ?!", "Ces ouvrages ne", "sortent pas d'ici."]
elif xp == 15:
return [0,0,"La derniere personne", "qui l'a consulte ?", "Je vais regarder le", "registre", "...", "C'est Thyel, hier."]
else:
return [0,0,"Bienvenu dans la", "bibliotheque d'Asci."]
elif lieu == 6:
if xp == 19:
return [1,0,"L'ancien archiviste", "oui c'est moi..."]
elif xp == 20:
return [1,0,"J'ai ete limoge suite", "a une vieille affaire", "il faut savoir qu'en", "ce temps-la les", "livres etaient tous", "ouverts au public."]
elif xp == 21:
return [1,0,"Puis le", "bibliothecaire a eu", "le droit de censurer", "les livres a sa guise", "Voulant proteger le", "droit a l'..."]
elif xp == 22:
return [1,0,"...l'information,", "j'ai cache des livres", "censures chez moi ou", "le public pouvait les", "consulter."]
elif xp == 23:
return [1,0,"De quoi parlaient-ils", "? Certains de", "politique d'autre de", "sorcelerie."]
elif xp == 24:
return [1,0,"He non je ne les ais", "plus ils ont ete", "brules. Avant", "beaucoup savaient se", "teleporter..."]
elif xp == 25:
return [0,0,"Maintenant, quelques", "voleurs astucieux", "connaissent la", "formule et c'est", "bien tout."]
else:
return [0,0,"Bonjour jeune homme."]
elif lieu == 4:
if xp == 25:
return [1,0,"Envoye par le Roi !", "Mais... ca fait", "grimper la rancon", "ca !!"]
elif xp == 26:
return [1,0,"Le code de", "teleportation ! Rien", "que ca ? J'en ai", "evicere pour moins", "que ca alors debale", "un argument credible"]
elif xp == 27:
return [0,0,"Un service ? Mmm...", "Va donc tuer ce", "detrousseur la un", "peu plus bas.","Ce malhonnete vole", "mes clients !"]
elif xp == 28:
return [1,0,"Bien, tu a de", "l'avenir petit. Le", "code est 15510 tu le", "connaissais sans", "doute deja..."]
else:
return [0,0,"Si tu tiens a ta vie", "plie bagages avant", "que je ne te les", "prennes !"]
else:
return [0,0,"..."]

129
old_project/Evnt2.py Executable file
View File

@ -0,0 +1,129 @@
def Evnt (liste):
xp = liste[0]
carte = liste[1]
if carte == 7 and xp == 34:
xp = 35
if carte == 8 and xp == 38:
xp = 39
input("Vous trouvez une\nlettre sur le mort...\nIl y est ecrit\n'MWVBER NM LAXZE WP\nAEUWZILG. BHQGT'\n")
if carte ==5+liste[2] and xp == 50:
txt = input("Entrez le message\nentier et decode en\nmajuscules :\n")
if txt == "METTEZ LE LIVRE EN SECURITE. THYEL":
xp = 51
return xp
def discussion(lieu,map_no,xp,pv):
if lieu == 1+map_no:
if xp == 30:
return[1,0,"Bonjour. Je vais", "devoir partir en", "province pour des", "affaires urgentes."]
elif xp == 31:
return[1,0,"Pendant mon abcence", "je voudrais que tu", "trouves le voleur de", "ce livre. Son contenu", "est tres sensible."]
elif xp == 32:
return[0,0,"On se reverra des mon", "retour en attendant", "tu peux te confier a", "Thyel, il a ma", "confiance."]
else:
return[0,0,"Le Roi ?", "Il est en", "deplacement..."]
elif lieu == 2+map_no:
if xp == 32:
return[1,0,"Ah, c'est le Roi qui", "t'envoie ! Je suis", "moi-meme plus ou", "moins espion ayant", "beaucoup d'amis..."]
elif xp == 33:
return[1,0,"On ma rapporte qu'un", "riche villageois", "s'est vante d'avoir", "le secret de la", "teleportation"]
elif xp == 34:
return[0,0,"Tu peux commencer", "tes recherches par", "le village..."]
elif xp == 42:
return[1,0,"Un message code", "dis-tu ? Montre moi", "ca... Mmmh, bon", "travail, et ce", "livre ? C'est pour", "demain ?"]
elif xp == 43:
return[1,0,"Donne-le moi, je le", "ferais decrypter."]
elif xp == 44:
return[0,0,"Tu veux en referer au", "Roi ? Quelle idee !", "On ne le derange pas", "pour des bouts de", "papiers ! Allez", "donne-moi ce papier !"]
else:
return[0,0,"Salut !","Tes recherches", "avancent comme tu le", "souhaite ?"]
elif lieu == 7+map_no:
if xp == 34:
return[0,0,"Aah... enfin !", "Un homme de peu de", "foi rode devant ma", "maison j'ai peur de", "sortir..."]
elif xp == 35:
return[1,0,"Voila un travail bien", "fait ! Non je n'ai", "jamais entendu parle", "d'un tel livre."]
elif xp == 36:
return[1,0,"Attend ! Je me", "souviens avoir", "consulte un ouvrage", "sur la teleportation", "chez un archiviste", "anarchiste."]
elif xp == 37:
return[0,0,"Peut etre trouverez", "vous plus", "d'informations aupres", "de la bibliotheque ou", "de l'archiviste ?"]
elif xp == 46:
return[1,0,"Ah te voila.","J'ai horreur de", "retrouver mes hommes", "de mains en pieces", "detachees ! QUOI ! Un"]
elif xp == 47:
return[0,0,"message ? Mais... je", "n'utilise que des", "illetres. Hors", "d'ici imposteur !"]
else:
return[0,0,"Je ne vous permet de", "m'introduire chez moi", "de la sorte !!"]
elif lieu == 6:
if xp == 37:
return[1,0,"Tu as ete voir 'le", "bourgeois' ? C'est un", "manipulateur cynique", "prends garde !"]
elif xp == 38:
return [0,0,"Je n'en sais pas plus", "mais des sbires a lui", "trainent dans", "le bois. Prend cette", "potion de", "soins. [>295]"]
elif xp == 52:
return[1,0,"Thyel un traitre !?","Bon la question est", "ou est cache", "le livre... Le", "'bourgeois' doit", "tremper dans la..."]
elif xp == 53:
return[1,0,"...combine c'etait", "son sbire qui avait", "le billet... Ou alors", "le sbire etait un", "simple", "intermediaire ?"]
elif xp == 54:
return[1,0,"Thyel va chercher a", "t'eliminer. Essaie", "d'abord de savoir ou", "est le livre."]
elif xp == 55:
return[0,0,"Je connais un brigand", "qui pourra sans doute", "t'aider. Il se trouve", "dans la foret"]
else:
return[0,0,"Ah, te revoila !","Tes recherches", "avancent ?"]
elif lieu == 5+map_no:
if xp == 39:
return[1,0,"De la documentation", "sur la cryptographie", "? Oui j'ai cela...", "Ah voila c'etait ici", "!"]
elif xp == 40:
return[1,0,"Il y est dit que les", "methodes recentes", "utilisent un mot ou", "une phrase comme cle.", "Cette methode empeche", "une analyse..."]
elif xp == 41:
return[1,0,"...frequencologique.", "Sans le code", "parfois lui-meme code", "il est impossible de", "dechiffrer le texte."]
elif xp == 42:
return[0,0,"Je n'ai pas d'autres", "informations pour", "l'instant, mais", "revient plus tard je", "mene mes recherches", "sur le sujet !"]
elif xp == 45:
return[1,0,"Ton message est code", "par un mot de 4", "lettres mais je n'en", "sais pas plus. Si tu", "trouves le mot..."]
elif xp == 46:
return[0,0,"On m'a dit que", "'le Bourgeois' te", "cherche..."]
elif xp == 49:
return[1,0,"CUEK ? Mmmh... Voyons", "voir... On dirait un", "decalage... Ca", "pourrait etre 'BTDJ'", "a voir si ca marche", ",a toi de jouer !"]
elif xp == 50:
return[0,0,"Reviens ici quand", "tu auras tout decode", "et presse [7]."]
elif xp == 51:
return[1,0,"C'est Thyel qui a", "vole mon livre ?", "Mais... pourquoi ?","Le Roi doit", "etre prevenu !"]
elif xp == 52:
return[0,0,"Mon ancien archiviste", "est toujours mon ami,", "va le voir les", "magouilles c'est son", "rayon."]
else:
return[0,0,"Bonjour !", "Des nouvelles de", "mon livre ?"]
elif lieu == 4:
if xp == 44:
return[1,0,"Tu vas me tuer avec", "tes conneries ! Filer", "Thyel ? Tu", "prefererais pas tuer", "le Roi ?"]
elif xp == 45:
return[0,0,"Bon ok reviens me", "voir je le ferais", "suivre..."]
elif xp == 47:
return[1,0,"Thyel a rencontre", "'le Bourgeois'","Fouiller la baraque", "de Thyel ?? Pour qui", "tu me prends ?"]
elif xp == 48:
return[1,0,"Bien sur que je l'ai", "fouillee !"]
elif xp == 49:
return[0,0,"J'ai trouve du pain", "des chaussures et...", "un bout de papier", "avec marque 'CUEK'", "dessus."]
elif xp == 55:
return[1,0,"ENCORE !!", "Trouver un livre ?", "Je crois que t'as", "toujours pas", "compris..."]
elif xp == 56:
return[1,0,"Ah ben voila ouvrir", "les yeux je sais", "faire ! Par contre", "si tu veux des infos", "je veux un service !"]
elif xp == 57:
return[1,0,"Va jeter un oeil", "vers le village et", "ramene-moi des tuyaux", "sur le 'bourgeois'"]
elif xp == 58:
return[0,0,"Pourquoi ? Je t'en", "pose, moi des", "questions ? File !"]
elif xp == 59:
return[1,0,"Bien. Ton livre est", "planque chez", "le 'bourgeois'."]
else:
return[0,0,"Toi, si tu continues", "tu vas finir les", "boyaux par terre..."]
elif lieu == 7:
if xp == 58:
return[1,0,"Le 'bourgeois' ? Bah", "il a recu", "un envoye du Roi et", "Thyel. il parait", "qu'un de ses homme", "de main est mort..."]
else:
return[0,0,"S'lut."]
elif lieu == 3+map_no:
if pv < 100:
return [0,100,"Quoi ?!", "Tu es encore blesse !","Tu le fais expres !?"]
else:
return [0,0,"Que fais-tu ici ?","Ici c'est pour les", "blesses pas les gens", "en pleine forme !"]
else:
return[0,0,"..."]

12
old_project/Opus1.py Executable file
View File

@ -0,0 +1,12 @@
from Asci import *
print("Opus 1 (v1.1b):\n'Le Secret d'Asci'\nNouvelle partie:\nAsci([0,1,100])\nSinon entrez le code:\nAsci([,,])")
def Asci(liste):
xp = liste[0]
carte = liste[1]
pv = liste[2]
opus(1)
liste = main([1,xp, carte, pv, 30])
if liste[0] > 29:
return print("Tu as trouve le code\n! (15510) Mais les\nennuis arrivent qui\na vole ce livre et\nsurtout pourquoi ?")
else:
return print("Pour reprendre la\npartie entrez le code\nsuivant :\nAsci(",liste,")")

14
old_project/Opus2.py Executable file
View File

@ -0,0 +1,14 @@
from Asci import *
print("Opus 2 (v1.0b):\n'Le Livre perdu'\nNouvelle partie:\nAsci([30,9,100])\nSinon entrez le code:\nAsci([,,])")
def Asci(liste):
xp = liste[0]
carte = liste[1]
pv = liste[2]
opus(2)
liste = main([1,xp, carte, pv, 60])
if liste[0] > 59:
print("Quelqu'un a vole le\nlivre sur ordre de\nThyel.\nAvec des complicites\nle livre a ete...")
input()
return print("...cache\nchez le 'bourgeois'.\nMais dans quel but ?\nPourquoi un proche du\nRoi vole et cache ce\nlivre sensible ?")
else:
return print("Pour reprendre la\npartie entrez le code\nsuivant :\nAsci(",liste,")")

90
old_project/locate.py Executable file
View File

@ -0,0 +1,90 @@
class Screen:
def _check(self, x, o, name):
if not isinstance(x, int):
raise TypeError("{} is not an int object".format(name))
elif x < 1:
raise ValueError("{} is lower than 1".format(name))
if o is None:
o = 0
elif x > o and o:
raise ValueError("{} is greater than the height of this object: {} > {}".
format(name, x, o))
def __init__(self, width=21, height=6, patern=" ", copy=None):
if isinstance(copy, Screen):
self._width = copy._width
self._height = copy._height
self._mat = copy._mat
else:
self._check(width, None, "width")
self._check(height, None, "height")
if not isinstance(patern, str):
raise TypeError("patern is not a string")
elif len(patern) > 1:
raise ValueError("patern is too long (length = {})".format(len(patern)))
self._width = width
self._height = height
self.fill(patern)
def locate(self, x, y, string):
self._check(x, self._width, "x")
self._check(y, self._height, "y")
string = str(string)
i = -1
for char in string:
if i + x < self._width:
self._mat[y - 1][x + i] = char
i += 1
def locate_v(self, x, y, string):
self._check(x, self._width, "x")
self._check(y, self._height, "y")
string = str(string)
i = -1
for char in string:
if i + y < self._height:
self._mat[y + i][x - 1] = char
i += 1
def fill(self, patern=" "):
self._mat = [[patern[0] for i in range(self._width)] for i in range(self._height)]
def refresh(self, ask_for_input=True, endl="\n"):
to_print = str()
for line in self._mat:
for cell in line:
to_print += cell
to_print += "\n"
to_print = to_print[:-1]
print(to_print)
if ask_for_input:
return input(">")
else:
print("", end=endl)
return None
def get_cell(self, x, y):
self._check(x, self._width, "x")
self._check(y, self._width, "y")
return self._mat[y - 1][x - 1]
def export(self):
result = str()
for line in self._mat:
for cell in line:
result += cell
return result
def load(self, string):
if type(string) is not str:
raise TypeError("string is not a string type")
if len(string) != self._width * self._height:
raise ValueError("string lenght isn't equal to {}".format(self._width * self._height))
i = 0
s = 0
while i != self._height:
self._mat[i] = list(string[s:s + self._width])
i += 1
s += self._width
get_cell_content = get_cell # For retro-compability

95
old_project/mapset.py Executable file
View File

@ -0,0 +1,95 @@
def map_init(n,map_no):
if n == 1:
map_1 = " ### $ __ __"
map_2 = " ##### /<>\___/<>\\"
map_3 = " ### | | | |"
map_4 = " /_\ | | _ | |"
map_5 = " |___|^|___|"
map_6 = "|==|==|"
elif n == 2:
map_1 = " __ ####"
map_2 = "/ \__ ######"
map_3 = "|_ \ ######"
map_4 = "|^|___| ######"
map_5 = " ####"
map_6 = " ||"
elif n == 3:
map_1 = "\ _"
map_2 = "\\\\ / \_"
map_3 = "\\\\|==|==|=|_ \\"
map_4 = " \|==|==|=|^|_|==|==|"
map_5 = ""
map_6 = ""
elif n == 4:
map_1 = " ### ### ###"
map_2 = "##### #####*#####"
map_3 = " ### ### ###"
map_4 = " /_\ /_\ /_\\"
map_5 = " $ "
map_6 = "|==|==|==|==|==| |="
elif n == 5:
map_1 = " _ _ ### ###"
map_2 = " / \_/ \ ##### #####"
map_3 = " |_ | ### ###"
map_4 = " |^|___| /_\ /_\\"
map_5 = ""
map_6 = "|~~|~~|~~|~~|~~|~~|~~"
elif n == 6:
map_1 = "~~~~~~~~ _ _"
map_2 = "~~~~~~ * / \ / \\"
map_3 = "~~~~~~~ |_| |_|"
map_4 = "~~~~~~~~~ _"
map_5 = "~~~~ / \\"
map_6 = "~~~~~~~~ |_|"
elif n == 7:
map_1 = " _ *"
map_2 = "/ \_ _ _"
map_3 = "|_ \ / \ / \ _"
map_4 = "|^|_| |_| |_| / \\"
map_5 = " |_|"
map_6 = "$"
elif n == 8:
map_1 = " $ ### _"
map_2 = " ### ##### / \\"
map_3 = "##### ### |_| *"
map_4 = " ### /_\ _ "
map_5 = " /_\ / \\"
map_6 = " |_|"
elif n == 1 + map_no:
map_1 = "+-------------------+"
map_2 = "| +--+ |"
map_3 = "| * |~~| |"
map_4 = "| +--+ |"
map_5 = "| |"
map_6 = "+-------| |--------+"
elif n == 2 + map_no:
map_1 = "+---------------+---+"
map_2 = "| |* |"
map_3 = "| +----------- | |"
map_4 = "+- | --+"
map_5 = "| | | |"
map_6 = "+-----+-| |--+-----+"
elif n == 3 + map_no:
map_1 = "+-------+--+--------+"
map_2 = "| * | |* |"
map_3 = "| -----+ +---- --+"
map_4 = "| |"
map_5 = "| | | | |"
map_6 = "+--+----| |--------+"
elif n == 5 + map_no:
map_1 = "+-------------------+"
map_2 = "|=====/======\======|"
map_3 = "|=====/ \==|_|=|"
map_4 = "|==/ |_| |"
map_5 = "| * |_| |"
map_6 = "+-------| |--------+"
elif n == 7 + map_no:
map_1 = "+-------+--+--------+"
map_2 = "| | | |"
map_3 = "+-- ---+ * |"
map_4 = "| | |"
map_5 = "| | | |"
map_6 = "+-------| |--------+"
return [map_1, map_2, map_3, map_4, map_5, map_6]