1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-13 19:54:17 +02:00

Update spell docs

This commit is contained in:
Ivan Savenko
2023-09-23 19:21:12 +03:00
parent ddda6c0c01
commit 403acc0cf1
3 changed files with 159 additions and 142 deletions

View File

@@ -135,7 +135,7 @@
}, },
"name" : { "name" : {
"type" : "string", "type" : "string",
"description" : "Localizable name" "description" : "Localizable name of this spell"
}, },
"type" : { "type" : {
"type" : "string", "type" : "string",
@@ -144,7 +144,7 @@
}, },
"school" : { "school" : {
"type" : "object", "type" : "object",
"description" : "Spell schools", "description" : "List of spell schools this spell belongs to",
"additionalProperties" : false, "additionalProperties" : false,
"properties" : { "properties" : {
"air" : {"type" : "boolean"}, "air" : {"type" : "boolean"},
@@ -161,7 +161,7 @@
}, },
"power" : { "power" : {
"type" : "number", "type" : "number",
"description" : "Base power" "description" : "Base power of the spell"
}, },
"defaultGainChance" : { "defaultGainChance" : {
"type" : "number", "type" : "number",
@@ -170,7 +170,7 @@
}, },
"gainChance" : { "gainChance" : {
"type" : "object", "type" : "object",
"description" : "Chance in % to gain for faction. NOTE: this field is merged with faction config", "description" : "Chance for this spell to appear in Mage Guild of a specific faction",
"additionalProperties" : { "additionalProperties" : {
"type" : "number", "type" : "number",
"minimum" : 0 "minimum" : 0
@@ -223,6 +223,7 @@
"description" : "Non-magical ability. Usually used by some creatures. Should not be affected by sorcery and generic magic resistance. School resistances apply. Examples: dendroid bind, efreet fire shield." "description" : "Non-magical ability. Usually used by some creatures. Should not be affected by sorcery and generic magic resistance. School resistances apply. Examples: dendroid bind, efreet fire shield."
} }
} }
}
}, },
"immunity" : { "immunity" : {
"$ref" : "#/definitions/flags", "$ref" : "#/definitions/flags",
@@ -312,7 +313,7 @@
}, },
"onlyOnWaterMap" : { "onlyOnWaterMap" : {
"type" : "boolean", "type" : "boolean",
"description" : "It true, spell won't be available on a map without water" "description" : "If true, spell won't be available on a map without water"
} }
}, },
} }

View File

