1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

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

This commit is contained in:
Ivan Savenko
2025-06-15 14:25:18 +03:00
parent f5c037137b
commit 2b43d415a9
7 changed files with 8 additions and 6 deletions

View File

@@ -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

View File

@@ -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
}
```

View File

@@ -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

View File

@@ -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:

View File

@@ -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);

View File

@@ -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;

View File

@@ -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);
}