Mercurial > skaapsteker
annotate skaapsteker/sprites/items.py @ 383:87246b84a851
Notification text.
author | Jeremy Thurgood <firxen@gmail.com> |
---|---|
date | Sat, 09 Apr 2011 16:02:51 +0200 |
parents | b37dbc557ae0 |
children | de71c3fa5626 |
rev | line source |
---|---|
383 | 1 from .. import engine |
2 from .base import Item | |
127 | 3 |
4 | |
354
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
5 class BreakableItem(Item): |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
6 whole_image_file = None |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
7 broken_image_file = None |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
8 |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
9 def setup(self, broken, **opts): |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
10 super(BreakableItem, self).setup(**opts) |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
11 self.broken = broken |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
12 |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
13 |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
14 def setup_image_data(self, pos): |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
15 self.image_file = self.broken_image_file if self._me.broken else self.whole_image_file |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
16 super(BreakableItem, self).setup_image_data(pos) |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
17 |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
18 |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
19 def smash(self): |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
20 self._me.broken = True |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
21 self.broken = True |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
22 self.setup_image_data(self._starting_tile_pos) |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
23 |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
24 |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
25 |
335 | 26 ################################################## |
27 # Collectibles | |
28 | |
29 class Aburage(Item): | |
30 image_file = 'tofu.png' | |
31 | |
32 def player_action(self, player): | |
33 player.eat_aburage() | |
34 self.remove() | |
35 | |
36 | |
340 | 37 class HaikuScroll(Item): |
38 image_file = 'haiku-scroll.png' | |
39 | |
40 def player_action(self, player): | |
41 player.collect_scroll(self) | |
42 self.remove() | |
43 | |
44 | |
45 def setup(self, text, **opts): | |
46 super(HaikuScroll, self).setup(**opts) | |
47 self.text = text | |
48 | |
49 | |
335 | 50 |
51 ################################################## | |
52 # Monk tea mission | |
53 | |
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
|
54 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
|
55 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
|
56 |
9d08f99b5ddf
Add npcs to gamestate. Update gamestate. Pass world around a bit. Some other stuff.
Simon Cross <hodgestar@gmail.com>
parents:
162
diff
changeset
|
57 |
9d08f99b5ddf
Add npcs to gamestate. Update gamestate. Pass world around a bit. Some other stuff.
Simon Cross <hodgestar@gmail.com>
parents:
162
diff
changeset
|
58 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
|
59 image_file = 'tealeaf.png' |
127 | 60 |
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
|
61 |
191 | 62 class TeaCupFull(Item): |
63 image_file = 'teacup_full.png' | |
64 | |
65 | |
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
|
66 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
|
67 image_file = 'teapot.png' |
237
e06c54d7701f
Add vase to demonstrate item state testing in dialogues.
Simon Cross <hodgestar@gmail.com>
parents:
191
diff
changeset
|
68 |
296
15b2be883a40
Ancient and honorable tea ceremony.
Jeremy Thurgood <firxen@gmail.com>
parents:
237
diff
changeset
|
69 def setup(self, brewed, **opts): |
15b2be883a40
Ancient and honorable tea ceremony.
Jeremy Thurgood <firxen@gmail.com>
parents:
237
diff
changeset
|
70 super(TeaPot, self).setup(**opts) |
15b2be883a40
Ancient and honorable tea ceremony.
Jeremy Thurgood <firxen@gmail.com>
parents:
237
diff
changeset
|
71 |
15b2be883a40
Ancient and honorable tea ceremony.
Jeremy Thurgood <firxen@gmail.com>
parents:
237
diff
changeset
|
72 |
15b2be883a40
Ancient and honorable tea ceremony.
Jeremy Thurgood <firxen@gmail.com>
parents:
237
diff
changeset
|
73 def player_action(self, player): |
15b2be883a40
Ancient and honorable tea ceremony.
Jeremy Thurgood <firxen@gmail.com>
parents:
237
diff
changeset
|
74 if player.has_item('tealeaf'): |
335 | 75 self._me.brewed = True |
296
15b2be883a40
Ancient and honorable tea ceremony.
Jeremy Thurgood <firxen@gmail.com>
parents:
237
diff
changeset
|
76 player.discard_item() |
383 | 77 engine.OpenNotification.post(text="A nice cup of tea is brewing.") |
296
15b2be883a40
Ancient and honorable tea ceremony.
Jeremy Thurgood <firxen@gmail.com>
parents:
237
diff
changeset
|
78 return |
15b2be883a40
Ancient and honorable tea ceremony.
Jeremy Thurgood <firxen@gmail.com>
parents:
237
diff
changeset
|
79 if player.has_item('teacup'): |
335 | 80 if self._me.brewed: |
296
15b2be883a40
Ancient and honorable tea ceremony.
Jeremy Thurgood <firxen@gmail.com>
parents:
237
diff
changeset
|
81 player.discard_item() |
15b2be883a40
Ancient and honorable tea ceremony.
Jeremy Thurgood <firxen@gmail.com>
parents:
237
diff
changeset
|
82 player.take_item_by_name('teacupfull') |
335 | 83 self._me.brewed = False |
296
15b2be883a40
Ancient and honorable tea ceremony.
Jeremy Thurgood <firxen@gmail.com>
parents:
237
diff
changeset
|
84 else: |
15b2be883a40
Ancient and honorable tea ceremony.
Jeremy Thurgood <firxen@gmail.com>
parents:
237
diff
changeset
|
85 print "Sadly, the teapot is empty." |
383 | 86 return |
87 engine.OpenNotification.post(text="A proper tea ceremony requires a cup.") | |
296
15b2be883a40
Ancient and honorable tea ceremony.
Jeremy Thurgood <firxen@gmail.com>
parents:
237
diff
changeset
|
88 |
15b2be883a40
Ancient and honorable tea ceremony.
Jeremy Thurgood <firxen@gmail.com>
parents:
237
diff
changeset
|
89 |
354
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
90 |
335 | 91 ################################################## |
354
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
92 # Guard seduction |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
93 |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
94 |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
95 class Fan(Item): |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
96 image_file = 'fan.png' |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
97 |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
98 |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
99 |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
100 ################################################## |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
101 # Samurai distraction |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
102 |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
103 |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
104 class Kindling(Item): |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
105 image_file = 'props/kindling.png' |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
106 |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
107 |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
108 class Oil(Item): |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
109 image_file = 'props/oil.png' |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
110 |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
111 |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
112 |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
113 ################################################## |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
114 # Cannon destruction |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
115 |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
116 |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
117 class Cannon(BreakableItem): |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
118 whole_image_file = 'props/cannon-whole.png' |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
119 broken_image_file = 'props/cannon-broken.png' |
335 | 120 |
121 | |
237
e06c54d7701f
Add vase to demonstrate item state testing in dialogues.
Simon Cross <hodgestar@gmail.com>
parents:
191
diff
changeset
|
122 |
354
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
123 ################################################## |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
124 # Geisha character assassination |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
125 |
237
e06c54d7701f
Add vase to demonstrate item state testing in dialogues.
Simon Cross <hodgestar@gmail.com>
parents:
191
diff
changeset
|
126 |
354
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
127 class Vase(BreakableItem): |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
128 whole_image_file = 'props/vase-whole.png' |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
129 broken_image_file = 'props/vase-broken.png' |
297
2844edb6c1cc
Hook up maneki, kaneda2 and the fishmonger who were hiding in limbo (i.e. not in game.json).
Simon Cross <hodgestar@gmail.com>
parents:
296
diff
changeset
|
130 |
2844edb6c1cc
Hook up maneki, kaneda2 and the fishmonger who were hiding in limbo (i.e. not in game.json).
Simon Cross <hodgestar@gmail.com>
parents:
296
diff
changeset
|
131 |
2844edb6c1cc
Hook up maneki, kaneda2 and the fishmonger who were hiding in limbo (i.e. not in game.json).
Simon Cross <hodgestar@gmail.com>
parents:
296
diff
changeset
|
132 class Salmon(Item): |
354
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
133 image_file = 'props/fish.png' |
335 | 134 |
135 | |
136 | |
354
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
137 ################################################## |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
138 # Theatrical debut |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
139 |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
140 |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
141 class NoMask(BreakableItem): |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
142 whole_image_file = 'props/no-mask-whole.png' |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
143 broken_image_file = 'props/no-mask-broken.png' |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
144 |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
145 |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
146 class NoCostume(Item): |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
147 image_file = 'props/no-costume.png' |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
148 |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
149 |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
150 |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
151 ################################################## |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
152 # Big business |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
153 |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
154 |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
155 class Rice(BreakableItem): |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
156 whole_image_file = 'props/rice-whole.png' |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
157 broken_image_file = 'props/rice-broken.png' |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
158 |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
159 |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
160 class Documents(Item): |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
161 image_file = 'haiku-scroll.png' |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
162 |