1
0
mirror of https://gitee.com/sui-feng-cb/AzurLaneAutoScript1 synced 2026-03-09 16:19:03 +08:00
AzurLaneAutoScript/campaign/campaign_main/campaign_15_base.py

219 lines
7.3 KiB
Python
Raw Normal View History

Add: 15图开荒/周回 (#3563) * Add: W15 maps extracted * Add: template for Special Carrier in W15 * Add: method mob_move * Fix: MapDetectionError in strategy mob move * Fix: adjacent grid judge condition * Fix: should focus on location before moving * Fix: should update view before further operation * Fix: wait for STRATEGY_OPENED after executing mob move * Fix: offset for assets in _mob_move() * Opt: judge if movable before moving camera * Add: W15 mechanism * Opt: Rename Special Carrier asset name * Fix: offset for MOB_MOVE_1/MOB_MOVE_2 * Fix: separate MOB_MOVE_1 and MOB_MOVE_2 * Fix: should use appear_then_click in strategy_mob_move_enter * Fix: function import in campaign_15_base.py * Fix: missing assets import * Fix: missing offset in strategy_mob_move_cancel() * Fix: should move only once in a campaign * Temp: modify special carrier filter string to 3E * Fix: missing self. before 'moved' variable * Revert "Fix: missing self. before 'moved' variable" This reverts commit 00f70e0ab55e422898cb90c5d5e54d4e7c989511. * Revert "Fix: should move only once in a campaign" This reverts commit b588f5bb07dfc4511f39fa0797fbe160f356d604. * Fix: force goto special carrier * Fix: missing return True in battle function * Fix: enlarge offset of MOB_MOVE_ICON * Fix: typo in campaing_15_3 * Fix: update view after moving mob * Fix: should use full_scan_movable since mob moved * Fix: missing map_data_init() in campaign_15_4.py * Fix: battle 4 should be done by mob fleet * Revert "Fix: battle 4 should be done by mob fleet" This reverts commit 0e2af1ec817b7bc89fe123f03a33ea9ad955973f. * Fix: should switch to fleet_1 after battle_3 * Add: battle function when using clear mode * Fix: missing import * Fix: colliding Config class * Fix: Config.when should contain all cases * Opt: pick ammo after third battle in clear mode of 15-4 * Del: old assets CarrierSpecial * Fix: remake of CarrierSpecial template * Add: UI mask for W15 * Fix: missing ASSETS import * Fix: change full_scan_movable() to predict() * Fix: predict should be done after each move * Opt: camera_data in W15 * Del: remove predict * Add: map info process after mob move * Add: support for multi bosses in _expected_end() for W15 * Opt: show map after moving * Del: remove redundant import in fleet.py * Opt: using clear_chosen_enemy() instead of goto() directly * Fix: should first take screenshot before strategy enter/confirm/cancel * Add: asset TEMPLATE_SIREN_BOSS * Opt: Handle first stages of BOSS as Siren in 15-3/15-4 * Fix: missing override map_data * Add: ignore is_boss prediction for siren boss in 15-3/15-4 * Fix: should not use decorator Config with battle_x functions * Opt: camera data in 15-4 * Opt: directly overwrite map info into original map_data * Fix: missing indent block in campaign_15_4.py * Fix: expect 15-3/15-4 first bosses as siren * Revert "Add: ignore is_boss prediction for siren boss in 15-3/15-4" This reverts commit 1104631f92e5df0672dce8c7acaa1eb122731746. * Revert "Add: asset TEMPLATE_SIREN_BOSS" This reverts commit a29d6b6b9bfb9d79963adb404ce2091cbfafb810. * Revert "Add: support for multi bosses in _expected_end() for W15" This reverts commit 8d357abe5bab79a643e23e8513cefa87d31cb3e8. * Del: redundent map config * Fix: recover boss grids * Del: redundant clear_siren() * Del: redundant clear_siren() in battle_6 * Add: template for mob move icon * Opt: enlarge reinforcement fleet mask area for W15 * Opt: method _mob_move * Upd: TEMPLATE_MOB_MOVE_ICON * Fix: should have cool time between clicks of grid * Revert "Upd: TEMPLATE_MOB_MOVE_ICON" This reverts commit b3f2dcbc88dbe166470905f33d041b91c2192f57. * Upd: TEMPLATE_MOB_MOVE_ICON * Upd: TEMPLATE_MOB_MOVE_ICON * Upd: predict_mob_move_icon * Fix: 15-2 camera spawn point * Fix: should update view using self.device.image * Revert "Upd: TEMPLATE_MOB_MOVE_ICON" This reverts commit 92a12596a8f271ec64e249ecb58779d9b64ecea6. * Del: redundant assets MOB_MOVE_ICON.png * Fix: using map_is_clear_mode to get real value of clear mode * Opt: check mob_movable before moving * Opt: Refactor _mob_move * Fix: camera_sight in W15 * Opt: move sight to further point in _mob_move
2024-04-19 01:29:17 +08:00
from module.base.mask import Mask
from module.base.timer import Timer
from module.campaign.campaign_base import CampaignBase as CampaignBase_
from module.handler.assets import STRATEGY_OPENED
from module.logger import logger
from module.map.map_grids import SelectedGrids
from module.map.utils import location_ensure
from module.map_detection.grid import GridInfo
from module.map_detection.utils_assets import ASSETS
Add: 15图开荒/周回 (#3563) * Add: W15 maps extracted * Add: template for Special Carrier in W15 * Add: method mob_move * Fix: MapDetectionError in strategy mob move * Fix: adjacent grid judge condition * Fix: should focus on location before moving * Fix: should update view before further operation * Fix: wait for STRATEGY_OPENED after executing mob move * Fix: offset for assets in _mob_move() * Opt: judge if movable before moving camera * Add: W15 mechanism * Opt: Rename Special Carrier asset name * Fix: offset for MOB_MOVE_1/MOB_MOVE_2 * Fix: separate MOB_MOVE_1 and MOB_MOVE_2 * Fix: should use appear_then_click in strategy_mob_move_enter * Fix: function import in campaign_15_base.py * Fix: missing assets import * Fix: missing offset in strategy_mob_move_cancel() * Fix: should move only once in a campaign * Temp: modify special carrier filter string to 3E * Fix: missing self. before 'moved' variable * Revert "Fix: missing self. before 'moved' variable" This reverts commit 00f70e0ab55e422898cb90c5d5e54d4e7c989511. * Revert "Fix: should move only once in a campaign" This reverts commit b588f5bb07dfc4511f39fa0797fbe160f356d604. * Fix: force goto special carrier * Fix: missing return True in battle function * Fix: enlarge offset of MOB_MOVE_ICON * Fix: typo in campaing_15_3 * Fix: update view after moving mob * Fix: should use full_scan_movable since mob moved * Fix: missing map_data_init() in campaign_15_4.py * Fix: battle 4 should be done by mob fleet * Revert "Fix: battle 4 should be done by mob fleet" This reverts commit 0e2af1ec817b7bc89fe123f03a33ea9ad955973f. * Fix: should switch to fleet_1 after battle_3 * Add: battle function when using clear mode * Fix: missing import * Fix: colliding Config class * Fix: Config.when should contain all cases * Opt: pick ammo after third battle in clear mode of 15-4 * Del: old assets CarrierSpecial * Fix: remake of CarrierSpecial template * Add: UI mask for W15 * Fix: missing ASSETS import * Fix: change full_scan_movable() to predict() * Fix: predict should be done after each move * Opt: camera_data in W15 * Del: remove predict * Add: map info process after mob move * Add: support for multi bosses in _expected_end() for W15 * Opt: show map after moving * Del: remove redundant import in fleet.py * Opt: using clear_chosen_enemy() instead of goto() directly * Fix: should first take screenshot before strategy enter/confirm/cancel * Add: asset TEMPLATE_SIREN_BOSS * Opt: Handle first stages of BOSS as Siren in 15-3/15-4 * Fix: missing override map_data * Add: ignore is_boss prediction for siren boss in 15-3/15-4 * Fix: should not use decorator Config with battle_x functions * Opt: camera data in 15-4 * Opt: directly overwrite map info into original map_data * Fix: missing indent block in campaign_15_4.py * Fix: expect 15-3/15-4 first bosses as siren * Revert "Add: ignore is_boss prediction for siren boss in 15-3/15-4" This reverts commit 1104631f92e5df0672dce8c7acaa1eb122731746. * Revert "Add: asset TEMPLATE_SIREN_BOSS" This reverts commit a29d6b6b9bfb9d79963adb404ce2091cbfafb810. * Revert "Add: support for multi bosses in _expected_end() for W15" This reverts commit 8d357abe5bab79a643e23e8513cefa87d31cb3e8. * Del: redundent map config * Fix: recover boss grids * Del: redundant clear_siren() * Del: redundant clear_siren() in battle_6 * Add: template for mob move icon * Opt: enlarge reinforcement fleet mask area for W15 * Opt: method _mob_move * Upd: TEMPLATE_MOB_MOVE_ICON * Fix: should have cool time between clicks of grid * Revert "Upd: TEMPLATE_MOB_MOVE_ICON" This reverts commit b3f2dcbc88dbe166470905f33d041b91c2192f57. * Upd: TEMPLATE_MOB_MOVE_ICON * Upd: TEMPLATE_MOB_MOVE_ICON * Upd: predict_mob_move_icon * Fix: 15-2 camera spawn point * Fix: should update view using self.device.image * Revert "Upd: TEMPLATE_MOB_MOVE_ICON" This reverts commit 92a12596a8f271ec64e249ecb58779d9b64ecea6. * Del: redundant assets MOB_MOVE_ICON.png * Fix: using map_is_clear_mode to get real value of clear mode * Opt: check mob_movable before moving * Opt: Refactor _mob_move * Fix: camera_sight in W15 * Opt: move sight to further point in _mob_move
2024-04-19 01:29:17 +08:00
MASK_MAP_UI_W15 = Mask(file='./assets/mask/MASK_MAP_UI_W15.png')
class Config:
# Ambushes can be avoid by having more DDs.
MAP_WALK_TURNING_OPTIMIZE = False
MAP_HAS_MYSTERY = False
Add: 15图开荒/周回 (#3563) * Add: W15 maps extracted * Add: template for Special Carrier in W15 * Add: method mob_move * Fix: MapDetectionError in strategy mob move * Fix: adjacent grid judge condition * Fix: should focus on location before moving * Fix: should update view before further operation * Fix: wait for STRATEGY_OPENED after executing mob move * Fix: offset for assets in _mob_move() * Opt: judge if movable before moving camera * Add: W15 mechanism * Opt: Rename Special Carrier asset name * Fix: offset for MOB_MOVE_1/MOB_MOVE_2 * Fix: separate MOB_MOVE_1 and MOB_MOVE_2 * Fix: should use appear_then_click in strategy_mob_move_enter * Fix: function import in campaign_15_base.py * Fix: missing assets import * Fix: missing offset in strategy_mob_move_cancel() * Fix: should move only once in a campaign * Temp: modify special carrier filter string to 3E * Fix: missing self. before 'moved' variable * Revert "Fix: missing self. before 'moved' variable" This reverts commit 00f70e0ab55e422898cb90c5d5e54d4e7c989511. * Revert "Fix: should move only once in a campaign" This reverts commit b588f5bb07dfc4511f39fa0797fbe160f356d604. * Fix: force goto special carrier * Fix: missing return True in battle function * Fix: enlarge offset of MOB_MOVE_ICON * Fix: typo in campaing_15_3 * Fix: update view after moving mob * Fix: should use full_scan_movable since mob moved * Fix: missing map_data_init() in campaign_15_4.py * Fix: battle 4 should be done by mob fleet * Revert "Fix: battle 4 should be done by mob fleet" This reverts commit 0e2af1ec817b7bc89fe123f03a33ea9ad955973f. * Fix: should switch to fleet_1 after battle_3 * Add: battle function when using clear mode * Fix: missing import * Fix: colliding Config class * Fix: Config.when should contain all cases * Opt: pick ammo after third battle in clear mode of 15-4 * Del: old assets CarrierSpecial * Fix: remake of CarrierSpecial template * Add: UI mask for W15 * Fix: missing ASSETS import * Fix: change full_scan_movable() to predict() * Fix: predict should be done after each move * Opt: camera_data in W15 * Del: remove predict * Add: map info process after mob move * Add: support for multi bosses in _expected_end() for W15 * Opt: show map after moving * Del: remove redundant import in fleet.py * Opt: using clear_chosen_enemy() instead of goto() directly * Fix: should first take screenshot before strategy enter/confirm/cancel * Add: asset TEMPLATE_SIREN_BOSS * Opt: Handle first stages of BOSS as Siren in 15-3/15-4 * Fix: missing override map_data * Add: ignore is_boss prediction for siren boss in 15-3/15-4 * Fix: should not use decorator Config with battle_x functions * Opt: camera data in 15-4 * Opt: directly overwrite map info into original map_data * Fix: missing indent block in campaign_15_4.py * Fix: expect 15-3/15-4 first bosses as siren * Revert "Add: ignore is_boss prediction for siren boss in 15-3/15-4" This reverts commit 1104631f92e5df0672dce8c7acaa1eb122731746. * Revert "Add: asset TEMPLATE_SIREN_BOSS" This reverts commit a29d6b6b9bfb9d79963adb404ce2091cbfafb810. * Revert "Add: support for multi bosses in _expected_end() for W15" This reverts commit 8d357abe5bab79a643e23e8513cefa87d31cb3e8. * Del: redundent map config * Fix: recover boss grids * Del: redundant clear_siren() * Del: redundant clear_siren() in battle_6 * Add: template for mob move icon * Opt: enlarge reinforcement fleet mask area for W15 * Opt: method _mob_move * Upd: TEMPLATE_MOB_MOVE_ICON * Fix: should have cool time between clicks of grid * Revert "Upd: TEMPLATE_MOB_MOVE_ICON" This reverts commit b3f2dcbc88dbe166470905f33d041b91c2192f57. * Upd: TEMPLATE_MOB_MOVE_ICON * Upd: TEMPLATE_MOB_MOVE_ICON * Upd: predict_mob_move_icon * Fix: 15-2 camera spawn point * Fix: should update view using self.device.image * Revert "Upd: TEMPLATE_MOB_MOVE_ICON" This reverts commit 92a12596a8f271ec64e249ecb58779d9b64ecea6. * Del: redundant assets MOB_MOVE_ICON.png * Fix: using map_is_clear_mode to get real value of clear mode * Opt: check mob_movable before moving * Opt: Refactor _mob_move * Fix: camera_sight in W15 * Opt: move sight to further point in _mob_move
2024-04-19 01:29:17 +08:00
MAP_ENEMY_TEMPLATE = ['Light', 'Main', 'Carrier', 'CarrierSpecial']
INTERNAL_LINES_FIND_PEAKS_PARAMETERS = {
'height': (80, 255 - 33),
'width': (0.9, 10),
'prominence': 10,
'distance': 35,
}
HOMO_CANNY_THRESHOLD = (50, 100)
MAP_SWIPE_MULTIPLY = (0.993, 1.011)
MAP_SWIPE_MULTIPLY_MINITOUCH = (0.960, 0.978)
MAP_SWIPE_MULTIPLY_MAATOUCH = (0.932, 0.949)
Add: 15图开荒/周回 (#3563) * Add: W15 maps extracted * Add: template for Special Carrier in W15 * Add: method mob_move * Fix: MapDetectionError in strategy mob move * Fix: adjacent grid judge condition * Fix: should focus on location before moving * Fix: should update view before further operation * Fix: wait for STRATEGY_OPENED after executing mob move * Fix: offset for assets in _mob_move() * Opt: judge if movable before moving camera * Add: W15 mechanism * Opt: Rename Special Carrier asset name * Fix: offset for MOB_MOVE_1/MOB_MOVE_2 * Fix: separate MOB_MOVE_1 and MOB_MOVE_2 * Fix: should use appear_then_click in strategy_mob_move_enter * Fix: function import in campaign_15_base.py * Fix: missing assets import * Fix: missing offset in strategy_mob_move_cancel() * Fix: should move only once in a campaign * Temp: modify special carrier filter string to 3E * Fix: missing self. before 'moved' variable * Revert "Fix: missing self. before 'moved' variable" This reverts commit 00f70e0ab55e422898cb90c5d5e54d4e7c989511. * Revert "Fix: should move only once in a campaign" This reverts commit b588f5bb07dfc4511f39fa0797fbe160f356d604. * Fix: force goto special carrier * Fix: missing return True in battle function * Fix: enlarge offset of MOB_MOVE_ICON * Fix: typo in campaing_15_3 * Fix: update view after moving mob * Fix: should use full_scan_movable since mob moved * Fix: missing map_data_init() in campaign_15_4.py * Fix: battle 4 should be done by mob fleet * Revert "Fix: battle 4 should be done by mob fleet" This reverts commit 0e2af1ec817b7bc89fe123f03a33ea9ad955973f. * Fix: should switch to fleet_1 after battle_3 * Add: battle function when using clear mode * Fix: missing import * Fix: colliding Config class * Fix: Config.when should contain all cases * Opt: pick ammo after third battle in clear mode of 15-4 * Del: old assets CarrierSpecial * Fix: remake of CarrierSpecial template * Add: UI mask for W15 * Fix: missing ASSETS import * Fix: change full_scan_movable() to predict() * Fix: predict should be done after each move * Opt: camera_data in W15 * Del: remove predict * Add: map info process after mob move * Add: support for multi bosses in _expected_end() for W15 * Opt: show map after moving * Del: remove redundant import in fleet.py * Opt: using clear_chosen_enemy() instead of goto() directly * Fix: should first take screenshot before strategy enter/confirm/cancel * Add: asset TEMPLATE_SIREN_BOSS * Opt: Handle first stages of BOSS as Siren in 15-3/15-4 * Fix: missing override map_data * Add: ignore is_boss prediction for siren boss in 15-3/15-4 * Fix: should not use decorator Config with battle_x functions * Opt: camera data in 15-4 * Opt: directly overwrite map info into original map_data * Fix: missing indent block in campaign_15_4.py * Fix: expect 15-3/15-4 first bosses as siren * Revert "Add: ignore is_boss prediction for siren boss in 15-3/15-4" This reverts commit 1104631f92e5df0672dce8c7acaa1eb122731746. * Revert "Add: asset TEMPLATE_SIREN_BOSS" This reverts commit a29d6b6b9bfb9d79963adb404ce2091cbfafb810. * Revert "Add: support for multi bosses in _expected_end() for W15" This reverts commit 8d357abe5bab79a643e23e8513cefa87d31cb3e8. * Del: redundent map config * Fix: recover boss grids * Del: redundant clear_siren() * Del: redundant clear_siren() in battle_6 * Add: template for mob move icon * Opt: enlarge reinforcement fleet mask area for W15 * Opt: method _mob_move * Upd: TEMPLATE_MOB_MOVE_ICON * Fix: should have cool time between clicks of grid * Revert "Upd: TEMPLATE_MOB_MOVE_ICON" This reverts commit b3f2dcbc88dbe166470905f33d041b91c2192f57. * Upd: TEMPLATE_MOB_MOVE_ICON * Upd: TEMPLATE_MOB_MOVE_ICON * Upd: predict_mob_move_icon * Fix: 15-2 camera spawn point * Fix: should update view using self.device.image * Revert "Upd: TEMPLATE_MOB_MOVE_ICON" This reverts commit 92a12596a8f271ec64e249ecb58779d9b64ecea6. * Del: redundant assets MOB_MOVE_ICON.png * Fix: using map_is_clear_mode to get real value of clear mode * Opt: check mob_movable before moving * Opt: Refactor _mob_move * Fix: camera_sight in W15 * Opt: move sight to further point in _mob_move
2024-04-19 01:29:17 +08:00
class W15GridInfo(GridInfo):
def merge(self, info, mode='normal'):
# Consider boss as siren
if info.is_boss:
if not self.is_land and self.may_siren:
self.is_siren = True
self.enemy_scale = 0
self.enemy_genre = ''
return True
return super().merge(info, mode=mode)
Add: 15图开荒/周回 (#3563) * Add: W15 maps extracted * Add: template for Special Carrier in W15 * Add: method mob_move * Fix: MapDetectionError in strategy mob move * Fix: adjacent grid judge condition * Fix: should focus on location before moving * Fix: should update view before further operation * Fix: wait for STRATEGY_OPENED after executing mob move * Fix: offset for assets in _mob_move() * Opt: judge if movable before moving camera * Add: W15 mechanism * Opt: Rename Special Carrier asset name * Fix: offset for MOB_MOVE_1/MOB_MOVE_2 * Fix: separate MOB_MOVE_1 and MOB_MOVE_2 * Fix: should use appear_then_click in strategy_mob_move_enter * Fix: function import in campaign_15_base.py * Fix: missing assets import * Fix: missing offset in strategy_mob_move_cancel() * Fix: should move only once in a campaign * Temp: modify special carrier filter string to 3E * Fix: missing self. before 'moved' variable * Revert "Fix: missing self. before 'moved' variable" This reverts commit 00f70e0ab55e422898cb90c5d5e54d4e7c989511. * Revert "Fix: should move only once in a campaign" This reverts commit b588f5bb07dfc4511f39fa0797fbe160f356d604. * Fix: force goto special carrier * Fix: missing return True in battle function * Fix: enlarge offset of MOB_MOVE_ICON * Fix: typo in campaing_15_3 * Fix: update view after moving mob * Fix: should use full_scan_movable since mob moved * Fix: missing map_data_init() in campaign_15_4.py * Fix: battle 4 should be done by mob fleet * Revert "Fix: battle 4 should be done by mob fleet" This reverts commit 0e2af1ec817b7bc89fe123f03a33ea9ad955973f. * Fix: should switch to fleet_1 after battle_3 * Add: battle function when using clear mode * Fix: missing import * Fix: colliding Config class * Fix: Config.when should contain all cases * Opt: pick ammo after third battle in clear mode of 15-4 * Del: old assets CarrierSpecial * Fix: remake of CarrierSpecial template * Add: UI mask for W15 * Fix: missing ASSETS import * Fix: change full_scan_movable() to predict() * Fix: predict should be done after each move * Opt: camera_data in W15 * Del: remove predict * Add: map info process after mob move * Add: support for multi bosses in _expected_end() for W15 * Opt: show map after moving * Del: remove redundant import in fleet.py * Opt: using clear_chosen_enemy() instead of goto() directly * Fix: should first take screenshot before strategy enter/confirm/cancel * Add: asset TEMPLATE_SIREN_BOSS * Opt: Handle first stages of BOSS as Siren in 15-3/15-4 * Fix: missing override map_data * Add: ignore is_boss prediction for siren boss in 15-3/15-4 * Fix: should not use decorator Config with battle_x functions * Opt: camera data in 15-4 * Opt: directly overwrite map info into original map_data * Fix: missing indent block in campaign_15_4.py * Fix: expect 15-3/15-4 first bosses as siren * Revert "Add: ignore is_boss prediction for siren boss in 15-3/15-4" This reverts commit 1104631f92e5df0672dce8c7acaa1eb122731746. * Revert "Add: asset TEMPLATE_SIREN_BOSS" This reverts commit a29d6b6b9bfb9d79963adb404ce2091cbfafb810. * Revert "Add: support for multi bosses in _expected_end() for W15" This reverts commit 8d357abe5bab79a643e23e8513cefa87d31cb3e8. * Del: redundent map config * Fix: recover boss grids * Del: redundant clear_siren() * Del: redundant clear_siren() in battle_6 * Add: template for mob move icon * Opt: enlarge reinforcement fleet mask area for W15 * Opt: method _mob_move * Upd: TEMPLATE_MOB_MOVE_ICON * Fix: should have cool time between clicks of grid * Revert "Upd: TEMPLATE_MOB_MOVE_ICON" This reverts commit b3f2dcbc88dbe166470905f33d041b91c2192f57. * Upd: TEMPLATE_MOB_MOVE_ICON * Upd: TEMPLATE_MOB_MOVE_ICON * Upd: predict_mob_move_icon * Fix: 15-2 camera spawn point * Fix: should update view using self.device.image * Revert "Upd: TEMPLATE_MOB_MOVE_ICON" This reverts commit 92a12596a8f271ec64e249ecb58779d9b64ecea6. * Del: redundant assets MOB_MOVE_ICON.png * Fix: using map_is_clear_mode to get real value of clear mode * Opt: check mob_movable before moving * Opt: Refactor _mob_move * Fix: camera_sight in W15 * Opt: move sight to further point in _mob_move
2024-04-19 01:29:17 +08:00
class CampaignBase(CampaignBase_):
ENEMY_FILTER = '1T > 1L > 1E > 1M > 2T > 2L > 2E > 2M > 3T > 3L > 3E > 3M'
def map_data_init(self, map_):
super().map_data_init(map_)
# Patch ui_mask, get rid of supporting fleet
_ = ASSETS.ui_mask
ASSETS.ui_mask = MASK_MAP_UI_W15.image
map_has_mob_move = True
def strategy_set_execute(self, formation_index=None, sub_view=None, sub_hunt=None):
super().strategy_set_execute(
formation_index=formation_index,
sub_view=sub_view,
sub_hunt=sub_hunt,
)
2024-05-20 23:30:47 +08:00
logger.attr("Map has mob move", self.strategy_has_mob_move())
2024-04-20 02:51:02 +08:00
def _map_swipe(self, vector, box=(239, 159, 1175, 628)):
# Left border to 239, avoid swiping on support fleet
return super()._map_swipe(vector, box=box)
Add: 15图开荒/周回 (#3563) * Add: W15 maps extracted * Add: template for Special Carrier in W15 * Add: method mob_move * Fix: MapDetectionError in strategy mob move * Fix: adjacent grid judge condition * Fix: should focus on location before moving * Fix: should update view before further operation * Fix: wait for STRATEGY_OPENED after executing mob move * Fix: offset for assets in _mob_move() * Opt: judge if movable before moving camera * Add: W15 mechanism * Opt: Rename Special Carrier asset name * Fix: offset for MOB_MOVE_1/MOB_MOVE_2 * Fix: separate MOB_MOVE_1 and MOB_MOVE_2 * Fix: should use appear_then_click in strategy_mob_move_enter * Fix: function import in campaign_15_base.py * Fix: missing assets import * Fix: missing offset in strategy_mob_move_cancel() * Fix: should move only once in a campaign * Temp: modify special carrier filter string to 3E * Fix: missing self. before 'moved' variable * Revert "Fix: missing self. before 'moved' variable" This reverts commit 00f70e0ab55e422898cb90c5d5e54d4e7c989511. * Revert "Fix: should move only once in a campaign" This reverts commit b588f5bb07dfc4511f39fa0797fbe160f356d604. * Fix: force goto special carrier * Fix: missing return True in battle function * Fix: enlarge offset of MOB_MOVE_ICON * Fix: typo in campaing_15_3 * Fix: update view after moving mob * Fix: should use full_scan_movable since mob moved * Fix: missing map_data_init() in campaign_15_4.py * Fix: battle 4 should be done by mob fleet * Revert "Fix: battle 4 should be done by mob fleet" This reverts commit 0e2af1ec817b7bc89fe123f03a33ea9ad955973f. * Fix: should switch to fleet_1 after battle_3 * Add: battle function when using clear mode * Fix: missing import * Fix: colliding Config class * Fix: Config.when should contain all cases * Opt: pick ammo after third battle in clear mode of 15-4 * Del: old assets CarrierSpecial * Fix: remake of CarrierSpecial template * Add: UI mask for W15 * Fix: missing ASSETS import * Fix: change full_scan_movable() to predict() * Fix: predict should be done after each move * Opt: camera_data in W15 * Del: remove predict * Add: map info process after mob move * Add: support for multi bosses in _expected_end() for W15 * Opt: show map after moving * Del: remove redundant import in fleet.py * Opt: using clear_chosen_enemy() instead of goto() directly * Fix: should first take screenshot before strategy enter/confirm/cancel * Add: asset TEMPLATE_SIREN_BOSS * Opt: Handle first stages of BOSS as Siren in 15-3/15-4 * Fix: missing override map_data * Add: ignore is_boss prediction for siren boss in 15-3/15-4 * Fix: should not use decorator Config with battle_x functions * Opt: camera data in 15-4 * Opt: directly overwrite map info into original map_data * Fix: missing indent block in campaign_15_4.py * Fix: expect 15-3/15-4 first bosses as siren * Revert "Add: ignore is_boss prediction for siren boss in 15-3/15-4" This reverts commit 1104631f92e5df0672dce8c7acaa1eb122731746. * Revert "Add: asset TEMPLATE_SIREN_BOSS" This reverts commit a29d6b6b9bfb9d79963adb404ce2091cbfafb810. * Revert "Add: support for multi bosses in _expected_end() for W15" This reverts commit 8d357abe5bab79a643e23e8513cefa87d31cb3e8. * Del: redundent map config * Fix: recover boss grids * Del: redundant clear_siren() * Del: redundant clear_siren() in battle_6 * Add: template for mob move icon * Opt: enlarge reinforcement fleet mask area for W15 * Opt: method _mob_move * Upd: TEMPLATE_MOB_MOVE_ICON * Fix: should have cool time between clicks of grid * Revert "Upd: TEMPLATE_MOB_MOVE_ICON" This reverts commit b3f2dcbc88dbe166470905f33d041b91c2192f57. * Upd: TEMPLATE_MOB_MOVE_ICON * Upd: TEMPLATE_MOB_MOVE_ICON * Upd: predict_mob_move_icon * Fix: 15-2 camera spawn point * Fix: should update view using self.device.image * Revert "Upd: TEMPLATE_MOB_MOVE_ICON" This reverts commit 92a12596a8f271ec64e249ecb58779d9b64ecea6. * Del: redundant assets MOB_MOVE_ICON.png * Fix: using map_is_clear_mode to get real value of clear mode * Opt: check mob_movable before moving * Opt: Refactor _mob_move * Fix: camera_sight in W15 * Opt: move sight to further point in _mob_move
2024-04-19 01:29:17 +08:00
def mob_movable(self, location, target):
"""
Check if mob is movable from location to target.
This requires that:
1. both location and target are grids in the map (not exceeding the boundaries)
2. Manhattan distance between location and target is 1.
3. location is a mob fleet
4. target is a sea grid
Args:
location (tuple): Location of mob.
target (tuple): Destination.
Returns:
bool: if movable.
"""
location = location_ensure(location)
target = location_ensure(target)
movable = True
try:
logger.info(f'location: {self.map[location]}, target: {self.map[target]}')
except KeyError as e:
logger.exception(f'Given coordinates are outside the map.')
raise e
if abs(location[0] - target[0]) + abs(location[1] - target[1]) != 1:
logger.error(f'{self.map[target]} is not adjacent from {self.map[location]}.')
movable = False
if not self.map[location].is_enemy:
logger.error(f'{self.map[location]} is not a mob fleet.')
movable = False
if not self.map[target].is_sea:
logger.error(f'{self.map[target]} is not a sea grid.')
movable = False
Add: 15图开荒/周回 (#3563) * Add: W15 maps extracted * Add: template for Special Carrier in W15 * Add: method mob_move * Fix: MapDetectionError in strategy mob move * Fix: adjacent grid judge condition * Fix: should focus on location before moving * Fix: should update view before further operation * Fix: wait for STRATEGY_OPENED after executing mob move * Fix: offset for assets in _mob_move() * Opt: judge if movable before moving camera * Add: W15 mechanism * Opt: Rename Special Carrier asset name * Fix: offset for MOB_MOVE_1/MOB_MOVE_2 * Fix: separate MOB_MOVE_1 and MOB_MOVE_2 * Fix: should use appear_then_click in strategy_mob_move_enter * Fix: function import in campaign_15_base.py * Fix: missing assets import * Fix: missing offset in strategy_mob_move_cancel() * Fix: should move only once in a campaign * Temp: modify special carrier filter string to 3E * Fix: missing self. before 'moved' variable * Revert "Fix: missing self. before 'moved' variable" This reverts commit 00f70e0ab55e422898cb90c5d5e54d4e7c989511. * Revert "Fix: should move only once in a campaign" This reverts commit b588f5bb07dfc4511f39fa0797fbe160f356d604. * Fix: force goto special carrier * Fix: missing return True in battle function * Fix: enlarge offset of MOB_MOVE_ICON * Fix: typo in campaing_15_3 * Fix: update view after moving mob * Fix: should use full_scan_movable since mob moved * Fix: missing map_data_init() in campaign_15_4.py * Fix: battle 4 should be done by mob fleet * Revert "Fix: battle 4 should be done by mob fleet" This reverts commit 0e2af1ec817b7bc89fe123f03a33ea9ad955973f. * Fix: should switch to fleet_1 after battle_3 * Add: battle function when using clear mode * Fix: missing import * Fix: colliding Config class * Fix: Config.when should contain all cases * Opt: pick ammo after third battle in clear mode of 15-4 * Del: old assets CarrierSpecial * Fix: remake of CarrierSpecial template * Add: UI mask for W15 * Fix: missing ASSETS import * Fix: change full_scan_movable() to predict() * Fix: predict should be done after each move * Opt: camera_data in W15 * Del: remove predict * Add: map info process after mob move * Add: support for multi bosses in _expected_end() for W15 * Opt: show map after moving * Del: remove redundant import in fleet.py * Opt: using clear_chosen_enemy() instead of goto() directly * Fix: should first take screenshot before strategy enter/confirm/cancel * Add: asset TEMPLATE_SIREN_BOSS * Opt: Handle first stages of BOSS as Siren in 15-3/15-4 * Fix: missing override map_data * Add: ignore is_boss prediction for siren boss in 15-3/15-4 * Fix: should not use decorator Config with battle_x functions * Opt: camera data in 15-4 * Opt: directly overwrite map info into original map_data * Fix: missing indent block in campaign_15_4.py * Fix: expect 15-3/15-4 first bosses as siren * Revert "Add: ignore is_boss prediction for siren boss in 15-3/15-4" This reverts commit 1104631f92e5df0672dce8c7acaa1eb122731746. * Revert "Add: asset TEMPLATE_SIREN_BOSS" This reverts commit a29d6b6b9bfb9d79963adb404ce2091cbfafb810. * Revert "Add: support for multi bosses in _expected_end() for W15" This reverts commit 8d357abe5bab79a643e23e8513cefa87d31cb3e8. * Del: redundent map config * Fix: recover boss grids * Del: redundant clear_siren() * Del: redundant clear_siren() in battle_6 * Add: template for mob move icon * Opt: enlarge reinforcement fleet mask area for W15 * Opt: method _mob_move * Upd: TEMPLATE_MOB_MOVE_ICON * Fix: should have cool time between clicks of grid * Revert "Upd: TEMPLATE_MOB_MOVE_ICON" This reverts commit b3f2dcbc88dbe166470905f33d041b91c2192f57. * Upd: TEMPLATE_MOB_MOVE_ICON * Upd: TEMPLATE_MOB_MOVE_ICON * Upd: predict_mob_move_icon * Fix: 15-2 camera spawn point * Fix: should update view using self.device.image * Revert "Upd: TEMPLATE_MOB_MOVE_ICON" This reverts commit 92a12596a8f271ec64e249ecb58779d9b64ecea6. * Del: redundant assets MOB_MOVE_ICON.png * Fix: using map_is_clear_mode to get real value of clear mode * Opt: check mob_movable before moving * Opt: Refactor _mob_move * Fix: camera_sight in W15 * Opt: move sight to further point in _mob_move
2024-04-19 01:29:17 +08:00
if not movable:
logger.error(f'Cannot move from {self.map[location]} to {self.map[target]}.')
return movable
Add: 15图开荒/周回 (#3563) * Add: W15 maps extracted * Add: template for Special Carrier in W15 * Add: method mob_move * Fix: MapDetectionError in strategy mob move * Fix: adjacent grid judge condition * Fix: should focus on location before moving * Fix: should update view before further operation * Fix: wait for STRATEGY_OPENED after executing mob move * Fix: offset for assets in _mob_move() * Opt: judge if movable before moving camera * Add: W15 mechanism * Opt: Rename Special Carrier asset name * Fix: offset for MOB_MOVE_1/MOB_MOVE_2 * Fix: separate MOB_MOVE_1 and MOB_MOVE_2 * Fix: should use appear_then_click in strategy_mob_move_enter * Fix: function import in campaign_15_base.py * Fix: missing assets import * Fix: missing offset in strategy_mob_move_cancel() * Fix: should move only once in a campaign * Temp: modify special carrier filter string to 3E * Fix: missing self. before 'moved' variable * Revert "Fix: missing self. before 'moved' variable" This reverts commit 00f70e0ab55e422898cb90c5d5e54d4e7c989511. * Revert "Fix: should move only once in a campaign" This reverts commit b588f5bb07dfc4511f39fa0797fbe160f356d604. * Fix: force goto special carrier * Fix: missing return True in battle function * Fix: enlarge offset of MOB_MOVE_ICON * Fix: typo in campaing_15_3 * Fix: update view after moving mob * Fix: should use full_scan_movable since mob moved * Fix: missing map_data_init() in campaign_15_4.py * Fix: battle 4 should be done by mob fleet * Revert "Fix: battle 4 should be done by mob fleet" This reverts commit 0e2af1ec817b7bc89fe123f03a33ea9ad955973f. * Fix: should switch to fleet_1 after battle_3 * Add: battle function when using clear mode * Fix: missing import * Fix: colliding Config class * Fix: Config.when should contain all cases * Opt: pick ammo after third battle in clear mode of 15-4 * Del: old assets CarrierSpecial * Fix: remake of CarrierSpecial template * Add: UI mask for W15 * Fix: missing ASSETS import * Fix: change full_scan_movable() to predict() * Fix: predict should be done after each move * Opt: camera_data in W15 * Del: remove predict * Add: map info process after mob move * Add: support for multi bosses in _expected_end() for W15 * Opt: show map after moving * Del: remove redundant import in fleet.py * Opt: using clear_chosen_enemy() instead of goto() directly * Fix: should first take screenshot before strategy enter/confirm/cancel * Add: asset TEMPLATE_SIREN_BOSS * Opt: Handle first stages of BOSS as Siren in 15-3/15-4 * Fix: missing override map_data * Add: ignore is_boss prediction for siren boss in 15-3/15-4 * Fix: should not use decorator Config with battle_x functions * Opt: camera data in 15-4 * Opt: directly overwrite map info into original map_data * Fix: missing indent block in campaign_15_4.py * Fix: expect 15-3/15-4 first bosses as siren * Revert "Add: ignore is_boss prediction for siren boss in 15-3/15-4" This reverts commit 1104631f92e5df0672dce8c7acaa1eb122731746. * Revert "Add: asset TEMPLATE_SIREN_BOSS" This reverts commit a29d6b6b9bfb9d79963adb404ce2091cbfafb810. * Revert "Add: support for multi bosses in _expected_end() for W15" This reverts commit 8d357abe5bab79a643e23e8513cefa87d31cb3e8. * Del: redundent map config * Fix: recover boss grids * Del: redundant clear_siren() * Del: redundant clear_siren() in battle_6 * Add: template for mob move icon * Opt: enlarge reinforcement fleet mask area for W15 * Opt: method _mob_move * Upd: TEMPLATE_MOB_MOVE_ICON * Fix: should have cool time between clicks of grid * Revert "Upd: TEMPLATE_MOB_MOVE_ICON" This reverts commit b3f2dcbc88dbe166470905f33d041b91c2192f57. * Upd: TEMPLATE_MOB_MOVE_ICON * Upd: TEMPLATE_MOB_MOVE_ICON * Upd: predict_mob_move_icon * Fix: 15-2 camera spawn point * Fix: should update view using self.device.image * Revert "Upd: TEMPLATE_MOB_MOVE_ICON" This reverts commit 92a12596a8f271ec64e249ecb58779d9b64ecea6. * Del: redundant assets MOB_MOVE_ICON.png * Fix: using map_is_clear_mode to get real value of clear mode * Opt: check mob_movable before moving * Opt: Refactor _mob_move * Fix: camera_sight in W15 * Opt: move sight to further point in _mob_move
2024-04-19 01:29:17 +08:00
def _mob_move(self, location, target):
"""
Move mob from location to target, and confirm if successfully moved.
Args:
location (tuple, str, GridInfo): Location of mob.
target (tuple, str, GridInfo): Destination.
Returns:
bool: If mob moved.
Pages:
in: MOB_MOVE_CANCEL
out: STRATEGY_OPENED
"""
location = location_ensure(location)
target = location_ensure(target)
2024-04-20 02:51:02 +08:00
view_target = SelectedGrids([self.map[location], self.map[target]]) \
.sort_by_camera_distance(self.camera)[1]
self.in_sight(view_target)
origin_grid = self.convert_global_to_local(location)
origin_grid.__str__ = location
target_grid = self.convert_global_to_local(target)
target_grid.__str__ = target
logger.info('Select mob to move')
skip_first_screenshot = True
interval = Timer(2, count=4)
Add: 15图开荒/周回 (#3563) * Add: W15 maps extracted * Add: template for Special Carrier in W15 * Add: method mob_move * Fix: MapDetectionError in strategy mob move * Fix: adjacent grid judge condition * Fix: should focus on location before moving * Fix: should update view before further operation * Fix: wait for STRATEGY_OPENED after executing mob move * Fix: offset for assets in _mob_move() * Opt: judge if movable before moving camera * Add: W15 mechanism * Opt: Rename Special Carrier asset name * Fix: offset for MOB_MOVE_1/MOB_MOVE_2 * Fix: separate MOB_MOVE_1 and MOB_MOVE_2 * Fix: should use appear_then_click in strategy_mob_move_enter * Fix: function import in campaign_15_base.py * Fix: missing assets import * Fix: missing offset in strategy_mob_move_cancel() * Fix: should move only once in a campaign * Temp: modify special carrier filter string to 3E * Fix: missing self. before 'moved' variable * Revert "Fix: missing self. before 'moved' variable" This reverts commit 00f70e0ab55e422898cb90c5d5e54d4e7c989511. * Revert "Fix: should move only once in a campaign" This reverts commit b588f5bb07dfc4511f39fa0797fbe160f356d604. * Fix: force goto special carrier * Fix: missing return True in battle function * Fix: enlarge offset of MOB_MOVE_ICON * Fix: typo in campaing_15_3 * Fix: update view after moving mob * Fix: should use full_scan_movable since mob moved * Fix: missing map_data_init() in campaign_15_4.py * Fix: battle 4 should be done by mob fleet * Revert "Fix: battle 4 should be done by mob fleet" This reverts commit 0e2af1ec817b7bc89fe123f03a33ea9ad955973f. * Fix: should switch to fleet_1 after battle_3 * Add: battle function when using clear mode * Fix: missing import * Fix: colliding Config class * Fix: Config.when should contain all cases * Opt: pick ammo after third battle in clear mode of 15-4 * Del: old assets CarrierSpecial * Fix: remake of CarrierSpecial template * Add: UI mask for W15 * Fix: missing ASSETS import * Fix: change full_scan_movable() to predict() * Fix: predict should be done after each move * Opt: camera_data in W15 * Del: remove predict * Add: map info process after mob move * Add: support for multi bosses in _expected_end() for W15 * Opt: show map after moving * Del: remove redundant import in fleet.py * Opt: using clear_chosen_enemy() instead of goto() directly * Fix: should first take screenshot before strategy enter/confirm/cancel * Add: asset TEMPLATE_SIREN_BOSS * Opt: Handle first stages of BOSS as Siren in 15-3/15-4 * Fix: missing override map_data * Add: ignore is_boss prediction for siren boss in 15-3/15-4 * Fix: should not use decorator Config with battle_x functions * Opt: camera data in 15-4 * Opt: directly overwrite map info into original map_data * Fix: missing indent block in campaign_15_4.py * Fix: expect 15-3/15-4 first bosses as siren * Revert "Add: ignore is_boss prediction for siren boss in 15-3/15-4" This reverts commit 1104631f92e5df0672dce8c7acaa1eb122731746. * Revert "Add: asset TEMPLATE_SIREN_BOSS" This reverts commit a29d6b6b9bfb9d79963adb404ce2091cbfafb810. * Revert "Add: support for multi bosses in _expected_end() for W15" This reverts commit 8d357abe5bab79a643e23e8513cefa87d31cb3e8. * Del: redundent map config * Fix: recover boss grids * Del: redundant clear_siren() * Del: redundant clear_siren() in battle_6 * Add: template for mob move icon * Opt: enlarge reinforcement fleet mask area for W15 * Opt: method _mob_move * Upd: TEMPLATE_MOB_MOVE_ICON * Fix: should have cool time between clicks of grid * Revert "Upd: TEMPLATE_MOB_MOVE_ICON" This reverts commit b3f2dcbc88dbe166470905f33d041b91c2192f57. * Upd: TEMPLATE_MOB_MOVE_ICON * Upd: TEMPLATE_MOB_MOVE_ICON * Upd: predict_mob_move_icon * Fix: 15-2 camera spawn point * Fix: should update view using self.device.image * Revert "Upd: TEMPLATE_MOB_MOVE_ICON" This reverts commit 92a12596a8f271ec64e249ecb58779d9b64ecea6. * Del: redundant assets MOB_MOVE_ICON.png * Fix: using map_is_clear_mode to get real value of clear mode * Opt: check mob_movable before moving * Opt: Refactor _mob_move * Fix: camera_sight in W15 * Opt: move sight to further point in _mob_move
2024-04-19 01:29:17 +08:00
while 1:
2024-04-20 02:51:02 +08:00
if skip_first_screenshot:
skip_first_screenshot = False
else:
Add: 15图开荒/周回 (#3563) * Add: W15 maps extracted * Add: template for Special Carrier in W15 * Add: method mob_move * Fix: MapDetectionError in strategy mob move * Fix: adjacent grid judge condition * Fix: should focus on location before moving * Fix: should update view before further operation * Fix: wait for STRATEGY_OPENED after executing mob move * Fix: offset for assets in _mob_move() * Opt: judge if movable before moving camera * Add: W15 mechanism * Opt: Rename Special Carrier asset name * Fix: offset for MOB_MOVE_1/MOB_MOVE_2 * Fix: separate MOB_MOVE_1 and MOB_MOVE_2 * Fix: should use appear_then_click in strategy_mob_move_enter * Fix: function import in campaign_15_base.py * Fix: missing assets import * Fix: missing offset in strategy_mob_move_cancel() * Fix: should move only once in a campaign * Temp: modify special carrier filter string to 3E * Fix: missing self. before 'moved' variable * Revert "Fix: missing self. before 'moved' variable" This reverts commit 00f70e0ab55e422898cb90c5d5e54d4e7c989511. * Revert "Fix: should move only once in a campaign" This reverts commit b588f5bb07dfc4511f39fa0797fbe160f356d604. * Fix: force goto special carrier * Fix: missing return True in battle function * Fix: enlarge offset of MOB_MOVE_ICON * Fix: typo in campaing_15_3 * Fix: update view after moving mob * Fix: should use full_scan_movable since mob moved * Fix: missing map_data_init() in campaign_15_4.py * Fix: battle 4 should be done by mob fleet * Revert "Fix: battle 4 should be done by mob fleet" This reverts commit 0e2af1ec817b7bc89fe123f03a33ea9ad955973f. * Fix: should switch to fleet_1 after battle_3 * Add: battle function when using clear mode * Fix: missing import * Fix: colliding Config class * Fix: Config.when should contain all cases * Opt: pick ammo after third battle in clear mode of 15-4 * Del: old assets CarrierSpecial * Fix: remake of CarrierSpecial template * Add: UI mask for W15 * Fix: missing ASSETS import * Fix: change full_scan_movable() to predict() * Fix: predict should be done after each move * Opt: camera_data in W15 * Del: remove predict * Add: map info process after mob move * Add: support for multi bosses in _expected_end() for W15 * Opt: show map after moving * Del: remove redundant import in fleet.py * Opt: using clear_chosen_enemy() instead of goto() directly * Fix: should first take screenshot before strategy enter/confirm/cancel * Add: asset TEMPLATE_SIREN_BOSS * Opt: Handle first stages of BOSS as Siren in 15-3/15-4 * Fix: missing override map_data * Add: ignore is_boss prediction for siren boss in 15-3/15-4 * Fix: should not use decorator Config with battle_x functions * Opt: camera data in 15-4 * Opt: directly overwrite map info into original map_data * Fix: missing indent block in campaign_15_4.py * Fix: expect 15-3/15-4 first bosses as siren * Revert "Add: ignore is_boss prediction for siren boss in 15-3/15-4" This reverts commit 1104631f92e5df0672dce8c7acaa1eb122731746. * Revert "Add: asset TEMPLATE_SIREN_BOSS" This reverts commit a29d6b6b9bfb9d79963adb404ce2091cbfafb810. * Revert "Add: support for multi bosses in _expected_end() for W15" This reverts commit 8d357abe5bab79a643e23e8513cefa87d31cb3e8. * Del: redundent map config * Fix: recover boss grids * Del: redundant clear_siren() * Del: redundant clear_siren() in battle_6 * Add: template for mob move icon * Opt: enlarge reinforcement fleet mask area for W15 * Opt: method _mob_move * Upd: TEMPLATE_MOB_MOVE_ICON * Fix: should have cool time between clicks of grid * Revert "Upd: TEMPLATE_MOB_MOVE_ICON" This reverts commit b3f2dcbc88dbe166470905f33d041b91c2192f57. * Upd: TEMPLATE_MOB_MOVE_ICON * Upd: TEMPLATE_MOB_MOVE_ICON * Upd: predict_mob_move_icon * Fix: 15-2 camera spawn point * Fix: should update view using self.device.image * Revert "Upd: TEMPLATE_MOB_MOVE_ICON" This reverts commit 92a12596a8f271ec64e249ecb58779d9b64ecea6. * Del: redundant assets MOB_MOVE_ICON.png * Fix: using map_is_clear_mode to get real value of clear mode * Opt: check mob_movable before moving * Opt: Refactor _mob_move * Fix: camera_sight in W15 * Opt: move sight to further point in _mob_move
2024-04-19 01:29:17 +08:00
self.device.screenshot()
2024-04-20 02:51:02 +08:00
# End
if self.is_in_strategy_mob_move():
self.view.update(image=self.device.image)
if origin_grid.predict_mob_move_icon():
Add: 15图开荒/周回 (#3563) * Add: W15 maps extracted * Add: template for Special Carrier in W15 * Add: method mob_move * Fix: MapDetectionError in strategy mob move * Fix: adjacent grid judge condition * Fix: should focus on location before moving * Fix: should update view before further operation * Fix: wait for STRATEGY_OPENED after executing mob move * Fix: offset for assets in _mob_move() * Opt: judge if movable before moving camera * Add: W15 mechanism * Opt: Rename Special Carrier asset name * Fix: offset for MOB_MOVE_1/MOB_MOVE_2 * Fix: separate MOB_MOVE_1 and MOB_MOVE_2 * Fix: should use appear_then_click in strategy_mob_move_enter * Fix: function import in campaign_15_base.py * Fix: missing assets import * Fix: missing offset in strategy_mob_move_cancel() * Fix: should move only once in a campaign * Temp: modify special carrier filter string to 3E * Fix: missing self. before 'moved' variable * Revert "Fix: missing self. before 'moved' variable" This reverts commit 00f70e0ab55e422898cb90c5d5e54d4e7c989511. * Revert "Fix: should move only once in a campaign" This reverts commit b588f5bb07dfc4511f39fa0797fbe160f356d604. * Fix: force goto special carrier * Fix: missing return True in battle function * Fix: enlarge offset of MOB_MOVE_ICON * Fix: typo in campaing_15_3 * Fix: update view after moving mob * Fix: should use full_scan_movable since mob moved * Fix: missing map_data_init() in campaign_15_4.py * Fix: battle 4 should be done by mob fleet * Revert "Fix: battle 4 should be done by mob fleet" This reverts commit 0e2af1ec817b7bc89fe123f03a33ea9ad955973f. * Fix: should switch to fleet_1 after battle_3 * Add: battle function when using clear mode * Fix: missing import * Fix: colliding Config class * Fix: Config.when should contain all cases * Opt: pick ammo after third battle in clear mode of 15-4 * Del: old assets CarrierSpecial * Fix: remake of CarrierSpecial template * Add: UI mask for W15 * Fix: missing ASSETS import * Fix: change full_scan_movable() to predict() * Fix: predict should be done after each move * Opt: camera_data in W15 * Del: remove predict * Add: map info process after mob move * Add: support for multi bosses in _expected_end() for W15 * Opt: show map after moving * Del: remove redundant import in fleet.py * Opt: using clear_chosen_enemy() instead of goto() directly * Fix: should first take screenshot before strategy enter/confirm/cancel * Add: asset TEMPLATE_SIREN_BOSS * Opt: Handle first stages of BOSS as Siren in 15-3/15-4 * Fix: missing override map_data * Add: ignore is_boss prediction for siren boss in 15-3/15-4 * Fix: should not use decorator Config with battle_x functions * Opt: camera data in 15-4 * Opt: directly overwrite map info into original map_data * Fix: missing indent block in campaign_15_4.py * Fix: expect 15-3/15-4 first bosses as siren * Revert "Add: ignore is_boss prediction for siren boss in 15-3/15-4" This reverts commit 1104631f92e5df0672dce8c7acaa1eb122731746. * Revert "Add: asset TEMPLATE_SIREN_BOSS" This reverts commit a29d6b6b9bfb9d79963adb404ce2091cbfafb810. * Revert "Add: support for multi bosses in _expected_end() for W15" This reverts commit 8d357abe5bab79a643e23e8513cefa87d31cb3e8. * Del: redundent map config * Fix: recover boss grids * Del: redundant clear_siren() * Del: redundant clear_siren() in battle_6 * Add: template for mob move icon * Opt: enlarge reinforcement fleet mask area for W15 * Opt: method _mob_move * Upd: TEMPLATE_MOB_MOVE_ICON * Fix: should have cool time between clicks of grid * Revert "Upd: TEMPLATE_MOB_MOVE_ICON" This reverts commit b3f2dcbc88dbe166470905f33d041b91c2192f57. * Upd: TEMPLATE_MOB_MOVE_ICON * Upd: TEMPLATE_MOB_MOVE_ICON * Upd: predict_mob_move_icon * Fix: 15-2 camera spawn point * Fix: should update view using self.device.image * Revert "Upd: TEMPLATE_MOB_MOVE_ICON" This reverts commit 92a12596a8f271ec64e249ecb58779d9b64ecea6. * Del: redundant assets MOB_MOVE_ICON.png * Fix: using map_is_clear_mode to get real value of clear mode * Opt: check mob_movable before moving * Opt: Refactor _mob_move * Fix: camera_sight in W15 * Opt: move sight to further point in _mob_move
2024-04-19 01:29:17 +08:00
break
2024-04-20 02:51:02 +08:00
# Click
if interval.reached() and self.is_in_strategy_mob_move():
self.device.click(origin_grid)
interval.reset()
continue
logger.info('Select target grid')
skip_first_screenshot = True
interval = Timer(2, count=4)
while 1:
if skip_first_screenshot:
skip_first_screenshot = False
else:
self.device.screenshot()
Add: 15图开荒/周回 (#3563) * Add: W15 maps extracted * Add: template for Special Carrier in W15 * Add: method mob_move * Fix: MapDetectionError in strategy mob move * Fix: adjacent grid judge condition * Fix: should focus on location before moving * Fix: should update view before further operation * Fix: wait for STRATEGY_OPENED after executing mob move * Fix: offset for assets in _mob_move() * Opt: judge if movable before moving camera * Add: W15 mechanism * Opt: Rename Special Carrier asset name * Fix: offset for MOB_MOVE_1/MOB_MOVE_2 * Fix: separate MOB_MOVE_1 and MOB_MOVE_2 * Fix: should use appear_then_click in strategy_mob_move_enter * Fix: function import in campaign_15_base.py * Fix: missing assets import * Fix: missing offset in strategy_mob_move_cancel() * Fix: should move only once in a campaign * Temp: modify special carrier filter string to 3E * Fix: missing self. before 'moved' variable * Revert "Fix: missing self. before 'moved' variable" This reverts commit 00f70e0ab55e422898cb90c5d5e54d4e7c989511. * Revert "Fix: should move only once in a campaign" This reverts commit b588f5bb07dfc4511f39fa0797fbe160f356d604. * Fix: force goto special carrier * Fix: missing return True in battle function * Fix: enlarge offset of MOB_MOVE_ICON * Fix: typo in campaing_15_3 * Fix: update view after moving mob * Fix: should use full_scan_movable since mob moved * Fix: missing map_data_init() in campaign_15_4.py * Fix: battle 4 should be done by mob fleet * Revert "Fix: battle 4 should be done by mob fleet" This reverts commit 0e2af1ec817b7bc89fe123f03a33ea9ad955973f. * Fix: should switch to fleet_1 after battle_3 * Add: battle function when using clear mode * Fix: missing import * Fix: colliding Config class * Fix: Config.when should contain all cases * Opt: pick ammo after third battle in clear mode of 15-4 * Del: old assets CarrierSpecial * Fix: remake of CarrierSpecial template * Add: UI mask for W15 * Fix: missing ASSETS import * Fix: change full_scan_movable() to predict() * Fix: predict should be done after each move * Opt: camera_data in W15 * Del: remove predict * Add: map info process after mob move * Add: support for multi bosses in _expected_end() for W15 * Opt: show map after moving * Del: remove redundant import in fleet.py * Opt: using clear_chosen_enemy() instead of goto() directly * Fix: should first take screenshot before strategy enter/confirm/cancel * Add: asset TEMPLATE_SIREN_BOSS * Opt: Handle first stages of BOSS as Siren in 15-3/15-4 * Fix: missing override map_data * Add: ignore is_boss prediction for siren boss in 15-3/15-4 * Fix: should not use decorator Config with battle_x functions * Opt: camera data in 15-4 * Opt: directly overwrite map info into original map_data * Fix: missing indent block in campaign_15_4.py * Fix: expect 15-3/15-4 first bosses as siren * Revert "Add: ignore is_boss prediction for siren boss in 15-3/15-4" This reverts commit 1104631f92e5df0672dce8c7acaa1eb122731746. * Revert "Add: asset TEMPLATE_SIREN_BOSS" This reverts commit a29d6b6b9bfb9d79963adb404ce2091cbfafb810. * Revert "Add: support for multi bosses in _expected_end() for W15" This reverts commit 8d357abe5bab79a643e23e8513cefa87d31cb3e8. * Del: redundent map config * Fix: recover boss grids * Del: redundant clear_siren() * Del: redundant clear_siren() in battle_6 * Add: template for mob move icon * Opt: enlarge reinforcement fleet mask area for W15 * Opt: method _mob_move * Upd: TEMPLATE_MOB_MOVE_ICON * Fix: should have cool time between clicks of grid * Revert "Upd: TEMPLATE_MOB_MOVE_ICON" This reverts commit b3f2dcbc88dbe166470905f33d041b91c2192f57. * Upd: TEMPLATE_MOB_MOVE_ICON * Upd: TEMPLATE_MOB_MOVE_ICON * Upd: predict_mob_move_icon * Fix: 15-2 camera spawn point * Fix: should update view using self.device.image * Revert "Upd: TEMPLATE_MOB_MOVE_ICON" This reverts commit 92a12596a8f271ec64e249ecb58779d9b64ecea6. * Del: redundant assets MOB_MOVE_ICON.png * Fix: using map_is_clear_mode to get real value of clear mode * Opt: check mob_movable before moving * Opt: Refactor _mob_move * Fix: camera_sight in W15 * Opt: move sight to further point in _mob_move
2024-04-19 01:29:17 +08:00
2024-04-20 02:51:02 +08:00
# End
if self.appear(STRATEGY_OPENED, offset=(120, 120)):
break
# Click
if interval.reached() and self.is_in_strategy_mob_move():
self.device.click(target_grid)
interval.reset()
continue
if self.handle_popup_confirm('MOB_MOVE'):
continue
Add: 15图开荒/周回 (#3563) * Add: W15 maps extracted * Add: template for Special Carrier in W15 * Add: method mob_move * Fix: MapDetectionError in strategy mob move * Fix: adjacent grid judge condition * Fix: should focus on location before moving * Fix: should update view before further operation * Fix: wait for STRATEGY_OPENED after executing mob move * Fix: offset for assets in _mob_move() * Opt: judge if movable before moving camera * Add: W15 mechanism * Opt: Rename Special Carrier asset name * Fix: offset for MOB_MOVE_1/MOB_MOVE_2 * Fix: separate MOB_MOVE_1 and MOB_MOVE_2 * Fix: should use appear_then_click in strategy_mob_move_enter * Fix: function import in campaign_15_base.py * Fix: missing assets import * Fix: missing offset in strategy_mob_move_cancel() * Fix: should move only once in a campaign * Temp: modify special carrier filter string to 3E * Fix: missing self. before 'moved' variable * Revert "Fix: missing self. before 'moved' variable" This reverts commit 00f70e0ab55e422898cb90c5d5e54d4e7c989511. * Revert "Fix: should move only once in a campaign" This reverts commit b588f5bb07dfc4511f39fa0797fbe160f356d604. * Fix: force goto special carrier * Fix: missing return True in battle function * Fix: enlarge offset of MOB_MOVE_ICON * Fix: typo in campaing_15_3 * Fix: update view after moving mob * Fix: should use full_scan_movable since mob moved * Fix: missing map_data_init() in campaign_15_4.py * Fix: battle 4 should be done by mob fleet * Revert "Fix: battle 4 should be done by mob fleet" This reverts commit 0e2af1ec817b7bc89fe123f03a33ea9ad955973f. * Fix: should switch to fleet_1 after battle_3 * Add: battle function when using clear mode * Fix: missing import * Fix: colliding Config class * Fix: Config.when should contain all cases * Opt: pick ammo after third battle in clear mode of 15-4 * Del: old assets CarrierSpecial * Fix: remake of CarrierSpecial template * Add: UI mask for W15 * Fix: missing ASSETS import * Fix: change full_scan_movable() to predict() * Fix: predict should be done after each move * Opt: camera_data in W15 * Del: remove predict * Add: map info process after mob move * Add: support for multi bosses in _expected_end() for W15 * Opt: show map after moving * Del: remove redundant import in fleet.py * Opt: using clear_chosen_enemy() instead of goto() directly * Fix: should first take screenshot before strategy enter/confirm/cancel * Add: asset TEMPLATE_SIREN_BOSS * Opt: Handle first stages of BOSS as Siren in 15-3/15-4 * Fix: missing override map_data * Add: ignore is_boss prediction for siren boss in 15-3/15-4 * Fix: should not use decorator Config with battle_x functions * Opt: camera data in 15-4 * Opt: directly overwrite map info into original map_data * Fix: missing indent block in campaign_15_4.py * Fix: expect 15-3/15-4 first bosses as siren * Revert "Add: ignore is_boss prediction for siren boss in 15-3/15-4" This reverts commit 1104631f92e5df0672dce8c7acaa1eb122731746. * Revert "Add: asset TEMPLATE_SIREN_BOSS" This reverts commit a29d6b6b9bfb9d79963adb404ce2091cbfafb810. * Revert "Add: support for multi bosses in _expected_end() for W15" This reverts commit 8d357abe5bab79a643e23e8513cefa87d31cb3e8. * Del: redundent map config * Fix: recover boss grids * Del: redundant clear_siren() * Del: redundant clear_siren() in battle_6 * Add: template for mob move icon * Opt: enlarge reinforcement fleet mask area for W15 * Opt: method _mob_move * Upd: TEMPLATE_MOB_MOVE_ICON * Fix: should have cool time between clicks of grid * Revert "Upd: TEMPLATE_MOB_MOVE_ICON" This reverts commit b3f2dcbc88dbe166470905f33d041b91c2192f57. * Upd: TEMPLATE_MOB_MOVE_ICON * Upd: TEMPLATE_MOB_MOVE_ICON * Upd: predict_mob_move_icon * Fix: 15-2 camera spawn point * Fix: should update view using self.device.image * Revert "Upd: TEMPLATE_MOB_MOVE_ICON" This reverts commit 92a12596a8f271ec64e249ecb58779d9b64ecea6. * Del: redundant assets MOB_MOVE_ICON.png * Fix: using map_is_clear_mode to get real value of clear mode * Opt: check mob_movable before moving * Opt: Refactor _mob_move * Fix: camera_sight in W15 * Opt: move sight to further point in _mob_move
2024-04-19 01:29:17 +08:00
def _mob_move_info_change(self, location, target):
location = location_ensure(location)
target = location_ensure(target)
self.map[target].enemy_scale = self.map[location].enemy_scale
self.map[location].enemy_scale = 0
self.map[target].enemy_genre = self.map[location].enemy_genre
self.map[location].enemy_genre = None
self.map[target].is_boss = self.map[location].is_boss
self.map[location].is_boss = False
self.map[target].is_enemy = True
2024-05-20 23:30:47 +08:00
self.map[target].may_enemy = True
Add: 15图开荒/周回 (#3563) * Add: W15 maps extracted * Add: template for Special Carrier in W15 * Add: method mob_move * Fix: MapDetectionError in strategy mob move * Fix: adjacent grid judge condition * Fix: should focus on location before moving * Fix: should update view before further operation * Fix: wait for STRATEGY_OPENED after executing mob move * Fix: offset for assets in _mob_move() * Opt: judge if movable before moving camera * Add: W15 mechanism * Opt: Rename Special Carrier asset name * Fix: offset for MOB_MOVE_1/MOB_MOVE_2 * Fix: separate MOB_MOVE_1 and MOB_MOVE_2 * Fix: should use appear_then_click in strategy_mob_move_enter * Fix: function import in campaign_15_base.py * Fix: missing assets import * Fix: missing offset in strategy_mob_move_cancel() * Fix: should move only once in a campaign * Temp: modify special carrier filter string to 3E * Fix: missing self. before 'moved' variable * Revert "Fix: missing self. before 'moved' variable" This reverts commit 00f70e0ab55e422898cb90c5d5e54d4e7c989511. * Revert "Fix: should move only once in a campaign" This reverts commit b588f5bb07dfc4511f39fa0797fbe160f356d604. * Fix: force goto special carrier * Fix: missing return True in battle function * Fix: enlarge offset of MOB_MOVE_ICON * Fix: typo in campaing_15_3 * Fix: update view after moving mob * Fix: should use full_scan_movable since mob moved * Fix: missing map_data_init() in campaign_15_4.py * Fix: battle 4 should be done by mob fleet * Revert "Fix: battle 4 should be done by mob fleet" This reverts commit 0e2af1ec817b7bc89fe123f03a33ea9ad955973f. * Fix: should switch to fleet_1 after battle_3 * Add: battle function when using clear mode * Fix: missing import * Fix: colliding Config class * Fix: Config.when should contain all cases * Opt: pick ammo after third battle in clear mode of 15-4 * Del: old assets CarrierSpecial * Fix: remake of CarrierSpecial template * Add: UI mask for W15 * Fix: missing ASSETS import * Fix: change full_scan_movable() to predict() * Fix: predict should be done after each move * Opt: camera_data in W15 * Del: remove predict * Add: map info process after mob move * Add: support for multi bosses in _expected_end() for W15 * Opt: show map after moving * Del: remove redundant import in fleet.py * Opt: using clear_chosen_enemy() instead of goto() directly * Fix: should first take screenshot before strategy enter/confirm/cancel * Add: asset TEMPLATE_SIREN_BOSS * Opt: Handle first stages of BOSS as Siren in 15-3/15-4 * Fix: missing override map_data * Add: ignore is_boss prediction for siren boss in 15-3/15-4 * Fix: should not use decorator Config with battle_x functions * Opt: camera data in 15-4 * Opt: directly overwrite map info into original map_data * Fix: missing indent block in campaign_15_4.py * Fix: expect 15-3/15-4 first bosses as siren * Revert "Add: ignore is_boss prediction for siren boss in 15-3/15-4" This reverts commit 1104631f92e5df0672dce8c7acaa1eb122731746. * Revert "Add: asset TEMPLATE_SIREN_BOSS" This reverts commit a29d6b6b9bfb9d79963adb404ce2091cbfafb810. * Revert "Add: support for multi bosses in _expected_end() for W15" This reverts commit 8d357abe5bab79a643e23e8513cefa87d31cb3e8. * Del: redundent map config * Fix: recover boss grids * Del: redundant clear_siren() * Del: redundant clear_siren() in battle_6 * Add: template for mob move icon * Opt: enlarge reinforcement fleet mask area for W15 * Opt: method _mob_move * Upd: TEMPLATE_MOB_MOVE_ICON * Fix: should have cool time between clicks of grid * Revert "Upd: TEMPLATE_MOB_MOVE_ICON" This reverts commit b3f2dcbc88dbe166470905f33d041b91c2192f57. * Upd: TEMPLATE_MOB_MOVE_ICON * Upd: TEMPLATE_MOB_MOVE_ICON * Upd: predict_mob_move_icon * Fix: 15-2 camera spawn point * Fix: should update view using self.device.image * Revert "Upd: TEMPLATE_MOB_MOVE_ICON" This reverts commit 92a12596a8f271ec64e249ecb58779d9b64ecea6. * Del: redundant assets MOB_MOVE_ICON.png * Fix: using map_is_clear_mode to get real value of clear mode * Opt: check mob_movable before moving * Opt: Refactor _mob_move * Fix: camera_sight in W15 * Opt: move sight to further point in _mob_move
2024-04-19 01:29:17 +08:00
self.map[location].is_enemy = False
def mob_move(self, location, target):
"""
Open strategy, move mob fleet from location to target, close strategy.
Args:
location (tuple, str, GridInfo): Location of mob.
target (tuple, str, GridInfo): Destination.
Returns:
bool: If mob moved
Pages:
in: IN_MAP
out: IN_MAP
"""
if not self.mob_movable(location, target):
return False
self.strategy_open()
2024-05-20 23:30:47 +08:00
if not self.strategy_has_mob_move():
Add: 15图开荒/周回 (#3563) * Add: W15 maps extracted * Add: template for Special Carrier in W15 * Add: method mob_move * Fix: MapDetectionError in strategy mob move * Fix: adjacent grid judge condition * Fix: should focus on location before moving * Fix: should update view before further operation * Fix: wait for STRATEGY_OPENED after executing mob move * Fix: offset for assets in _mob_move() * Opt: judge if movable before moving camera * Add: W15 mechanism * Opt: Rename Special Carrier asset name * Fix: offset for MOB_MOVE_1/MOB_MOVE_2 * Fix: separate MOB_MOVE_1 and MOB_MOVE_2 * Fix: should use appear_then_click in strategy_mob_move_enter * Fix: function import in campaign_15_base.py * Fix: missing assets import * Fix: missing offset in strategy_mob_move_cancel() * Fix: should move only once in a campaign * Temp: modify special carrier filter string to 3E * Fix: missing self. before 'moved' variable * Revert "Fix: missing self. before 'moved' variable" This reverts commit 00f70e0ab55e422898cb90c5d5e54d4e7c989511. * Revert "Fix: should move only once in a campaign" This reverts commit b588f5bb07dfc4511f39fa0797fbe160f356d604. * Fix: force goto special carrier * Fix: missing return True in battle function * Fix: enlarge offset of MOB_MOVE_ICON * Fix: typo in campaing_15_3 * Fix: update view after moving mob * Fix: should use full_scan_movable since mob moved * Fix: missing map_data_init() in campaign_15_4.py * Fix: battle 4 should be done by mob fleet * Revert "Fix: battle 4 should be done by mob fleet" This reverts commit 0e2af1ec817b7bc89fe123f03a33ea9ad955973f. * Fix: should switch to fleet_1 after battle_3 * Add: battle function when using clear mode * Fix: missing import * Fix: colliding Config class * Fix: Config.when should contain all cases * Opt: pick ammo after third battle in clear mode of 15-4 * Del: old assets CarrierSpecial * Fix: remake of CarrierSpecial template * Add: UI mask for W15 * Fix: missing ASSETS import * Fix: change full_scan_movable() to predict() * Fix: predict should be done after each move * Opt: camera_data in W15 * Del: remove predict * Add: map info process after mob move * Add: support for multi bosses in _expected_end() for W15 * Opt: show map after moving * Del: remove redundant import in fleet.py * Opt: using clear_chosen_enemy() instead of goto() directly * Fix: should first take screenshot before strategy enter/confirm/cancel * Add: asset TEMPLATE_SIREN_BOSS * Opt: Handle first stages of BOSS as Siren in 15-3/15-4 * Fix: missing override map_data * Add: ignore is_boss prediction for siren boss in 15-3/15-4 * Fix: should not use decorator Config with battle_x functions * Opt: camera data in 15-4 * Opt: directly overwrite map info into original map_data * Fix: missing indent block in campaign_15_4.py * Fix: expect 15-3/15-4 first bosses as siren * Revert "Add: ignore is_boss prediction for siren boss in 15-3/15-4" This reverts commit 1104631f92e5df0672dce8c7acaa1eb122731746. * Revert "Add: asset TEMPLATE_SIREN_BOSS" This reverts commit a29d6b6b9bfb9d79963adb404ce2091cbfafb810. * Revert "Add: support for multi bosses in _expected_end() for W15" This reverts commit 8d357abe5bab79a643e23e8513cefa87d31cb3e8. * Del: redundent map config * Fix: recover boss grids * Del: redundant clear_siren() * Del: redundant clear_siren() in battle_6 * Add: template for mob move icon * Opt: enlarge reinforcement fleet mask area for W15 * Opt: method _mob_move * Upd: TEMPLATE_MOB_MOVE_ICON * Fix: should have cool time between clicks of grid * Revert "Upd: TEMPLATE_MOB_MOVE_ICON" This reverts commit b3f2dcbc88dbe166470905f33d041b91c2192f57. * Upd: TEMPLATE_MOB_MOVE_ICON * Upd: TEMPLATE_MOB_MOVE_ICON * Upd: predict_mob_move_icon * Fix: 15-2 camera spawn point * Fix: should update view using self.device.image * Revert "Upd: TEMPLATE_MOB_MOVE_ICON" This reverts commit 92a12596a8f271ec64e249ecb58779d9b64ecea6. * Del: redundant assets MOB_MOVE_ICON.png * Fix: using map_is_clear_mode to get real value of clear mode * Opt: check mob_movable before moving * Opt: Refactor _mob_move * Fix: camera_sight in W15 * Opt: move sight to further point in _mob_move
2024-04-19 01:29:17 +08:00
logger.warning(f'No remain mob move trials, will abandon moving')
self.strategy_close()
return False
self.strategy_mob_move_enter()
2024-04-20 02:51:02 +08:00
self._mob_move(location, target)
Add: 15图开荒/周回 (#3563) * Add: W15 maps extracted * Add: template for Special Carrier in W15 * Add: method mob_move * Fix: MapDetectionError in strategy mob move * Fix: adjacent grid judge condition * Fix: should focus on location before moving * Fix: should update view before further operation * Fix: wait for STRATEGY_OPENED after executing mob move * Fix: offset for assets in _mob_move() * Opt: judge if movable before moving camera * Add: W15 mechanism * Opt: Rename Special Carrier asset name * Fix: offset for MOB_MOVE_1/MOB_MOVE_2 * Fix: separate MOB_MOVE_1 and MOB_MOVE_2 * Fix: should use appear_then_click in strategy_mob_move_enter * Fix: function import in campaign_15_base.py * Fix: missing assets import * Fix: missing offset in strategy_mob_move_cancel() * Fix: should move only once in a campaign * Temp: modify special carrier filter string to 3E * Fix: missing self. before 'moved' variable * Revert "Fix: missing self. before 'moved' variable" This reverts commit 00f70e0ab55e422898cb90c5d5e54d4e7c989511. * Revert "Fix: should move only once in a campaign" This reverts commit b588f5bb07dfc4511f39fa0797fbe160f356d604. * Fix: force goto special carrier * Fix: missing return True in battle function * Fix: enlarge offset of MOB_MOVE_ICON * Fix: typo in campaing_15_3 * Fix: update view after moving mob * Fix: should use full_scan_movable since mob moved * Fix: missing map_data_init() in campaign_15_4.py * Fix: battle 4 should be done by mob fleet * Revert "Fix: battle 4 should be done by mob fleet" This reverts commit 0e2af1ec817b7bc89fe123f03a33ea9ad955973f. * Fix: should switch to fleet_1 after battle_3 * Add: battle function when using clear mode * Fix: missing import * Fix: colliding Config class * Fix: Config.when should contain all cases * Opt: pick ammo after third battle in clear mode of 15-4 * Del: old assets CarrierSpecial * Fix: remake of CarrierSpecial template * Add: UI mask for W15 * Fix: missing ASSETS import * Fix: change full_scan_movable() to predict() * Fix: predict should be done after each move * Opt: camera_data in W15 * Del: remove predict * Add: map info process after mob move * Add: support for multi bosses in _expected_end() for W15 * Opt: show map after moving * Del: remove redundant import in fleet.py * Opt: using clear_chosen_enemy() instead of goto() directly * Fix: should first take screenshot before strategy enter/confirm/cancel * Add: asset TEMPLATE_SIREN_BOSS * Opt: Handle first stages of BOSS as Siren in 15-3/15-4 * Fix: missing override map_data * Add: ignore is_boss prediction for siren boss in 15-3/15-4 * Fix: should not use decorator Config with battle_x functions * Opt: camera data in 15-4 * Opt: directly overwrite map info into original map_data * Fix: missing indent block in campaign_15_4.py * Fix: expect 15-3/15-4 first bosses as siren * Revert "Add: ignore is_boss prediction for siren boss in 15-3/15-4" This reverts commit 1104631f92e5df0672dce8c7acaa1eb122731746. * Revert "Add: asset TEMPLATE_SIREN_BOSS" This reverts commit a29d6b6b9bfb9d79963adb404ce2091cbfafb810. * Revert "Add: support for multi bosses in _expected_end() for W15" This reverts commit 8d357abe5bab79a643e23e8513cefa87d31cb3e8. * Del: redundent map config * Fix: recover boss grids * Del: redundant clear_siren() * Del: redundant clear_siren() in battle_6 * Add: template for mob move icon * Opt: enlarge reinforcement fleet mask area for W15 * Opt: method _mob_move * Upd: TEMPLATE_MOB_MOVE_ICON * Fix: should have cool time between clicks of grid * Revert "Upd: TEMPLATE_MOB_MOVE_ICON" This reverts commit b3f2dcbc88dbe166470905f33d041b91c2192f57. * Upd: TEMPLATE_MOB_MOVE_ICON * Upd: TEMPLATE_MOB_MOVE_ICON * Upd: predict_mob_move_icon * Fix: 15-2 camera spawn point * Fix: should update view using self.device.image * Revert "Upd: TEMPLATE_MOB_MOVE_ICON" This reverts commit 92a12596a8f271ec64e249ecb58779d9b64ecea6. * Del: redundant assets MOB_MOVE_ICON.png * Fix: using map_is_clear_mode to get real value of clear mode * Opt: check mob_movable before moving * Opt: Refactor _mob_move * Fix: camera_sight in W15 * Opt: move sight to further point in _mob_move
2024-04-19 01:29:17 +08:00
self.strategy_close(skip_first_screenshot=False)
2024-04-20 02:51:02 +08:00
self._mob_move_info_change(location, target)
self.find_path_initial()
2024-04-20 02:51:02 +08:00
self.map.show()