diff --git a/game.py b/game.py index 7c86ea7..23adb15 100644 --- a/game.py +++ b/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 diff --git a/static/app.js b/static/app.js index cbbf0a0..6f2e9f9 100644 --- a/static/app.js +++ b/static/app.js @@ -708,11 +708,9 @@ function actionCard(a) { io += Object.entries(a.outputs).map(([id, q]) => itemChip(id, q)).join(""); let extra = ""; if (a.enemy) { - const o = me.fight_odds[a.id], e = a.enemy, pct = (x) => `${Math.round(x * 100)}%`; - extra = `${variantRows(e, o)} -