Przeglądaj źródła

Merge pull request #1652 from yEs1do/fix(TrueOrochi_times)

修复真蛇次数计算逻辑错误
huangrunheng 4 miesięcy temu
rodzic
commit
7ee983dbd4
1 zmienionych plików z 7 dodań i 6 usunięć
  1. 7 6
      tasks/TrueOrochi/script_task.py

+ 7 - 6
tasks/TrueOrochi/script_task.py

@@ -181,26 +181,27 @@ class ScriptTask(OrochiScriptTask, TrueOrochiAssets):
     def check_times(self, battle: bool):
         """
         后续的次数和时间设置
-        :param battle:
+        :param battle: 本次是否挑战了真蛇
         :param current_success: 这周的成功次数
         :return:
         """
         now = datetime.now()
         now_year, now_week_number, now_weekday = now.isocalendar()
         if battle:
+            # 只有真正打过才加一次数
+            logger.info('Add current_success by 1')
+            self.config.true_orochi.true_orochi_config.current_success += 1
+            self.config.true_orochi.true_orochi_config.current_success = min(2, self.config.true_orochi.true_orochi_config.current_success)
             next_run = now + self.config.true_orochi.scheduler.success_interval
         else:
+            logger.info('Battle skipped or not found True Orochi')
             next_run = now + self.config.true_orochi.scheduler.failure_interval
         next_run_year, next_run_week_number, next_run_weekday = next_run.isocalendar()
         # 如果下次运行的时间是下一周,那么就重置成功次数
         if now_week_number != next_run_week_number:
             logger.info('Reset current_success')
             self.config.true_orochi.true_orochi_config.current_success = 0
-        else:
-            # 如果不是下一周,那么就加一
-            logger.info('Add current_success by 1')
-            self.config.true_orochi.true_orochi_config.current_success += 1
-            self.config.true_orochi.true_orochi_config.current_success = min(2, self.config.true_orochi.true_orochi_config.current_success)
+
         self.config.save()
         self.set_next_run(task='TrueOrochi', target=next_run)
         # self.set_next_run('TrueOrochi', finish=True, success=True)