source: nagslang/protagonist.py@ 56:b9430b4a48da

Last change on this file since 56:b9430b4a48da was 28:c03982fe3c70, checked in by Jeremy Thurgood <firxen@…>, 8 years ago

Protagonist and environment.

File size: 1.2 KB
Line 
1
2
3class Protagonist(object):
4 """Representation of our fearless protagonist.
5
6 TODO: Factor out a bunch of this stuff when we need it for other objects.
7 """
8
9 HUMAN_FORM = 'human'
10 WOLF_FORM = 'wolf'
11
12 def __init__(self):
13 self.inventory = {}
14 self.form = self.HUMAN_FORM
15
16 @classmethod
17 def from_saved_state(cls, saved_state):
18 """Create an instance from the provided serialised state.
19 """
20 obj = cls()
21 # TODO: Update from saved state.
22 return obj
23
24 def act_on(self, target):
25 """Perform an action on the target.
26 """
27 # TODO: Decide how best to do this.
28 pass
29
30 def change_to_form(self, form):
31 """Change to a particular form.
32
33 This will be a no-op if we're already in this form.
34 """
35 pass
36
37 def swap_form(self):
38 """Swap to your other form.
39 """
40 pass
41
42 def attack(self):
43 """Attempt to hurt something.
44 """
45 pass
46
47 def in_wolf_form(self):
48 return self.form == self.WOLF_FORM
49
50 def in_human_form(self):
51 return self.form == self.HUMAN_FORM
52
53 def has_item(self, item):
54 return item in self.inventory
Note: See TracBrowser for help on using the repository browser.