summaryrefslogtreecommitdiffstats
path: root/weatbag/tiles/e1.py
blob: 8e69a9a8bc161f3770f707bc578fb2ede77e339b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from weatbag import words
from weatbag.utils import transfer

class Tile:
    def __init__(self):
        self.contents = {'berries': 1}
    
    def describe(self):
        print("The path crosses a small stream.")
        if self.contents['berries']:
            print("There are some berries hanging from a tree. "
                "They look edible. "
                "If you're hungry enough, anyway.")
    
    def action(self, player, do):
        if (do[0] in words.take) and ('berries' in do):
            self.take_berries(player)
        else:
            print("Sorry, I don't understand.")
    
    def take_berries(self, player):
        if transfer('berries', self.contents, player.inventory):
            print("Reaching up, you pick the berries.")
        else:
            print("There are no berries here.")

    def leave(self,player,direction):
        if direction ==  's':
            print("You decide the path is too boring for you,\n"
                "so you follow the stream south, looking for adventure...")
            input()
            return True
        else:
            return True