summaryrefslogtreecommitdiffstats
path: root/weatbag/tiles/n2w2.py
blob: c4f857501d9486bad235dcdfbb7dfad6560ea5c6 (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 = {'doorknob': 1}
    
    def describe(self):
        print("You are now on the island.")
        if self.contents['doorknob']:
            print("As you walk around you find something shiny on the ground. "
            "It looks like a brass doorknob.")
        else:
            print("There is nothing interesting here")
    def action(self, player, do):
        if (do[0] in words.take) and ('doorknob' in do):
            self.take_doorknob(player)
            
        else:
            print("Sorry, I don't understand.")
    
    def take_doorknob(self, player):
        if transfer('doorknob', self.contents, player.inventory):
            print("You pick up the doorknob.")
        else:
            print("There is nothing here.")

    def leave(self, player, direction):
        if direction == "e":
            print ("You can't go back by swimming, that part is full of "
                 "electric eels.")
            return False
        else:
            return True