Add: Predict is_approaching_total with combat_wave_done

This commit is contained in:
LmeSzinc 2024-05-28 03:56:30 +08:00
parent ca18869f2f
commit bad6a5f9bc
3 changed files with 18 additions and 13 deletions

View File

@ -125,7 +125,7 @@ class Combat(CombatInteract, CombatPrepare, CombatState, CombatTeam, CombatSuppo
self.interval_reset(COMBAT_PREPARE)
self.map_A_timer.reset()
if self.appear(COMBAT_PREPARE, interval=2):
if self.obtained_is_full(self.dungeon):
if self.obtained_is_full(self.dungeon, wave_done=self.combat_wave_done):
# Update stamina so task can be delayed if both obtained_is_full and stamina exhausted
self.combat_get_trailblaze_power()
return False

View File

@ -246,7 +246,7 @@ class CombatObtain(PlannerMixin):
self.planner_write()
return items
def obtained_is_full(self, dungeon: DungeonList | None) -> bool:
def obtained_is_full(self, dungeon: DungeonList | None, wave_done=0) -> bool:
if dungeon is None:
self.obtain_frequent_check = False
return False
@ -270,9 +270,9 @@ class CombatObtain(PlannerMixin):
return True
# obtain_frequent_check
# approaching = row.is_approaching_total()
# logger.attr('is_approaching_total', approaching)
# self.obtain_frequent_check = approaching
approaching = row.is_approaching_total(wave_done)
logger.attr('is_approaching_total', approaching)
self.obtain_frequent_check = approaching
return False
def _find_may_obtain(self, skip_first_screenshot=True):

View File

@ -147,32 +147,37 @@ class StoredPlannerProxy(BaseModelWithFallback):
else:
self.value.blue += self.synthesize.purple * 3
def is_approaching_total(self):
def is_approaching_total(self, wave_done: int = 0):
"""
Args:
wave_done:
Returns:
bool: True if the future value may >= total after next combat
"""
wave_done = max(wave_done, 0)
# Items with a static drop rate will have `AVG * (wave_done + 1)
if self.item.dungeon.is_Calyx_Golden_Treasures:
return self.value + 24000 >= self.total
return self.value + 24000 * (wave_done + 12) >= self.total
if self.item.dungeon.is_Calyx_Golden_Memories:
# purple, blue, green = 5, 1, 0
value = self.value.equivalent_green()
total = self.total.equivalent_green()
return value + 48 >= total
if self.item.dungeon.Calyx_Golden_Aether:
return value + 48 * (wave_done + 12) >= total
if self.item.dungeon.is_Calyx_Golden_Aether:
# purple, blue, green = 1, 2, 2.5
value = self.value.equivalent_green()
total = self.total.equivalent_green()
return value + 17.5 >= total
return value + 17.5 * (wave_done + 12) >= total
if self.item.is_ItemAscension:
return self.value + 3 >= self.total
return self.value + 3 * (wave_done + 1) >= self.total
if self.item.is_ItemTrace:
# purple, blue, green = 0.155, 1, 1.25
value = self.value.equivalent_green()
total = self.total.equivalent_green()
return value + 33.87 >= total
return value + 5.645 * (wave_done + 12) >= total
if self.item.is_ItemWeekly:
return self.value + 3 >= self.total
return self.value + 3 * (wave_done + 1) >= self.total
return False
def update_progress(self):