Add: Change flagship when level >= 32

This commit is contained in:
LmeSzinc 2021-06-30 18:04:31 +08:00
parent e6c17171c8
commit d750f73696
4 changed files with 75 additions and 2 deletions

View File

@ -215,6 +215,12 @@ class AzurLaneAutoScript:
az.run('campaign_12_2_leveling')
self.reward_when_finished()
def gems_farming(self):
from module.campaign.gems_farming import GemsFarming
az = GemsFarming(self.config, device=self.device)
az.run(self.config.GEMS_STAGE)
self.reward_when_finished()
def retire(self):
from module.retire.retirement import Retirement
az = Retirement(self.config, device=self.device)

View File

@ -4,7 +4,6 @@ from module.equipment.assets import *
from module.equipment.fleet_equipment import OCR_FLEET_INDEX
from module.retire.dock import *
from module.ui.page import page_fleet
from module.logger import logger
class GemsFarming(CampaignRun):
@ -61,3 +60,50 @@ class GemsFarming(CampaignRun):
self.dock_filter_set_faster()
self.ui_back(check_button=page_fleet.check_button)
return False
_trigger_lv32 = False
def triggered_stop_condition(self, oil_check=True):
# Lv32 limit
if self.config.STOP_IF_REACH_LV32 and self.campaign.config.LV32_TRIGGERED:
self._trigger_lv32 = True
logger.hr('Triggered lv32 limit')
return True
return super().triggered_stop_condition(oil_check=oil_check)
def run(self, name, folder='campaign_main', total=0):
name = name.lower()
if not name[0].isdigit():
folder = self.config.EVENT_NAME
else:
name = 'campaign_' + name.replace('-', '_')
while 1:
backup = self.config.cover(
STOP_IF_REACH_LV32=True,
FLEET_1=self.config.GEMS_FLEET_1,
FLEET_2=self.config.GEMS_FLEET_2,
FLEET_BOSS=1,
SUBMARINE=0,
FLEET_1_FORMATION=1,
FLEET_2_FORMATION=1,
FLEET_1_AUTO_MODE='combat_auto',
FLEET_2_AUTO_MODE='combat_auto',
ENABLE_MAP_FLEET_LOCK=True,
ENABLE_AUTO_SEARCH=False,
ENABLE_2X_BOOK=False,
STOP_IF_MAP_REACH='no',
ENABLE_EMOTION_REDUCE=False,
IGNORE_LOW_EMOTION_WARN=True,
)
self._trigger_lv32 = False
super().run(name=name, folder=folder, total=total)
backup.recover()
# End
if self._trigger_lv32:
self.flagship_change()
continue
else:
break

View File

@ -55,7 +55,7 @@ class Level(ModuleBase):
Returns:
list[int]:
"""
if not self.config.STOP_IF_REACH_LV120:
if not self.config.STOP_IF_REACH_LV120 and not self.config.STOP_IF_REACH_LV32:
return [-1] * 6
self._lv_before_battle = self.lv if after_battle else [-1] * 6
@ -66,6 +66,7 @@ class Level(ModuleBase):
if after_battle:
self.lv120_triggered()
self.lv32_triggered()
return self.lv
@ -81,6 +82,17 @@ class Level(ModuleBase):
return False
def lv32_triggered(self):
if not self.config.STOP_IF_REACH_LV32:
return False
if self.lv[0] >= 32:
logger.info(f'Position 0 LV.32 Reached')
self.config.LV32_TRIGGERED = True
return True
return False
class LevelOcr(Digit):
def pre_process(self, image):

View File

@ -95,6 +95,7 @@ class AzurLaneConfig:
module.combat.level
"""
LV120_TRIGGERED = False
LV32_TRIGGERED = False
"""
module.campaign
@ -113,6 +114,7 @@ class AzurLaneConfig:
STOP_IF_TRIGGER_EMOTION_LIMIT = False
STOP_IF_DOCK_FULL = False
STOP_IF_REACH_LV120 = False
STOP_IF_REACH_LV32 = False
STOP_IF_MAP_REACH = 'no' # no, map_100, map_3_star, map_green_without_3_star, map_green
STOP_IF_GET_SHIP = False
@ -124,6 +126,13 @@ class AzurLaneConfig:
# In Dreamwaker's Butterfly (event_20200917) add new stage entrance icons, called `blue`.
STAGE_ENTRANCE = ['normal'] # normal, blue, half
"""
gems_farming
"""
GEMS_STAGE = 'A3'
GEMS_FLEET_1 = 3
GEMS_FLEET_2 = 5
"""
module.event
"""