Skip unsupported commission offers and explain acceptance blockers

This commit is contained in:
AttilaNet
2026-11-08 20:43:06 +08:00
parent 5432a3d583
commit d7ca68b5f9
7 changed files with 77 additions and 7 deletions
+20 -3
View File
@@ -93,6 +93,7 @@ class Engine:
self._progression_intents = []
self._commission_planner_available = False
self._commission_offer_reason = ""
self._commission_offer_checks = {}
self._progression_records = []
self._progression_error = ""
self._planner_pending = False
@@ -334,8 +335,13 @@ class Engine:
reasons = {}
adjusted = []
for intent in intents:
if value(intent, "kind") == "progression_loop_accept" and not self._commission_offer_supported(value(intent, "task_type_id")):
intent = replace(intent, block_reason=self._commission_offer_reason)
if value(intent, "kind") == "progression_loop_accept":
key = str(value(intent, "task_type_id"))
if key not in self._commission_offer_checks:
self._check_commission_offer(key)
supported, reason = self._commission_offer_checks[key]
if not supported:
intent = replace(intent, block_reason=reason)
if (value(intent, "kind") in ("progression_battle", "battle", "task_battle", "stage_battle", "map_battle")
or self._is_farm(intent) and not self._is_sweep_intent(intent)) and not value(intent, "block_reason"):
supported, reason = self._battle_capability(intent)
@@ -347,6 +353,9 @@ class Engine:
farms = {str(value(intent, "source_task_type_id")): intent for intent in adjusted if self._is_farm(intent)}
for row in rows:
source_supported = row.get("supported") is not False
check = self._commission_offer_checks.get(str(row.get("task_type_id")))
if row.get("category") == "commission" and row.get("state") == "offered" and check is not None:
row.update(block_reason=check[1], next_action="接取城市委托" if check[0] else "暂不接取:" + check[1])
commission = commissions.get(str(row.get("task_type_id")))
if commission is not None:
row.update(next_action=value(commission, "description"), block_reason=value(commission, "block_reason", ""))
@@ -417,6 +426,12 @@ class Engine:
commissions=True, accept=quest.accept, auto_farm=True, allow_items=quest.allow_items, allow_monsters=quest.allow_monsters,
max_money=quest.max_money, item_reserves=dict(quest.item_reserves))
def _check_commission_offer(self, type_id):
supported = self._commission_offer_supported(type_id)
self._commission_offer_checks[str(type_id)] = (supported,
"" if supported else self._commission_offer_reason or "委托后续步骤当前无法自动完成")
return supported
def _commission_offer_supported(self, type_id):
self._commission_offer_reason = "委托后续条件、剧情或战斗未验证支持,未消耗接取次数"
info = self.game_data.task(type_id)
@@ -462,12 +477,14 @@ class Engine:
"quests": vars(self.quest_policy), "ranch": vars(self.policy), "local_state": self.progression_planner.state_signature(self.snapshot),
"pending": self._progression_pending(), "runtime": id(self.battles.runtime), "day": int(self.snapshot.now // 86400)})
if force or key != self._progression_cache_key:
self._commission_offer_checks = {}
rows = self.progression_planner.rows(self.snapshot, self.progression_policy, self.policy, quest_policy=self.quest_policy)
intents = self.progression_planner.plan(self.snapshot, self.progression_policy, self.policy)
commission_plan = getattr(self.progression_planner, "commission_plan", None)
self._commission_planner_available = callable(commission_plan)
if self._commission_planner_available:
intents += commission_plan(self.snapshot, self.quest_policy, self.policy, battle_policy=self.progression_policy)
intents += commission_plan(self.snapshot, self.quest_policy, self.policy,
battle_policy=self.progression_policy, accept_supported=self._check_commission_offer)
intents.sort(key=lambda intent: not self._is_commission(intent))
self._progression_rows, self._progression_intents = self._overlay_battle_capabilities(rows, intents)
self._persist_progression()