From 7dcbb5284b9b75e88572809310a692bd715d6aa7 Mon Sep 17 00:00:00 2001 From: alex Date: Fri, 5 Jun 2026 21:39:15 +0200 Subject: [PATCH] fix: improve potion management by filling belt from inventory and adjusting consumable handling --- config/params.ini | 6 +++++- src/config.py | 1 + src/game_stats.py | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/config/params.ini b/config/params.ini index 781c3fd..bdd12be 100644 --- a/config/params.ini +++ b/config/params.ini @@ -18,7 +18,7 @@ ; Gear targets: ~350+ AR, ~20+ ED, ~50%+ HR, ~60%+ FCR, ; ~150% IAS on weapon. Full Rejuv belt recommended. ; If you chicken/die repeatedly, drop to Nightmare first. -difficulty=hell +difficulty=nightmare ; name: bot profile name used in logs/messages and mod launch option replacement name=fistman ; randomize_runs: 0 = run in listed order, 1 = shuffle run order @@ -67,6 +67,10 @@ d2r_path=C:\Program Files (x86)\Diablo II Resurrected max_consecutive_fails=5 ; max_game_length_s: emergency timeout per run/game max_game_length_s=600 +; auto_downgrade_threshold: if combined chickens+deaths exceed this number within 1 hour, +; bot automatically lowers difficulty by one tier (hell->nightmare->normal) and restarts. +; Set to 0 to disable. +auto_downgrade_threshold=40 ; if you set this field to 1, botty will attempt to restart d2 after a crash or failure restart_d2r_when_stuck=1 diff --git a/src/config.py b/src/config.py index fb0c65c..757aedc 100644 --- a/src/config.py +++ b/src/config.py @@ -199,6 +199,7 @@ class Config: "name": _default_iff(self._select_val("general", "name"), "", "botty"), "max_game_length_s": float(self._select_val("general", "max_game_length_s")), "max_consecutive_fails": int(self._select_val("general", "max_consecutive_fails")), + "auto_downgrade_threshold": int(self._select_optional("general", "auto_downgrade_threshold", "0")), "max_runtime_before_break_m": float(_default_iff(self._select_val("general", "max_runtime_before_break_m"), '', 0)), "break_length_m": float(_default_iff(self._select_val("general", "break_length_m"), '', 0)), "randomize_runs": bool(int(self._select_val("general", "randomize_runs"))), diff --git a/src/game_stats.py b/src/game_stats.py index 18e22e7..8f342b3 100644 --- a/src/game_stats.py +++ b/src/game_stats.py @@ -95,6 +95,8 @@ class GameStats: self._last_status_report_run = 0 self._last_failure_reason = None self._merc_resurrect_failed = False + # Auto-downgrade tracking: timestamps of chickens+deaths + self._downgrade_events: deque[float] = deque() os.makedirs("log/stats", exist_ok=True) def set_failure_reason(self, reason: str):