blob: 72773436d1cf5563843e76282ec59b5a9611165f (
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
|
from weatbag import words
from weatbag.utils import transfer
class Tile:
def __init__(self):
self.contents = {'catfood': 2}
def describe(self):
if self.contents['catfood']:
print("\nYou look around and you see a shelf with catfood cans.\n"
"I don't know about you, but a catfood can is always handy!\n"
"Never know when you'll need to feed a kitty!")
def action(self, player, do):
if (do[0] in words.take) and ('catfood' in do):
self.take_catfood(player)
self.contents['catfood'] -= 1
else:
print("Sorry, I don't understand.")
def take_catfood(self, player):
if transfer('catfood', self.contents, player.inventory, n=2):
print("\nYou did wise. You took the catfood!")
else:
print("\nThere is nothing here.")
def leave(self, player, direction):
if direction == 'w'or direction == 's' or direction == 'n':
print("Area 51. No trespassing beyond this point.")
return False
else:
return True
|