ihhub / fheroes2

fheroes2 is a recreation of Heroes of Might and Magic II game engine.
https://ihhub.github.io/fheroes2/
GNU General Public License v2.0
2.72k stars 376 forks source link

AI hero gets stuck in an infinite loop jumping between 2 castles #6920

Open ihhub opened 1 year ago

ihhub commented 1 year ago

Preliminary checks

Platform

Windows

Describe the bug

AI hero goes into an infinite loop while using Town Portal and jumping between 2 castles. Load the save file to pass the control to AI.

Save file

town_portal_infinite_loop.zip

Additional info

No response

ihhub commented 1 year ago

This issue requires implementation of #7139 in order to avoid such a behavior.

oleg-derevenetz commented 1 year ago

This issue requires implementation of https://github.com/ihhub/fheroes2/issues/7139 in order to avoid such a behavior.

Hi @ihhub could you please explain in more detail how #7139 is related to the Town Portal spell? Please also note that as soon as Solmyr hires enough troops, he stops jumping from castle to castle and attacks the wandering stack of dwarves nearby, so it's not "endless" at all - he just has nothing to do until he hires more troops.

ihhub commented 1 year ago

Hi @oleg-derevenetz , I actually realized that AI heroes do start their turn by executing an action when they are in castles. So yes, you are right.

I don't think that we can improve this behavior at the moment.