Mercurial > skaapsteker
annotate skaapsteker/sprites/items.py @ 535:d7f3329a6bf8
Fix theatre mission.
author | Jeremy Thurgood <firxen@gmail.com> |
---|---|
date | Sun, 10 Apr 2011 00:26:39 +0200 |
parents | eec2cf912e03 |
children | f36e7a885373 |
rev | line source |
---|---|
529
0ffb493a6fa4
Add support for sounds for breaking objects.
Simon Cross <hodgestar@gmail.com>
parents:
525
diff
changeset
|
1 from .. import engine, data, sound |
442
a084af91d5dc
Make breakable items break
Neil Muller <drnlmuller@gmail.com>
parents:
434
diff
changeset
|
2 from .base import Item, PC_LAYER, PROJECTILE_LAYER |
a084af91d5dc
Make breakable items break
Neil Muller <drnlmuller@gmail.com>
parents:
434
diff
changeset
|
3 |
474 | 4 import time |
5 | |
127 | 6 |
7 | |
388 | 8 def notify(text): |
9 engine.OpenNotification.post(text=text) | |
10 | |
11 | |
354
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
12 class BreakableItem(Item): |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
13 whole_image_file = None |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
14 broken_image_file = None |
532
eec2cf912e03
Add tearing rice sound. Only smash breakables once.
Simon Cross <hodgestar@gmail.com>
parents:
529
diff
changeset
|
15 breaking_sound = None, None |
354
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
16 |
442
a084af91d5dc
Make breakable items break
Neil Muller <drnlmuller@gmail.com>
parents:
434
diff
changeset
|
17 collides_with = set([PC_LAYER, PROJECTILE_LAYER]) |
a084af91d5dc
Make breakable items break
Neil Muller <drnlmuller@gmail.com>
parents:
434
diff
changeset
|
18 |
354
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
19 def setup(self, broken, **opts): |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
20 super(BreakableItem, self).setup(**opts) |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
21 self.broken = broken |
529
0ffb493a6fa4
Add support for sounds for breaking objects.
Simon Cross <hodgestar@gmail.com>
parents:
525
diff
changeset
|
22 if self.breaking_sound[0] is not None: |
0ffb493a6fa4
Add support for sounds for breaking objects.
Simon Cross <hodgestar@gmail.com>
parents:
525
diff
changeset
|
23 track, volume = self.breaking_sound |
0ffb493a6fa4
Add support for sounds for breaking objects.
Simon Cross <hodgestar@gmail.com>
parents:
525
diff
changeset
|
24 sound.load_sound(track, track, volume) |
354
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
25 |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
26 def setup_image_data(self, pos): |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
27 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
|
28 super(BreakableItem, self).setup_image_data(pos) |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
29 |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
30 |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
31 def smash(self): |
532
eec2cf912e03
Add tearing rice sound. Only smash breakables once.
Simon Cross <hodgestar@gmail.com>
parents:
529
diff
changeset
|
32 if not self._me.broken: |
eec2cf912e03
Add tearing rice sound. Only smash breakables once.
Simon Cross <hodgestar@gmail.com>
parents:
529
diff
changeset
|
33 self._me.broken = True |
eec2cf912e03
Add tearing rice sound. Only smash breakables once.
Simon Cross <hodgestar@gmail.com>
parents:
529
diff
changeset
|
34 self.broken = True |
eec2cf912e03
Add tearing rice sound. Only smash breakables once.
Simon Cross <hodgestar@gmail.com>
parents:
529
diff
changeset
|
35 self.setup_image_data(self._starting_tile_pos) |
eec2cf912e03
Add tearing rice sound. Only smash breakables once.
Simon Cross <hodgestar@gmail.com>
parents:
529
diff
changeset
|
36 if self.breaking_sound[0] is not None: |
eec2cf912e03
Add tearing rice sound. Only smash breakables once.
Simon Cross <hodgestar@gmail.com>
parents:
529
diff
changeset
|
37 sound.play_sound(self.breaking_sound[0]) |
354
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
38 |
442
a084af91d5dc
Make breakable items break
Neil Muller <drnlmuller@gmail.com>
parents:
434
diff
changeset
|
39 def damage(self, damage): |
a084af91d5dc
Make breakable items break
Neil Muller <drnlmuller@gmail.com>
parents:
434
diff
changeset
|
40 self.smash() |
354
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
41 |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
42 |
335 | 43 ################################################## |
44 # Collectibles | |
45 | |
46 class Aburage(Item): | |
397 | 47 image_file = 'props/tofu.png' |
335 | 48 |
49 def player_action(self, player): | |
50 player.eat_aburage() | |
51 self.remove() | |
52 | |
53 | |
340 | 54 class HaikuScroll(Item): |
397 | 55 image_file = 'props/haiku-scroll.png' |
340 | 56 |
57 def player_action(self, player): | |
58 player.collect_scroll(self) | |
522
4de4f94c326d
Move skaapsteker behind stuff and make haiku scrolls display text on collection.
Jeremy Thurgood <firxen@gmail.com>
parents:
518
diff
changeset
|
59 notify("The scroll looks like a fragment of a haiku: '%s'" % self.text) |
340 | 60 self.remove() |
61 | |
62 | |
63 def setup(self, text, **opts): | |
64 super(HaikuScroll, self).setup(**opts) | |
65 self.text = text | |
66 | |
67 | |
335 | 68 |
69 ################################################## | |
70 # Monk tea mission | |
71 | |
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
|
72 class TeaCup(Item): |
397 | 73 image_file = 'props/teacup_empty.png' |
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
|
74 |
9d08f99b5ddf
Add npcs to gamestate. Update gamestate. Pass world around a bit. Some other stuff.
Simon Cross <hodgestar@gmail.com>
parents:
162
diff
changeset
|
75 |
9d08f99b5ddf
Add npcs to gamestate. Update gamestate. Pass world around a bit. Some other stuff.
Simon Cross <hodgestar@gmail.com>
parents:
162
diff
changeset
|
76 class TeaLeaf(Item): |
397 | 77 image_file = 'props/tealeaf.png' |
127 | 78 |
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
|
79 |
191 | 80 class TeaCupFull(Item): |
397 | 81 image_file = 'props/teacup_full.png' |
191 | 82 |
83 | |
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
|
84 class TeaPot(Item): |
397 | 85 image_file = 'props/teapot.png' |
237
e06c54d7701f
Add vase to demonstrate item state testing in dialogues.
Simon Cross <hodgestar@gmail.com>
parents:
191
diff
changeset
|
86 |
296
15b2be883a40
Ancient and honorable tea ceremony.
Jeremy Thurgood <firxen@gmail.com>
parents:
237
diff
changeset
|
87 def setup(self, brewed, **opts): |
15b2be883a40
Ancient and honorable tea ceremony.
Jeremy Thurgood <firxen@gmail.com>
parents:
237
diff
changeset
|
88 super(TeaPot, self).setup(**opts) |
15b2be883a40
Ancient and honorable tea ceremony.
Jeremy Thurgood <firxen@gmail.com>
parents:
237
diff
changeset
|
89 |
15b2be883a40
Ancient and honorable tea ceremony.
Jeremy Thurgood <firxen@gmail.com>
parents:
237
diff
changeset
|
90 |
15b2be883a40
Ancient and honorable tea ceremony.
Jeremy Thurgood <firxen@gmail.com>
parents:
237
diff
changeset
|
91 def player_action(self, player): |
15b2be883a40
Ancient and honorable tea ceremony.
Jeremy Thurgood <firxen@gmail.com>
parents:
237
diff
changeset
|
92 if player.has_item('tealeaf'): |
335 | 93 self._me.brewed = True |
296
15b2be883a40
Ancient and honorable tea ceremony.
Jeremy Thurgood <firxen@gmail.com>
parents:
237
diff
changeset
|
94 player.discard_item() |
388 | 95 notify("A nice cup of tea is brewing.") |
296
15b2be883a40
Ancient and honorable tea ceremony.
Jeremy Thurgood <firxen@gmail.com>
parents:
237
diff
changeset
|
96 return |
15b2be883a40
Ancient and honorable tea ceremony.
Jeremy Thurgood <firxen@gmail.com>
parents:
237
diff
changeset
|
97 if player.has_item('teacup'): |
335 | 98 if self._me.brewed: |
296
15b2be883a40
Ancient and honorable tea ceremony.
Jeremy Thurgood <firxen@gmail.com>
parents:
237
diff
changeset
|
99 player.discard_item() |
15b2be883a40
Ancient and honorable tea ceremony.
Jeremy Thurgood <firxen@gmail.com>
parents:
237
diff
changeset
|
100 player.take_item_by_name('teacupfull') |
335 | 101 self._me.brewed = False |
403 | 102 notify("You pour a cup of tea.") |
296
15b2be883a40
Ancient and honorable tea ceremony.
Jeremy Thurgood <firxen@gmail.com>
parents:
237
diff
changeset
|
103 else: |
388 | 104 notify("Sadly, the teapot is empty.") |
383 | 105 return |
388 | 106 notify("A proper tea ceremony requires a cup.") |
296
15b2be883a40
Ancient and honorable tea ceremony.
Jeremy Thurgood <firxen@gmail.com>
parents:
237
diff
changeset
|
107 |
15b2be883a40
Ancient and honorable tea ceremony.
Jeremy Thurgood <firxen@gmail.com>
parents:
237
diff
changeset
|
108 |
354
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
109 |
335 | 110 ################################################## |
354
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
111 # Guard seduction |
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 class Fan(Item): |
397 | 115 image_file = 'props/fan.png' |
354
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
116 |
395 | 117 def player_action(self, player): |
118 player.get_fan(self) | |
119 | |
120 | |
354
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
121 |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
122 ################################################## |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
123 # Samurai distraction |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
124 |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
125 |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
126 class Kindling(Item): |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
127 image_file = 'props/kindling.png' |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
128 |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
129 |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
130 class Oil(Item): |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
131 image_file = 'props/oil.png' |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
132 |
412 | 133 |
134 class SignalFire(Item): | |
432
e65f6783a9f7
placed fire on the road; animation not yet hooked up
Adrianna Pińska <adrianna.pinska@gmail.com>
parents:
417
diff
changeset
|
135 image_file = 'props/signal_fire/signal_fire_unlit.png' |
412 | 136 |
474 | 137 animation_files = ['props/signal_fire/signal_fire_lit01.png', |
138 'props/signal_fire/signal_fire_lit02.png', | |
139 'props/signal_fire/signal_fire_lit03.png', | |
140 'props/signal_fire/signal_fire_lit04.png'] | |
141 | |
142 wants_updates = True | |
143 | |
412 | 144 def setup(self, litness, **opts): |
145 super(SignalFire, self).setup(**opts) | |
474 | 146 self._last_time = None |
147 self._frame = 0 | |
148 self.animations = [data.load_image(self.image_dir + x) for x in self.animation_files] | |
412 | 149 |
150 | |
151 def player_action(self, player): | |
152 if self._me.litness == 'set': | |
153 if player.has_item('kindling'): | |
417 | 154 notify("You put the kindling in the signal fire.") |
515
6c21ba7de1e6
Better signal fire interaction.
Jeremy Thurgood <firxen@gmail.com>
parents:
490
diff
changeset
|
155 self._me.litness = 'kindled' |
412 | 156 elif player.has_item('oil'): |
417 | 157 notify("You pour the oil on the signal fire.") |
515
6c21ba7de1e6
Better signal fire interaction.
Jeremy Thurgood <firxen@gmail.com>
parents:
490
diff
changeset
|
158 self._me.litness = 'oiled' |
412 | 159 else: |
515
6c21ba7de1e6
Better signal fire interaction.
Jeremy Thurgood <firxen@gmail.com>
parents:
490
diff
changeset
|
160 notify("This signal fire needs some oil and kindling before it can be lit.") |
412 | 161 return |
162 player.discard_item() | |
515
6c21ba7de1e6
Better signal fire interaction.
Jeremy Thurgood <firxen@gmail.com>
parents:
490
diff
changeset
|
163 |
6c21ba7de1e6
Better signal fire interaction.
Jeremy Thurgood <firxen@gmail.com>
parents:
490
diff
changeset
|
164 elif self._me.litness in ['oiled', 'kindled']: |
412 | 165 if player.has_item('kindling'): |
417 | 166 notify("You put the kindling on the signal fire and light it.") |
412 | 167 elif player.has_item('oil'): |
417 | 168 notify("You pour the oil on the signal fire and light it.") |
412 | 169 else: |
515
6c21ba7de1e6
Better signal fire interaction.
Jeremy Thurgood <firxen@gmail.com>
parents:
490
diff
changeset
|
170 if self._me.litness == 'oiled': |
6c21ba7de1e6
Better signal fire interaction.
Jeremy Thurgood <firxen@gmail.com>
parents:
490
diff
changeset
|
171 notify("This fire still needs some kindling before it can be lit.") |
6c21ba7de1e6
Better signal fire interaction.
Jeremy Thurgood <firxen@gmail.com>
parents:
490
diff
changeset
|
172 else: |
6c21ba7de1e6
Better signal fire interaction.
Jeremy Thurgood <firxen@gmail.com>
parents:
490
diff
changeset
|
173 notify("This fire still needs some oil before it can be lit.") |
412 | 174 return |
175 player.discard_item() | |
176 self._me.litness = 'burning' | |
177 self.world.missions.fire_started_on_road = True | |
354
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
178 |
474 | 179 def update(self): |
180 if self._me.litness != 'burning': | |
181 return | |
182 if self._last_time is None: | |
183 self._last_time = time.time() | |
184 return | |
185 if time.time() - self._last_time > 0.1: | |
186 self._last_time = time.time() | |
187 self._frame += 1 | |
188 if self._frame >= len(self.animations): | |
189 self._frame = 0 | |
190 pos = self.rect.midbottom | |
191 self.image = self.animations[self._frame] | |
192 self.rect = self.image.get_rect(midbottom=pos) | |
193 self.collide_rect = self.rect.move(0, 0) | |
194 | |
354
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
195 |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
196 ################################################## |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
197 # Cannon destruction |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
198 |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
199 |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
200 class Cannon(BreakableItem): |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
201 whole_image_file = 'props/cannon-whole.png' |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
202 broken_image_file = 'props/cannon-broken.png' |
335 | 203 |
434
827c5d045cf5
Don't allow the cannon to be picked up
Neil Muller <drnlmuller@gmail.com>
parents:
432
diff
changeset
|
204 liftable = False |
827c5d045cf5
Don't allow the cannon to be picked up
Neil Muller <drnlmuller@gmail.com>
parents:
432
diff
changeset
|
205 |
525 | 206 def setup(self, block, **opts): |
207 super(Cannon, self).setup(**opts) | |
208 self.block = block | |
209 | |
210 def smash(self): | |
211 self._me.block = False | |
212 self.block = False | |
213 super(Cannon, self).smash() | |
214 self.world.missions.cannon_destroyed = True | |
335 | 215 |
237
e06c54d7701f
Add vase to demonstrate item state testing in dialogues.
Simon Cross <hodgestar@gmail.com>
parents:
191
diff
changeset
|
216 |
354
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
217 ################################################## |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
218 # Geisha character assassination |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
219 |
237
e06c54d7701f
Add vase to demonstrate item state testing in dialogues.
Simon Cross <hodgestar@gmail.com>
parents:
191
diff
changeset
|
220 |
354
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
221 class Vase(BreakableItem): |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
222 whole_image_file = 'props/vase-whole.png' |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
223 broken_image_file = 'props/vase-broken.png' |
532
eec2cf912e03
Add tearing rice sound. Only smash breakables once.
Simon Cross <hodgestar@gmail.com>
parents:
529
diff
changeset
|
224 breaking_sound = 'sounds/vase breaking.ogg', 0.1 |
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
|
225 |
535 | 226 liftable = False |
227 | |
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
|
228 |
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
|
229 class Salmon(Item): |
354
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
230 image_file = 'props/fish.png' |
335 | 231 |
232 | |
233 | |
354
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
234 ################################################## |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
235 # Theatrical debut |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
236 |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
237 |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
238 class NoMask(BreakableItem): |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
239 whole_image_file = 'props/no-mask-whole.png' |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
240 broken_image_file = 'props/no-mask-broken.png' |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
241 |
535 | 242 liftable = False |
243 | |
244 | |
245 def smash(self): | |
246 super(NoMask, self).smash() | |
247 if self.world.items.no_costume.level == '_limbo': | |
248 self.world.missions.masks_destroyed = True | |
249 | |
250 | |
354
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
251 |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
252 class NoCostume(Item): |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
253 image_file = 'props/no-costume.png' |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
254 |
535 | 255 def player_action(self, player): |
256 self.remove() | |
257 notify("I think I'll hide this away somewhere.") | |
258 if self.world.items.no_mask.broken: | |
259 self.world.missions.masks_destroyed = True | |
354
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
260 |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
261 |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
262 ################################################## |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
263 # Big business |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
264 |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
265 |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
266 class Rice(BreakableItem): |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
267 whole_image_file = 'props/rice-whole.png' |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
268 broken_image_file = 'props/rice-broken.png' |
532
eec2cf912e03
Add tearing rice sound. Only smash breakables once.
Simon Cross <hodgestar@gmail.com>
parents:
529
diff
changeset
|
269 breaking_sound = 'sounds/tearing-rice bag.ogg', 0.2 |
354
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
270 |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
271 |
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
272 class Documents(Item): |
518
be1333278d5b
proper image for document
Adrianna Pińska <adrianna.pinska@gmail.com>
parents:
515
diff
changeset
|
273 image_file = 'props/documents.png' |
354
b37dbc557ae0
Stub classes for all items.
Jeremy Thurgood <firxen@gmail.com>
parents:
340
diff
changeset
|
274 |
470 | 275 ################################################## |
276 # Tails | |
277 | |
278 class Tail(Item): | |
279 | |
490
0eade58a71b9
Support item dropping (specifically tails). Have monk drop tail.
Simon Cross <hodgestar@gmail.com>
parents:
489
diff
changeset
|
280 image_dir = 'icons/tails/' |
470 | 281 image_file = None |
282 tail_type = None | |
473 | 283 help_msg = None |
470 | 284 |
285 def player_action(self, player): | |
286 player.add_tail(self.tail_type) | |
473 | 287 notify(self.help_msg) |
470 | 288 self.remove() |
289 | |
290 | |
291 class ShapeshiftTail(Tail): | |
490
0eade58a71b9
Support item dropping (specifically tails). Have monk drop tail.
Simon Cross <hodgestar@gmail.com>
parents:
489
diff
changeset
|
292 image_file = 'shapeshift.png' |
470 | 293 tail_type = 'shapeshift' |
473 | 294 help_msg = "Shapeshifting tail. Press C to shape shift." \ |
295 " Your powers are more limited while in human form." | |
470 | 296 |
297 | |
298 class FireballTail(Tail): | |
490
0eade58a71b9
Support item dropping (specifically tails). Have monk drop tail.
Simon Cross <hodgestar@gmail.com>
parents:
489
diff
changeset
|
299 image_file = 'fireball.png' |
470 | 300 tail_type = 'fireball' |
473 | 301 help_msg = "Fireball tail. The X attack key now shoots fireballs." |
302 | |
303 | |
304 class SprintTail(Tail): | |
490
0eade58a71b9
Support item dropping (specifically tails). Have monk drop tail.
Simon Cross <hodgestar@gmail.com>
parents:
489
diff
changeset
|
305 image_file = 'sprint.png' |
473 | 306 tail_type = 'sprint' |
307 help_msg = "Sprint tail. Double-tap the left or right arrow key to" \ | |
308 " sprint for a few seconds." | |
309 | |
310 | |
311 class InvisibilityTail(Tail): | |
490
0eade58a71b9
Support item dropping (specifically tails). Have monk drop tail.
Simon Cross <hodgestar@gmail.com>
parents:
489
diff
changeset
|
312 image_file = 'invisibility.png' |
473 | 313 tail_type = 'invisibility' |
314 help_msg = "Invisibility tail. Press V to become invisible for a few seconds." \ | |
315 " You become visible again if you attack or interact with others." | |
316 | |
317 | |
318 class FlightTail(Tail): | |
490
0eade58a71b9
Support item dropping (specifically tails). Have monk drop tail.
Simon Cross <hodgestar@gmail.com>
parents:
489
diff
changeset
|
319 image_file = 'flight.png' |
473 | 320 tail_type = 'flight' |
321 help_msg = "Flight tail. Double-tap up to fly. Press down while on the ground to land." \ | |
322 " If you stay in the air too long you'll tire and fall." | |
323 | |
324 | |
325 class ShieldTail(Tail): | |
490
0eade58a71b9
Support item dropping (specifically tails). Have monk drop tail.
Simon Cross <hodgestar@gmail.com>
parents:
489
diff
changeset
|
326 image_file = 'shield.png' |
473 | 327 tail_type = 'shield' |
328 help_msg = "Shield tail. If you get hit, your mystical shield will protect you for" \ | |
329 " one second. After that it'll need a little time to recharge." | |
330 | |
331 | |
332 class StealTail(Tail): | |
490
0eade58a71b9
Support item dropping (specifically tails). Have monk drop tail.
Simon Cross <hodgestar@gmail.com>
parents:
489
diff
changeset
|
333 image_file = 'steal.png' |
473 | 334 tail_type = 'steal' |
335 help_msg = "Life-stealing tail. If you projectiles hit your enemies, you steal some" \ | |
336 " of their life." | |
337 | |
338 | |
339 class LightningTail(Tail): | |
490
0eade58a71b9
Support item dropping (specifically tails). Have monk drop tail.
Simon Cross <hodgestar@gmail.com>
parents:
489
diff
changeset
|
340 image_file = 'lightning.png' |
473 | 341 tail_type = 'lightning' |
342 help_msg = "Lightning tail. The Z attack now shoots lightning bolts." |