fheroes2 icon indicating copy to clipboard operation
fheroes2 copied to clipboard

Make the AI order the artifacts in the bag from worst to best

Open zenseii opened this issue 1 year ago • 4 comments

Preliminary checks

Describe the problem requiring a solution

Currently if an AI hero has met up with another hero and exchanged artifacts, it will have its artifacts ordered from best to worst, and this means that when they lose a battle the winner will get the best artifacts first. It should be the opposite.

Describe the possible solution

Add logic for the AI to sort its artifacts from worst to best, both after it has met and exchanged artifacts and other situations when it gets artifacts. The latter could be the first turn because its possible that a hero starts with artifacts, in which case they should be sorted by the AI.

Additional info

~~I have not checked if this logic of transferring artifacts to the winner in fheroes2 is the same as in the original game. If the original game transfers artifacts over to the winner according to different rules, like according to artifactID, then we should discuss if we want to reimplement that.~~

This has been confirmed as working the same as the original game (see https://github.com/ihhub/fheroes2/issues/9208#issuecomment-2662965866)

zenseii avatar Oct 17 '24 14:10 zenseii

Step 1 in this issue is to verify the artifact transfer logic of the original game. ~~Note that in the original game it was not possible to reorder artifacts in the bag~~ I've since learnt that you can reorder artifacts in the heroes meeting screen in the OG.

Also see: https://github.com/ihhub/fheroes2/issues/1643

zenseii avatar Oct 17 '24 15:10 zenseii

I think that if this gets implemented, only the higher difficulties should use this tactic.

PlatoHero avatar Oct 17 '24 19:10 PlatoHero

I've now confirmed that this is how the artifact transfer works in the original game. The two heroes above in the picture do a battle, the right side wins and the inventory on the bottom is the resulting one. This also shows a bug in the original game, that since the losing hero had an ultimate artifact (the ultimate book of knowledge), which can't be transferred, the spot it would've taken is left empty, and the winning hero "loses" out on getting the hideous mask.

Image

As stated in a comment above, it was possible to switch places for artifacts in the original game by meeting up with another hero, so strategically organizing a hero's inventory by placing the worst artifacts first was definitely something you could do. I therefore believe the fheroes2 AI should do this.

Sure, there's a slight difference between the OG and fheroes2 in that in fheroes2 you can reorder you inventory without having to meet up with another hero, but this is personally something I don't think we should consider reverting to even if it facilitates this gameplay strategy.

zenseii avatar Feb 17 '25 12:02 zenseii

It would be great to implement it for the upcoming release.

ihhub avatar Oct 21 '25 23:10 ihhub