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

Adventure map, maximum spell points after heroes' meeting with artifact exchange concerning the hero's knowledge #7520

Open LeHerosInconnu opened 1 year ago

LeHerosInconnu commented 1 year ago

Preliminary checks

Platform

Windows

Describe the bug

During a meeting, when two heroes exchange artifacts that modify the maximum spell point total linked to the hero's knowledge, the maximum spell point total of the hero with a number greater than the new maximum total should be adjusted. This is the case in the original game.

In the example, Ariel has 150 spell points corresponding to the maximum she can have with her knowledge of 15. The Ultimate Book of Knowledge artifact gives her 12 of these 15 knowledge points. When the Ultimate Book of Knowledge artifact is transferred to the hero Arie, Ariel's knowledge is reduced to 3 knowledge points.

At the end of the meeting, Ariel's spell points should therefore be reduced to 30 spell points, rather than remaining at 150 spell points. But beware, this change in the number of spell points should only take effect just after the meeting window closes, so that the player can move artifacts from one hero to another several times if he changes his mind without losing the hero's spell points (there's a bug in the original game regarding this). However, the hero spell points indicator bar (in the hero list) should be updated before returning to the adventure map screen after the meeting.

In the example, if Ariel goes to the Artesian Spring before the meeting, her spell points will increase to 300 spell points. If during the meeting Ariel gives the Ultimate Book of Knowledge artifact to Arie, she will have 30 spell points after the meeting (the maximum she can have) and not 60 spell points. If Ariel wants 60 spell points, she should visit the Artesian spring after giving the Ultimate Book of Knowledge artifact to Arie during the meeting.

In fheroes2:

https://github.com/ihhub/fheroes2/assets/43583994/8cdcc79a-7888-419b-b935-6b46ee9a80af

Save file

Here is the save file: Max spell poin after meeting_.zip

Additional info

No response

oleg-derevenetz commented 1 year ago

To be honest, I don't find this mechanics sane. As far as I understand, this has been fixed in HoMM3 and subsequent games of the series:

https://github.com/ihhub/fheroes2/assets/32623900/8e2df5b4-91b0-451c-890b-e079f5e65b0a

The whole idea is that the already existing number of spell points is not changed when hero's Knowledge is changed. In this video Sorsha got 5 Knowledge due to the Crown of the Supreme Magi artifact (+4 Knowledge) and got 100SP due to Mana Vortex, and after he transferred this Crown to another hero, he still has 100SP despite having just 1 Knowledge.

But beware, this change in the number of spell points should only take effect just after the meeting window closes, so that the player can move artifacts from one hero to another several times if he changes his mind without losing the hero's spell points (there's a bug in the original game regarding this).

I'd say that this whole mechanics is a bug, which has been fixed in subsequent versions.

kitovyj commented 1 year ago

Yes, it's hard to tell what is better. On one hand the preservation of mana allows exploiting artifact exchange to recharge multiple heroes manas above their "intrinsic" knowledge level. On the other hand, resetting doubled mana to 'normal' amount just because a hero lost only 1 point of knowledge due to artifact exchange seems strange and maybe suprising the the player. I would vote for leaving it as it is.

oleg-derevenetz commented 1 year ago

On one hand the preservation of mana allows exploiting artifact exchange to recharge multiple heroes manas above their "intrinsic" knowledge level.

This is not so easy to exploit because you need to have both an artifact, a courier hero (or even a whole chain of heroes) and also some mana replenishment object (such as Well) near each hero to recharge. Otherwise, such a recharge will take a lot of game time.

kitovyj commented 1 year ago

On one hand the preservation of mana allows exploiting artifact exchange to recharge multiple heroes manas above their "intrinsic" knowledge level.

This is not so easy to exploit because you need to have both an artifact, a courier hero (or even a whole chain of heroes) and also some mana replenishment object (such as Well) near each hero to recharge. Otherwise, such a recharge will take a lot of game time.

Yes, I don't remember I ever used such a trick, game time is too precious.

kitovyj commented 1 year ago

