Skip to content

Commit 7601b1c

Browse files
committed
Attack soft lock fix
If the function calls to attack a specific enemy and that enemy is already dead (not targetable), logic will now attack any available enemy (first targetted) instead.
1 parent 6380c88 commit 7601b1c

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Diff for: players/base.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,16 @@ def _target_specific_id(self, target_id: int, direction: str = "l"):
144144
def attack(
145145
self, target_id: Optional[int] = None, direction_hint: Optional[str] = "u"
146146
):
147+
skip_direction = False
147148
if target_id is None:
148-
logger.debug("Attack")
149+
logger.debug("Attack enemy, first targetted.")
150+
elif target_id in range(7):
151+
logger.debug(f"Attack player character {target_id}")
152+
elif memory.main.get_enemy_current_hp()[target_id-20] == 0:
153+
logger.debug(
154+
f"Enemy {target_id} is not attack-able. Resorting to basic attack."
155+
)
156+
skip_direction = True
149157
else:
150158
logger.debug(
151159
f"Attacking a specific target with id {target_id}, direction hint is {direction_hint}"
@@ -159,7 +167,7 @@ def attack(
159167
self.navigate_to_battle_menu(attack_menu_id)
160168
while memory.main.main_battle_menu():
161169
xbox.tap_b()
162-
if target_id is not None:
170+
if target_id is not None and not skip_direction:
163171
self._target_specific_id(target_id, direction_hint)
164172
self._tap_targeting()
165173

0 commit comments

Comments
 (0)