diff --git a/AI/Nullkiller/Engine/PriorityEvaluator.cpp b/AI/Nullkiller/Engine/PriorityEvaluator.cpp index 0aae6d558..6c189492d 100644 --- a/AI/Nullkiller/Engine/PriorityEvaluator.cpp +++ b/AI/Nullkiller/Engine/PriorityEvaluator.cpp @@ -20,6 +20,7 @@ #include "../../../lib/CCreatureHandler.h" #include "../../../lib/GameLibrary.h" #include "../../../lib/StartInfo.h" +#include "../../../lib/GameSettings.h" #include "../../../lib/filesystem/Filesystem.h" #include "../Goals/ExecuteHeroChain.h" #include "../Goals/BuildThis.h" @@ -581,7 +582,7 @@ float RewardEvaluator::evaluateWitchHutSkillScore(const CGObjectInstance * hut, return role == HeroRole::SCOUT ? 2 : 0; if(hero->getSecSkillLevel(skill) != MasteryLevel::NONE - || hero->secSkills.size() >= GameConstants::SKILL_PER_HERO) + || static_cast(hero->secSkills.size()) >= cb->getSettings().getInteger(EGameSettings::HEROES_SKILL_PER_HERO)) return 0; auto score = ai->heroManager->evaluateSecSkill(skill, hero); diff --git a/client/windows/CKingdomInterface.cpp b/client/windows/CKingdomInterface.cpp index 11ce4c5dd..5e3cee763 100644 --- a/client/windows/CKingdomInterface.cpp +++ b/client/windows/CKingdomInterface.cpp @@ -40,7 +40,8 @@ #include "../../lib/mapObjects/CGHeroInstance.h" #include "../../lib/mapObjects/CGTownInstance.h" #include "../../lib/mapObjects/MiscObjects.h" -#include "../../lib/texts/CGeneralTextHandler.h" +#include "texts/CGeneralTextHandler.h" +#include "../../lib/GameSettings.h" static const std::string OVERVIEW_BACKGROUND = "OvCast.pcx"; static const size_t OVERVIEW_SIZE = 4; @@ -978,7 +979,7 @@ CHeroItem::CHeroItem(const CGHeroInstance * Hero) heroInfo.push_back(std::make_shared(Point(78+(int)i*36, 26), InfoBox::POS_DOWN, InfoBox::SIZE_SMALL, data)); } - for(size_t i=0; iinterface()->cb->getSettings().getInteger(EGameSettings::HEROES_SKILL_PER_HERO); i++) { auto data = std::make_shared(IInfoBoxData::HERO_SECONDARY_SKILL, hero, (int)i); heroInfo.push_back(std::make_shared(Point(410+(int)i*36, 5), InfoBox::POS_NONE, InfoBox::SIZE_SMALL, data)); diff --git a/config/gameConfig.json b/config/gameConfig.json index f746a35c7..5ab82b8fe 100644 --- a/config/gameConfig.json +++ b/config/gameConfig.json @@ -313,7 +313,10 @@ /// movement points hero can get on start of the turn when on land, depending on speed of slowest creature (0-based list) "movementPointsLand" : [ 1500, 1500, 1500, 1500, 1560, 1630, 1700, 1760, 1830, 1900, 1960, 2000 ], /// movement points hero can get on start of the turn when on sea, depending on speed of slowest creature (0-based list) - "movementPointsSea" : [ 1500 ] + "movementPointsSea" : [ 1500 ], + + /// maximal secondary skills per hero + "skillPerHero" : 8 }, "towns": diff --git a/config/schemas/gameSettings.json b/config/schemas/gameSettings.json index 43f080959..8b65ac9f5 100644 --- a/config/schemas/gameSettings.json +++ b/config/schemas/gameSettings.json @@ -47,7 +47,8 @@ "minimalPrimarySkills" : { "type" : "array" }, "movementCostBase" : { "type" : "number" }, "movementPointsLand" : { "type" : "array" }, - "movementPointsSea" : { "type" : "array" } + "movementPointsSea" : { "type" : "array" }, + "skillPerHero" : { "type" : "number" } } }, "towns" : { diff --git a/lib/GameSettings.cpp b/lib/GameSettings.cpp index 50ef04d59..90e907f7c 100644 --- a/lib/GameSettings.cpp +++ b/lib/GameSettings.cpp @@ -86,6 +86,7 @@ const std::vector GameSettings::settingProperties = {EGameSettings::HEROES_MOVEMENT_COST_BASE, "heroes", "movementCostBase" }, {EGameSettings::HEROES_MOVEMENT_POINTS_LAND, "heroes", "movementPointsLand" }, {EGameSettings::HEROES_MOVEMENT_POINTS_SEA, "heroes", "movementPointsSea" }, + {EGameSettings::HEROES_SKILL_PER_HERO, "heroes", "skillPerHero" }, {EGameSettings::MAP_FORMAT_ARMAGEDDONS_BLADE, "mapFormat", "armageddonsBlade" }, {EGameSettings::MAP_FORMAT_CHRONICLES, "mapFormat", "chronicles" }, {EGameSettings::MAP_FORMAT_HORN_OF_THE_ABYSS, "mapFormat", "hornOfTheAbyss" }, diff --git a/lib/IGameSettings.h b/lib/IGameSettings.h index 5b25069a7..37027a7db 100644 --- a/lib/IGameSettings.h +++ b/lib/IGameSettings.h @@ -59,6 +59,7 @@ enum class EGameSettings HEROES_MOVEMENT_COST_BASE, HEROES_MOVEMENT_POINTS_LAND, HEROES_MOVEMENT_POINTS_SEA, + HEROES_SKILL_PER_HERO, MAP_FORMAT_ARMAGEDDONS_BLADE, MAP_FORMAT_CHRONICLES, MAP_FORMAT_HORN_OF_THE_ABYSS, diff --git a/lib/constants/NumericConstants.h b/lib/constants/NumericConstants.h index afd470b1a..9ca09409d 100644 --- a/lib/constants/NumericConstants.h +++ b/lib/constants/NumericConstants.h @@ -34,7 +34,6 @@ namespace GameConstants constexpr int BATTLE_SHOOTING_PENALTY_DISTANCE = 10; //if the distance is > than this, then shooting stack has distance penalty constexpr int BATTLE_SHOOTING_RANGE_DISTANCE = std::numeric_limits::max(); // used when shooting stack has no shooting range limit constexpr int ARMY_SIZE = 7; - constexpr int SKILL_PER_HERO = 8; constexpr ui32 HERO_HIGH_LEVEL = 10; // affects primary skill upgrade order constexpr int SKILL_QUANTITY=28; diff --git a/lib/mapObjects/CGHeroInstance.cpp b/lib/mapObjects/CGHeroInstance.cpp index cf2a3c483..bac24e5e0 100644 --- a/lib/mapObjects/CGHeroInstance.cpp +++ b/lib/mapObjects/CGHeroInstance.cpp @@ -30,6 +30,7 @@ #include "../CCreatureHandler.h" #include "../mapping/CMap.h" #include "../StartInfo.h" +#include "../GameSettings.h" #include "CGTownInstance.h" #include "../entities/artifact/ArtifactUtils.h" #include "../entities/artifact/CArtifact.h" @@ -175,7 +176,7 @@ int3 CGHeroInstance::convertFromVisitablePos(const int3 & position) const bool CGHeroInstance::canLearnSkill() const { - return secSkills.size() < GameConstants::SKILL_PER_HERO; + return secSkills.size() < cb->getSettings().getInteger(EGameSettings::HEROES_SKILL_PER_HERO); } bool CGHeroInstance::canLearnSkill(const SecondarySkill & which) const