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