コード例 #1
0
    def test_reset_unit_actions_and_movement(self):
        civ = Civilisation("myCiv", grid, logger)
        hextile = Hex(0, 0, 0)
        worker = Worker("worker", 1, hextile, "myCiv")
        civ.units[worker.id] = worker
        archer = Archer(1, 1, hextile, "myCiv")
        civ.units[archer.id] = archer

        civ.reset_unit_actions_and_movement()

        self.assertEqual(archer.actions, 2)
        self.assertEqual(worker.actions, 2)
        self.assertEqual(archer.movement, 5)
        self.assertEqual(worker.movement, 4)
コード例 #2
0
    def test_per_turn(self):  # tbc
        civ = Civilisation("myCiv", grid, logger)
        hextile = Hex(0, 0, 0)
        worker = Worker("worker", 1, hextile, "myCiv")
        civ.units[worker.id] = worker
        archer = Archer(1, 1, hextile, "myCiv")
        civ.units[archer.id] = archer
        civ.reset_unit_actions_and_movement()

        grid.create_grid()
        civ.build_city_on_tile(worker, 1)
        hextile2 = grid.get_neighbour_in_direction(hextile, 2)
        worker.position = hextile2
        civ.build_structure(worker, BuildingType.UNIVERSITY, 1)

        civ.reset_unit_actions_and_movement()

        hextile3 = grid.get_neighbour_in_direction(hextile, 4)
        worker.position = hextile3
        civ.build_structure(worker, BuildingType.FARM, 2)

        civ.reset_unit_actions_and_movement()
        civ.currency_per_turn()

        self.assertEqual(archer.actions, 2)
        self.assertEqual(worker.actions, 2)
        self.assertEqual(archer.movement, 5)
        self.assertEqual(worker.movement, 4)

        self.assertEqual(civ.food, 99)
        self.assertEqual(civ.gold, 51)
        self.assertEqual(civ.science, 5)