mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-23 22:37:55 +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:
@@ -351,6 +351,17 @@ CGHeroInstance * HeroPoolProcessor::pickHeroFor(bool isNative, const PlayerColor
|
||||
return *RandomGeneratorUtil::nextItem(possibleHeroes, getRandomGenerator(player));
|
||||
}
|
||||
|
||||
CRandomGenerator & HeroPoolProcessor::getHeroSkillsRandomGenerator(const HeroTypeID & hero)
|
||||
{
|
||||
if (heroSeed.count(hero) == 0)
|
||||
{
|
||||
int seed = gameHandler->getRandomGenerator().nextInt();
|
||||
heroSeed.emplace(hero, std::make_unique<CRandomGenerator>(seed));
|
||||
}
|
||||
|
||||
return *heroSeed.at(hero);
|
||||
}
|
||||
|
||||
CRandomGenerator & HeroPoolProcessor::getRandomGenerator(const PlayerColor & player)
|
||||
{
|
||||
if (playerSeed.count(player) == 0)
|
||||
|
||||
Reference in New Issue
Block a user