On one hand the preservation of mana allows exploiting artifact exchange to recharge multiple heroes manas above their "intrinsic" knowledge level.

This is not so easy to exploit because you need to have both an artifact, a courier hero (or even a whole chain of heroes) and also some mana replenishment object (such as Well) near each hero to recharge. Otherwise, such a recharge will take a lot of game time.

An interesting solution could be to use the formula "if mana > current_knowledge10 then mana = floor(mana current_knowledge / old_knowledge)" . It would preserve the flavour of the original game, prevent the boring exploit and allow to avoid strange "spring-boosted mana reset" after artifact exchanges.

oleg-derevenetz commented 1 year ago

An interesting solution could be to use the formula "if mana > current_knowledge10 then mana = floor(mana current_knowledge / old_knowledge)" . It would preserve the flavour of the original game, prevent the boring exploit and allow to avoid strange "spring-boosted mana reset" after artifact exchanges.

Any behavior that will differ both from OG behavior and from the behavior of subsequent games of HoMM series (the "fixed" one, I believe) looks doubtful IMHO. I'd just leave the current behavior (the same as in subsequent HoMM games) as is.

ihhub commented 1 year ago

Let's keep it the logic the same as in the original game which is the current behavior.

oleg-derevenetz commented 1 year ago

Hi @ihhub

Let's keep it the logic the same as in the original game which is the current behavior.

The problem is that the original game has a different logic :)

In the example, Ariel has 150 spell points corresponding to the maximum she can have with her knowledge of 15. The Ultimate Book of Knowledge artifact gives her 12 of these 15 knowledge points. When the Ultimate Book of Knowledge artifact is transferred to the hero Arie, Ariel's knowledge is reduced to 3 knowledge points.

At the end of the meeting, Ariel's spell points should therefore be reduced to 30 spell points, rather than remaining at 150 spell points. But beware, this change in the number of spell points should only take effect just after the meeting window closes, so that the player can move artifacts from one hero to another several times if he changes his mind without losing the hero's spell points (there's a bug in the original game regarding this).

@LeHerosInconnu just believes that the bug is only that the SP changes are applied immediately after moving the artifact, while I believe that the bug is is that these changes are taking place at all.

LeHerosInconnu commented 1 year ago

Hello everyone,

The problem is that by keeping the extra spell points above the maximum possible level, it becomes easy to abuse the functioning. The hero fills up his spell points with lots of Knowledge artifacts and then exchanges them for Attack, Defense and/or Spell Power artifacts. The hero is then much stronger in attack defense and/or spell power and with lots of spell points without worrying about Knowledge artifacts. This becomes a "trick" advantage, even if it's only for two or three consecutive combats, that can easily be reproduced by the player.

In the original game, if during a meeting between heroes, a Knowledge artifact is moved in the same inventory (for example, the player rearranges the position of artifacts in the inventory of one of his heroes for greater clarity or whatever), the extra spell points above the maximum possible level are removed. I consider this a bug.

Edit.

It should also be noted that in Heroes 3, artifact types occupy very specific slots, and it is not possible to replace a Knowledge artifact with an Attack artifact, for example.

oleg-derevenetz commented 1 year ago

The problem is that by keeping the extra spell points above the maximum possible level, it becomes easy to abuse the functioning. The hero fills up his spell points with lots of Knowledge artifacts and then exchanges them for Attack, Defense and/or Spell Power artifacts.

It's not so easy, because you should have not just the artifacts, but also the mana sources, like Well, somewhere nearby, so you cannot just bring some set of artifacts anywhere you like and get all the benefits. Also in HoMM2 this mechanics is obviously bugged, and in later HoMMs it is completely absent, there is no way to decrease already existing MP by removing artifacts in them.

LeHerosInconnu commented 1 year ago

Hello @oleg-derevenetz,

The problem is that by keeping the extra spell points above the maximum possible level, it becomes easy to abuse the functioning. The hero fills up his spell points with lots of Knowledge artifacts and then exchanges them for Attack, Defense and/or Spell Power artifacts.

It's not so easy, because you should have not just the artifacts, but also the mana sources, like Well, somewhere nearby, so you cannot just bring some set of artifacts anywhere you like and get all the benefits. Also in HoMM2 this mechanics is obviously bugged, and in later HoMMs it is completely absent, there is no way to decrease already existing MP by removing artifacts in them.

You replied before my edit in the previous post. :) So: "It should also be noted that in Heroes 3, artifact types occupy very specific slots, and it is not possible to replace a Knowledge artifact with an Attack artifact, for example." It's a different system.

