fix: keep automatic cultivation on one stable primary per species

This commit is contained in:
AttilaNet
2026-11-13 08:51:03 +08:00
parent 01ad2e3ab9
commit 4fbe895999
35 changed files with 2069 additions and 322 deletions
+9 -4
View File
@@ -252,6 +252,10 @@ class AutomationTests(unittest.TestCase):
def test_encrypted_http_buy_hatch_mature_dispatch_and_balance(self):
state = copy.deepcopy(self.snapshot.raw)
state["stacks"][0]["monsterId"] = -1
state["monsters"] = [{"id": 900, "typeId": 1001010, "process": 3, "mode": 2,
"level": 20, "roomId": 1, "lock": 0,
**{"g" + stat.capitalize(): self.catalog.monster(1001010)[stat + "_grow_min"]
for stat in ("atk", "def", "hp", "dex")}}]
initial_money = state["master"]["money"]
calls, catalog = [], self.catalog
with workspace_temp() as folder:
@@ -274,13 +278,13 @@ class AutomationTests(unittest.TestCase):
mon = {"id": 101, "typeId": 1001010, "mode": 0, "process": 2,
"timeStart": time.time() * 1000, "level": 1}
mon.update({"g" + s.capitalize(): catalog.monster(1001010)[s + "_grow_min"] for s in ("atk", "def", "hp", "dex")})
state["monsters"] = [mon]
state["monsters"].append(mon)
state["stacks"][0]["monsterId"] = 101
elif name == "stackCheckProcess":
state["monsters"][0]["mode"] = 2
next(mon for mon in state["monsters"] if mon["id"] == 101)["mode"] = 2
elif name == "monsterSell":
assert body["monsterIds"] == [101]
state["monsters"] = []
state["monsters"] = [mon for mon in state["monsters"] if mon["id"] != 101]
state["stacks"][0]["monsterId"] = -1
state["master"]["money"] += 150
elif name != "masterQueryDetail":
@@ -310,10 +314,11 @@ class AutomationTests(unittest.TestCase):
self.assertEqual(state["master"]["money"], initial_money - 1000)
self.assertIn("共 11 枚", engine.last_draw)
engine.poll() # Hatch, re-read, wait.
state["monsters"][0]["timeStart"] = (time.time() - 601) * 1000
next(mon for mon in state["monsters"] if mon["id"] == 101)["timeStart"] = (time.time() - 601) * 1000
snapshot, _, _ = engine.poll() # Settle growth, dispatch, re-read.
self.assertEqual(snapshot.raw["master"]["money"], initial_money - 850)
self.assertEqual(snapshot.raw["stacks"][0]["monsterId"], -1)
self.assertEqual(set(snapshot.monsters), {900})
self.assertEqual([n for n, _ in calls if n != "masterQueryDetail"],
["gachaGetEggs", "stackAddMonster", "stackCheckProcess", "monsterSell"])
engine.poll()