diff --git a/arknights_mower/models/operator_select.model b/arknights_mower/models/operator_select.model index d37a8a6f..051c6d68 100644 Binary files a/arknights_mower/models/operator_select.model and b/arknights_mower/models/operator_select.model differ diff --git a/arknights_mower/models/recruit.pkl b/arknights_mower/models/recruit.pkl index 76cc2fca..f5f7eb21 100644 Binary files a/arknights_mower/models/recruit.pkl and b/arknights_mower/models/recruit.pkl differ diff --git a/arknights_mower/utils/operators.py b/arknights_mower/utils/operators.py index b5e85ea3..b3f1274a 100644 --- a/arknights_mower/utils/operators.py +++ b/arknights_mower/utils/operators.py @@ -685,11 +685,6 @@ def __repr__(self): class Operator: - time_stamp = None - depletion_rate = 0 - workaholic = False - arrange_order = [2, "false"] - refresh_drained = False def __init__( self, @@ -731,6 +726,9 @@ def __init__( self.lower_limit = lower_limit self.depletion_rate = depletion_rate self.time_stamp = time_stamp + self.workaholic = False + self.arrange_order = [2, "false"] + self.refresh_drained = False @property def current_room(self): @@ -800,5 +798,14 @@ def current_mood(self): else: return self.mood + def predict_exhaust(self): + remaining_mood = self.mood - self.lower_limit # 剩余心情 + depletion_rate = self.depletion_rate # 心情掉率,小时单位 + # 计算到心情归零所需时间(小时),再加上当前时间戳 + if depletion_rate > 0: + return self.time_stamp + timedelta(hours=((remaining_mood / depletion_rate) - 0.5)) + else: + return datetime.now()+timedelta(hours=24) + def __repr__(self): return f"Operator(name='{self.name}', room='{self.room}', index={self.index}, group='{self.group}', replacement={self.replacement}, resting_priority='{self.resting_priority}', current_room='{self.current_room}',exhaust_require={self.exhaust_require},mood={self.mood}, upper_limit={self.upper_limit}, rest_in_full={self.rest_in_full}, current_index={self.current_index}, lower_limit={self.lower_limit}, operator_type='{self.operator_type}',depletion_rate={self.depletion_rate},time_stamp='{self.time_stamp}',refresh_order_room = {self.refresh_order_room})" diff --git a/auto_get_res_new.py b/auto_get_res_new.py index 58b051d1..803976b2 100644 --- a/auto_get_res_new.py +++ b/auto_get_res_new.py @@ -491,8 +491,8 @@ def 训练选中的干员名的模型(self): "arknights_mower/fonts/SourceHanSansCN-Medium.otf", 25 ) - font26 = ImageFont.truetype( - "arknights_mower/fonts/SourceHanSansCN-Medium.otf", 26 + font27 = ImageFont.truetype( + "arknights_mower/fonts/SourceHanSansCN-Medium.otf", 27 ) data = {} @@ -504,16 +504,35 @@ def 训练选中的干员名的模型(self): for idx, operator in enumerate(agent_list): font = font31 if not operator[0].encode().isalpha(): - if "·" in operator: - # 维娜·维多利亚 识别的临时解决办法 - font = font26 - elif len(operator) == 7: - font = font25 + if len(operator) == 7: + if "·" in operator: + # 维娜·维多利亚 识别的临时解决办法 + font = font27 + else: + font = font25 elif len(operator) == 6: font = font30 img = Image.new(mode="L", size=(400, 100)) draw = ImageDraw.Draw(img) - draw.text((50, 20), operator, fill=(255,), font=font) + if "·" in operator: + x, y = 50, 20 + char_index = { + i: False for i, char in enumerate(operator) if char == "·" + } + for i, char in enumerate(operator): + if i in char_index and not char_index[i]: + x -= 8 + char_index[i] = True + if i + 1 not in char_index and char == "·": + char_index[i + 1] = False + draw.text((x, y), char, fill=(255,), font=font) # 绘制每个字符 + char_width, char_height = font.getbbox(char)[ + 2:4 + ] # getbbox 返回 (x1, y1, x2, y2) + x += char_width + else: + draw.text((50, 20), operator, fill=(255,), font=font) + img = np.array(img, dtype=np.uint8) img = thres2(img, 140) dilation = cv2.dilate(img, kernel, iterations=1)