1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-29 23:07:48 +02:00

Reworked and fixed selection of secondary skills:

- Fixed off-by-one error when checking for obligatory skills
- If both wisdom and magic school must be offered in the same slot, magic
school will be correctly offered on next levelup
- Obligatory skill can now be proposed for upgrade
- Obligatory skills are now offered using hero class weight instead of
simple random
- If hero has multiple skills not available to his class game will
select random skill instead of first one
- Moved storage of random seed to server instead of mutable member
This commit is contained in:
Ivan Savenko
2023-11-20 18:44:27 +02:00
parent ff6260e5c5
commit e9ac8c67c1
10 changed files with 106 additions and 154 deletions

View File

@@ -1276,23 +1276,6 @@ struct DLL_LINKAGE ChangeObjectVisitors : public CPackForClient
}
};
struct DLL_LINKAGE PrepareHeroLevelUp : public CPackForClient
{
ObjectInstanceID heroId;
/// Do not serialize, used by server only
std::vector<SecondarySkill> skills;
void applyGs(CGameState * gs);
void visitTyped(ICPackVisitor & visitor) override;
template <typename Handler> void serialize(Handler & h, const int version)
{
h & heroId;
}
};
struct DLL_LINKAGE HeroLevelUp : public Query
{
PlayerColor player;