diff --git a/app/functions/get_creature.py b/app/functions/get_creature.py new file mode 100644 index 0000000..2948204 --- /dev/null +++ b/app/functions/get_creature.py @@ -0,0 +1,6 @@ +from app.tables.creature import Creatures + + +def get_creature(creature_id): + creature = Creatures() + return creature.get_creature(creature_id) diff --git a/app/routes/encounter.py b/app/routes/encounter.py index 655b632..f262a3d 100644 --- a/app/routes/encounter.py +++ b/app/routes/encounter.py @@ -1,5 +1,7 @@ from flask import request from flask_restx import Resource, Namespace, reqparse + +from app.functions.get_creature import get_creature from app.functions.roll_encounter import roll_encounter namespace = Namespace('gameplay', description='Gamma World Game Play') @@ -18,7 +20,13 @@ class RollEncounter(Resource): valid_terrains = ["clear", "mountains", "forest", "desert", "watery", "ruins", "deathlands"] if terrain: if terrain.lower() in valid_terrains: - return roll_encounter(terrain.lower()), 200 + details = dict() + encounter = roll_encounter(terrain.lower()) + details["name"] = encounter["encounter"] + creature_stats = get_creature(encounter["encounter"]) + if creature_stats is not None: + details.update(creature_stats) + return details, 200 else: return { 'error': 'Invalid terrain type provided.', diff --git a/app/tables/creatures.json b/app/tables/creatures.json index 9d86e7e..78fb2d3 100644 --- a/app/tables/creatures.json +++ b/app/tables/creatures.json @@ -367,5 +367,26 @@ "mutations": ["Death Field Generation", "Life Leach", "Manipulative Vines", "Mobility", "Molecular Disruption", "Symbiotic Attachment"], "description": "[Red Crep | Pink Crep] Creps come in 2 varieties: the Water Crep (also called the Pink Crep) and the Land Crep (also called the Red Crep). Water Creps live totally submerged and Land Creps grow under a mat of other foliage. Both are carnivorous, using their broad flat leaves to feed by Life Leaching those with whom they come into contact. Leaves that have been used to feed drop off once the victim escapes or dies, eventually sprouting new plants. [HOUSE NOTE: Players snared by a Crep Plant must make a Dex Check to escape. Life Leach attacks continue for each round the Dex Check fails. - GMG]" + }, + "fen": { + "number": [1, 10, 0], + "morale": [1, 6, 4], + "hit dice": [10, 6, 0], + "armour": 7, + "environ": ["land","water", "air"], + "land speed": [0, 300, 6], + "water speed": [6, 1800, 36], + "air speed": [0, 1800, 36], + "ms": [1, 10, 2], + "in": [1, 10, 8], + "dx": [1, 10, 2], + "ch": [1, 8, 1], + "cn": [1, 12, 4], + "ps": [1, 10, 8], + "attacks": {"Tail Slap": [6,6,0]}, + "mutations": ["Shape change"], + "description": "[Man Fish] These intelligent Humanoids are adapted for living both on land and in water, having fish-like tails, stubby legs, and both lungs and gills. They can remain out of water for only 24 hours at a time. They are not affected by attacks involving heat or lasers during the first 5 action turns these attacks are used against them in a combat. Fens can shape-change into the form of a bird of their own size. They carry Tech Level I weapons (usually clubs) and wear Fishkin Armour (similar to fiber armour)." } + + } \ No newline at end of file diff --git a/app/tables/encounters.py b/app/tables/encounters.py index 6b005ea..9473f53 100644 --- a/app/tables/encounters.py +++ b/app/tables/encounters.py @@ -9,18 +9,18 @@ class EncounterTable: 'centisteed', 'rakox', 'rakox', 'brutorz', 'hoop', 'hawkoid', 'hopper', 'hopper', None, None], 'mountains': ['hisser', 'blight', 'parn', 'zarn', 'manta', 'orlen', 'zeethh', 'sep', 'arn', 'yexil', 'herp', 'wardent', 'kep plant', 'crep plant', 'cal then', 'ark', 'hawkoid', 'podog', 'carrin', None], - 'forest': ['hisser', 'sep', 'blaash', 'blackun', 'terl', 'winseen', 'pineto', 'perth', 'obb', 'kailin', - 'grens', 'badder', 'arn', 'lil', 'blood bird', 'horl choo', 'soul besh', 'dabber', 'centisteed', + 'forest': ['hisser', 'sep', 'blaash', 'blackun', 'terl', 'win seen', 'pineto', 'perth', 'obb', 'kailin', + 'gren', 'badder', 'arn', 'lil', 'blood bird', 'horl choo', 'soul besh', 'dabber', 'centisteed', None], 'desert': ['serf', 'kamodo', 'blight', 'perth', 'parn', 'zarn', 'yexil', 'hisser', 'sep', 'calthen', 'manta', 'kep plant', 'carrin', 'podog', None, None, None, None, None, None], - 'watery': ['winseen', 'crep plant', 'seroon loo', 'terl', 'ert telden', 'barl nep', 'ert', 'fleshin', - 'keeshin', 'narlep', 'menarl', 'herkel', 'berlep', 'crentosh', 'fen', 'gator', None, None, None, + 'watery': ['win seen', 'crep plant', 'seroon lou', 'terl', 'ert telden', 'barl nep', 'ert', 'fleshin', + 'keeshin', 'narl ep', 'menarl', 'herkel', 'ber lep', 'cren tosh', 'fen', 'gator', None, None, None, None], 'ruins': ['arn', 'obb', 'hoop', 'android', 'badder', 'serf', 'blaash', 'yexil', 'manta', 'ark', 'orlen', 'dabber', 'sleeth', 'carrin', 'squeeker', 'squeeker', 'squeeker', None, None, None], 'deathlands': ['android', 'hisser', 'blight', 'zarn', 'perth', 'blaash', 'serf', 'parn', 'squeeker', - 'squeekr', None, None, None, None, None, None, None, None, None, None] + 'squeeker', None, None, None, None, None, None, None, None, None, None] } self.table_dataframe = pd.DataFrame(self.table) self.table_dataframe.index = np.arange(1, len(self.table_dataframe) + 1) diff --git a/web/encounter.html b/web/encounter.html index 5521f98..2338148 100644 --- a/web/encounter.html +++ b/web/encounter.html @@ -2,6 +2,7 @@
+