1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-09-16 09:26:28 +02:00

possibility to adjust skill selection

This commit is contained in:
Laserlicht
2025-07-24 19:39:06 +02:00
parent 7fcb0246fb
commit 1316389e9d
5 changed files with 43 additions and 33 deletions

View File

@@ -517,7 +517,12 @@
/// Strength of generic secondary skill specialties ( "secondary" : "skillName" ) per level
"specialtySecondarySkillGrowth" : 5,
/// Strength of generic creature specialties ( "creature" : "creatureName" ) per level
"specialtyCreatureGrowth" : 5
"specialtyCreatureGrowth" : 5,
/// Amount of advanced or expert skills selectable (if any)
"skillSelectionAmountUpgr" : 1,
/// Amount of basic skills selectable (if fewer advanced or expert skills than expected they will also filled up with basic skills)
"skillSelectionAmount" : 1
},
"towns":

View File

@@ -38,20 +38,22 @@
"type" : "object",
"additionalProperties" : false,
"properties" : {
"perPlayerOnMapCap" : { "type" : "number" },
"perPlayerTotalCap" : { "type" : "number" },
"retreatOnWinWithoutTroops" : { "type" : "boolean" },
"startingStackChances" : { "type" : "array" },
"backpackSize" : { "type" : "number" },
"tavernInvite" : { "type" : "boolean" },
"minimalPrimarySkills" : { "type" : "array" },
"movementCostBase" : { "type" : "number" },
"movementPointsLand" : { "type" : "array" },
"movementPointsSea" : { "type" : "array" },
"skillPerHero" : { "type" : "number" },
"specialtyCreatureGrowth" : { "type" : "number" },
"perPlayerOnMapCap" : { "type" : "number" },
"perPlayerTotalCap" : { "type" : "number" },
"retreatOnWinWithoutTroops" : { "type" : "boolean" },
"startingStackChances" : { "type" : "array" },
"backpackSize" : { "type" : "number" },
"tavernInvite" : { "type" : "boolean" },
"minimalPrimarySkills" : { "type" : "array" },
"movementCostBase" : { "type" : "number" },
"movementPointsLand" : { "type" : "array" },
"movementPointsSea" : { "type" : "array" },
"skillPerHero" : { "type" : "number" },
"specialtyCreatureGrowth" : { "type" : "number" },
"specialtySecondarySkillGrowth" : { "type" : "number" },
"baseScoutingRange" : { "type" : "number" }
"baseScoutingRange" : { "type" : "number" },
"skillSelectionAmountUpgr" : { "type" : "number" },
"skillSelectionAmount" : { "type" : "number" }
}
},
"towns" : {

View File

@@ -86,6 +86,8 @@ const std::vector<GameSettings::SettingOption> GameSettings::settingProperties =
{EGameSettings::HEROES_SKILL_PER_HERO, "heroes", "skillPerHero" },
{EGameSettings::HEROES_SPECIALTY_CREATURE_GROWTH, "heroes", "specialtyCreatureGrowth" },
{EGameSettings::HEROES_SPECIALTY_SECONDARY_SKILL_GROWTH, "heroes", "specialtySecondarySkillGrowth" },
{EGameSettings::HEROES_SKILL_SELECTION_AMOUNT_UPGR, "heroes", "skillSelectionAmountUpgr" },
{EGameSettings::HEROES_SKILL_SELECTION_AMOUNT, "heroes", "skillSelectionAmount" },
{EGameSettings::MAP_FORMAT_ARMAGEDDONS_BLADE, "mapFormat", "armageddonsBlade" },
{EGameSettings::MAP_FORMAT_CHRONICLES, "mapFormat", "chronicles" },
{EGameSettings::MAP_FORMAT_HORN_OF_THE_ABYSS, "mapFormat", "hornOfTheAbyss" },

View File

@@ -59,6 +59,8 @@ enum class EGameSettings
HEROES_SKILL_PER_HERO,
HEROES_SPECIALTY_CREATURE_GROWTH,
HEROES_SPECIALTY_SECONDARY_SKILL_GROWTH,
HEROES_SKILL_SELECTION_AMOUNT_UPGR,
HEROES_SKILL_SELECTION_AMOUNT,
INTERFACE_PLAYER_COLORED_BACKGROUND,
MAP_FORMAT_ARMAGEDDONS_BLADE,
MAP_FORMAT_CHRONICLES,

View File

@@ -1412,29 +1412,28 @@ std::vector<SecondarySkill> CGHeroInstance::getLevelupSkillCandidates(IGameRando
basicAndAdv.insert(elem.first);
none.erase(elem.first);
}
if (!basicAndAdv.empty())
for(;;)
{
skills.push_back(gameRandomizer.rollSecondarySkillForLevelup(this, basicAndAdv));
basicAndAdv.erase(skills.back());
if(skills.size() >= cb->getSettings().getInteger(EGameSettings::HEROES_SKILL_SELECTION_AMOUNT_UPGR) || basicAndAdv.empty())
break;
if (!basicAndAdv.empty())
{
skills.push_back(gameRandomizer.rollSecondarySkillForLevelup(this, basicAndAdv));
basicAndAdv.erase(skills.back());
}
}
if (!none.empty())
for(;;)
{
skills.push_back(gameRandomizer.rollSecondarySkillForLevelup(this, none));
none.erase(skills.back());
}
if(skills.size() >= cb->getSettings().getInteger(EGameSettings::HEROES_SKILL_SELECTION_AMOUNT) + cb->getSettings().getInteger(EGameSettings::HEROES_SKILL_SELECTION_AMOUNT_UPGR) || none.empty())
break;
if (!basicAndAdv.empty() && skills.size() < 2)
{
skills.push_back(gameRandomizer.rollSecondarySkillForLevelup(this, basicAndAdv));
basicAndAdv.erase(skills.back());
}
if (!none.empty() && skills.size() < 2)
{
skills.push_back(gameRandomizer.rollSecondarySkillForLevelup(this, none));
none.erase(skills.back());
if (!none.empty())
{
skills.push_back(gameRandomizer.rollSecondarySkillForLevelup(this, none));
none.erase(skills.back());
}
}
return skills;