Classes become trades; building costs draw on every trade

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rope 2026-10-19 22:45:32 +01:00
parent f810e16eb8
commit f4b2bb1320
6 changed files with 305 additions and 137 deletions

11
app.py
View file

@ -117,7 +117,7 @@ def player_view(world: dict, player: dict, now: float) -> dict:
view["times"] = {action["id"]: game.action_time(world, player, action) for action in game.ACTIONS}
view["blocked"] = {action["id"]: game.can_start(world, player, action) for action in game.ACTIONS}
view["drill_per_action"] = game.drill_per_action(player)
view["recon_gain"] = {action["id"]: game.recon_gain(world, action) for action in game.ACTIONS
view["recon_gain"] = {action["id"]: game.recon_gain(world, player, action) for action in game.ACTIONS
if action.get("special") == "recon"}
return view
@ -361,6 +361,15 @@ class Handler(BaseHTTPRequestHandler):
return None
if path == "/api/favour":
return game.spend_favour(world, player, str(body.get("kind")), now)
if path == "/api/class":
cls = body.get("cls")
if not player.get("repick"):
return "You've already chosen your trade"
if cls not in game.CLASSES:
return "Pick a class"
player["cls"], player["repick"] = cls, False
game.log(world, now, "join", f"{player['name']} took up the {game.CLASSES[cls]['name'].lower()}'s trade", player["id"])
return None
if path == "/api/perk":
return game.buy_perk(player, str(body.get("perk")))
if path == "/api/settings":