fix: keep automatic cultivation on one stable primary per species
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
import math
|
||||
from .model import Action, seconds
|
||||
from .cultivation import CultivationSelector
|
||||
from .team_availability import _exploring_ids
|
||||
|
||||
|
||||
def item_reserve(item_type, ranch, quests):
|
||||
@@ -40,11 +41,16 @@ class GiftPlanner:
|
||||
mon.update(feel=entry["feel"], giftTime=entry["giftTime"])
|
||||
|
||||
def candidates(self, snapshot, policy):
|
||||
# Select identity before checking availability; a busy primary must
|
||||
# never cause its quality backup to receive cultivation resources.
|
||||
primaries = self.cultivation.select(snapshot)
|
||||
exploring = _exploring_ids(snapshot)
|
||||
available = {int(mon["id"]): mon for mon in primaries.values()
|
||||
if not mon.get("inExploreTeam") and not mon.get("inBuild") and int(mon["id"]) not in exploring}
|
||||
if policy.gift_auto_representative:
|
||||
return sorted(self.cultivation.select(snapshot).values(), key=lambda mon: self.cultivation.rank(mon), reverse=True)
|
||||
monsters = snapshot.monsters
|
||||
return [monsters[int(key)] for key, _ in sorted(policy.gift_targets.items(), key=lambda pair: pair[1])
|
||||
if int(key) in monsters and monsters[int(key)].get("process") == 3]
|
||||
return sorted(available.values(), key=lambda mon: self.cultivation.rank(mon), reverse=True)
|
||||
return [available[int(key)] for key, _ in sorted(policy.gift_targets.items(), key=lambda pair: pair[1])
|
||||
if int(key) in available]
|
||||
|
||||
def target(self, snapshot, policy):
|
||||
for mon in self.candidates(snapshot, policy):
|
||||
|
||||
Reference in New Issue
Block a user