Skip unsupported commission offers and explain acceptance blockers
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
## 2026-11-08 增量收尾与下次待办
|
||||
|
||||
委托调度修复:实际战斗能力检查移入奖励排序的候选选择过程,跳过不支持的高奖励委托后继续查找其他可完成候选,避免首个候选阻塞全部接取。自动委托页同步显示缓存的中文阻塞原因。两个本地账号快照在全启用配置下离线回放,分别选择到可处理的10氪金与20氪金委托,未执行真实接取请求。
|
||||
|
||||
界面增量:战斗阻塞原因统一显示中文;实际模拟战败显示“打不过”。任务1002002第二步对应0202难度1,其原始失败条件包含保护单位阵亡(`loseType=3`),尚未实现保护/摧毁目标的完整判定及对象单位行为;本轮只改善提示,该关卡仍会暂停,保护战斗支持留待后续实现。
|
||||
|
||||
按用户剩余额度限制,本轮只完成短路径修改:桌面程序统一使用内置实验模拟并等待计算出的战斗时长,移除运行时选择;修复任务1002002(再次出发,0201难度1)纯显示 `buffMovie` 控制器造成的阻塞;委托按奖励氪金20→15→10排序,委托执行优先于普通策略,材料不足时接通现有扫荡/挑战来源。保留原属性、资源保护和未知结果核对机制,未执行真实游戏请求。
|
||||
|
||||
@@ -93,6 +93,8 @@
|
||||
2. 打开“推进策略”,选择主线或支线、自动接取、已支持对话和补链选项。需要补齐材料、蛋或击杀时,勾选“自动收集任务材料 / 击杀目标”;来源必须符合当前位置、地图解锁、资源保护及运行时能力。
|
||||
3. 任务和委托统一使用内置模拟,无需选择运行时;保留原始属性,计算战斗过程并等待相应时长后再提交。选择推进战斗队伍,设置保留体力、单次交付金币上限、物品保留量和连续失败停止次数。物品、魔物交付默认关闭,金币上限默认 0。
|
||||
4. 委托仍在“自动委托”单独配置启用、接取、城市、交付限制及“也接取需要实战的委托”。按奖励氪金20→15→10优先接取可处理的委托,已有委托优先完成,委托步骤及材料补缺优先于普通孵蛋、赠礼、主线和刷图。缺少材料时自动选择已支持的扫荡/挑战来源,并遵守保留设置;已有足够库存则直接交付。按委托缺口买蛋、孵化、交付的完整联动尚待实现。
|
||||
|
||||
委托自动执行只需启用“自动委托”及顶部绿色“开启”,下一轮状态刷新会检查接取和完成条件,无需启用自动主线。接取前会逐份检查实际战斗能力;高奖励委托无法完成时继续检查其他同奖励或较低奖励的委托。表格“需求 / 进度”以中文显示暂不接取或等待条件的原因。勾选允许提交道具、魔物及实战表示允许这些操作,不能使尚未实现的战斗机制或买蛋孵化联动自动变为可用。
|
||||
5. 勾选“启用自动主线策略”,再点击顶部绿色“开启”。修改规则会自动保存并应用;菜单“策略配置”可立即保存、导入或导出当前账号规则,包含任务策略与战斗模式。重启、恢复会话和导入后,顶部策略开关保持关闭,核对后再开启。
|
||||
6. 在“战斗记录”查看上下文、队伍、胜负和原因;“刷新本地记录”只读取本机记录。点击顶部红色“停止”可取消后续推进和可取消的运行/时钟等待;已经发出的请求仍须等待确认,开战后的未知状态会保留待核对记录。
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
+14
-3
@@ -1777,9 +1777,20 @@ class Window(ProgressionPages, ActivityPages, W.QMainWindow):
|
||||
def render_quests(self, snapshot):
|
||||
quest_policy = self.read_quest_policy()
|
||||
quest_rows = self.engine.tasks.rows(snapshot, quest_policy, self.read_policy())
|
||||
fill_table(self.quests_table, [[key, name, status,
|
||||
self.catalog.data["task_info"][key].get("reward", {}).get("money", 0),
|
||||
self.catalog.data["task_info"][key].get("reward", {}).get("ke", 0), text] for key, name, status, text, _ in quest_rows])
|
||||
diagnostics = {str(row.get("task_type_id")): row for row in self.engine.progression_rows()
|
||||
if row.get("category") == "commission"}
|
||||
rows = []
|
||||
for key, name, status, text, meta in quest_rows:
|
||||
diagnostic = diagnostics.get(str(key), {})
|
||||
reason = diagnostic.get("block_reason") or diagnostic.get("blocked_reason")
|
||||
if reason:
|
||||
status = "暂不接取" if "city" in meta else "等待条件"
|
||||
text = reason
|
||||
elif diagnostic.get("next_action"):
|
||||
text = diagnostic["next_action"]
|
||||
reward = self.catalog.data["task_info"][key].get("reward", {})
|
||||
rows.append([key, name, status, reward.get("money", 0), reward.get("ke", 0), battle_message(text)])
|
||||
fill_table(self.quests_table, rows)
|
||||
|
||||
@staticmethod
|
||||
def update_combo(widget, rows):
|
||||
|
||||
@@ -854,7 +854,7 @@ class ProgressionPlanner:
|
||||
return False, "整份委托提交魔物不足或受保留保护"
|
||||
return (True, "可接取") if info.get("steps") else (False, "委托没有有效步骤")
|
||||
|
||||
def commission_plan(self, snapshot, quest_policy, ranch_policy, *, battle_policy=None):
|
||||
def commission_plan(self, snapshot, quest_policy, ranch_policy, *, battle_policy=None, accept_supported=None):
|
||||
"""Plan full type-4 progression using the existing commission policy.
|
||||
|
||||
The engine must call this INSTEAD OF TaskPlanner.plan for commissions.
|
||||
@@ -902,6 +902,12 @@ class ProgressionPlanner:
|
||||
continue
|
||||
if not self._commission_offer_ready(snapshot, quest_policy, policy, ranch_policy, info)[0]:
|
||||
continue
|
||||
if accept_supported is not None and not accept_supported(key):
|
||||
blocked.append(self._intent(scope, {"id": 0, "typeId": key}, 0, info.get("startStep") or {},
|
||||
"progression_loop_accept", "暂不接取:" + info.get("name", key), policy,
|
||||
path="taskService/taskLoopReceive", payload={"taskTypeId": key, "city": city}, phase=str(today),
|
||||
block_reason="委托后续战斗或条件当前无法自动完成"))
|
||||
continue
|
||||
action = self._intent(scope, {"id": 0, "typeId": key}, 0, info.get("startStep") or {},
|
||||
"progression_loop_accept", "接取城市委托:" + info.get("name", key), policy,
|
||||
path="taskService/taskLoopReceive", payload={"taskTypeId": key, "city": city}, phase=str(today))
|
||||
|
||||
@@ -409,6 +409,12 @@ class AutomationGuiTests(unittest.TestCase):
|
||||
reward = window.catalog.data["task_info"][key]["reward"]
|
||||
window.tabs.setCurrentWidget(window.quests_table.parentWidget())
|
||||
self.assertEqual(int(window.quests_table.item(0, 4).text()), reward["ke"])
|
||||
window.engine._progression_rows = [{"task_type_id": key, "category": "commission",
|
||||
"block_reason": "Unsupported monster controller: monSteps"}]
|
||||
window.render_quests(snapshot)
|
||||
self.assertEqual(window.quests_table.item(0, 2).text(), "等待条件")
|
||||
self.assertIn("尚未支持", window.quests_table.item(0, 5).text())
|
||||
self.assertNotIn("Unsupported", window.quests_table.item(0, 5).text())
|
||||
self.assertIn("氪金", window.summary.text())
|
||||
finally:
|
||||
window.close()
|
||||
|
||||
@@ -3,6 +3,7 @@ import unittest
|
||||
from unittest.mock import Mock
|
||||
|
||||
from ranch_assistant.engine import Engine, demo_snapshot
|
||||
from ranch_assistant.game_data import ProgressionData
|
||||
from ranch_assistant.model import Catalog, Policy
|
||||
from ranch_assistant.progression import ProgressionPlanner
|
||||
from ranch_assistant.quests import QuestPolicy, TaskPlanner
|
||||
@@ -34,6 +35,31 @@ class CommissionPriorityTests(unittest.TestCase):
|
||||
action = TaskPlanner(self.catalog).plan(self.snapshot, self.quest, self.ranch)[0]
|
||||
self.assertEqual(action.payload["taskTypeId"], "402")
|
||||
|
||||
def test_unsupported_high_reward_offer_does_not_block_other_feasible_offers(self):
|
||||
for fallback_reward in (20, 15):
|
||||
with self.subTest(fallback_reward=fallback_reward):
|
||||
self.tasks["401"]["reward"]["ke"] = fallback_reward
|
||||
engine = Engine(self.catalog, game_data=ProgressionData(config(self.tasks)))
|
||||
engine.snapshot, engine.quest_policy = self.snapshot, self.quest
|
||||
engine._commission_offer_reason = "该委托的保护目标规则暂不支持"
|
||||
engine._commission_offer_supported = Mock(side_effect=lambda key: str(key) != "402")
|
||||
# Keep the rejected 20-reward offer first even when the fallback is also 20.
|
||||
self.snapshot.raw["history"]["loopTask"] = {"1": ["402", "401", "400"]}
|
||||
engine._refresh_progression_cache(force=True)
|
||||
accepted = [i for i in engine._progression_intents if i.kind == "progression_loop_accept" and not i.block_reason]
|
||||
self.assertEqual([i.task_type_id for i in accepted], ["401"])
|
||||
|
||||
def test_all_unsupported_offers_keep_reasons_without_accepting(self):
|
||||
engine = Engine(self.catalog, game_data=ProgressionData(config(self.tasks)))
|
||||
engine.snapshot, engine.quest_policy = self.snapshot, self.quest
|
||||
engine._commission_offer_reason = "战斗规则尚未支持"
|
||||
engine._commission_offer_supported = Mock(return_value=False)
|
||||
engine._refresh_progression_cache(force=True)
|
||||
self.assertFalse(any(i.kind == "progression_loop_accept" and not i.block_reason for i in engine._progression_intents))
|
||||
rows = [r for r in engine.progression_rows() if r.get("state") == "offered"]
|
||||
self.assertTrue(rows)
|
||||
self.assertTrue(all("战斗规则尚未支持" in r.get("block_reason", "") for r in rows))
|
||||
|
||||
def test_active_commission_precedes_new_offer(self):
|
||||
self.tasks["400"]["steps"] = [step("passLevel", statusValue={"level": 99})]
|
||||
self.snapshot.raw["currentTasks"] = [{"id": 50, "typeId": "400", "curStep": 1}]
|
||||
|
||||
Reference in New Issue
Block a user