def test_resolve_combat_flee_no_monster_attack_returns_true(
         self, mock_dice_roll):
     player = {"Name": "Vlad", "Health": 10}
     monster = {"Name": "Orc", "Health": 5}
     for number in range(9):
         self.assertEqual(True,
                          combat.resolve_combat(player, "flee", monster))
Example #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
 def test_resolve_combat_quit_returns_false(self):
     player = {"Name": "Vlad", "Health": 10}
     monster = {"Name": "Orc", "Health": 5}
     self.assertEqual(False, combat.resolve_combat(player, "quit", monster))
 def test_resolve_combat_fighting_and_dieing_to_monster_returns_false(
         self, mock_dice_roll):
     player = {"Name": "Vlad", "Health": 10}
     monster = {"Name": "Orc", "Health": 5}
     self.assertEqual(False, combat.resolve_combat(player, "fight",
                                                   monster))
 def test_resolve_combat_flee_surviving_monster_attack_returns_true(
         self, mock_dice_roll):
     player = {"Name": "Vlad", "Health": 10}
     monster = {"Name": "Orc", "Health": 5}
     self.assertEqual(True, combat.resolve_combat(player, "flee", monster))