From 9d9cea8dc03d9a0768e7fd81e0ddfb112c23f7bb Mon Sep 17 00:00:00 2001 From: Shadow15510 Date: Tue, 12 Jul 2022 12:53:44 +0200 Subject: [PATCH] re-organize repo --- gen_sce | 1 + {idk => scenarii}/alfheim.py | 0 {idk => scenarii}/asci.py | 3 +- {idk => scenarii}/asgard.py | 0 scenarii/dlc_idk.py | 31 +++ scenarii/hy_po.py | 343 ++++++++++++++++++++++++++++++ {idk => scenarii}/idk.py | 0 {idk => scenarii}/idk_lib.py | 0 {idk => scenarii}/jotunheim.py | 0 {idk => scenarii}/midgard.py | 0 {idk => scenarii}/muspellheim.py | 0 {idk => scenarii}/nidavellir.py | 0 {idk => scenarii}/niflheim.py | 0 {idk => scenarii}/svartalfheim.py | 0 {idk => scenarii}/vanaheim.py | 0 15 files changed, 377 insertions(+), 1 deletion(-) rename {idk => scenarii}/alfheim.py (100%) rename {idk => scenarii}/asci.py (98%) rename {idk => scenarii}/asgard.py (100%) create mode 100644 scenarii/dlc_idk.py create mode 100644 scenarii/hy_po.py rename {idk => scenarii}/idk.py (100%) rename {idk => scenarii}/idk_lib.py (100%) rename {idk => scenarii}/jotunheim.py (100%) rename {idk => scenarii}/midgard.py (100%) rename {idk => scenarii}/muspellheim.py (100%) rename {idk => scenarii}/nidavellir.py (100%) rename {idk => scenarii}/niflheim.py (100%) rename {idk => scenarii}/svartalfheim.py (100%) rename {idk => scenarii}/vanaheim.py (100%) diff --git a/gen_sce b/gen_sce index 82b3d66..14a670c 100755 --- a/gen_sce +++ b/gen_sce @@ -20,6 +20,7 @@ def nouveau_scenario(nom): "h_20_npc", "vanaheim_po", "vanaheim_npc", + "h_21_npc", "h_22_npc", "alfheim_po", "alfheim_npc", diff --git a/idk/alfheim.py b/scenarii/alfheim.py similarity index 100% rename from idk/alfheim.py rename to scenarii/alfheim.py diff --git a/idk/asci.py b/scenarii/asci.py similarity index 98% rename from idk/asci.py rename to scenarii/asci.py index 8fde004..900201e 100644 --- a/idk/asci.py +++ b/scenarii/asci.py @@ -405,7 +405,8 @@ def follow(entity, data, stat, screen, walkable): if entity.args: walkable += entity.args[0] cases = ((data[2] + 1, data[3]), (data[2], data[3] - 1), (data[2] - 1, data[3]), 0, (data[2], data[3] + 1))[data[4] - 1] if not (0 <= cases[0] < screen.map_width and 0 <= cases[1] < screen.map_height): entity.pos_x, entity.pos_y = data[2], data[3] - elif screen.get_cell(cases[0], cases[1]) in walkable: entity.pos_x, entity.pos_y = cases + elif not screen.get_cell(cases[0], cases[1]) in walkable: (entity.pos_x, entity.pos_y), (data[2], data[3]) = (data[2], data[3]), (entity.pos_x, entity.pos_y) + else: entity.pos_x, entity.pos_y = cases def walk_between(entity, data, stat, screen, walkable): diff --git a/idk/asgard.py b/scenarii/asgard.py similarity index 100% rename from idk/asgard.py rename to scenarii/asgard.py diff --git a/scenarii/dlc_idk.py b/scenarii/dlc_idk.py new file mode 100644 index 0000000..f4ad977 --- /dev/null +++ b/scenarii/dlc_idk.py @@ -0,0 +1,31 @@ +dlc_title = "Marchands" + +dlc_spells = ("Soin", "Flammes", "Givre", "Etincelles", "Fatigue") +dlc_spells_level = ("I", "II", "III", "IV", "V") +dlc_spells_effect = ((0, 1, True), (4, -1, False), (4, -1, False), (4, -1, False), (0, -1, False)) +dlc_weapons = ("", "Dague", "Marteau", "Masse", "Fleau", "Hache", "Epee", "Espadon", "Hache double") +dlc_armors = ("", "Rondache", "Pavois", "Cote de maille", "Broigne", "Harnois") + +dlc_entities = ( + ["Khajit", '*', 3, 51, 60, 'stand by'], +) + +def dlc_npc(data, stat, entities, identifiant): + if not "dlc" in data[0]: data[0]["dlc"] = 0 + coords = data[2], data[3] + xp = data[0]["dlc"] + main = data[0]["main"] + + if identifiant == "Khajit": + if xp == 0: return [0, "Bonjour {}, je suis Khajit, marchand ambulant. Je suis a la recherche d'un partenaire d'affaire, partant ?\n1.J'ai besoin d'y reflechir.\n2.J'en suis !\n3.On se connait ?".format(stat[5]), 3] + elif xp == 1: return [-1, "Je comprends, reviens quand tu veux : je pense rester quelques temps a Midgard."] + elif xp == 2: return [2, "Excellente idee ! Un riche client m'a demande la dague d'Odin. Si tu arrives a te la procurer, cela serait un bon debut."] + elif xp == 3: return [-3, "Hum, non. Mais les nouvelles vont vites et ceux qui peuvent voyager dans tous l'Yggdrasil sont rares."] + elif xp == 4: + if main == 0: return [0, "Alors ?"] + elif main <= 3: return [0, "Oh ! [KHAJIT VOUS PRIS LA DAGUE DES MAINS] Elle est superbe ! Mais je crois que tu en as encore besoin. [KHAJIT VOUS RENDIT LA DAGUE]"] + elif stat[3][0] == 1: + stat[3][0] = 2 + return [1, "Magnifique ! [KHAJIT PRIT LA DAGUE ET LA RANGEA] Voici un marteau en echange et quelques pieces ! Revient me voir bientot, j'aurais du travail pour toi. [+10 PO]", 0, (1, 10)] + else: return [1, "Hum, tu n'as plus la dague... Ce n'est pas grave, nous trouveront bien un autre client. Revient me voir bientot, j'aurais du travail pour toi."] + diff --git a/scenarii/hy_po.py b/scenarii/hy_po.py new file mode 100644 index 0000000..ec06ffc --- /dev/null +++ b/scenarii/hy_po.py @@ -0,0 +1,343 @@ +from idk_lib import * + +try: + import dlc_hy_po as dlc + spells = dlc.dlc_spells + spells_level = dlc.dlc_spells_level + spells_effect = dlc.dlc_spells_effect + weapons = dlc.dlc_weapons + armors = dlc.dlc_armors + dlc_entities = dlc.dlc_entities +except: + dlc = None + dlc_entities = () + + + +# Game +def npc(data, stat, entities, identifiant): + npc_data = ( + asgard_npc, + vanaheim_npc, + alfheim_npc, + midgard_npc, + niflheim_npc, + jotunheim_npc, + nidavellir_npc, + muspellheim_npc, + svartalfheim_npc, + h_9_npc, h_10_npc, h_11_npc, h_12_npc, h_13_npc, h_14_npc, h_15_npc, h_16_npc, h_17_npc, h_18_npc, h_19_npc, h_20_npc, + h_21_npc, h_22_npc, + h_23_npc, h_24_npc, + h_25_npc, h_26_npc, h_27_npc, h_28_npc, + h_29_npc, h_30_npc, + h_31_npc, h_32_npc, h_33_npc, h_34_npc, h_35_npc, h_36_npc, + h_37_npc, h_38_npc, h_39_npc, h_40_npc, h_41_npc, + h_42_npc, h_43_npc, h_44_npc, + h_45_npc, h_46_npc, h_47_npc, h_48_npc) + + + if dlc: + event = dlc.dlc_npc(data, stat, entities, identifiant) + if event: return "dlc", event + + elif identifiant == "Kvasir": return kvasir(data, stat) + + return npc_core(npc_data[data[1]], data, stat, entities, identifiant) + + +def point_of_interest(data, stat, entities, identifiant): + po_data = ( + asgard_po, + vanaheim_po, + alfheim_po, + midgard_po, + niflheim_po, + jotunheim_po, + nidavellir_po, + muspellheim_po, + svartalfheim_po + ) + + coords = data[2], data[3] + event = po_data[data[1]](coords, identifiant) + + if not event: return [0, "Il n'y a rien à voir ici."] + else: return event + + +entities = asgard_entities + vanaheim_entities + alfheim_entities + midgard_entities + niflheim_entities + jotunheim_entities + nidavellir_entities + muspellheim_entities + svartalfheim_entities + dlc_entities + (["Kvasir", "*", 3, 45, 66, "follow"], ) + +print(center("L'Hydromel poetique", 21, " ")) +print() +print("Entrez 'hy_po()' pour\nune nouvelle partie.") +events = {"*": npc, "?": point_of_interest} +keys = {4: display_stat, 7: spell, 8: misc_stat, 6: inventory, 9: sleep, "s": quick_save} + + +def hy_po(save_code=None): + # stat = [0 - PV, 1 - pièces d'or, 2 - [vitesse, agilité, attaque, defense, magie], 3 - [arme, armure], 4 - ticks, 5 - nom, 6 - classe, 7 - sorts connus : (id, level), 8 - sous-quêtes terminées] + if not save_code: + stat = init_stat() + name = stat[5] + data = [{"main": 0}, 3, 44, 66] + + print_text("A l'issue de la guerre qui opposa Ases et Vanes, Odin et Freyja conclurent un accord de paix durant lequel ils cracherent dans une meme cuve. De cette cuve naquit Kvasir, l'etre le plus sage qui soit. Venere par tous, Kvasir est tres souvent appelle au chevet des Dieux pour prodiguer ses precieux conseils. Odin et Freyja vous ont missionne pour escorter et assister Kvasir dans ses deplacements.") + else: + stat, data = decode_save(save_code) + + idk_game = Asci(maps, entities, events, keys) + stat, data = idk_game.mainloop(1, stat, data, routine=routine, low_bar=low_bar, door="^_", walkable=".,`' ", exit_key="q") + if stat[9] != -1: data[0]["main"] -= stat[9] + + if data[0]["main"] == 1: + print_text("conclusion") + else: + print("hy_po(\"{}\")".format(encode_save(data, stat[:-1]))) + + +def kvasir(data, stat): + return { + "base": [0, "Je suis Kvasir"], + } + +# - - - Asgard - - - # +def asgard_po(coords, identifiant): + pass + + +def asgard_npc(data, stat, entites, identifiant): + pass + + +def h_9_npc(data, stat, entites, identifiant): + pass + + +def h_10_npc(data, stat, entites, identifiant): + pass + + +def h_11_npc(data, stat, entites, identifiant): + pass + + +def h_12_npc(data, stat, entites, identifiant): + pass + + +def h_13_npc(data, stat, entites, identifiant): + pass + + +def h_14_npc(data, stat, entites, identifiant): + pass + + +def h_15_npc(data, stat, entites, identifiant): + pass + + +def h_16_npc(data, stat, entites, identifiant): + pass + + +def h_17_npc(data, stat, entites, identifiant): + pass + + +def h_18_npc(data, stat, entites, identifiant): + pass + + +def h_19_npc(data, stat, entites, identifiant): + pass + + +def h_20_npc(data, stat, entites, identifiant): + pass + + +# - - - Vanaheim - - - # +def vanaheim_po(coords, identifiant): + pass + + +def vanaheim_npc(data, stat, entites, identifiant): + pass + + + +def h_21_npc(data, stat, entites, identifiant): + pass + + +def h_22_npc(data, stat, entites, identifiant): + pass + + +# - - - Alfheim - - - # +def alfheim_po(coords, identifiant): + pass + + +def alfheim_npc(data, stat, entites, identifiant): + pass + + +def h_23_npc(data, stat, entites, identifiant): + pass + + +def h_24_npc(data, stat, entites, identifiant): + pass + + +# - - - Midgard - - - # +def midgard_po(coords, identifiant): + pass + + +def midgard_npc(data, stat, entites, identifiant): + pass + + +def h_25_npc(data, stat, entites, identifiant): + pass + + +def h_26_npc(data, stat, entites, identifiant): + pass + + +def h_27_npc(data, stat, entites, identifiant): + pass + + +def h_28_npc(data, stat, entites, identifiant): + pass + + +# - - - Niflheim - - - # +def niflheim_po(coords, identifiant): + pass + + +def niflheim_npc(data, stat, entites, identifiant): + pass + + +def h_29_npc(data, stat, entites, identifiant): + pass + + +def h_30_npc(data, stat, entites, identifiant): + pass + + +# - - - Jotunheim - - - # +def jotunheim_po(coords, identifiant): + pass + + +def jotunheim_npc(data, stat, entites, identifiant): + pass + + +def h_31_npc(data, stat, entites, identifiant): + pass + + +def h_32_npc(data, stat, entites, identifiant): + pass + + +def h_33_npc(data, stat, entites, identifiant): + pass + + +def h_34_npc(data, stat, entites, identifiant): + pass + + +def h_35_npc(data, stat, entites, identifiant): + pass + + +def h_36_npc(data, stat, entites, identifiant): + pass + + +# - - - Nidavellir - - - # +def nidavellir_po(coords, identifiant): + pass + + +def nidavellir_npc(data, stat, entites, identifiant): + pass + + +def h_37_npc(data, stat, entites, identifiant): + pass + + +def h_38_npc(data, stat, entites, identifiant): + pass + + +def h_39_npc(data, stat, entites, identifiant): + pass + + +def h_40_npc(data, stat, entites, identifiant): + pass + + +def h_41_npc(data, stat, entites, identifiant): + pass + + +# - - - Muspellheim - - - # +def muspellheim_po(coords, identifiant): + pass + + +def muspellheim_npc(data, stat, entites, identifiant): + pass + + +def h_42_npc(data, stat, entites, identifiant): + pass + + +def h_43_npc(data, stat, entites, identifiant): + pass + + +def h_44_npc(data, stat, entites, identifiant): + pass + + +# - - - Svartalfheim - - - # +def svartalfheim_po(coords, identifiant): + pass + + +def svartalfheim_npc(data, stat, entites, identifiant): + pass + + +def h_45_npc(data, stat, entites, identifiant): + pass + + +def h_46_npc(data, stat, entites, identifiant): + pass + + +def h_47_npc(data, stat, entites, identifiant): + pass + + +def h_48_npc(data, stat, entites, identifiant): + pass \ No newline at end of file diff --git a/idk/idk.py b/scenarii/idk.py similarity index 100% rename from idk/idk.py rename to scenarii/idk.py diff --git a/idk/idk_lib.py b/scenarii/idk_lib.py similarity index 100% rename from idk/idk_lib.py rename to scenarii/idk_lib.py diff --git a/idk/jotunheim.py b/scenarii/jotunheim.py similarity index 100% rename from idk/jotunheim.py rename to scenarii/jotunheim.py diff --git a/idk/midgard.py b/scenarii/midgard.py similarity index 100% rename from idk/midgard.py rename to scenarii/midgard.py diff --git a/idk/muspellheim.py b/scenarii/muspellheim.py similarity index 100% rename from idk/muspellheim.py rename to scenarii/muspellheim.py diff --git a/idk/nidavellir.py b/scenarii/nidavellir.py similarity index 100% rename from idk/nidavellir.py rename to scenarii/nidavellir.py diff --git a/idk/niflheim.py b/scenarii/niflheim.py similarity index 100% rename from idk/niflheim.py rename to scenarii/niflheim.py diff --git a/idk/svartalfheim.py b/scenarii/svartalfheim.py similarity index 100% rename from idk/svartalfheim.py rename to scenarii/svartalfheim.py diff --git a/idk/vanaheim.py b/scenarii/vanaheim.py similarity index 100% rename from idk/vanaheim.py rename to scenarii/vanaheim.py