From 379e007e9d4bfe8fb47600d458ac0d4aa342d90e Mon Sep 17 00:00:00 2001 From: lxgr-linux Date: Sun, 30 May 2021 12:53:07 +0200 Subject: [PATCH] removed test, moved items to pokete_data, added items to wiki --- gen-wiki.py | 27 ++++++++++++++++++++++++++- pokete.py | 16 +++++----------- pokete_data/__init__.py | 10 ++++++++++ pokete_data/items.py | 30 ++++++++++++++++++++++++++++++ wiki.md | 24 ++++++++++++++++++++++++ 5 files changed, 95 insertions(+), 12 deletions(-) create mode 100644 pokete_data/__init__.py create mode 100644 pokete_data/items.py diff --git a/gen-wiki.py b/gen-wiki.py index beb8e3a9..f0073959 100755 --- a/gen-wiki.py +++ b/gen-wiki.py @@ -3,6 +3,7 @@ from pokete_data.poketes import * from pokete_data.attacks import * from pokete_data.types import * +from pokete_data.items import * md_str = """# Pokete wiki This wiki/documentation is a compilation of all Poketes/attacks/types present in the Pokete game. @@ -12,6 +13,7 @@ 1. [Poketes](#poketes) """ + # Table of contents for j, poke in enumerate(sorted([i for i in pokes][1:])): md_str += f""" {j+1}. [{pokes[poke]["name"]}](#{poke})\n""" @@ -21,9 +23,16 @@ for j, atc in enumerate(sorted(attacs)): md_str += f""" {j+1}. [{attacs[atc]["name"]}](#{atc.replace("_", "-")})\n""" -# Poketes md_str += """3. [Types](#types) +4. [Items](#items) +""" + +for j, item in enumerate(sorted(items)): + md_str += f""" {j+1}. [{items[item]["pretty_name"]}](#{item.replace("_", "-")})\n""" + +# Poketes +md_str += """ ## Poketes In the following all Poketes with their attributes are displayed. """ @@ -52,6 +61,7 @@ {evolve_txt} """ + # Attacks md_str += """ ## Attacks @@ -69,6 +79,7 @@ - Attack points: {attacs[atc]["ap"]} """ + # Types md_str += """ ## Types @@ -88,6 +99,20 @@ md_str += f"{type.capitalize()}|{effective}|{ineffective}\n" +# Items +md_str += """ +## Items +Those are all items present in the game, that can be traded or found. +""" + +for item in sorted(items): + md_str += f""" +### {items[item]["pretty_name"]} +{items[item]["desc"]} +- Price: {items[item]["price"]} +""" + + # writing to file with open("wiki.md", "w+") as file: file.write(md_str) diff --git a/pokete.py b/pokete.py index 69e1a93e..9b2abbcd 100755 --- a/pokete.py +++ b/pokete.py @@ -9,11 +9,7 @@ import random, time, os, sys, threading, math import scrap_engine as se from pathlib import Path -from pokete_data.poketes import * -from pokete_data.attacks import * -from pokete_data.maps import * -from pokete_data.classes import * -from pokete_data.types import * +from pokete_data import * # Class definition ################## @@ -803,7 +799,7 @@ def buy(): ev = "" buybox.add(movemap, movemap.width-35, 0) buybox2.add(movemap, buybox.x-19, 3) - items = [invbox.poketeball, invbox.superball, invbox.test, invbox.heal_potion, invbox.super_potion] + items = [invbox.poketeball, invbox.superball, invbox.healing_potion, invbox.super_potion] obs = [se.Text(ob.pretty_name+" : "+str(ob.price)+"$") for ob in items] for i, ob in enumerate(obs): buybox.add_ob(ob, 4, 1+i) @@ -1629,11 +1625,9 @@ def recogniser(): # adding invbox2.add_ob(invbox2.desc_label, 1, 1) # every possible item for the inv has to have such an onbject -invbox.poketeball = InvItem("poketeball", "Poketeball", "A ball you can use to catch Poketes", 2, fight_poketeball) -invbox.superball = InvItem("superball", "Superball", "A ball you can use to catch Poketes with an increased chance", 10, fight_superball) -invbox.test = InvItem("test", "Test", "A fucking test, a test, a test bla bla bla. test test 123", 10) -invbox.heal_potion = InvItem("heal_potion", "Healing potion", "Heals a Pokete with 5 HP", 15, fight_heal_potion) -invbox.super_potion = InvItem("super_potion", "Super potion", "Heals a Pokete with 15 HP", 25, fight_super_potion) +# invbox.poketeball = InvItem("poketeball", "Poketeball", "A ball you can use to catch Poketes", 2, fight_poketeball) +for name in items: + exec(f'invbox.{name} = InvItem(name, items[name]["pretty_name"], items[name]["desc"], items[name]["price"], {items[name]["fn"]})') # buybox buybox = ChooseBox(height-3, 35, "Shop") diff --git a/pokete_data/__init__.py b/pokete_data/__init__.py new file mode 100644 index 00000000..d9b81e27 --- /dev/null +++ b/pokete_data/__init__.py @@ -0,0 +1,10 @@ +from pokete_data.poketes import * +from pokete_data.attacks import * +from pokete_data.maps import * +from pokete_data.classes import * +from pokete_data.types import * +from pokete_data.items import * + + +if __name__ == "__main__": + print("\033[31;1mDo not execute this!\033[0m") diff --git a/pokete_data/items.py b/pokete_data/items.py new file mode 100644 index 00000000..d4726dfd --- /dev/null +++ b/pokete_data/items.py @@ -0,0 +1,30 @@ +items = { + "poketeball": { + "pretty_name": "Poketeball", + "desc": "A ball you can use to catch Poketes", + "price": 2, + "fn": "fight_poketeball" + }, + "superball": { + "pretty_name": "Superball", + "desc": "A ball you can use to catch Poketes with an increased chance", + "price": 10, + "fn": "fight_superball" + }, + "healing_potion": { + "pretty_name": "Healing potion", + "desc": "Heals a Pokete with 5 HP", + "price": 15, + "fn": "fight_heal_potion" + }, + "super_potion": { + "pretty_name": "Super potion", + "desc": "Heals a Pokete with 15 HP", + "price": 25, + "fn": "fight_super_potion" + }, +} + + +if __name__ == "__main__": + print("\033[31;1mDo not execute this!\033[0m") diff --git a/wiki.md b/wiki.md index 0b7b0238..1ce8a84c 100644 --- a/wiki.md +++ b/wiki.md @@ -52,6 +52,11 @@ This wiki can be generated using ```$ gen-wiki.py```. 24. [Tail wipe](#tail-wipe) 25. [Wing hit](#wing-hit) 3. [Types](#types) +4. [Items](#items) + 1. [Healing potion](#healing-potion) + 2. [Poketeball](#poketeball) + 3. [Super potion](#super-potion) + 4. [Superball](#superball) ## Poketes In the following all Poketes with their attributes are displayed. @@ -724,3 +729,22 @@ Fire|Flying, Plant|Stone, Water Ground|Normal|Flying Electro|Stone, Flying|Ground Flying|Plant|Stone + +## Items +Those are all items present in the game, that can be traded or found. + +### Healing potion +Heals a Pokete with 5 HP +- Price: 15 + +### Poketeball +A ball you can use to catch Poketes +- Price: 2 + +### Super potion +Heals a Pokete with 15 HP +- Price: 25 + +### Superball +A ball you can use to catch Poketes with an increased chance +- Price: 10