1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +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 /// Strength of generic secondary skill specialties ( "secondary" : "skillName" ) per level
"specialtySecondarySkillGrowth" : 5, "specialtySecondarySkillGrowth" : 5,
/// Strength of generic creature specialties ( "creature" : "creatureName" ) per level /// 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": "towns":

View File

@@ -51,7 +51,9 @@
"skillPerHero" : { "type" : "number" }, "skillPerHero" : { "type" : "number" },
"specialtyCreatureGrowth" : { "type" : "number" }, "specialtyCreatureGrowth" : { "type" : "number" },
"specialtySecondarySkillGrowth" : { "type" : "number" }, "specialtySecondarySkillGrowth" : { "type" : "number" },
"baseScoutingRange" : { "type" : "number" } "baseScoutingRange" : { "type" : "number" },
"skillSelectionAmountUpgr" : { "type" : "number" },
"skillSelectionAmount" : { "type" : "number" }
} }
}, },
"towns" : { "towns" : {

View File

@@ -86,6 +86,8 @@ const std::vector<GameSettings::SettingOption> GameSettings::settingProperties =
{EGameSettings::HEROES_SKILL_PER_HERO, "heroes", "skillPerHero" }, {EGameSettings::HEROES_SKILL_PER_HERO, "heroes", "skillPerHero" },
{EGameSettings::HEROES_SPECIALTY_CREATURE_GROWTH, "heroes", "specialtyCreatureGrowth" }, {EGameSettings::HEROES_SPECIALTY_CREATURE_GROWTH, "heroes", "specialtyCreatureGrowth" },
{EGameSettings::HEROES_SPECIALTY_SECONDARY_SKILL_GROWTH, "heroes", "specialtySecondarySkillGrowth" }, {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_ARMAGEDDONS_BLADE, "mapFormat", "armageddonsBlade" },
{EGameSettings::MAP_FORMAT_CHRONICLES, "mapFormat", "chronicles" }, {EGameSettings::MAP_FORMAT_CHRONICLES, "mapFormat", "chronicles" },
{EGameSettings::MAP_FORMAT_HORN_OF_THE_ABYSS, "mapFormat", "hornOfTheAbyss" }, {EGameSettings::MAP_FORMAT_HORN_OF_THE_ABYSS, "mapFormat", "hornOfTheAbyss" },

View File

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

View File

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