Spell Format
Main format
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | |
Animation format
TODO
affect— animation shown on every affected target.affectSecondary— optional. Animation shown on secondary targets instead ofaffect. Used by spells that act on more than one unit with different roles, such as Sacrifice, where the primary (resurrected) target keepsaffectwhile the sacrificed unit usesaffectSecondary. If empty, secondary targets fall back toaffect.
Chaining ray
Some spells (such as Chain Lightning) hit several targets in a row. You can draw a
lightning-like ray that jumps from one target to the next by adding a ray block to
the animation. The ray is a bundle of colored lines with a slightly random, zig-zag
shape. The first target still shows the full affect animation; the ray only connects
the targets to each other.
jaggedness— how strongly the ray zig-zags between targets.0is a straight line, higher values (around0.2) give a lightning look.hopDelay— delay in milliseconds before the ray jumps to the next target. The ray appears instantly on each target, one after another, with this pause between jumps.width— thickness of the ray in pixels.colors— the ray's color, from its outer edge to its center. Each entry has astartandendcolor (the color at the beginning and at the end of the ray), given as[red, green, blue, transparency]with values from 0 to 255. List the outer-edge color first and the center color last; the colors in between are blended automatically and the ray is drawn symmetrically. Use a low transparency for the edges and a high one for the center to get a glowing core.
Spell level base format
Json object with data common for all levels can be put here. These configuration parameters will be default for all levels. All mandatory level fields become optional if they equal "base" configuration.
Example
This will make spell affect single target on all levels except expert, where it is massive spell.
Spell level format
TODO
Spell power
Most of battle effects are scaled based on spell effect value. This value is same across all effects and calculated as:
Where:
caster spell schoolis assumed spell school level for the spell. For unit this is value of SPELLCASTER bonus. For hero this is value of MAGIC_SCHOOL_SKILL or SPELL bonus, whichever is greaterspell mastery powerispowerparameter defined in config of corresponding mastery level of the spellbase spell powerispowerparameter, as defined in config of spell itselfcaster spell poweris spellpower of the hero, or CREATURE_SPELL_POWER bonus for units
If unit has SPECIFIC_SPELL_POWER bonus for corresponding spell, game will use value of the bonus instead
Power of damage, heal, summon, and demonSummon effects cast by hero can also be affected by following bonuses:
- SPECIAL_SPELL_LEV bonus for the spell, scaled down by target level (Solmyr / Deemer)
Following bonuses will only affect damage, heal and demonSummon effects
- SPELL_DAMAGE for specific spell school (Sorcery)
- SPECIFIC_SPELL_DAMAGE for the spell (Luna / Ciele)
Smart target modifier
To restrict spell from casting it on "wrong" side in combat, you can use smart target modifier. If this flag is set, and spell has positive flag, it can only affect friendly units. Similarly, spells with negative flag and smart target modifier can only affect enemies. This affects both primary targets and any secondary targets in case of area of effect or massive spells.
Configurable battle effects
Common format
Catapult
This spell can only be used when attacking a town with existing, non-destroyed walls. Can be also cast by defender, unless spell uses "smart" targeting
Casting the spell on location with wall will deal 0-2 damage to the walls or towers, depending on spell configuration.
Casting the spell with "massive" target will randomly pick selected number of target using logic similar to H3
Clone
Configurable version of Clone spell. Casting the spell will create clone of targeted unit that belongs to side of spell caster.
Damage
Deals specified damage to all affected targets based on spell effect value:
- if
killByPercentageis set, spell will deal damage equal to unit total health * spell effect power / 100 - if
killByCountis set, spell will deal damage equal to single creature health * spell effect power - if neither flag is set, spell will deal damage equal to spell effect power
If spell has chain effect, damage dealt to chained target will be multiplied by specified chainFactor
Target with SPELL_DAMAGE_REDUCTION bonus with value greater than 100% for any of spell school of the spell are immune to this effect
Dispel
Dispells all bonuses provided by any other spells from this unit. Following spells can not be dispelled
- Disrupting ray
- Acid Breath
- any effects from adventure spells
- any effects that comes from this spell, including effects from previous casts of the spell
Only bonuses from spells with specified positiveness(es) will be dispelled. See configuration example.
Heal
Effect restores spell effect power health points of affected unit. Can only be cast on unit that is not a clone and have lost some health points in the battle.
If parameter minFullUnits is non-zero, spell can only be cast if it will at least heal enough health points to fully restore health of specified number of units. For example, a single Archangel can only use Resurrection on units with 100 health points or lower
Spell can be used on dead units, but only if corpse is not blocked by a living unit.
Sacrifice
Sacrifice spell. Allows to destroy first target, while healing the second one. Destroyed unit is completely removed from the game.
Effect configuration is identical to Heal effect.
Obstacle
TODO
Per-side fields:
shape— hexes occupied by the obstacle, as direction paths from the anchor hex.range— hexes the obstacle may be placed on, as direction paths from the target hex.appearSound— sound played when the obstacle appears.appearAnimation— animation played when the obstacle appears.animation— looping animation shown while the obstacle is on the battlefield.removalAnimation— animation played when the obstacle is removed (expires or is dispelled). If empty, the obstacle reusesappearAnimation(played in reverse for magical obstacles) or, for plain obstacles, simply fades out.offsetY— vertical offset of the obstacle sprite, in pixels.
Moat
TODO
Remove obstacle
Effect removes an obstacle from targeted hex
Summon
Effect summons additional units to the battlefield.
If exclusive flag is set, attempt to summon a different creature by the same side in combat will fail (even if previous summon was non-exclusive)
Amount of summoned units is equal to spell effect power. Summoned units will disappear after combat, unless permanent flag in effect config is set
If summonByHealth option is set, then number of summoned units will be equal to spell effect power / unit health. Hero need to be able to summon at least one full unit for spell to work
if summonSameUnit flag is set, and same creature was already summoned before, spell will instead heal unit in "overheal" mode, using same spell effect power.
Demon Summon
Implements Pit Lord's ability with the same name. Raises targeted dead unit as unit specified in spell parameters on casters side. New unit will be placed on the same position as corpse, and corpse will be removed from the battlefield
Raised amount of units is limited by (rounded down):
- total HP of summoned unit can not be larger than spell effect power of caster
- total HP of summoned unit can not be larger than total HP of dead unit
- total stack size of summoned unit can not be greater than stack size of dead unit
Teleport
Effect instantly moves unit from its current location to targeted tile
Timed
Timed effect gives affected units specified bonuses for duration of the spell.
Duration of effect is:
- Hero: Spellpower + value of SPELL_DURATION + SPELL_DURATION for specific spell
- Units: value of CREATURE_ENCHANT_POWER, or 3 if no such bonus
Value of all bonuses can be affected by following bonuses:
- SPECIAL_PECULIAR_ENCHANT: value modified by 1-3 according to level of target unit
- SPECIAL_ADD_VALUE_ENCHANT: value from addInfo is added to val of bonus
- SPECIAL_FIXED_VALUE_ENCHANT: value from addInfo replaces val of bonus
Target types
CREATURE
- range 0: smart assumed single creature target
- range "X" + smart modifier = enchanter casting, expert massive spells
- range "X" + no smart modifier = armageddon, death ripple, destroy undead
- any other range (including chain effect)
- smart modifier: smth like cloud of confusion in H4 (if I remember correctly :) )
- no smart modifier: like inferno, fireball etc. but target only creature
NO_TARGET
- no target selection,(abilities, most adventure spells)
LOCATION
- any tile on map/battlefield (inferno, fireball etc.), DD also here but with special handling
- clearTarget - destination hex must be clear (unused so far)
- clearAfffected - all affected hexes must be clear (forceField, fireWall)
OBSTACLE
- range 0: any single obstacle
- range X: all obstacles
Configurable adventure map effects
Currently, VCMI does not allow completely new spell effects for adventure maps. However, it is possible to:
- modify the parameters of all H3 spells.
- create spells with similar effects to H3 spells
- create a spell that gives bonuses to the hero who cast the spell.
Unlike combat effects, adventure map spells can only have one special effect, such as the Dimension Door or Town Portal effect. The number of bonuses granted by an adventure map spell is unlimited.
The AI has a limited understanding of adventure map spells and may use the following spells:
- Spells that give
WATER_WALKINGorFLYING_MOVEMENTbonuses - Spells with the Summon Boat effect, provided the spell can create new boats with a 100% success chance.
- Any spells with the Town Portal effect.
Common format
All properties in this section can be used for all non-generic adventure map spell effects.
Parameters:
type- the type of spell effect used for this spell, orgenericif a custom mechanic is not used.castsPerDay- Optional. Defines how many times a hero can cast this spell per day; set to zero or omit for unlimited use.castsPerDayXL- Optional. An alternative cast-per-day limit that is only active on maps that are at least XL+U in size. If this value is not set or is set to zero, the game will use the value of thecastsPerDayvariable.bonuses- A list of bonuses that will be given to the hero when this spell is cast successfully. When used with effects that can fail (e.g. Summon Boat), the bonuses will only apply to a successful cast.
Example:
Dimension Door
The effect instantly teleports the hero to the selected location.
Parameters:
movementPointsRequired- The amount of movement points the hero must have to cast this spell.movementPointsTaken- The amount of movement points that will be taken if the spell is cast successfully. If the hero does not have enough movement points, they will be reduced to zero after casting.waterLandFailureTakesPoints- If set to true, mana and movement points will be spent on an attempt to teleport to an inaccessible location (e.g. teleporting to land while in a boat).cursor- Identifier of the cursor that will be shown when hovering over a valid destination tile. Seeconfig/cursors.jsonfor more details.cursorGuarded- alternative cursor that appears if using the teleport spell on a target would result in combat. This is only used if the game rule 'dimensionDoorTriggersGuards' is active.exposeFow- If this is set to true, using this spell will reveal information behind fog of war, such as whether teleportation is possible or if the location is guarded.ignoreFow- If this is set to true, it is possible to use the spell to teleport into terra incognita.rangeX- maximum distance to teleport in the X dimension (left-right axis).rangeY- maximum distance to teleport in the Y dimension (top-bottom axis).
Example:
Remove Object
The effect completely removes the targeted object from the map. The Scuttle Boat spell is an example of this effect. The success chance is defined as spell effect power.
Parameters:
objects- a list of map objects that can be removed by this spell.cursor- identifier of the cursor that will be displayed when hovering over a valid target object. Seeconfig/cursors.jsonfor more details.ignoreFow- If set to true, it is possible to use this spell to remove objects behind terra incognita.rangeX- maximum distance to remove objects in the X dimension (left-right axis).rangeY- maximum distance to remove objects in the Y dimension (top-bottom axis).
Example:
Summon Boat
The effect moves or creates a boat next to the hero who cast the spell. The success chance is defined as spell effect power.
Parameters:
useExistingBoat- If this is set to true, the spell can move existing boats to the hero's location.createdBoat- Optional identifier of the boat type that can be created by this spell. If this is not set, the spell cannot create new boats.
Note that if the spell can both create new boats and use existing ones, it would prefer to move existing boats and only create new ones if there are no suitable ones to move.
Example:
Town Portal
Effect moves hero to a location of owned or allied town.
Parameters:
movementPointsRequired- amount of movement points that hero must have to cast this spellmovementPointsTaken- amount of movement points that will be taken on sucessful cast of the spell. If hero does not have enough movement points, they will be reduced to zero after castallowTownSelection- if set to true, player will be able to select town to teleport to among all friendly non-occupied towns.skipOccupiedTowns- if set to true, hero will teleport to nearest non-occupied town, ignoring any closer towns that are occupied by a visiting hero. No effect ifallowTownSelectionis set.
Example:
View World
Effect shows World View menu with specified objects behind FoW revealed to the player
Parameters:
objects- list of object types that will be revealed on World View. Note that only following objects have assotiated icon, any objects not from this list will not be visible:resource,mine,abandonedMine,artifact,hero,town.showTerrain- if set to true, terrain of the entire map (but not objects on it) will be revealed to the player.
Example: