Skip to content
This repository has been archived by the owner on Jul 1, 2022. It is now read-only.

Walking Hammerdin bugfix #749

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 19 additions & 23 deletions src/char/hammerdin.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,6 @@ def pre_buff(self):
mouse.click(button="right")
wait(self._cast_duration, self._cast_duration + 0.06)

def on_capabilities_discovered(self, capabilities: CharacterCapabilities):
# In case we have a running pala, we want to switch to concentration when moving to the boss
# ass most likely we will click on some mobs and already cast hammers
if capabilities.can_teleport_natively:
self._do_pre_move = False

Comment on lines -54 to -59
Copy link
Collaborator

@aliig aliig May 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this function removed? I'm not 100% sure of the consequences of this but @VladimirMakaev might know

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering the same which is why I asked if it still works for hdin with tele. Ive been running as a walkadin and seems fine. Ill double verify in a bit if enigma still works.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When debugging self._do_pre_move it turned out that it reverts back to true. The Hammerdin class logic expected it to stay false though. It was the main culprit of why the Hammerdin seemed to "attack" while having Vigor turned on. It should have switched to Concentration, but didn't. Not relying on self._do_pre_move fixed it immediately and then the on_capabilities_discovered wasn't required anymore.

Also it lead to unneccesarily complicated logic constructs that were hard to follow and could be done in a simpler and more readable way.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't touch this code. It can easily break something for Enigma / Tele-Charge paladin . And you need to test 3 different version of paladin on all routes to make sure it's sound:

  1. Walkdadin Trav/Shenk/...
  2. Enigma Paladin Trav/Shenk/...
  3. Tele-Charge Paladin Trav/Shenk

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should just cast Concentration and move with PreMove=False that way you won't change to Vigor.
preMove() will flip to Vigor in case of Walkadin or Tele-Charge (there is no way to pass that telecharge is to be used based on current code structure). So in case you're opting to tele-charge then you should manage PreMove part manually. E.g. casting concentration and doing PreMove=False, TeleCharge = True or PreMove=True if you want Vigor to be on for walking / running out of tele charges and walking.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't touch this code. It can easily break something for Enigma / Tele-Charge paladin . And you need to test 3 different version of paladin on all routes to make sure it's sound:

1. Walkdadin Trav/Shenk/...

2. Enigma Paladin Trav/Shenk/...

3. Tele-Charge Paladin Trav/Shenk

It didn't even work the way it was intended to work. No need to re-introduce bugs.

This PR has been tested extensively with all three variants. Some people even happily and successfully use it for their daily runs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should just cast Concentration and move with PreMove=False that way you won't change to Vigor. preMove() will flip to Vigor in case of Walkadin or Tele-Charge (there is no way to pass that telecharge is to be used based on current code structure). So in case you're opting to tele-charge then you should manage PreMove part manually. E.g. casting concentration and doing PreMove=False, TeleCharge = True or PreMove=True if you want Vigor to be on for walking / running out of tele charges and walking.

Which is what I did.

def pre_move(self):
# select teleport if available
super().pre_move()
Expand All @@ -77,11 +71,12 @@ def kill_pindle(self) -> bool:
wait(0.1, 0.15)
if self.capabilities.can_teleport_natively:
self._pather.traverse_nodes_fixed("pindle_end", self)
# If no teleport available -> Activate Concentration. Why? The bot will accidentally click on monsters and already cast hammers.
else:
if not self._do_pre_move:
keyboard.send(self._skill_hotkeys["concentration"])
wait(0.05, 0.15)
self._pather.traverse_nodes((Location.A5_PINDLE_SAFE_DIST, Location.A5_PINDLE_END), self, timeout=1.0, do_pre_move=self._do_pre_move)
keyboard.send(self._skill_hotkeys["concentration"])
wait(0.05, 0.15)
# Traverse without pre_move, because we don't want to activate vigor when walking!
self._pather.traverse_nodes((Location.A5_PINDLE_SAFE_DIST, Location.A5_PINDLE_END), self, timeout=1.0, do_pre_move=False, force_tp=True, use_tp_charge=True)
self._cast_hammers(Config().char["atk_len_pindle"])
wait(0.1, 0.15)
self._cast_hammers(1.6, "redemption")
Expand All @@ -91,43 +86,44 @@ def kill_eldritch(self) -> bool:
if self.capabilities.can_teleport_natively:
# Custom eld position for teleport that brings us closer to eld
self._pather.traverse_nodes_fixed([(675, 30)], self)
# If no teleport available -> Activate Concentration. Why? The bot will accidentally click on monsters and already cast hammers.
else:
if not self._do_pre_move:
keyboard.send(self._skill_hotkeys["concentration"])
wait(0.05, 0.15)
self._pather.traverse_nodes((Location.A5_ELDRITCH_SAFE_DIST, Location.A5_ELDRITCH_END), self, timeout=1.0, do_pre_move=self._do_pre_move, force_tp=True, use_tp_charge=True)
keyboard.send(self._skill_hotkeys["concentration"])
wait(0.05, 0.15)
# Traverse without pre_move, because we don't want to activate vigor when walking!
self._pather.traverse_nodes((Location.A5_ELDRITCH_SAFE_DIST, Location.A5_ELDRITCH_END), self, timeout=1.0, do_pre_move=False, force_tp=True, use_tp_charge=True)
wait(0.05, 0.1)
self._cast_hammers(Config().char["atk_len_eldritch"])
wait(0.1, 0.15)
self._cast_hammers(1.6, "redemption")
return True

def kill_shenk(self):
if not self._do_pre_move:
keyboard.send(self._skill_hotkeys["concentration"])
wait(0.05, 0.15)
self._pather.traverse_nodes((Location.A5_SHENK_SAFE_DIST, Location.A5_SHENK_END), self, timeout=1.0, do_pre_move=self._do_pre_move, force_tp=True, use_tp_charge=True)
# Activate Concentration, because we might accidentally cast Hammers while moving around.
keyboard.send(self._skill_hotkeys["concentration"])
wait(0.05, 0.15)
self._pather.traverse_nodes((Location.A5_SHENK_SAFE_DIST, Location.A5_SHENK_END), self, timeout=1.0, do_pre_move=False, force_tp=True, use_tp_charge=True)
wait(0.05, 0.1)
self._cast_hammers(Config().char["atk_len_shenk"])
wait(0.1, 0.15)
self._cast_hammers(1.6, "redemption")
return True

def kill_council(self) -> bool:
if not self._do_pre_move:
keyboard.send(self._skill_hotkeys["concentration"])
wait(0.05, 0.15)
# Activate Concentration, because we might accidentally cast Hammers while moving around.
keyboard.send(self._skill_hotkeys["concentration"])
wait(0.05, 0.15)
# Check out the node screenshot in assets/templates/trav/nodes to see where each node is at
atk_len = Config().char["atk_len_trav"]
# Go inside and hammer a bit
self._pather.traverse_nodes([228, 229], self, timeout=2.5, force_tp=True, use_tp_charge=True)
self._pather.traverse_nodes([228, 229], self, timeout=2.5, do_pre_move=False, force_tp=True, use_tp_charge=True)
self._cast_hammers(atk_len)
# Move a bit back and another round
self._move_and_attack((40, 20), atk_len)
# Here we have two different attack sequences depending if tele is available or not
if self.capabilities.can_teleport_natively or self.capabilities.can_teleport_with_charges:
# Back to center stairs and more hammers
self._pather.traverse_nodes([226], self, timeout=2.5, force_tp=True, use_tp_charge=True)
self._pather.traverse_nodes([226], self, timeout=2.5, do_pre_move=False, force_tp=True, use_tp_charge=True)
self._cast_hammers(atk_len)
# move a bit to the top
self._move_and_attack((65, -30), atk_len)
Expand Down