Select one cultivation target per species and retain growth improvements
This commit is contained in:
@@ -5,6 +5,7 @@ import json
|
||||
import math
|
||||
from pathlib import Path
|
||||
import time
|
||||
from .cultivation import CultivationSelector, growth_score
|
||||
|
||||
WIKI = "https://wiki.biligame.com/myrzx/魔物收益表"
|
||||
|
||||
@@ -299,6 +300,8 @@ class Policy:
|
||||
gift_targets: dict[str, int] = field(default_factory=dict)
|
||||
gift_items: dict[str, dict] = field(default_factory=dict)
|
||||
gift_liked_only: bool = True
|
||||
gift_auto_representative: bool = False
|
||||
keep_better_quality: bool = False
|
||||
|
||||
def __post_init__(self):
|
||||
self.egg_rules = {str(int(key)): asdict(EggRule(**rule)) for key, rule in self.egg_rules.items()}
|
||||
@@ -317,8 +320,9 @@ class Action:
|
||||
|
||||
|
||||
class Planner:
|
||||
def __init__(self, catalog):
|
||||
def __init__(self, catalog, cultivation=None):
|
||||
self.catalog = catalog
|
||||
self.cultivation = cultivation or CultivationSelector(catalog)
|
||||
self.managed = set()
|
||||
self.notes = []
|
||||
self.restocking = set()
|
||||
@@ -341,6 +345,18 @@ class Planner:
|
||||
if condition:
|
||||
return reason
|
||||
quality = math.ceil(sum(qualities) / 4)
|
||||
if policy.keep_better_quality or policy.gift_auto_representative:
|
||||
representative = self.cultivation.select(snapshot).get(str(mon.get("typeId")))
|
||||
if representative and int(representative["id"]) == int(mon["id"]):
|
||||
return "同种魔物的唯一培养代表(等级、好感、资质优先)"
|
||||
if policy.keep_better_quality:
|
||||
if representative is None:
|
||||
return "牧场尚无同种魔物,保留首次获得的魔物"
|
||||
baseline, candidate = growth_score(self.catalog, representative), growth_score(self.catalog, mon)
|
||||
if baseline is None:
|
||||
return "同种培养代表的资质尚未同步,暂时保留"
|
||||
if candidate is not None and candidate > baseline + 1e-8:
|
||||
return f"综合成长资质高于同种培养代表 #{representative['id']}({candidate:.1%} > {baseline:.1%})"
|
||||
if policy.protect_quality == 6:
|
||||
return "攻/防/生命/敏捷四项资质全S(4S)" if all(q == 4 for q in qualities) else ""
|
||||
if quality >= policy.protect_quality:
|
||||
|
||||
Reference in New Issue
Block a user