mirror of
https://github.com/0O0o0oOoO00/Alas.git
synced 2026-05-14 07:49:25 +08:00
This commit was manually merged into this repository earlier, and later guoh064 merged this commit into LmeSzinc’s repository.
This reverts commit 13aba919a2.
89 lines
2.4 KiB
Python
89 lines
2.4 KiB
Python
from module.base.base import ModuleBase
|
|
from module.combat.assets import *
|
|
|
|
|
|
class CombatManual(ModuleBase):
|
|
auto_mode_checked = False
|
|
auto_mode_switched = False
|
|
manual_executed = False
|
|
|
|
def combat_manual_reset(self):
|
|
self.manual_executed = False
|
|
|
|
def handle_combat_stand_still_in_the_middle(self, auto):
|
|
"""
|
|
Args:
|
|
auto (str): Combat auto mode.
|
|
|
|
Returns:
|
|
bool: If executed
|
|
"""
|
|
if auto != 'stand_still_in_the_middle':
|
|
return False
|
|
# When switching from auto to manual, fleets are usually in the middle, no need to move down
|
|
# Otherwise fleet will be moved to the bottom
|
|
if self.auto_mode_switched:
|
|
return False
|
|
|
|
self.device.long_click(MOVE_DOWN, duration=0.8)
|
|
return True
|
|
|
|
def handle_combat_stand_still_bottom_left(self, auto):
|
|
"""
|
|
Args:
|
|
auto (str): Combat auto mode.
|
|
|
|
Returns:
|
|
bool: If executed
|
|
"""
|
|
if auto != 'hide_in_bottom_left':
|
|
return False
|
|
|
|
self.device.long_click(MOVE_LEFT_DOWN, duration=(3.5, 5.5))
|
|
return True
|
|
|
|
def handle_combat_stand_still_upper_left(self, auto):
|
|
"""
|
|
Args:
|
|
auto (str): Combat auto mode.
|
|
|
|
Returns:
|
|
bool: If executed
|
|
"""
|
|
if auto != 'hide_in_upper_left':
|
|
return False
|
|
|
|
self.device.long_click(MOVE_LEFT_UP, duration=(1.5, 3.5))
|
|
return True
|
|
|
|
def handle_combat_weapon_release(self):
|
|
if self.appear_then_click(READY_AIR_RAID, interval=10):
|
|
return True
|
|
if self.appear_then_click(READY_TORPEDO, interval=10):
|
|
return True
|
|
|
|
return False
|
|
|
|
def handle_combat_manual(self, auto):
|
|
"""
|
|
Args:
|
|
auto (str): Combat auto mode.
|
|
|
|
Returns:
|
|
bool: If executed
|
|
"""
|
|
if self.manual_executed or not self.auto_mode_checked:
|
|
return False
|
|
|
|
if self.handle_combat_stand_still_in_the_middle(auto):
|
|
self.manual_executed = True
|
|
return True
|
|
if self.handle_combat_stand_still_bottom_left(auto):
|
|
self.manual_executed = True
|
|
return True
|
|
if self.handle_combat_stand_still_upper_left(auto):
|
|
self.manual_executed = True
|
|
return True
|
|
|
|
return False
|