Просмотр исходного кода

fix(GeneralBattle): Fix activity reward area selection

neptine 2 месяцев назад
Родитель
Сommit
3dca54e1f3
2 измененных файлов с 5 добавлено и 3 удалено
  1. 3 1
      module/atom/click.py
  2. 2 2
      tasks/Component/GeneralBattle/battle_wait.py

+ 3 - 1
module/atom/click.py

@@ -196,7 +196,9 @@ class RuleClickExclude(RuleClick):
         return self._coord_complement(self.distribution)
 
     def coord_in_excluded(self, areas: list[str] | None = None) -> tuple:
-        """Return a random coordinate inside one of the named excluded areas."""
+        """
+        
+        """
         if not areas:
             areas = ['C_END_1_1', 'C_END_1_2', 'C_END_1_3', 'C_END_1_4', 'C_END_1_5', 'C_END_1_6',
                      'C_END_2_1', 'C_END_2_2', 'C_END_2_3', 'C_END_2_4', 'C_END_2_5', 'C_END_2_6']

+ 2 - 2
tasks/Component/GeneralBattle/battle_wait.py

@@ -502,7 +502,7 @@ class BattleWait(BaseTask, GeneralBattleAssets):
             if click is None:
                 raise ValueError(f'Unknown success exclusion click: {area!r}')
             inputs.append(click)
-        return RuleClickExclude(inputs, name='exclude_click_activity')
+        return RuleClickExclude(inputs, name='exclude_click_activity', strategy='rejection', distribution='uniform')
 
     def _bw_success_activity(self, bw_ctx: BattleWaitContext) -> HookSignal:
         if not self.appear(self.I_UI_REWARD):
@@ -523,7 +523,7 @@ class BattleWait(BaseTask, GeneralBattleAssets):
             if self.appear(self.I_UI_REWARD):
                 if random.random() < 0.02:
                     # 有一定的概率专门点击具体的奖励物品
-                    x, y = self.exclude_click_activity.coord_in_excluded(None)
+                    x, y = self.exclude_click_activity.coord_in_excluded(['C_END_ACTIVITY_REWARD'])
                     self.device.click(x=x, y=y, control_name='reward_item')
                     continue
                 self.click(self.exclude_click_activity, interval=1.5)