Combat engine: swing-by-swing fights, Frontier and expeditions, trophies
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
2ca90c43c0
commit
19ccab4ac3
7 changed files with 395 additions and 115 deletions
13
app.py
13
app.py
|
|
@ -100,9 +100,7 @@ def player_view(world: dict, player: dict, now: float) -> dict:
|
|||
view["reduction"] = round(game.damage_reduction(player), 3)
|
||||
view["edible"] = game.edible(player)
|
||||
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 "difficulty" in a}
|
||||
view["fight_odds"] = {a["id"]: game.fight_odds(player, a) 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}
|
||||
|
|
@ -112,9 +110,12 @@ def player_view(world: dict, player: dict, now: float) -> dict:
|
|||
view["power"] = game.combat_power(player)
|
||||
view["perk_costs"] = {perk: game.perk_cost(player, perk) for perk in player["perks"]}
|
||||
if player["action"]:
|
||||
action = game.growing(player)
|
||||
view["action"] = {**player["action"], "growing": action["id"], "duration": game.action_time(world, player, action)}
|
||||
view["times"] = {action["id"]: game.action_time(world, player, action) for action in game.ACTIONS}
|
||||
action, fight = game.growing(player), player["action"].get("fight")
|
||||
duration = fight["duration"] if fight else game.action_time(world, player, action)
|
||||
view["action"] = {**player["action"], "growing": action["id"], "duration": duration}
|
||||
# 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)
|
||||
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)
|
||||
view["recon_gain"] = {action["id"]: game.recon_gain(world, player, action) for action in game.ACTIONS
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue