Mercurial > skaapsteker
view skaapsteker/sprites/items.py @ 388:de71c3fa5626
Tea notification stuff.
author | Jeremy Thurgood <firxen@gmail.com> |
---|---|
date | Sat, 09 Apr 2011 16:09:32 +0200 |
parents | 87246b84a851 |
children | 135cbb99511f |
line wrap: on
line source
from .. import engine from .base import Item def notify(text): engine.OpenNotification.post(text=text) 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() notify("A nice cup of tea is brewing.") return if player.has_item('teacup'): if self._me.brewed: player.discard_item() player.take_item_by_name('teacupfull') self._me.brewed = False notify("You have tea now.") else: notify("Sadly, the teapot is empty.") return notify("A proper tea ceremony requires a cup.") ################################################## # 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'