Encounter cards: gold range as a reward chip, drop the odds lines
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
ba7556de4d
commit
ea1bae9b53
3 changed files with 11 additions and 9 deletions
9
game.py
9
game.py
|
|
@ -564,7 +564,9 @@ def _encounter(id: str, name: str, group: str, level: int, roster: list, gold: i
|
|||
total = sum(v["weight"] for v in variants)
|
||||
xp = round(sum(v["xp"] * v["weight"] for v in variants) / total)
|
||||
enemy = {"name": name, "level": level, "boss": boss, "variants": variants}
|
||||
return _action(id, "combat", extra.pop("label", None) or name, level, RESPAWN, xp, gold=gold,
|
||||
# Gold per kill is a range around the encounter's worth.
|
||||
purse = [max(1, round(gold * 0.7)), max(2, round(gold * 1.3))] if gold else None
|
||||
return _action(id, "combat", extra.pop("label", None) or name, level, RESPAWN, xp, gold=purse,
|
||||
drops=[list(drop) for drop in drops], enemy=enemy, group=group, **extra)
|
||||
|
||||
|
||||
|
|
@ -1865,8 +1867,9 @@ def _complete(world: dict, player: dict, action: dict, now: float, rng: random.R
|
|||
gain_xp(world, player, "combat", xp // 3, now, summary)
|
||||
return
|
||||
summary["wins"] += 1
|
||||
player["gold"] += action.get("gold", 0)
|
||||
summary["gold"] += action.get("gold", 0)
|
||||
gold = rng.randint(*action["gold"]) if action.get("gold") else 0
|
||||
player["gold"] += gold
|
||||
summary["gold"] += gold
|
||||
for item, qty, odds in action.get("drops", []):
|
||||
if rng.random() < odds:
|
||||
outputs[item] = outputs.get(item, 0) + qty
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue