Mercurial > skaapsteker
view skaapsteker/sprites/items.py @ 354:b37dbc557ae0
Stub classes for all items.
author | Jeremy Thurgood <firxen@gmail.com> |
---|---|
date | Sat, 09 Apr 2011 14:01:32 +0200 |
parents | f870e3122ac7 |
children | 87246b84a851 |
line wrap: on
line source
from base import Item class BreakableItem(Item): whole_image_file = None broken_image_file = None def setup(self, broken, **opts): super(BreakableItem, self).setup(**opts) self.broken = broken def setup_image_data(self, pos): self.image_file = self.broken_image_file if self._me.broken else self.whole_image_file super(BreakableItem, self).setup_image_data(pos) def smash(self): self._me.broken = True self.broken = True self.setup_image_data(self._starting_tile_pos) ################################################## # Collectibles class Aburage(Item): image_file = 'tofu.png' def player_action(self, player): player.eat_aburage() self.remove() class HaikuScroll(Item): image_file = 'haiku-scroll.png' def player_action(self, player): player.collect_scroll(self) self.remove() def setup(self, text, **opts): super(HaikuScroll, self).setup(**opts) self.text = text ################################################## # Monk tea mission class TeaCup(Item): image_file = 'teacup_empty.png' class TeaLeaf(Item): image_file = 'tealeaf.png' class TeaCupFull(Item): image_file = 'teacup_full.png' class TeaPot(Item): image_file = 'teapot.png' def setup(self, brewed, **opts): super(TeaPot, self).setup(**opts) def player_action(self, player): if player.has_item('tealeaf'): self._me.brewed = True player.discard_item() return if player.has_item('teacup'): if self._me.brewed: player.discard_item() player.take_item_by_name('teacupfull') self._me.brewed = False else: print "Sadly, the teapot is empty." ################################################## # Guard seduction class Fan(Item): image_file = 'fan.png' ################################################## # Samurai distraction class Kindling(Item): image_file = 'props/kindling.png' class Oil(Item): image_file = 'props/oil.png' ################################################## # Cannon destruction class Cannon(BreakableItem): whole_image_file = 'props/cannon-whole.png' broken_image_file = 'props/cannon-broken.png' ################################################## # Geisha character assassination class Vase(BreakableItem): whole_image_file = 'props/vase-whole.png' broken_image_file = 'props/vase-broken.png' class Salmon(Item): image_file = 'props/fish.png' ################################################## # Theatrical debut class NoMask(BreakableItem): whole_image_file = 'props/no-mask-whole.png' broken_image_file = 'props/no-mask-broken.png' class NoCostume(Item): image_file = 'props/no-costume.png' ################################################## # Big business class Rice(BreakableItem): whole_image_file = 'props/rice-whole.png' broken_image_file = 'props/rice-broken.png' class Documents(Item): image_file = 'haiku-scroll.png'