summaryrefslogtreecommitdiffstats
path: root/weatbag/tiles/n1w5.py
blob: 558c0dc31b07eef2953cd0610ecc4217ba3dee4d (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
35
36
37
38
39
40
41
42
43
44
from weatbag import words
from weatbag.utils import transfer

class Tile:
    def __init__(self):
        self.contents = {'rats': 2}
    
    def describe(self):
        if self.contents['rats']:
            print("As you walk the rocky path at the edge of the cliff you "
                  "hear a squeaking sound and you notice two rat traps on the "
                  "ground. Each are having one rat inside them trapped.\n"
                  "You could take the nasty rodents but really... what the "
                  "hell are you gonna do with them?\n"
                  "Don't forget black death dear traveler!\n")
        else:
            print("You walk the path at the edge of the cliff. Nothing "
                  "to do here.\n")

    def action(self, player, do):
        if (do[0] in words.take) and ('rats' in do):
            self.take_rats(player)
        else:
            print("Sorry, I don't understand.\n")

    def take_rats(self, player):
        if transfer('rats', self.contents, player.inventory, n=2):
            print("Ok then. You took the rats.\n")
        else:
            print("No more rats for now. Got to leave the traps do their "
                  "job.\n")

    def leave(self, player, direction):
        if direction == "s":
            print("My dear traveler, you can't go south, you will fall of the "
                   "cliff!\n")
            return False
        elif direction == "n":
            print("It looks like the side of a wooden hut.\n"
                  "Since you don't walk though walls (yet) "
                  "you can't go there.\n")
            return False
        else:
            return True