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.74k stars 377 forks source link

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

Open zenseii opened 1 month ago

zenseii commented 1 month ago

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.

zenseii commented 1 month ago

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 (see https://github.com/ihhub/fheroes2/issues/1643).

PlatoHero commented 1 month ago

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