oleg-derevenetz commented 1 year ago

It should also be noted that in Heroes 3, artifact types occupy very specific slots, and it is not possible to replace a Knowledge artifact with an Attack artifact, for example.

This is not quite the case. For example, you can put the Crown of Supreme Magi on first, get the additional mana, and then replace it by the Spellbinder's Hat and get all level 5 spells for this additional mana.

LeHerosInconnu commented 1 year ago

@oleg-derevenetz.

It should also be noted that in Heroes 3, artifact types occupy very specific slots, and it is not possible to replace a Knowledge artifact with an Attack artifact, for example.

This is not quite the case. For example, you can put the Crown of Supreme Magi on first, get the additional mana, and then replace it by the Spellbinder's Hat and get all level 5 spells for this additional mana.

This is a "trick" advantage of the Heroes 3 system, that can therefore also be manipulated. :) The Heroes 2 system is better in this case.

Anyways, in Heroes 3 a Knowledge artifact cannot be replaced by an Attack artifact.

In Heroes 2, with the "universal slots" in the hero's inventory, the removal of the extra spell points above the maximum possible level acts as a safeguard.

oleg-derevenetz commented 1 year ago

Anyways, in Heroes 3 a Knowledge artifact cannot be replaced by an Attack artifact.

In fact, not everything works so straightforwardly there. For example, you can put on the Sword of Judgement first (all +5), get additional mana (even double it in the Mana Vortex) and then replace this sword by Titan's Gladius (attack +12). The same is with torso - Armor of Wonder vs Dragon Scale Armor, etc.

LeHerosInconnu commented 1 year ago

@oleg-derevenetz.

Anyways, in Heroes 3 a Knowledge artifact cannot be replaced by an Attack artifact.

In fact, not everything works so straightforwardly there. For example, you can put on the Sword of Judgement first (all +5), get additional mana (even double it in the Mana Vortex) and then replace this sword by Titan's Gladius (attack +12). The same is with torso - Armor of Wonder vs Dragon Scale Armor, etc.

This leads to more "trick" advantages in the Heroes 3 system. And it also means more micro-management for players who want to optimize their heroes to the max. The Heroes 2 system is definitely better in this regard. :)

Anyways, the goal is not to make fheroes2 work like Heroes 3; it's Heroes 2 we're dealing with. :)

Branikolog commented 1 year ago

Hi, @LeHerosInconnu ! I personally agree with @oleg-derevenetz . Reducing mana after a hero has took away artifact +knowledge seem to be broken. Especially considering the fact, that in other circumstances heroes can have more mana points than knowledge allows them to have. The logic mentioned in the issue seems straightforward only if we have a hero with full mana. What if the hero has visited artesian spring and doubled his mana reserves? After removing artifact how many mana points do you expect to have? 30? Or 60? What if the hero has already consumed part of these points? Keeping mana points after meeting two is quite clear and straightforward behaviour. It could be abused in some rare cases (two heroes, well nearby, a couple of artifacts "+knowledge" and sufficient backpack slots), but is this the only case when a player tries to get some benefits from the game? :)

LeHerosInconnu commented 1 year ago

Hello @Branikolog,

What if the hero has visited artesian spring and doubled his mana reserves? After removing artifact how many mana points do you expect to have? 30? Or 60?

The answer to that was already written in the original post: :) "In the example, if Ariel goes to the Artesian Spring before the meeting, her spell points will increase to 300 spell points. If during the meeting Ariel gives the Ultimate Book of Knowledge artifact to Arie, she will have 30 spell points after the meeting (the maximum she can have) and not 60 spell points. If Ariel wants 60 spell points, she should visit the Artesian spring after giving the Ultimate Book of Knowledge artifact to Arie during the meeting."

It's also possible to improve the way the original game works, and at the same time reduce micromanagement (exchanging artifacts first during a meeting with another hero, and then going to the artesian spring), by making it so that when the hero obtains spell points in a specific way (by visiting an artesian spring, or whatever) he can keep his extra spell points.

In the case of the artesian spring, whose effect is to double the hero's spell points according to the hero's Knowledge, if the hero has already visited an artesian spring before making the artifact exchange, he is "marked" following this visit, and retains at most double the spell points corresponding to his final Knowledge after the meeting.

Examples:

It could be abused in some rare cases (two heroes, well nearby, a couple of artifacts "+knowledge" and sufficient backpack slots), but is this the only case when a player tries to get some benefits from the game? :)

In Heroes 2, Knowledge cannot be abused, only in Heroes 3. So you want to reproduce the flawed operation of Heroes 3 in fheroes2? And will the AI also be able to make use of this wobbly operation? And why not make the other primary skills work the same way? After all, the hero has obtained +3 Attack with an artifact, so why take away this bonus when he gives the artifact to another hero? What if all spells were simply free to cast? What game would you like to play? :D

oleg-derevenetz commented 1 year ago

In Heroes 2, Knowledge cannot be abused, only in Heroes 3.

You call the behavior in the later games of the series "abuse", and the authors of this game mechanics, I suppose, call it "a reward for careful management and a, to a large extent, luck" (and probably also "a bugfix" - they fixed the original bug in their way, not in your way - although they certainly could have done it in your way). So it all depends on the point of view.

LeHerosInconnu commented 1 year ago

Hello @oleg-derevenetz,

In Heroes 2, Knowledge cannot be abused, only in Heroes 3.

You call the behavior in the later games of the series "abuse", and the authors of this game mechanics, I suppose, call it "a reward for careful management and a, to a large extent, luck" (and probably also "a bugfix" - they fixed the original bug in their way, not in your way - although they certainly could have done it in your way). So it all depends on the point of view.

To my Knowledge, :) fheroes2 is a remake of Heroes 2. Heroes 3 is based on a different artifact system.

LeHerosInconnu commented 2 months ago

Hello everyone,

For now, even if the player simply wants to ignore the trick which benefits his heroes, he can't do so. The player "cheats" without really meaning to. For example, a secondary hero with a knowledge artifact can benefit from spell points during his journey, which he retains after giving the artifact to another hero. The player who wants to play by the book will have to pay attention to this in order to play in the same conditions as the original game in this respect, it's a bit too much. This will be even more problematic once the multiplayer mode will have been integrated into the game and that human players will want to play competitively.

I think it's possible to keep Heroes 2's way of working, by adapting it a little. Knowledge should then work in the same way as the hero's other primary skills, i.e. if an artifact is removed, the value of the primary skill is adjusted. For example, if the hero removes an attack artifact, the attack value is adjusted.

Spell points gained from artesian spring and secondary skills, etc. should be stored in a separate reserve. Let's call it the extra reserve for now. When the hero uses magic on the adventure map or during combat, the extra reserve is depleted first. When the extra reserve runs out of spell points, the standard reserve is depleted.

In this way, extra spell points are always retained when the hero exchanges knowledge artifacts with another hero. And the game's original mechanism of adjusting the knowledge value when a knowledge artifact is no longer present is preserved.

Also, spell points from the extra reserve are taken into account in addition to spell points from the standard reserve when the hero visits a magic well or spends the night in a castle, to maintain the original game's functioning. When the hero visits an artesian spring, he gets double his spell points in relation to his current knowledge, regardless of the number of spell points in the different reserves, as it is also the case in the original game. In the case where the hero has more than the double of spell points than his current knowledge when he visits an artesian spring, he conserves all his spell points (the spell points are not decreased to the value of the double of spell points).