Combat rework: packs, abilities, rest, health potions, group bosses

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rope 2026-10-24 09:49:21 +01:00
parent 472609ac70
commit 57d11e30da
10 changed files with 1562 additions and 380 deletions

14
app.py
View file

@ -106,7 +106,7 @@ def player_view(world: dict, player: dict, now: float) -> dict:
view["ward_reduction"] = round(game.reduction(game.magic_ward(player)), 3)
view["edible"] = game.edible(player)
view["blessing"] = game.blessing(player)
view["fight_odds"] = {a["id"]: game.fight_odds(player, a) for a in game.ACTIONS if "enemy" in a}
view["fight_odds"] = {a["id"]: game.fight_odds(player, a, world) for a in game.ACTIONS if "enemy" in a}
view["pp"] = int(player["pp"])
view["labour_per_action"] = game.labour_per_action(player)
view["levels"] = {skill: game.skill_level(player, skill) for skill in game.SKILL_IDS}
@ -116,20 +116,24 @@ def player_view(world: dict, player: dict, now: float) -> dict:
view["power"] = game.combat_power(player)
me = game.fighter(player, game.blessing(player), game.potion_effect(player, "combat"))
view["fighter"] = {"max_hit": me["max_hit"], "accuracy": round(me["accuracy"]), "evasion": me["evasion"],
"crit": me["crit"], "interval": me["interval"], "block": me["block"], "damage": me["damage"]}
"crit": me["crit"], "interval": me["interval"], "block": me["block"], "damage": me["damage"],
"role": me["role"], "abilities": me["abilities"], "style": me["style"]}
view["health_potion"] = game.health_potion(player)
view["perk_costs"] = {perk: game.perk_cost(player, perk) for perk in player["perks"]}
if player["action"]:
action, fight = game.growing(player), game.current_fight(world, player)
duration = fight["duration"] if fight else game.action_time(world, player, action)
view["action"] = {**player["action"], "growing": action["id"], "duration": duration}
if action.get("together") and not fight:
view["action"]["waiting"] = True # for a group: nothing to count down
if fight:
view["action"]["fight"] = game.fight_view(fight)
view["action"]["respawn"] = game.RESPAWN / game.speed(world)
party = game.party_of(world, player)
if party:
view["action"]["with"] = [uid for uid in party["members"] if uid != player["id"]]
# A fight takes as long as it takes: show the average time to a kill.
view["times"] = {action["id"]: (view["fight_odds"][action["id"]]["kill_time"] + game.RESPAWN) / game.speed(world)
# A fight takes as long as it takes: show the average time to win one and rest after it.
view["times"] = {action["id"]: (view["fight_odds"][action["id"]]["kill_time"] + view["fight_odds"][action["id"]]["rest"])
/ game.speed(world)
if "enemy" in action else 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)