Add: is_approaching_total(), no use yet

This commit is contained in:
LmeSzinc 2024-05-21 04:44:42 +08:00
parent 8ed52d74bc
commit cf31bd93af
2 changed files with 35 additions and 2 deletions

View File

@ -241,7 +241,9 @@ class CombatObtain(PlannerMixin):
return True
# obtain_frequent_check
self.obtain_frequent_check = True
# approaching = row.is_approaching_total()
# logger.attr('is_approaching_total', approaching)
# self.obtain_frequent_check = approaching
return False
def _find_may_obtain(self, skip_first_screenshot=True):

View File

@ -74,6 +74,9 @@ class MultiValue(BaseModelWithFallback):
self.blue += other.blue
self.purple += other.purple
def equivalent_green(self):
return self.green + self.blue * 3 + self.purple * 9
class StoredPlannerProxy(BaseModelWithFallback):
item: ITEM_TYPES
@ -144,9 +147,37 @@ class StoredPlannerProxy(BaseModelWithFallback):
else:
self.value.blue += self.synthesize.purple * 3
def is_approaching_total(self):
"""
Returns:
bool: True if the future value may >= total after next combat
"""
if self.item.dungeon.is_Calyx_Golden_Treasures:
return self.value + 24000 >= 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:
# purple, blue, green = 1, 2, 2.5
value = self.value.equivalent_green()
total = self.total.equivalent_green()
return value + 17.5 >= total
if self.item.is_ItemAscension:
return self.value + 3 >= 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
if self.item.is_ItemWeekly:
return self.value + 3 >= self.total
return False
def update_progress(self):
if self.item.has_group_base:
total = self.total.green + self.total.blue * 3 + self.total.purple * 9
total = self.total.equivalent_green()
green = min(self.value.green, self.total.green)
blue = min(self.value.blue + self.synthesize.blue, self.total.blue)
purple = min(self.value.purple + self.synthesize.purple, self.total.purple)