Allow user to choose whether getting housed is an error
Previously, the simulation would automatically end whenever it determined you were housed. That is still the default, but the user can now choose to have the simulation continue instead. Also, this likely fixes a bug whereby an error could have been thrown for an unavailable production building when searching the production queue.
This commit is contained in:
@@ -202,6 +202,34 @@ class TestWorld(unittest.TestCase):
|
||||
game.play_until(25)
|
||||
|
||||
|
||||
def test_get_housed_no_error(self):
|
||||
game = Gameplay()
|
||||
game.queue_villager(0, Tasks.IDLE)
|
||||
game.queue_villager(0, Tasks.IDLE)
|
||||
game.queue_villager(0, Tasks.IDLE)
|
||||
|
||||
game.set_housed_is_error(24, False)
|
||||
game.play_until(100)
|
||||
self.assertEqual(5, game.world.population)
|
||||
|
||||
|
||||
def test_get_housed_toggle_error(self):
|
||||
game = Gameplay()
|
||||
game.world.gather.resources = [1000, 1000, 1000, 1000]
|
||||
|
||||
game.queue_villager(0, Tasks.IDLE)
|
||||
game.queue_villager(0, Tasks.IDLE)
|
||||
|
||||
game.set_housed_is_error(24, False)
|
||||
game.play_until(80)
|
||||
|
||||
game.set_housed_is_error(81, True)
|
||||
game.queue_villager(82, Tasks.IDLE)
|
||||
|
||||
with self.assertRaises(YallGotHousedException):
|
||||
game.play_until(85)
|
||||
|
||||
|
||||
def test_gather_boar_without_lure(self):
|
||||
game = Gameplay()
|
||||
game.assign_villager(0, Tasks.IDLE, Tasks.BOAR, 1)
|
||||
|
||||
Reference in New Issue
Block a user