Let there be roaches.
[koperkapel.git] / koperkapel / world.py
diff --git a/koperkapel/world.py b/koperkapel/world.py
new file mode 100644 (file)
index 0000000..efb6403
--- /dev/null
@@ -0,0 +1,44 @@
+""" World and player state. """
+
+
+class World:
+    """ World and player state. """
+
+    def __init__(self):
+        self._state = self._build_initial_state()
+
+    @property
+    def level(self):
+        return self._level["level"]
+
+    @property
+    def roaches(self):
+        return self._state["roaches"]
+
+    def _build_initial_state(self):
+        state = {}
+        state["roaches"] = [
+            self._build_roach("roachel", intelligence=3),
+            self._build_roach("roeginald", strength=3),
+            self._build_roach("roichard", quickness=3),
+        ]
+        state["level"] = {
+            "file": "level1.json",
+        }
+        return state
+
+    def _build_roach(self, name, **kw):
+        attributes = {
+            "intelligence": 1,
+            "strength": 1,
+            "quickness": 1,
+            "health": 5,
+        }
+        attributes.update(kw)
+        return {
+            "name": name,
+            "attributes": attributes,
+        }
+
+    def apply_event(self, *args, **kw):
+        pass