示例#1
0
 def test_fight_or_flee_wrong_entry_warning_message(self, mock_stdout,
                                                    mock_input):
     expected_output = "A Spooky Scary Skeleton is attacking you do you flee or fight it. If you choose to flee " \
                       "there is a 10% chance to take 1 to 4 damage " \
                       "\n-------------------------------------------------------------------------------------" \
                       "\nPlease enter only the responses above\n"
     combat.fight_or_flee()
     self.assertEqual(mock_stdout.getvalue(), expected_output)
示例#2
0
def movement_handler(character: dict) -> bool:
    """
    Return a bool representing whether your character is still alive after processing possible outcomes after movement.
    :param character: a dictionary with the following key value pairs "Health": [int,int] , "Position": [int, int] ,
    "Name": str.
    :precondition character: a dictionary with the following keys "Health": [int,int] , "Position": [int, int] , "Name":
     str.
    :postcondition: Return a bool representing whether your character is still alive.
    :return: Return a bool representing whether your character is still alive.
    """
    is_there_combat = check_for_combat()
    if is_there_combat:
        return combat.resolve_combat(character, combat.fight_or_flee(), characters.generate_monster())
    else:
        characters.heal_character(character)
        display.display_character_healing(character)
        return True
示例#3
0
 def test_fight_or_flee_inputting_quit_returns_quit(self, mock_input):
     self.assertEqual("quit", combat.fight_or_flee())
示例#4
0
 def test_fight_or_flee_wrong_entry_requires_looping_until_correct_input(
         self, mock_input):
     self.assertEqual("flee", combat.fight_or_flee())
示例#5
0
 def test_fight_or_flee_entering_2_returns_flee(self, mock_input):
     self.assertEqual("flee", combat.fight_or_flee())