annotate skaapsteker/sprites/items.py @ 296:15b2be883a40

Ancient and honorable tea ceremony.
author Jeremy Thurgood <firxen@gmail.com>
date Fri, 08 Apr 2011 22:29:49 +0200
parents e06c54d7701f
children 2844edb6c1cc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
127
e1dd3b785269 Initial game state stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
1 from base import Item
e1dd3b785269 Initial game state stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
2
e1dd3b785269 Initial game state stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
3
189
9d08f99b5ddf Add npcs to gamestate. Update gamestate. Pass world around a bit. Some other stuff.
Simon Cross <hodgestar@gmail.com>
parents: 162
diff changeset
4 class TeaCup(Item):
9d08f99b5ddf Add npcs to gamestate. Update gamestate. Pass world around a bit. Some other stuff.
Simon Cross <hodgestar@gmail.com>
parents: 162
diff changeset
5 image_file = 'teacup_empty.png'
9d08f99b5ddf Add npcs to gamestate. Update gamestate. Pass world around a bit. Some other stuff.
Simon Cross <hodgestar@gmail.com>
parents: 162
diff changeset
6
9d08f99b5ddf Add npcs to gamestate. Update gamestate. Pass world around a bit. Some other stuff.
Simon Cross <hodgestar@gmail.com>
parents: 162
diff changeset
7
9d08f99b5ddf Add npcs to gamestate. Update gamestate. Pass world around a bit. Some other stuff.
Simon Cross <hodgestar@gmail.com>
parents: 162
diff changeset
8 class TeaLeaf(Item):
162
663bdac80299 Fix items, and stop the tea from looking like a monk.
Jeremy Thurgood <firxen@gmail.com>
parents: 127
diff changeset
9 image_file = 'tealeaf.png'
127
e1dd3b785269 Initial game state stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
10
189
9d08f99b5ddf Add npcs to gamestate. Update gamestate. Pass world around a bit. Some other stuff.
Simon Cross <hodgestar@gmail.com>
parents: 162
diff changeset
11
191
993f4f55eb93 Minor item changes.
Jeremy Thurgood <firxen@gmail.com>
parents: 189
diff changeset
12 class TeaCupFull(Item):
993f4f55eb93 Minor item changes.
Jeremy Thurgood <firxen@gmail.com>
parents: 189
diff changeset
13 image_file = 'teacup_full.png'
993f4f55eb93 Minor item changes.
Jeremy Thurgood <firxen@gmail.com>
parents: 189
diff changeset
14
993f4f55eb93 Minor item changes.
Jeremy Thurgood <firxen@gmail.com>
parents: 189
diff changeset
15
189
9d08f99b5ddf Add npcs to gamestate. Update gamestate. Pass world around a bit. Some other stuff.
Simon Cross <hodgestar@gmail.com>
parents: 162
diff changeset
16 class TeaPot(Item):
9d08f99b5ddf Add npcs to gamestate. Update gamestate. Pass world around a bit. Some other stuff.
Simon Cross <hodgestar@gmail.com>
parents: 162
diff changeset
17 image_file = 'teapot.png'
191
993f4f55eb93 Minor item changes.
Jeremy Thurgood <firxen@gmail.com>
parents: 189
diff changeset
18 portable = False
237
e06c54d7701f Add vase to demonstrate item state testing in dialogues.
Simon Cross <hodgestar@gmail.com>
parents: 191
diff changeset
19
296
15b2be883a40 Ancient and honorable tea ceremony.
Jeremy Thurgood <firxen@gmail.com>
parents: 237
diff changeset
20 def setup(self, brewed, **opts):
15b2be883a40 Ancient and honorable tea ceremony.
Jeremy Thurgood <firxen@gmail.com>
parents: 237
diff changeset
21 super(TeaPot, self).setup(**opts)
15b2be883a40 Ancient and honorable tea ceremony.
Jeremy Thurgood <firxen@gmail.com>
parents: 237
diff changeset
22
15b2be883a40 Ancient and honorable tea ceremony.
Jeremy Thurgood <firxen@gmail.com>
parents: 237
diff changeset
23
15b2be883a40 Ancient and honorable tea ceremony.
Jeremy Thurgood <firxen@gmail.com>
parents: 237
diff changeset
24 def player_action(self, player):
15b2be883a40 Ancient and honorable tea ceremony.
Jeremy Thurgood <firxen@gmail.com>
parents: 237
diff changeset
25 if player.has_item('tealeaf'):
15b2be883a40 Ancient and honorable tea ceremony.
Jeremy Thurgood <firxen@gmail.com>
parents: 237
diff changeset
26 self.item_state.brewed = True
15b2be883a40 Ancient and honorable tea ceremony.
Jeremy Thurgood <firxen@gmail.com>
parents: 237
diff changeset
27 player.discard_item()
15b2be883a40 Ancient and honorable tea ceremony.
Jeremy Thurgood <firxen@gmail.com>
parents: 237
diff changeset
28 return
15b2be883a40 Ancient and honorable tea ceremony.
Jeremy Thurgood <firxen@gmail.com>
parents: 237
diff changeset
29 if player.has_item('teacup'):
15b2be883a40 Ancient and honorable tea ceremony.
Jeremy Thurgood <firxen@gmail.com>
parents: 237
diff changeset
30 if self.item_state.brewed:
15b2be883a40 Ancient and honorable tea ceremony.
Jeremy Thurgood <firxen@gmail.com>
parents: 237
diff changeset
31 player.discard_item()
15b2be883a40 Ancient and honorable tea ceremony.
Jeremy Thurgood <firxen@gmail.com>
parents: 237
diff changeset
32 player.take_item_by_name('teacupfull')
15b2be883a40 Ancient and honorable tea ceremony.
Jeremy Thurgood <firxen@gmail.com>
parents: 237
diff changeset
33 self.item_state.brewed = False
15b2be883a40 Ancient and honorable tea ceremony.
Jeremy Thurgood <firxen@gmail.com>
parents: 237
diff changeset
34 else:
15b2be883a40 Ancient and honorable tea ceremony.
Jeremy Thurgood <firxen@gmail.com>
parents: 237
diff changeset
35 print "Sadly, the teapot is empty."
15b2be883a40 Ancient and honorable tea ceremony.
Jeremy Thurgood <firxen@gmail.com>
parents: 237
diff changeset
36
15b2be883a40 Ancient and honorable tea ceremony.
Jeremy Thurgood <firxen@gmail.com>
parents: 237
diff changeset
37
237
e06c54d7701f Add vase to demonstrate item state testing in dialogues.
Simon Cross <hodgestar@gmail.com>
parents: 191
diff changeset
38
e06c54d7701f Add vase to demonstrate item state testing in dialogues.
Simon Cross <hodgestar@gmail.com>
parents: 191
diff changeset
39 class Vase(Item):
e06c54d7701f Add vase to demonstrate item state testing in dialogues.
Simon Cross <hodgestar@gmail.com>
parents: 191
diff changeset
40 image_file = 'dummy.png'
e06c54d7701f Add vase to demonstrate item state testing in dialogues.
Simon Cross <hodgestar@gmail.com>
parents: 191
diff changeset
41
e06c54d7701f Add vase to demonstrate item state testing in dialogues.
Simon Cross <hodgestar@gmail.com>
parents: 191
diff changeset
42 def setup(self, broken, **opts):
e06c54d7701f Add vase to demonstrate item state testing in dialogues.
Simon Cross <hodgestar@gmail.com>
parents: 191
diff changeset
43 super(Vase, self).setup(**opts)
e06c54d7701f Add vase to demonstrate item state testing in dialogues.
Simon Cross <hodgestar@gmail.com>
parents: 191
diff changeset
44 self.broken = broken