예제 #1
0
def draw_action(view, path):

    rolls = outcome.Outcome()
    rolls.set_suboutcome(Position(3, 7), outcome.rolls(2, 1))

    gamestate = Gamestate.from_file(path + "Gamestate.json")
    units = gamestate.all_units()
    action = Action.from_document(
        units, json.loads(open(path + "Action.json").read()))
    view.draw_action_tutorial(action, rolls)
예제 #2
0
    def test_ActionDocument_WhenSavingAndLoading_ThenItShouldBeTheSame(self):
        gamestate = Gamestate.from_document(self.get_test_gamestate_document())
        actions = action_getter.get_actions(gamestate)
        for action in actions:
            action_document = action.to_document()
            same_action = Action.from_document(gamestate.all_units(), action_document)
            same_action.created_at = action.created_at
            same_action_document = same_action.to_document()

            self.assertEquals(action, same_action)
            self.assertEquals(action_document, same_action_document)