Herblore: herbs, potions with charges, one per skill

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rope 2026-10-18 23:12:57 +01:00
parent 278c5f4283
commit 090b202188
5 changed files with 245 additions and 19 deletions

6
app.py
View file

@ -99,8 +99,8 @@ def player_view(world: dict, player: dict, now: float) -> dict:
view["armour"] = game.armour(player)
view["reduction"] = round(game.damage_reduction(player), 3)
view["edible"] = game.edible(player)
blessed = game.blessing(player)
view["blessing"] = blessed
view["blessing"] = game.blessing(player)
blessed = game.with_potion(view["blessing"], game.potion_effect(player, "combat"))
view["fight_damage"] = {a["id"]: round(game.fight_damage(player, a, blessed), 1)
for a in game.ACTIONS if a["skill"] == "combat"}
view["pp"] = int(player["pp"])
@ -328,6 +328,8 @@ class Handler(BaseHTTPRequestHandler):
return "There's no raid to stand guard for"
player["garrison"] = bool(body.get("join"))
return None
if path == "/api/potion":
return game.use_potion(player, str(body.get("item")))
if path == "/api/prayers":
ids = body.get("ids")
return game.set_prayers(player, ids) if isinstance(ids, list) else "Bad request"