Empty homes draw settlers: growth follows housing
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
0b7e4a722f
commit
8fbab37a56
3 changed files with 33 additions and 7 deletions
17
game.py
17
game.py
|
|
@ -482,7 +482,10 @@ TIERS = [
|
|||
{"name": "City", "pop": 150, "cap": 99, "houses": 8},
|
||||
]
|
||||
TIER_SLOTS = 2
|
||||
GROWTH_PER_DAY = 0.12
|
||||
# Growth: empty homes draw settlers (a share of all the homes, every day, while
|
||||
# any stand empty), and families grow a little on their own.
|
||||
SETTLERS_PER_HOME = 0.25
|
||||
FAMILY_GROWTH = 0.05
|
||||
|
||||
RAID_GROUPS = ["the Red Hand", "the Hollow Crows", "the Blackwater gang", "the Ashen Wolves",
|
||||
"the Gallows Men", "the Thornback raiders"]
|
||||
|
|
@ -1431,6 +1434,13 @@ def _start_next(world: dict, now: float) -> None:
|
|||
log(world, now, "build", f"{verb} the {BUILDINGS[key]['name'].lower()} began")
|
||||
|
||||
|
||||
def growth_per_day(world: dict) -> float:
|
||||
"""New townsfolk a day while there's room: settlers for the homes, plus families."""
|
||||
pop = world["city"]["population"]
|
||||
growth = SETTLERS_PER_HOME * housing(world) + FAMILY_GROWTH * pop
|
||||
return growth * city_rate(world, "growth") * (1.25 if fitted(world, "furniture") else 1)
|
||||
|
||||
|
||||
def population_view(world: dict) -> dict:
|
||||
"""Population, food and tier, with the numbers that explain them."""
|
||||
city = world["city"]
|
||||
|
|
@ -1439,7 +1449,7 @@ def population_view(world: dict) -> dict:
|
|||
if city["starving"]:
|
||||
growth = -pop * 0.04
|
||||
elif pop < room - 0.01:
|
||||
growth = max(0.5, pop * GROWTH_PER_DAY)
|
||||
growth = growth_per_day(world)
|
||||
elif pop > room:
|
||||
growth = -pop * 0.05
|
||||
else:
|
||||
|
|
@ -1619,8 +1629,7 @@ def _city_hour(world: dict, now: float) -> None:
|
|||
else:
|
||||
room = housing(world)
|
||||
if pop < room:
|
||||
growth = max(0.5, pop * GROWTH_PER_DAY) * city_rate(world, "growth") * (1.25 if fitted(world, "furniture") else 1)
|
||||
city["population"] = min(room, pop + growth / 24)
|
||||
city["population"] = min(room, pop + growth_per_day(world) / 24)
|
||||
elif pop > room:
|
||||
city["population"] = max(room, pop - pop * 0.05 / 24)
|
||||
city["treasury"] += pop * 0.5 / 24
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue