Exemplo n.º 1
0
 def available_actions(self,player):
     moves = self.adjacent_moves()
     moves.append(actions.ViewInventory())
     moves.append(actions.CheckHP())
     moves.append(actions.EquipWep())
     if player.Potion_Of_Life:
         moves.append(actions.Undead())
     if player.HealingPotions > 0:
         moves.append(actions.Heal())
     if player.beer > 0:
         moves.append(actions.Drink())
     return moves
Exemplo n.º 2
0
 def available_actions(self,player):
     moves = self.adjacent_moves()
     if self.item:
         moves.append(actions.PickUpItem())
     if self.enemy.is_alive():
         moves.append(actions.Attack(enemy=self.enemy))
     if player.Potion_Of_Life:
         moves.append(actions.Undead())
     moves.append(actions.ViewInventory())
     moves.append(actions.CheckHP())
     moves.append(actions.EquipWep())
     if player.HealingPotions > 0:
         moves.append(actions.Heal())
     if player.beer > 0:
         moves.append(actions.Drink())
     return moves
Exemplo n.º 3
0
def play():
    '''main game loop'''
    player = Player()
    available_actions = [
        actions.Eat(),
        actions.Drink(),
        actions.Rest(),
        actions.Stat_set_0()
    ]
    while True:
        for action in available_actions:
            print(action)
        action_input = input('Action: ')
        for action in available_actions:
            if action_input == action.hotkey:
                player.do_action(action, **action.kwargs)
                break
        print(f'''
Your status now is:
Hunger: {player.hunger}
Thirst: {player.thirst}
Stamina: {player.stamina}''')