Browse Source

Fix docs, update spell immunity usage of addinfo, fix sonar

Ivan Savenko 4 months ago
parent
commit
2b43d415a9

+ 1 - 0
docs/modders/Bonus/Bonus_Types.md

@@ -964,6 +964,7 @@ Affected unit is permanently enchanted with a spell, that is cast again every tu
 Affected unit is immune to all spell with level below or equal to value of this bonus
 
 - val: level of spell up to which this unit is immune to
+- addInfo: if set to 1, this will be "absolute immunity" that can not be negated by Orb of Vulnerability
 
 ### MAGIC_RESISTANCE
 

+ 2 - 2
docs/modders/Bonus/Bonus_Updaters.md

@@ -25,8 +25,8 @@ Example: The following updater will cause a bonus to grow by 3 for every 20 leve
 ```json
 "updater" : {
     "type" : "GROWS_WITH_LEVEL",
-    "valPer20" : 6,
-    "stepSize" : 2
+    "valPer20" : 3,
+    "stepSize" : 1
 }
 ```
 

+ 1 - 1
docs/modders/Entities_Format/Bonus_Types_Format.md

@@ -1,4 +1,4 @@
-# Battlefield Format
+# Bonus Types Format
 
 WARNING: currently custom bonus types can only be used for custom "traits", for example to use them in limiters. At the moment it is not possible to provide custom mechanics for such bonus, or have custom bonuses with subtypes or addInfo parameters
 

+ 1 - 0
lib/json/JsonBonus.cpp

@@ -220,6 +220,7 @@ static void loadBonusAddInfo(CAddInfo & var, BonusType type, const JsonNode & va
 		case BonusType::PRIMARY_SKILL:
 		case BonusType::ENCHANTER:
 		case BonusType::SPECIAL_PECULIAR_ENCHANT:
+		case BonusType::SPELL_IMMUNITY:
 		case BonusType::DARKNESS:
 		case BonusType::FULL_MAP_SCOUTING:
 		case BonusType::FULL_MAP_DARKNESS:

+ 1 - 1
lib/modding/IdentifierStorage.cpp

@@ -89,7 +89,7 @@ void CIdentifierStorage::checkIdentifier(const std::string & ID)
 		logMod->error("BIG WARNING: identifier %s seems to be broken!", ID);
 }
 
-void CIdentifierStorage::requestIdentifier(ObjectCallback callback) const
+void CIdentifierStorage::requestIdentifier(const ObjectCallback & callback) const
 {
 	checkIdentifier(callback.type);
 	checkIdentifier(callback.name);

+ 1 - 1
lib/modding/IdentifierStorage.h

@@ -69,7 +69,7 @@ class DLL_LINKAGE CIdentifierStorage
 	/// Check if identifier can be valid (camelCase, point as separator)
 	static void checkIdentifier(const std::string & ID);
 
-	void requestIdentifier(ObjectCallback callback) const;
+	void requestIdentifier(const ObjectCallback & callback) const;
 	bool resolveIdentifier(const ObjectCallback & callback) const;
 	std::vector<ObjectData> getPossibleIdentifiers(const ObjectCallback & callback) const;
 

+ 1 - 1
lib/spells/TargetCondition.cpp

@@ -357,7 +357,7 @@ public:
 		{
 			std::optional bonusID(LIBRARY->identifiers()->getIdentifier(scope, "bonus", identifier, true));
 			if (bonusID)
-				return std::make_shared<SelectorCondition>(Selector::type()(BonusType(*bonusID)));
+				return std::make_shared<SelectorCondition>(Selector::type()(static_cast<BonusType>(*bonusID)));
 			else
 				logMod->error("Invalid bonus %s type in spell target condition.", identifier);
 		}