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)
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
def test_fight_or_flee_inputting_quit_returns_quit(self, mock_input): self.assertEqual("quit", combat.fight_or_flee())
def test_fight_or_flee_wrong_entry_requires_looping_until_correct_input( self, mock_input): self.assertEqual("flee", combat.fight_or_flee())
def test_fight_or_flee_entering_2_returns_flee(self, mock_input): self.assertEqual("flee", combat.fight_or_flee())