Let there be roaches.
[koperkapel.git] / koperkapel / world.py
1 """ World and player state. """
2
3
4 class World:
5     """ World and player state. """
6
7     def __init__(self):
8         self._state = self._build_initial_state()
9
10     @property
11     def level(self):
12         return self._level["level"]
13
14     @property
15     def roaches(self):
16         return self._state["roaches"]
17
18     def _build_initial_state(self):
19         state = {}
20         state["roaches"] = [
21             self._build_roach("roachel", intelligence=3),
22             self._build_roach("roeginald", strength=3),
23             self._build_roach("roichard", quickness=3),
24         ]
25         state["level"] = {
26             "file": "level1.json",
27         }
28         return state
29
30     def _build_roach(self, name, **kw):
31         attributes = {
32             "intelligence": 1,
33             "strength": 1,
34             "quickness": 1,
35             "health": 5,
36         }
37         attributes.update(kw)
38         return {
39             "name": name,
40             "attributes": attributes,
41         }
42
43     def apply_event(self, *args, **kw):
44         pass