gammatools/app/tables/creature.py

20 lines
512 B
Python
Raw Normal View History

import json
class Creatures:
creatures = None
@staticmethod
def load_creature_data():
"""Loads the monsters data from a JSON file"""
with open('app/tables/creatures.json') as f:
Creatures.creatures = json.load(f)
def __init__(self):
if not Creatures.creatures:
self.load_creature_data()
def get_creature(self, creature_name):
"""Returns the dictionary of the specified creature."""
return self.creatures.get(creature_name)