Bank: drink all potions

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rope 2026-10-27 21:23:00 +00:00
parent bb56d618df
commit 2597a1d7e7
4 changed files with 28 additions and 7 deletions

17
game.py
View file

@ -2692,18 +2692,24 @@ def potion_effect(player: dict, skill: str) -> dict:
return ITEMS[active["item"]]["potion"] if active else {}
def use_potion(player: dict, item: str) -> str | None:
"""Drink a potion from the bank into its skill's slot (topping up the same potion)."""
def use_potion(player: dict, item: str, qty: int | str = 1) -> str | None:
"""Drink potions from the bank into their skill's slot (topping up the same potion)."""
spec = ITEMS.get(item, {}).get("potion")
if not spec:
return "That isn't a potion"
if player["bank"].get(item, 0) < 1:
have = player["bank"].get(item, 0)
if have < 1:
return "You don't have one"
bank_take(player, item, 1)
qty = have if qty == "all" else qty
if not isinstance(qty, int) or qty < 1:
return "Bad amount"
if have < qty:
return "You don't have that many"
bank_take(player, item, qty)
current = player["potions"].get(spec["skill"])
charges = current["charges"] if current and current["item"] == item else 0
fresh = round(POTION_CHARGES * (1.25 if player["cls"] == "homesteader" else 1))
player["potions"][spec["skill"]] = {"item": item, "charges": charges + fresh}
player["potions"][spec["skill"]] = {"item": item, "charges": charges + fresh * qty}
return None
@ -6270,6 +6276,7 @@ ORDER_RECIPES, ORDER_RAW = _order_sources()
# line here (new / balance / fix), and a new release a new entry on top.
PATCH_NOTES = [
{"date": "2026-10-27", "title": "Prayer", "notes": [
("new", "Added \"Drink all\" option to potions in the bank."),
("new", "Firekeeping: Tend all fires. Each log goes on the lowest fire with room in your pile."),
("new", "Added resource dumps for Leatherworking: Guard Jerkins"),
("fix", "+Q button: rounded corners."),