Exemplo n.º 1
0
 def test_save_and_load_player_turn_finished(self):
     player = random_player_entity(name="raimund",
                                   classes=['warrior'],
                                   race='human')
     player.end_turn()
     player_saved = player.save('player')
     loaded_player = load_player(player_saved, True)
     self.assertTrue(loaded_player.turn_is_finished())
Exemplo n.º 2
0
 def test_save_and_load_player_with_equipment(self):
     helmet = parse_item_file('helmet')
     equipment = [helmet]
     player = random_player_entity(name="raimund",
                                   classes=['warrior'],
                                   race='human',
                                   equipments=equipment)
     player_saved = player.save('player')
     loaded_player = load_player(player_saved, True)
     self.assertFalse(loaded_player.turn_is_finished())
     self.assertTrue(helmet in loaded_player.equipments)
Exemplo n.º 3
0
 def test_save_and_load_player_with_items(self):
     first_item = parse_item_file('short_sword')
     second_item = parse_item_file('life_potion')
     inventory = [first_item, second_item]
     player = random_player_entity(name="raimund",
                                   classes=['warrior'],
                                   race='human',
                                   items=inventory)
     player_saved = player.save('player')
     loaded_player = load_player(player_saved, True)
     self.assertFalse(loaded_player.turn_is_finished())
     self.assertTrue(first_item in loaded_player.items)
     self.assertTrue(second_item in loaded_player.items)