diff --git a/src/business/business.py b/src/business/business.py index 82fbf38..bd22448 100644 --- a/src/business/business.py +++ b/src/business/business.py @@ -4,11 +4,12 @@ # bring in a passive catch each day in exchange for a daily wage. This turns # accumulated money into ongoing production rather than just a number that grows. +from fish import fish + BOAT_PRICE = 500 MAX_WORKERS = 5 WORKER_DAILY_WAGE = 10 -WORKER_FISH_PER_DAY = 6 -WORKER_CATCH_SPECIES = "Minnow" # workers bring in the common catch +WORKER_FISH_PER_DAY = 5 def runDailyProduction(player, stats=None): @@ -36,9 +37,14 @@ def runDailyProduction(player, stats=None): return summary wages = affordable * WORKER_DAILY_WAGE - caught = affordable * WORKER_FISH_PER_DAY player.money -= wages - player.addFish(WORKER_CATCH_SPECIES, caught) + # Each worker fishes the same waters as the player, landing a rarity-rolled + # species (not just the cheapest one), so the crew's income is competitive + # with simply upgrading your own gear. + caught = 0 + for _ in range(affordable): + player.addFish(fish.rollFishType(), WORKER_FISH_PER_DAY) + caught += WORKER_FISH_PER_DAY summary["wagesPaid"] = wages summary["fishCaught"] = caught if stats is not None: diff --git a/tests/business/test_business.py b/tests/business/test_business.py index 2ba8381..192ba02 100644 --- a/tests/business/test_business.py +++ b/tests/business/test_business.py @@ -1,3 +1,5 @@ +from unittest.mock import patch + from src.business import business from src.player.player import Player from src.stats.stats import Stats @@ -40,6 +42,22 @@ def test_workers_catch_fish_and_draw_wages(): assert stats.totalFishCaught == expectedFish +def test_workers_catch_rolled_species_not_just_minnow(): + # prepare - a boat and one worker; force the rolled species to Bass + player = Player() + player.hasBoat = True + player.workers = 1 + player.money = 1000 + + # call - workers fish a rarity-rolled species, not a hard-coded one + with patch.object(business.fish, "rollFishType", return_value="Bass"): + business.runDailyProduction(player) + + # check - the catch landed as the rolled species + assert player.fishByType.get("Bass") == business.WORKER_FISH_PER_DAY + assert "Minnow" not in player.fishByType + + def test_unaffordable_workers_quit(): # prepare - 3 workers but only enough money for one day's wage of one worker player = Player()