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
+13 -4
View File
@@ -9,23 +9,32 @@ os.environ.setdefault("QT_QPA_PLATFORM", "offscreen")
from PySide6 import QtWidgets as W
from PySide6.QtTest import QTest
from ranch_assistant.cultivation import CultivationSelector, growth_score
from ranch_assistant.cultivation import CultivationSelector, growth_score, quality_rank
from ranch_assistant.engine import Engine, demo_snapshot
from ranch_assistant.gifts import GiftPlanner
from ranch_assistant.gui import Window
from ranch_assistant.model import Catalog, Planner, Policy, Snapshot
from ranch_assistant.model import Catalog, EggRule, Planner, Policy, Snapshot
from ranch_assistant.policy_io import import_config, portable_config
from ranch_assistant.tests.test_core import workspace_temp
from ranch_assistant.tests.test_accounts import fake_client, role_snapshot
from ranch_assistant.api import Session
def monster(catalog, mid, *, level=10, feel=0, scale=.3, species=1001010, process=3):
def monster(catalog, mid, *, level=10, feel=0, scale=.3, species=1001010, process=3, **values):
row = catalog.monster(species)
return {"id": mid, "typeId": species, "process": process, "mode": 2, "level": level,
"feel": feel, "entangleLevel": 0, "giftTime": 0, "roomId": 1, "lock": 0,
**{"g" + stat.capitalize(): row[stat + "_grow_min"] + scale * (row[stat + "_grow_max"] - row[stat + "_grow_min"])
for stat in ("atk", "def", "hp", "dex")}}
for stat in ("atk", "def", "hp", "dex")}, **values}
def graded_monster(catalog, mid, grades, **values):
mon = monster(catalog, mid, **values)
row = catalog.monster(mon["typeId"])
for stat, grade in zip(("atk", "def", "hp", "dex"), grades):
low, high = row[stat + "_grow_min"], row[stat + "_grow_max"]
mon["g" + stat.capitalize()] = low + (high - low) * {"C": .1, "B": .375, "A": .625, "S": .9}[grade]
return mon
class CultivationTests(unittest.TestCase):