Allow hunting and building as initial villager tasks

This commit is contained in:
Nate Bowman
2026-11-15 16:29:13 -05:00
parent e4aaba0320
commit 8a8effe3d1
3 changed files with 134 additions and 41 deletions

View File

@@ -251,6 +251,32 @@ class TestWorld(unittest.TestCase):
self.assertResourcesMatch([200 + gathered, 200, 100, 200], game.world)
def test_gather_boar_initial_lure(self):
walking = 30
game = Gameplay()
game.queue_villager(0, Tasks.LURE)
game.play_until(25 + walking + 60)
boar_rate_times_60 = 24.6
gathered = boar_rate_times_60
self.assertResourcesMatch([150 + gathered, 200, 100, 200], game.world)
def test_gather_boar_initial_lure_custom_time(self):
walking = 80
game = Gameplay()
game.queue_villager(0, Tasks.LURE, walking_time=walking)
game.play_until(25 + walking + 60)
boar_rate_times_60 = 24.6
gathered = boar_rate_times_60
self.assertResourcesMatch([150 + gathered, 200, 100, 200], game.world)
def test_gather_boar_limited(self):
walking = 20
@@ -763,3 +789,29 @@ class TestWorld(unittest.TestCase):
self.assertEqual(4, len(game.world.buildings))
self.assertResourcesMatch([200 + gathered, 50, 100, 200], game.world)
def test_initial_build(self):
game = Gameplay()
game.queue_villager(0,
Tasks.BUILD,
building=Buildings.HOUSE,
villagers_to=Tasks.SHEEP)
game.play_until(10)
self.assertEqual(1, len(game.world.buildings))
self.assertEqual(4, game.world.population)
game.play_until(30)
self.assertEqual(1, len(game.world.buildings))
self.assertEqual(5, game.world.population)
game.play_until(25 + 25 + 60)
self.assertEqual(2, len(game.world.buildings))
self.assertEqual(5, game.world.population)
sheep_rate_per_60 = 19.8
gathered = sheep_rate_per_60
self.assertResourcesMatch([150 + gathered, 175, 100, 200], game.world)