Sfoglia il codice sorgente

allow more than 8 skills

Laserlicht 4 mesi fa
parent
commit
b0f5c4dd7b

+ 2 - 1
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<int>(hero->secSkills.size()) >= cb->getSettings().getInteger(EGameSettings::HEROES_SKILL_PER_HERO))
 		return 0;
 
 	auto score = ai->heroManager->evaluateSecSkill(skill, hero);

+ 3 - 2
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<InfoBox>(Point(78+(int)i*36, 26), InfoBox::POS_DOWN, InfoBox::SIZE_SMALL, data));
 	}
 
-	for(size_t i=0; i<GameConstants::SKILL_PER_HERO; i++)
+	for(size_t i=0; i<GAME->interface()->cb->getSettings().getInteger(EGameSettings::HEROES_SKILL_PER_HERO); i++)
 	{
 		auto data = std::make_shared<InfoBoxHeroData>(IInfoBoxData::HERO_SECONDARY_SKILL, hero, (int)i);
 		heroInfo.push_back(std::make_shared<InfoBox>(Point(410+(int)i*36, 5), InfoBox::POS_NONE, InfoBox::SIZE_SMALL, data));

+ 4 - 1
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":

+ 2 - 1
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" : {

+ 1 - 0
lib/GameSettings.cpp

@@ -86,6 +86,7 @@ const std::vector<GameSettings::SettingOption> 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"                       },

+ 1 - 0
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,

+ 0 - 1
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<uint8_t>::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;

+ 2 - 1
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