Clean old_project folder

This commit is contained in:
Shadow15510 2021-08-14 18:10:27 +02:00
parent 808d1d2d68
commit f349f0b821
9 changed files with 1 additions and 546 deletions

View File

@ -1,203 +0,0 @@
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]

View File

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

View File

@ -1,100 +0,0 @@
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,"..."]

View File

@ -1,12 +0,0 @@
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,")")

View File

@ -1,90 +0,0 @@
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

View File

@ -1,95 +0,0 @@
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]

View File

@ -48,6 +48,7 @@ def get_dialogue(xp, current_map, x, y, stat):
if stat[0] < 100: return [0, "Tsst, est-ce que je tape sur des gens moi ? Bah alors ? J'ai panse tes plaies, mais fait gaffe a toi...", 0, 50]
else: return [0, "Tu es en pleine forme !", 0]
#
elif coords == (4, 7): return {
6: [2, "Tu as tue le brigand !", 0],
"base": [0, "Il n'y a rien a faire par ici..."]