Add hatch retention, automatic breakthroughs and exploration

This commit is contained in:
AttilaNet
2026-11-09 11:27:29 +08:00
parent 26be820ff2
commit 9f819d828a
32 changed files with 6207 additions and 83 deletions
+5 -3
View File
@@ -161,6 +161,8 @@ class AutomationTests(unittest.TestCase):
self.assertFalse(any(a.kind == "feed" for a in self.planner.plan(snapshot, policy)))
self.assertIn("上限 20", self.planner.feed_status(snapshot, policy)[1])
target["level"] = 19
snapshot.raw["monsters"][1].update(process=3, roomId=1)
snapshot.raw["monsters"][2].update(process=3, roomId=1)
self.assertTrue(any(a.kind == "feed" for a in self.planner.plan(snapshot, policy)))
policy.target_level = 19
self.assertTrue(any(a.kind == "feed" for a in self.planner.plan(snapshot, policy)))
@@ -297,7 +299,7 @@ class AutomationTests(unittest.TestCase):
client = Client(Session(f"http://127.0.0.1:{server.server_port}/", "synthetic-test-token"))
try:
engine = Engine(catalog, client, budget_path)
engine.policy = replace(self.policy, manual_eggs=True, egg_rules={"1001010": asdict(EggRule(enabled=True, priority=1, refill_target=12, market_id="sc_city1"))})
engine.policy = replace(self.policy, manual_eggs=True, egg_rules={"1001010": asdict(EggRule(enabled=True, priority=1, refill_target=12, market_id="sc_city1", keep_count=0))})
engine.policy.egg_stock = 12
engine.policy.buy_batch = 5
engine.policy.daily_buy_money = 1000
@@ -376,7 +378,7 @@ class AutomationGuiTests(unittest.TestCase):
self.assertIn("自动孵蛋", [window.tabs.tabText(i) for i in range(window.tabs.count())])
window.gold_preset()
self.wait(window)
window.egg_rules = {str(m["typeId"]): {"enabled": True, "action": "sell"} for m in window.engine.snapshot.raw["monsters"][:2]}
window.egg_rules = {str(m["typeId"]): {"enabled": True, "action": "sell", "keep_count": 0} for m in window.engine.snapshot.raw["monsters"][:2]}
window.fill.setChecked(False)
window.buy_eggs.setChecked(False)
before = len(window.engine.snapshot.raw["monsters"])
@@ -428,7 +430,7 @@ class AutomationGuiTests(unittest.TestCase):
try:
self.wait(window)
window.strategy.setCurrentIndex(window.strategy.findData("gold"))
window.egg_rules = {str(m["typeId"]): {"enabled": True, "action": "sell"} for m in window.engine.snapshot.raw["monsters"][:2]}
window.egg_rules = {str(m["typeId"]): {"enabled": True, "action": "sell", "keep_count": 0} for m in window.engine.snapshot.raw["monsters"][:2]}
window.fill.setChecked(False)
before = len(window.engine.snapshot.raw["monsters"])
window.refresh()