@@ -102,41 +102,69 @@ def script_cultivate_training_select(ctx: UmamusumeContext):
102102
103103 if not ctx .cultivate_detail .turn_info .parse_train_info_finish :
104104 def _parse_training_in_thread (ctx , img , train_type ):
105- """Helper function to run parsing in a separate thread."""
106- parse_training_result (ctx , img , train_type )
107- parse_training_support_card (ctx , img , train_type )
105+ """Helper function to run parsing in a separate thread."""
106+ parse_training_result (ctx , img , train_type )
107+ parse_training_support_card (ctx , img , train_type )
108+
109+ def _clear_training (ctx : UmamusumeContext , train_type : TrainingType ):
110+ ctx .cultivate_detail .turn_info .training_info_list [train_type .value - 1 ].speed_incr = 0
111+ ctx .cultivate_detail .turn_info .training_info_list [train_type .value - 1 ].stamina_incr = 0
112+ ctx .cultivate_detail .turn_info .training_info_list [train_type .value - 1 ].power_incr = 0
113+ ctx .cultivate_detail .turn_info .training_info_list [train_type .value - 1 ].will_incr = 0
114+ ctx .cultivate_detail .turn_info .training_info_list [train_type .value - 1 ].intelligence_incr = 0
115+ ctx .cultivate_detail .turn_info .training_info_list [train_type .value - 1 ].skill_point_incr = 0
116+ ctx .cultivate_detail .turn_info .training_info_list [train_type .value - 1 ].support_card_info_list = []
117+
108118
109119 threads :list [threading .Thread ] = []
110120
121+ # 获取当年的额外权重
122+ date = ctx .cultivate_detail .turn_info .date
123+ if date == 0 :
124+ extra_weight = [0 , 0 , 0 , 0 , 0 ]
125+ elif date <= 24 :
126+ extra_weight = ctx .cultivate_detail .extra_weight [0 ]
127+ elif date <= 48 :
128+ extra_weight = ctx .cultivate_detail .extra_weight [1 ]
129+ else :
130+ extra_weight = ctx .cultivate_detail .extra_weight [2 ]
131+
111132 img = ctx .current_screen
112133 train_type = parse_train_type (ctx , img )
113134 if train_type == TrainingType .TRAINING_TYPE_UNKNOWN :
114135 return
115136 viewed = train_type .value
116- thread = threading .Thread (target = _parse_training_in_thread ,
117- args = (ctx , img , train_type ))
118- threads .append (thread )
119- thread .start ()
137+ # 仅当权重不为-1时, 开始parse, 否则清零
138+ if extra_weight [viewed - 1 ] != - 1 :
139+ thread = threading .Thread (target = _parse_training_in_thread ,
140+ args = (ctx , img , train_type ))
141+ threads .append (thread )
142+ thread .start ()
143+ else :
144+ _clear_training (ctx , train_type )
120145
121146 for i in range (5 ):
122147 if i != (viewed - 1 ):
123- retry = 0
124- max_retry = 3
125- ctx .ctrl .click_by_point (TRAINING_POINT_LIST [i ])
126- img = ctx .ctrl .get_screen ()
127- while parse_train_type (ctx , img ) != TrainingType (i + 1 ) and retry < max_retry :
128- if retry > 2 :
129- ctx .ctrl .click_by_point (TRAINING_POINT_LIST [i ])
130- time .sleep (0.2 )
148+ if extra_weight [i ] != - 1 :
149+ retry = 0
150+ max_retry = 3
151+ ctx .ctrl .click_by_point (TRAINING_POINT_LIST [i ])
131152 img = ctx .ctrl .get_screen ()
132- retry += 1
133- if retry == max_retry :
134- return
135-
136- thread = threading .Thread (target = _parse_training_in_thread ,
137- args = (ctx , img , TrainingType (i + 1 )))
138- threads .append (thread )
139- thread .start ()
153+ while parse_train_type (ctx , img ) != TrainingType (i + 1 ) and retry < max_retry :
154+ if retry > 2 :
155+ ctx .ctrl .click_by_point (TRAINING_POINT_LIST [i ])
156+ time .sleep (0.2 )
157+ img = ctx .ctrl .get_screen ()
158+ retry += 1
159+ if retry == max_retry :
160+ return
161+
162+ thread = threading .Thread (target = _parse_training_in_thread ,
163+ args = (ctx , img , TrainingType (i + 1 )))
164+ threads .append (thread )
165+ thread .start ()
166+ else :
167+ _clear_training (ctx , TrainingType (i + 1 ))
140168
141169 for thread in threads :
142170 thread .join ()
0 commit comments