瀏覽代碼

vcmi: translate wisdom

Make wisdom as separate bonus. It will be enough for now. But
next is should be done as IsLearnable for each spell.
Konstantin 2 年之前
父節點
當前提交
20a9332a3f
共有 5 個文件被更改,包括 10 次插入8 次删除
  1. 5 0
      config/defaultMods.json
  2. 1 2
      config/skills.json
  3. 1 0
      lib/HeroBonus.h
  4. 1 1
      lib/mapObjects/CGHeroInstance.cpp
  5. 2 5
      server/CGameHandler.cpp

+ 5 - 0
config/defaultMods.json

@@ -50,6 +50,11 @@
 			"type" : "SPELL_DAMAGE", //Default spell damage
 			"val" : 100,
 			"valueType" : "BASE_NUMBER"
+		},
+		{
+			"type" : "MAX_LEARNABLE_SPELL_LEVEL", //Hero can always learn level 1 and 2 spells
+			"val" : 2,
+			"valueType" : "BASE_NUMBER"
 		}
 	],
 	"heroBaseBonuses":

+ 1 - 2
config/skills.json

@@ -198,8 +198,7 @@
 		"base" : {
 			"effects" : {
 				"main" : {
-					"subtype" : "skill.wisdom",
-					"type" : "SECONDARY_SKILL_PREMY",
+					"type" : "MAX_LEARNABLE_SPELL_LEVEL",
 					"valueType" : "BASE_NUMBER"
 				}
 			}

+ 1 - 0
lib/HeroBonus.h

@@ -346,6 +346,7 @@ public:
 	BONUS_NAME(HERO_GRANTS_ATTACKS) /*If hero can grant additional attacks to creature, value is number of attacks, subtype is creatureID*/\
 	BONUS_NAME(BONUS_DAMAGE_PERCENTAGE) /*If hero can grant conditional damage to creature, value is percentage, subtype is creatureID*/\
 	BONUS_NAME(BONUS_DAMAGE_CHANCE) /*If hero can grant additional damage to creature, value is chance, subtype is creatureID*/\
+	BONUS_NAME(MAX_LEARNABLE_SPELL_LEVEL) /*This can work as wisdom before. val = max learnable spell level*/\
 	/* end of list */
 
 

+ 1 - 1
lib/mapObjects/CGHeroInstance.cpp

@@ -1078,7 +1078,7 @@ const std::set<SpellID> & CGHeroInstance::getSpellsInSpellbook() const
 
 int CGHeroInstance::maxSpellLevel() const
 {
-	return std::min(GameConstants::SPELL_LEVELS, 2 + valOfBonuses(Selector::typeSubtype(Bonus::SECONDARY_SKILL_PREMY, SecondarySkill::WISDOM)));
+	return std::min(GameConstants::SPELL_LEVELS, valOfBonuses(Selector::type()(Bonus::MAX_LEARNABLE_SPELL_LEVEL)));
 }
 
 void CGHeroInstance::deserializationFix()

+ 2 - 5
server/CGameHandler.cpp

@@ -682,11 +682,8 @@ void CGameHandler::changeSecSkill(const CGHeroInstance * hero, SecondarySkill wh
 	sss.abs = abs;
 	sendAndApply(&sss);
 
-	if (which == SecondarySkill::WISDOM)
-	{
-		if (hero->visitedTown)
-			giveSpells(hero->visitedTown, hero);
-	}
+	if (hero->visitedTown)
+		giveSpells(hero->visitedTown, hero);
 }
 
 void CGameHandler::endBattle(int3 tile, const CGHeroInstance * heroAttacker, const CGHeroInstance * heroDefender)