-
Notifications
You must be signed in to change notification settings - Fork 0
/
actions.py
46 lines (32 loc) · 1.49 KB
/
actions.py
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
45
46
import player
class Action():
def __init__(self, method, name, hotkey, **kwargs):
self.method = method
self.hotkey = hotkey
self.name = name
self.kwargs = kwargs #kwargs is an expandable argument which can account for more then one argument
def __str__(self):
return "{}: {}".format(self.hotkey, self.name)
class MoveNorth(Action):
def __init__(self):
super().__init__(method=Player.move_north, name = 'Move north', hotkey = 'n')
class MoveSouth(Action):
def __init__(self):
super().__init__(method=Player.move_south, name = 'Move south', hotkey = 's')
#this calls the Parent class
class MoveEast(Action):
def __init__(self):
super().__init__(method=Player.move_east, name = 'Move east', hotkey = 'e')
class MoveWest(Action):
def __init__(self):
super(),self).__init__(method=Player.move_west, name = 'Move west', hotkey = 'w')
class ViewInventory(Action):
"""Prints the players inventory"""
def __init__(self):
super().__init__(method=Player.print_inventory, name ='View inventory', hotkey = 'i')
class Flee(Action):
def __init__(self,tile):
super().__init__(method= Player.flee, name ='Flee', hotkey = 'f', tile = tile)
class Attack(Action):
def __init__(self,enemy):
super().__init__(method=Player.attack, name='Attack', hotkey = 'a', enemy = enemy)