Warmth shared by every pile hot enough

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rope 2026-10-21 13:22:20 +01:00
parent b4ecacf96c
commit f7daa4e44d
3 changed files with 26 additions and 7 deletions

13
game.py
View file

@ -167,7 +167,7 @@ FIRES = {
FLAMES = [("Red", "#ff6a2a"), ("Gold", "#ffcb3d"), ("White", "#eeeaf8"),
("Blue", "#4fa3ff"), ("Green", "#3ed37a"), ("Violet", "#b07cff")]
TEND_XP = [2, 3, 4.5, 5.5, 6.5, 7.5] # per game minute of fire fed, by the log's tier
WARMTH = 0.1 # of a craft's XP, to whoever fed the fuel that paid for it
WARMTH = 0.1 # of a craft's XP, shared by everyone whose pile is hot enough for it
FIRE_LOW = 30 * 60 # game seconds left when a fire counts as low
@ -2139,12 +2139,15 @@ def fire_inputs(world: dict, action: dict) -> dict:
def _warm(world: dict, crafter: dict, action: dict, xp: float, now: float) -> None:
"""A fire paid for a craft: count it, and give its feeder a share of the XP."""
"""A fire paid for a craft: count it, and share the warmth between everyone whose
pile alone was hot enough for it (a beginner's logs count for bricks and copper)."""
fire = world["city"]["fires"][action["fire"]]
fire["saved"] = fire.get("saved", 0) + 1
keeper = world["players"].get(burning(fire["fuel"])["by"])
if keeper and keeper is not crafter:
gain_xp(world, keeper, "firekeeping", xp * WARMTH, now, keeper.setdefault("away", empty_summary()))
keepers = [world["players"].get(by) for by in {chunk["by"] for chunk in fire["fuel"]}
if burning(fire["fuel"], by)["tier"] >= action["fuel"]]
keepers = [keeper for keeper in keepers if keeper and keeper is not crafter]
for keeper in keepers:
gain_xp(world, keeper, "firekeeping", xp * WARMTH / len(keepers), now, keeper.setdefault("away", empty_summary()))
def fires_view(world: dict, now: float) -> dict: