1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-08 23:36:33 +02:00

Fix validation of addInfo of bonuses

- Added missing docs on addInfo of some bonuses
- Unified naming in docs to match json keys
- Removed addInfo from bonuses that don't actually support it
- Added loading of addInfo to bonuses that support it
This commit is contained in:
Ivan Savenko 2025-05-22 19:00:18 +03:00
parent 1e272c603f
commit 6fe3666abb
5 changed files with 20 additions and 25 deletions

View File

@ -1357,8 +1357,7 @@
"subtype" : "dispel", "subtype" : "dispel",
"type" : "SPELL_IMMUNITY", "type" : "SPELL_IMMUNITY",
"val" : 0, "val" : 0,
"valueType" : "BASE_NUMBER", "valueType" : "BASE_NUMBER"
"addInfo" : 1
} }
], ],
"index" : 92, "index" : 92,
@ -1889,8 +1888,7 @@
"subtype" : "spell.armageddon", "subtype" : "spell.armageddon",
"type" : "SPELL_IMMUNITY", "type" : "SPELL_IMMUNITY",
"val" : 0, "val" : 0,
"valueType" : "BASE_NUMBER", "valueType" : "BASE_NUMBER"
"addInfo" : 1
}, },
{ {
"subtype" : "primarySkill.attack", "subtype" : "primarySkill.attack",

View File

@ -9,14 +9,12 @@
"blindImmunity" : "blindImmunity" :
{ {
"type" : "SPELL_IMMUNITY", "type" : "SPELL_IMMUNITY",
"subtype" : "spell.blind", "subtype" : "spell.blind"
"addInfo" : 1
}, },
"petrifyImmunity" : "petrifyImmunity" :
{ {
"type" : "SPELL_IMMUNITY", "type" : "SPELL_IMMUNITY",
"subtype" : "spell.stoneGaze", "subtype" : "spell.stoneGaze"
"addInfo" : 1
} }
}, },
"upgrades": ["infernalTroglodyte"], "upgrades": ["infernalTroglodyte"],
@ -44,14 +42,12 @@
"blindImmunity" : "blindImmunity" :
{ {
"type" : "SPELL_IMMUNITY", "type" : "SPELL_IMMUNITY",
"subtype" : "spell.blind", "subtype" : "spell.blind"
"addInfo" : 1
}, },
"petrifyImmunity" : "petrifyImmunity" :
{ {
"type" : "SPELL_IMMUNITY", "type" : "SPELL_IMMUNITY",
"subtype" : "spell.stoneGaze", "subtype" : "spell.stoneGaze"
"addInfo" : 1
} }
}, },
"graphics" : "graphics" :

View File

@ -278,7 +278,6 @@
"type":"core:timed", "type":"core:timed",
"bonus":{ "bonus":{
"levelSpellImmunity":{ "levelSpellImmunity":{
"addInfo" : 1, //absolute
"val" : 3, "val" : 3,
"type" : "LEVEL_SPELL_IMMUNITY", "type" : "LEVEL_SPELL_IMMUNITY",
"valueType" : "INDEPENDENT_MAX", "valueType" : "INDEPENDENT_MAX",
@ -417,7 +416,6 @@
"targetModifier":{"smart":true}, "targetModifier":{"smart":true},
"effects" : { "effects" : {
"alwaysMinimumDamage" : { "alwaysMinimumDamage" : {
"addInfo" : 0,
"val" : 0, "val" : 0,
"type" : "ALWAYS_MINIMUM_DAMAGE", "type" : "ALWAYS_MINIMUM_DAMAGE",
"valueType" : "INDEPENDENT_MAX", "valueType" : "INDEPENDENT_MAX",
@ -719,7 +717,6 @@
"duration" : "N_TURNS" "duration" : "N_TURNS"
}, },
"stacksSpeed" : { "stacksSpeed" : {
"addInfo" : 0,
"type" : "STACKS_SPEED", "type" : "STACKS_SPEED",
"val" : 2, "val" : 2,
"duration" : "N_TURNS" "duration" : "N_TURNS"
@ -972,7 +969,6 @@
"targetModifier":{"smart":true}, "targetModifier":{"smart":true},
"effects" : { "effects" : {
"stacksSpeed" : { "stacksSpeed" : {
"addInfo" : 0,
"type" : "STACKS_SPEED", "type" : "STACKS_SPEED",
"val" : 3, "val" : 3,
"duration" : "N_TURNS" "duration" : "N_TURNS"
@ -1023,7 +1019,6 @@
"targetModifier":{"smart":true}, "targetModifier":{"smart":true},
"effects" : { "effects" : {
"stacksSpeed" : { "stacksSpeed" : {
"addInfo" : 0,
"type" : "STACKS_SPEED", "type" : "STACKS_SPEED",
"val" : -25, "val" : -25,
"valueType" : "PERCENT_TO_ALL", "valueType" : "PERCENT_TO_ALL",

View File

@ -257,6 +257,7 @@ Gives additional bonus to effect of specific spell
Gives creature under effect of this spell additional bonus, which is hardcoded and depends on the creature tier. Gives creature under effect of this spell additional bonus, which is hardcoded and depends on the creature tier.
- subtype: affected spell identifier, ie. `spell.haste` - subtype: affected spell identifier, ie. `spell.haste`
- addInfo: must be set to 0, or 1 for Slayer specialty
### SPECIAL_ADD_VALUE_ENCHANT ### SPECIAL_ADD_VALUE_ENCHANT
@ -334,7 +335,7 @@ Affected heroes will add specified resources amounts to player treasure on new d
Increases weekly growth of creatures in affected towns (Legion artifacts) Increases weekly growth of creatures in affected towns (Legion artifacts)
- value: number of additional weekly creatures - val: number of additional weekly creatures
- subtype: dwelling level, in form `creatureLevelX` where X is desired level (1-7) - subtype: dwelling level, in form `creatureLevelX` where X is desired level (1-7)
### CREATURE_GROWTH_PERCENT ### CREATURE_GROWTH_PERCENT
@ -478,7 +479,7 @@ Affected unit will always retaliate if able (Royal Griffin)
Affected unit can retaliate multiple times per turn (basic Griffin) Affected unit can retaliate multiple times per turn (basic Griffin)
- value: number of additional retaliations - val: number of additional retaliations
### JOUSTING ### JOUSTING
@ -497,8 +498,8 @@ Affected unit will deal more damage when attacking specific creature
Affected unit ranged attack will use animation and range of specified spell (Magog, Lich) Affected unit ranged attack will use animation and range of specified spell (Magog, Lich)
- subtype - spell identifier - subtype: spell identifier
- value - spell mastery level - val: spell mastery level
### ATTACKS_ALL_ADJACENT ### ATTACKS_ALL_ADJACENT
@ -831,7 +832,7 @@ Affected unit will not use spellcast as default attack option
Affected units can cast a spell as targeted action (Archangel, Faerie Dragon). Use CASTS bonus to specify how many times per combat creature can use spellcasting. Use SPECIFIC_SPELL_POWER, CREATURE_SPELL_POWER or CREATURE_ENCHANT_POWER bonuses to set spell power. Affected units can cast a spell as targeted action (Archangel, Faerie Dragon). Use CASTS bonus to specify how many times per combat creature can use spellcasting. Use SPECIFIC_SPELL_POWER, CREATURE_SPELL_POWER or CREATURE_ENCHANT_POWER bonuses to set spell power.
- subtype: spell identifier - subtype: spell identifier
- value: spell mastery level - val: spell mastery level
- addInfo: weighted chance to select this spell. Can be omitted for always available spells - addInfo: weighted chance to select this spell. Can be omitted for always available spells
### ENCHANTER ### ENCHANTER
@ -840,7 +841,7 @@ Affected unit will cast specified spell before his turn (Enchanter)
- val - spell mastery level - val - spell mastery level
- subtype - spell identifier - subtype - spell identifier
- additionalInfo - cooldown before next cast, in number of turns - addInfo - cooldown before next cast, in number of turns
### RANDOM_SPELLCASTER ### RANDOM_SPELLCASTER
@ -857,7 +858,7 @@ Determines how many times per combat affected creature can cast its targeted spe
### SPELL_AFTER_ATTACK ### SPELL_AFTER_ATTACK
- subtype - spell id, eg. spell.iceBolt - subtype - spell id, eg. spell.iceBolt
- value - chance (percent) - val - chance (percent)
- addInfo - \[X, Y, Z\] - addInfo - \[X, Y, Z\]
- X - spell mastery level (1 - Basic, 3 - Expert) - X - spell mastery level (1 - Basic, 3 - Expert)
- Y = 0 - all attacks, 1 - shot only, 2 - melee only - Y = 0 - all attacks, 1 - shot only, 2 - melee only
@ -867,7 +868,7 @@ Determines how many times per combat affected creature can cast its targeted spe
### SPELL_BEFORE_ATTACK ### SPELL_BEFORE_ATTACK
- subtype - spell id - subtype - spell id
- value - chance % - val - chance %
- addInfo - \[X, Y, Z\] - addInfo - \[X, Y, Z\]
- X - spell mastery level (1 - Basic, 3 - Expert) - X - spell mastery level (1 - Basic, 3 - Expert)
- Y = 0 - all attacks, 1 - shot only, 2 - melee only - Y = 0 - all attacks, 1 - shot only, 2 - melee only
@ -1057,6 +1058,8 @@ Blocks casting spells of the level below specified one in battles affected by th
Dummy bonus that acts as marker for Dendroid's Bind ability Dummy bonus that acts as marker for Dendroid's Bind ability
- addInfo: ID of stack that have bound the unit
### SYNERGY_TARGET ### SYNERGY_TARGET
Dummy skill for alternative upgrades mod Dummy skill for alternative upgrades mod

View File

@ -214,9 +214,12 @@ static void loadBonusAddInfo(CAddInfo & var, BonusType type, const JsonNode & no
case BonusType::DESTRUCTION: case BonusType::DESTRUCTION:
case BonusType::LIMITED_SHOOTING_RANGE: case BonusType::LIMITED_SHOOTING_RANGE:
case BonusType::ACID_BREATH: case BonusType::ACID_BREATH:
case BonusType::BIND_EFFECT:
case BonusType::SPELLCASTER: case BonusType::SPELLCASTER:
case BonusType::FEROCITY: case BonusType::FEROCITY:
case BonusType::PRIMARY_SKILL: case BonusType::PRIMARY_SKILL:
case BonusType::ENCHANTER:
case BonusType::SPECIAL_PECULIAR_ENCHANT:
// 1 number // 1 number
var = getFirstValue(value).Integer(); var = getFirstValue(value).Integer();
break; break;