Changeset 296:15b2be883a40


Ignore:
Timestamp:
04/08/11 20:29:49 (12 years ago)
Author:
Jeremy Thurgood <firxen@…>
Branch:
default
Phase:
public
Message:

Ancient and honorable tea ceremony.

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • data/game.json

    r294 r296  
    2323        "tealeaf": { "type": "TeaLeaf", "level": "temple", "pos": [1, 7] },
    2424        "teacup": { "type": "TeaCup", "level": "temple", "pos": [18, 10] },
    25         "teapot": { "type": "TeaPot", "level": "temple", "pos": [13, 2] },
     25        "teapot": { "type": "TeaPot", "level": "temple", "pos": [13, 2], "brewed": false },
    2626        "teacupfull": { "type": "TeaCupFull", "level": "_limbo", "pos": [0, 0] },
    2727        "vase": { "type": "Vase", "level": "geisha_room", "pos": [1, 3], "broken": false }
  • skaapsteker/sprites/base.py

    r273 r296  
    232232        self.name = name
    233233        self.world = world
     234        self.item_state = getattr(self.world.items, self.name)
    234235
    235236
  • skaapsteker/sprites/items.py

    r237 r296  
    1818    portable = False
    1919
     20    def setup(self, brewed, **opts):
     21        super(TeaPot, self).setup(**opts)
     22
     23
     24    def player_action(self, player):
     25        if player.has_item('tealeaf'):
     26            self.item_state.brewed = True
     27            player.discard_item()
     28            return
     29        if player.has_item('teacup'):
     30            if self.item_state.brewed:
     31                player.discard_item()
     32                player.take_item_by_name('teacupfull')
     33                self.item_state.brewed = False
     34            else:
     35                print "Sadly, the teapot is empty."
     36
     37
    2038
    2139class Vase(Item):
  • skaapsteker/sprites/player.py

    r290 r296  
    294294
    295295
     296
     297    def discard_item(self):
     298        self.the_world.fox.item = None
     299
     300
    296301    def drop_item(self):
    297302        my_item = self.the_world.fox.item
    298303        if my_item is None:
    299304            return
    300         self.the_world.fox.item = None
     305        self.discard_item()
    301306        world_item = getattr(self.the_world.items, my_item)
    302307        world_item.level = self.the_world.fox.level
     
    310315
    311316    def take_item(self, item):
    312         self.drop_item()
    313         getattr(self.the_world.items, item.name).level = "_limbo"
    314         self.the_world.fox.item = item.name
     317        self.take_item_by_name(item.name)
    315318        item.kill()
    316319        print "took", item
    317320
    318321
     322    def take_item_by_name(self, item_name):
     323        self.drop_item()
     324        getattr(self.the_world.items, item_name).level = "_limbo"
     325        self.the_world.fox.item = item_name
     326
     327
     328    def has_item(self, item):
     329        return self.the_world.fox.item == item
     330
     331
    319332    def add_actionable(self, actionable):
    320333        self._touching_actionables.append(actionable)
Note: See TracChangeset for help on using the changeset viewer.