Character sheets; make one then go back to what you were doing
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
d2991ebf7a
commit
34dc85284d
5 changed files with 167 additions and 9 deletions
12
app.py
12
app.py
|
|
@ -144,11 +144,17 @@ def city_view(world: dict, now: float) -> dict:
|
|||
}
|
||||
|
||||
|
||||
def roster(world: dict) -> list[dict]:
|
||||
def roster(world: dict, now: float) -> list[dict]:
|
||||
"""What everyone can see about each other: no banks, no gold."""
|
||||
people = []
|
||||
for player in world["players"].values():
|
||||
action = game.ACTION_BY_ID[player["action"]["id"]] if player["action"] else None
|
||||
game.regen(world, player, now)
|
||||
people.append({
|
||||
"xp": player["xp"], "equip": player["equip"], "joined": player["joined"],
|
||||
"hp": int(player["hp"]), "max_hp": game.max_hp(player), "power": game.combat_power(player),
|
||||
"armour": game.armour(player), "reduction": round(game.damage_reduction(player), 3),
|
||||
"favour": player["favour"],
|
||||
"id": player["id"], "name": player["name"], "cls": player["cls"],
|
||||
"total": sum(game.skill_level(player, skill) for skill in game.SKILL_IDS),
|
||||
"levels": {skill: game.skill_level(player, skill) for skill in game.SKILL_IDS},
|
||||
|
|
@ -287,7 +293,7 @@ class Handler(BaseHTTPRequestHandler):
|
|||
if not isinstance(qty, int):
|
||||
return "Bad quantity"
|
||||
if path == "/api/action":
|
||||
return game.start_action(world, player, str(body.get("id")), now)
|
||||
return game.start_action(world, player, str(body.get("id")), now, once=bool(body.get("once")))
|
||||
if path == "/api/stop":
|
||||
game.stop(player)
|
||||
return None
|
||||
|
|
@ -406,7 +412,7 @@ class Handler(BaseHTTPRequestHandler):
|
|||
"city": city_view(world, now),
|
||||
"upcoming": game.event_view(world, upcoming, now) if upcoming else None,
|
||||
"history": history,
|
||||
"players": roster(world),
|
||||
"players": roster(world, now),
|
||||
"ledger": world["ledger"][-80:],
|
||||
"board": world["board"][-80:],
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue