Prioritize commission rewards and fix built-in battle simulation flow
This commit is contained in:
@@ -392,7 +392,7 @@ class Engine:
|
||||
return self.progression_policy
|
||||
quest = self.quest_policy
|
||||
return replace(self.progression_policy, enabled=quest.enabled, mainline=False, sidequests=False,
|
||||
commissions=True, accept=quest.accept, allow_items=quest.allow_items, allow_monsters=quest.allow_monsters,
|
||||
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 _commission_offer_supported(self, type_id):
|
||||
@@ -417,10 +417,13 @@ class Engine:
|
||||
self._commission_offer_reason = reason
|
||||
return False
|
||||
else:
|
||||
ready, _, _ = self.progression_planner.requirement(self.snapshot, step, {},
|
||||
self._intent_policy({"task_type_id": str(type_id)}), self.policy)
|
||||
policy = self._intent_policy({"task_type_id": str(type_id)})
|
||||
ready, _, _ = self.progression_planner.requirement(self.snapshot, step, {}, policy, self.policy)
|
||||
if not ready:
|
||||
return False
|
||||
sources = self.progression_planner.farming_intents(self.snapshot, step,
|
||||
{"id": 0, "typeId": str(type_id), "curStep": number}, policy, self.policy)
|
||||
if not any(self._is_sweep_intent(source) or self._battle_capability(source)[0] for source in sources):
|
||||
return False
|
||||
return bool(info.get("steps"))
|
||||
|
||||
def _refresh_progression_cache(self, *, force=False):
|
||||
@@ -443,6 +446,7 @@ class Engine:
|
||||
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.sort(key=lambda intent: not self._is_commission(intent))
|
||||
self._progression_rows, self._progression_intents = self._overlay_battle_capabilities(rows, intents)
|
||||
self._persist_progression()
|
||||
self._progression_cache_key = digest({"snapshot": self._battle_snapshot_digest, "policy": vars(self.progression_policy),
|
||||
@@ -716,7 +720,9 @@ class Engine:
|
||||
except (ValueError, TypeError, KeyError, AttributeError) as error:
|
||||
self.auto = False
|
||||
return self.snapshot, [], "状态已读取;策略暂不可用:" + str(error)
|
||||
actions = self.pending_hatches if hatch_only else plans
|
||||
commission_actions = [action for action in plans if action.kind.startswith("quest_") or
|
||||
action.kind == "progression" and self._is_commission(action.payload["intent"])]
|
||||
actions = (commission_actions or self.pending_hatches) if hatch_only else plans
|
||||
action = actions[0] if actions else None
|
||||
if action and defer_hatch and action.kind == "hatch":
|
||||
action = None
|
||||
@@ -819,9 +825,11 @@ class Engine:
|
||||
self.planner.notes.extend(self.gift_planner.notes)
|
||||
progression = [Action("progression", value(intent, "description", "推进任务"), "", {"intent": intent})
|
||||
for intent in self._progression_intents if not value(intent, "block_reason") and self._intent_policy(intent).enabled]
|
||||
commission = [action for action in progression if self._is_commission(action.payload["intent"])]
|
||||
progression = [action for action in progression if not self._is_commission(action.payload["intent"])]
|
||||
if quests and quests[0].kind == "quest_reset":
|
||||
return daily + quests + progression[:1] + gifts + ranch + sweep_actions
|
||||
return daily + progression[:1] + quests + gifts + ranch + sweep_actions
|
||||
return quests + commission[:1] + daily + progression[:1] + gifts + ranch + sweep_actions
|
||||
return commission[:1] + quests + daily + progression[:1] + gifts + ranch + sweep_actions
|
||||
|
||||
@account_serial
|
||||
def claim_daily_entry(self, entry):
|
||||
|
||||
Reference in New Issue
Block a user