@@ -5,63 +5,79 @@
``` javascript ``` javascript
{ {
"spellName": "spellName":
{ //numeric id of spell required only for original spells, prohibited for new spells {
"index": 0, // Mandatory. Spell type
//Original Heroes 3 info // Allowed values: "adventure", "combat", "ability"
//Mandatory, spell type "type": "adventure",
"type": "adventure",//"adventure", "combat", "ability"
//Mandatory, spell target type // Mandatory. Spell target type
"targetType":"NO_TARGET",//"CREATURE","OBSTACLE"."LOCATION" // "NO_TARGET" - instant cast no aiming (e.g. Armageddon)
// "CREATURE" - target is unit (e.g. Resurrection)
// "OBSTACLE" - target is obstacle (e.g. Remove Obstacle)
// "LOCATION" - target is location (e.g. Fire Wall)
"targetType":"NO_TARGET",
//Mandatory // Localizable name of this spell
"name": "Localizable name", "name": "Localizable name",
//Mandatory, flags structure of school names, Spell schools this spell belongs to
// Mandatory. List of spell schools this spell belongs to
"school": {"air":true, "earth":true, "fire":true, "water":true}, "school": {"air":true, "earth":true, "fire":true, "water":true},
//number, mandatory, Spell level, value in range 1-5
// Mandatory. Spell level, value in range 1-5, or 0 for abilities
"level": 1, "level": 1,
//Mandatory, base power
// Mandatory. Base power of the spell
"power": 10, "power": 10,
//Mandatory, default chance for this spell to appear in Mage Guilds
// Mandatory. Default chance for this spell to appear in Mage Guilds
// Used only if chance for a faction is not set in gainChance field // Used only if chance for a faction is not set in gainChance field
"defaultGainChance": 0, "defaultGainChance": 0,
//Optional, chance for it to appear in Mage Guild of a specific faction
//NOTE: this field is linker with faction configuration // Chance for this spell to appear in Mage Guild of a specific faction
// Symmetric property of "guildSpells" property in towns
"gainChance": "gainChance":
{ {
"factionName" : 3 "factionName" : 3
}, },
//VCMI info
"animation":{<Animation format>}, "animation":{<Animation format>},
//countering spells, flags structure of spell ids (spell. prefix is required) // List of spells that will be countered by this spell
"counters": {"spell.spellID1":true, ...} "counters": {
"spellID" : true,
...
},
//Mandatory,flags structure: //Mandatory. List of flags that describe this spell
// indifferent, negative, positive - Positiveness of spell for target (required) // positive - this spell is positive to target (buff)
// negative - this spell is negative to target (debuff)
// indifferent - spell is neither positive, nor negative
// damage - spell does damage (direct or indirect) // damage - spell does damage (direct or indirect)
// offensive - direct damage (implicitly sets damage and negative) // offensive - direct damage (implicitly sets damage and negative)
// rising - rising spell (implicitly sets positive) // rising - rising spell (implicitly sets positive)
// summoning //todo: // special - this spell is normally unavailable and can only be received explicitly, e.g. from bonus SPELL
// special - can be obtained only with bonus::SPELL // nonMagical - this spell is not affected by Sorcery or magic resistance. School resistances apply.
"flags" : {
"positive": true,
},
"flags" : {"flag1": true, "flag2": true}, // If true, spell won't be available on a map without water
"onlyOnWaterMap" : true,
//DEPRECATED | optional| no default | flags structure of bonus names,any one of these bonus grants immunity. Negatable by the Orb. //TODO: DEPRECATED | optional| no default | flags structure of bonus names,any one of these bonus grants immunity. Negatable by the Orb.
"immunity": {"BONUS_NAME":true, ...}, "immunity": {"BONUS_NAME":true, ...},
//DEPRECATED | optional| no default | flags structure of bonus names //TODO: DEPRECATED | optional| no default | flags structure of bonus names
//any one of these bonus grants immunity, cant be negated //any one of these bonus grants immunity, cant be negated
"absoluteImmunity": {"BONUS_NAME": true, ...}, "absoluteImmunity": {"BONUS_NAME": true, ...},
//DEPRECATED | optional| no default | flags structure of bonus names, presence of all bonuses required to be affected by. Negatable by the Orb. //TODO: DEPRECATED | optional| no default | flags structure of bonus names, presence of all bonuses required to be affected by. Negatable by the Orb.
"limit": {"BONUS_NAME": true, ...}, "limit": {"BONUS_NAME": true, ...},
//DEPRECATED | optional| no default | flags structure of bonus names, presence of all bonuses required to be affected by. Cant be negated //TODO: DEPRECATED | optional| no default | flags structure of bonus names, presence of all bonuses required to be affected by. Cant be negated
"absoluteLimit": {"BONUS_NAME": true, ...}, "absoluteLimit": {"BONUS_NAME": true, ...},
//[WIP] optional | default no limit no immunity //TODO: optional | default no limit no immunity
// //
"targetCondition" { "targetCondition" {
//at least one required to be affected //at least one required to be affected
@@ -86,38 +102,28 @@
} }
} }
//graphics; mandatory; object;
"graphics": "graphics":
{ {
// ! will be moved to bonus type config in next bonus config version
// iconImmune - OPTIONAL; string;
// resource path of icon for SPELL_IMMUNITY bonus (relative to DATA or SPRITES) // resource path of icon for SPELL_IMMUNITY bonus (relative to DATA or SPRITES)
"iconImmune":"ZVS/LIB1.RES/E_SPMET", "iconImmune":"ZVS/LIB1.RES/E_SPMET",
// iconScenarioBonus- mandatory, string, image resource path
// resource path of icon for scenario bonus // resource path of icon for scenario bonus
"iconScenarioBonus": "MYSPELL_B", "iconScenarioBonus": "MYSPELL_B",
// iconEffect- mandatory, string, image resource path
// resource path of icon for spell effects during battle // resource path of icon for spell effects during battle
"iconEffect": "MYSPELL_E", "iconEffect": "MYSPELL_E",
// iconBook- mandatory, string, image resource path
// resource path of icon for spellbook // resource path of icon for spellbook
"iconBook": "MYSPELL_E", "iconBook": "MYSPELL_E",
// iconScroll- mandatory, string, image resource path
// resource path of icon for spell scrolls // resource path of icon for spell scrolls
"iconScroll": "MYSPELL_E" "iconScroll": "MYSPELL_E"
}, },
//OPTIONAL; object; TODO
"sounds": "sounds":
{ {
//OPTIONAL; resourse path, casting sound //Resourse path of cast sound
"cast":"LIGHTBLT" "cast":"LIGHTBLT"
}, },
@@ -138,8 +144,9 @@
# Animation format # Animation format
``` javascript TODO
``` javascript
{ {
"projectile": [ "projectile": [
{"minimumAngle": 0 ,"defName":"C20SPX4"}, {"minimumAngle": 0 ,"defName":"C20SPX4"},
@@ -148,6 +155,7 @@
{"minimumAngle": 1.20 ,"defName":"C20SPX1"}, {"minimumAngle": 1.20 ,"defName":"C20SPX1"},
{"minimumAngle": 1.50 ,"defName":"C20SPX0"} {"minimumAngle": 1.50 ,"defName":"C20SPX0"}
], ],
"cast" : []
"hit":["C20SPX"], "hit":["C20SPX"],
"affect":[{"defName":"C03SPA0", "verticalPosition":"bottom"}, "C11SPA1"] "affect":[{"defName":"C03SPA0", "verticalPosition":"bottom"}, "C11SPA1"]
} }
@@ -162,9 +170,7 @@ Json object with data common for all levels can be put here. These configuration
This will make spell affect single target on all levels except expert, where it is massive spell. This will make spell affect single target on all levels except expert, where it is massive spell.
``` javascript ``` javascript
"base":{ "base":{
"range": 0 "range": 0
}, },
"expert":{ "expert":{
@@ -174,16 +180,15 @@ This will make spell affect single target on all levels except expert, where it
# Spell level format # Spell level format
TODO
``` javascript ``` javascript
{ {
//Mandatory, localizable description //Mandatory, localizable description. Use {xxx} for formatting
//Use {xxx} for formatting
"description": "", "description": "",
//Mandatory, cost in mana points
//Mandatory, number,
//cost in mana points
"cost": 1, "cost": 1,
//Mandatory, number //Mandatory, number
@@ -194,14 +199,13 @@ This will make spell affect single target on all levels except expert, where it
//Mandatory, flags structure //TODO //Mandatory, flags structure //TODO
// modifiers make sense for creature target // modifiers make sense for creature target
//
//
"targetModifier": "targetModifier":
{ {
"smart": false, //true: friendly/hostile based on positiveness; false: all targets "smart": false, //true: friendly/hostile based on positiveness; false: all targets
"clearTarget": false, "clearTarget": false,
"clearAffected": false, "clearAffected": false,
} },
//Mandatory //Mandatory
//spell range description in SRSL //spell range description in SRSL
// range "X" + smart modifier = enchanter casting, expert massive spells // range "X" + smart modifier = enchanter casting, expert massive spells
@@ -246,6 +250,8 @@ Configurable spells ignore *offensive* flag, *effects* and *cumulativeEffects*.
## Special effect common format ## Special effect common format
TODO
``` javascript ``` javascript
"mod:effectId":{ "mod:effectId":{
@@ -265,6 +271,8 @@ Configurable spells ignore *offensive* flag, *effects* and *cumulativeEffects*.
## catapult ## catapult
TODO
``` javascript ``` javascript
"mod:effectId":{ "mod:effectId":{
@@ -282,6 +290,8 @@ Configurable spells ignore *offensive* flag, *effects* and *cumulativeEffects*.
## Clone ## Clone
TODO
Configurable version of Clone spell. Configurable version of Clone spell.
``` javascript ``` javascript
@@ -296,6 +306,8 @@ Configurable version of Clone spell.
## Damage effect ## Damage effect
TODO
If effect is automatic, spell behave like offensive spell (uses power, levelPower etc) If effect is automatic, spell behave like offensive spell (uses power, levelPower etc)
``` javascript ``` javascript
@@ -313,34 +325,36 @@ If effect is automatic, spell behave like offensive spell (uses power, levelPowe
## Dispel ## Dispel
documetation TODO
## Heal ## Heal
documetation TODO
## Obstacle ## Obstacle
documetation TODO
## Remove obstacle ## Remove obstacle
documetation TODO
## Sacrifice ## Sacrifice
documetation TODO
## Summon ## Summon
documetation TODO
## Teleport ## Teleport
documetation TODO
## Timed ## Timed
TODO
If effect is automatic, spell behave like \[de\]buff spell (effect and If effect is automatic, spell behave like \[de\]buff spell (effect and
cumulativeEffects ignored) cumulativeEffects ignored)
@@ -362,6 +376,8 @@ cumulativeEffects ignored)
## Targets, ranges, modifiers ## Targets, ranges, modifiers
TODO
- CREATURE target (only battle spells) - CREATURE target (only battle spells)
- range 0: smart assumed single creature target - range 0: smart assumed single creature target
- range "X" + smart modifier = enchanter casting, expert massive spells - range "X" + smart modifier = enchanter casting, expert massive spells

View File

@@ -734,7 +734,7 @@ CSpell * CSpellHandler::loadFromJson(const std::string & scope, const JsonNode &
{ {
if(counteredSpell.second.Bool()) if(counteredSpell.second.Bool())
{ {
VLC->identifiers()->requestIdentifier(counteredSpell.second.meta, counteredSpell.first, [=](si32 id) VLC->identifiers()->requestIdentifier(counteredSpell.second.meta, "spell", counteredSpell.first, [=](si32 id)
{ {
spell->counteredSpells.emplace_back(id); spell->counteredSpells.emplace_back(id);
}); });