Game Files/JSON

Game data is stored in several large files. The structure is described briefly here.
==Text==
User-visible text in several different languages is stored in files named BattleNations_*.json. When Z2 makes an incremental update to the game, they often put new text in Delta_*.json to reduce the size of the download.
==Units==
Statistics for combat units are stored in BattleUnits.json. Some of the interesting fields of the unit object are as follows.
Field 	Description
blocking 	0=None, 1=Partial, 2=Blocking
buildingLevel 	Building level required. Check buildings to see which one trains this unit.
buildTime 	Training time in seconds
cost 	Cost to train unit
healCost 	Cost to heal unit
healTime 	Healing time in seconds
icon 	Unit image file name, usually without .png extension
name 	Key used to look up unit name from BattleNations_en.json
prereq 	Prerequisites such as player level, buildings, and missions; see below
shortName 	Key used to look up shortened unit name
side 	Player, Hostile, Neutral, Hero, Villain, etc.
stats 	Array of unit ranks; see below
statusEffectImmunities	Cold, Stun, etc.
tags 	Array of unit tags like Soldier, Vehicle, etc.
weapons 	Unit weapons information; see below
===Ranks===
The stats array contains statistics that change as the unit gains ranks. Useful fields are:
Field 	Description
abilitySlots 	Number of ability slots available to equip attacks
accuracy 	Added to the of each attack
armorDamageMods	Damage mods while the unit has armor remaining
armorHP 	Armor
bravery 	Ability to resist suppression
critical 	Bonus to the critical hit chance of each attack
damageMods 	Damage modifiers for each damage type
defense 	Ability to avoid damage
dodge 	Chance to dodge attacks
hp 	Hit points
levelCutoff 	Skill points for unit to gain the next rank
levelUpCost 	Cost to train the next rank
levelUpTime 	Time to train the next rank, in seconds
minDropLevel 	Prerank unit if player's level is this high
power 	Adds to the damage of each attack
prereqsForLevel	Prerequisites for gaining this rank (just player level so far)
pv 	PVP value
rewards 	Rewards for defeating this unit
===Prerequisites===
There are often various requirements that must be met before a unit can be trained. These are stored in a list of prereq objects, each of which has a type _t and other data. Here are some of the possible types.
Type 	Description
LevelPrereqConfig 	Minimum player level needed. This is not always accurate, if other prereqs are present.
CompleteMissionPrereqConfig	Must complete missionId.
HasCompositionPrereqConfig 	Must have the building with ID compositionName.
UnitLevelPrereqConfig 	unitType must have rank level (used for new attacks).
ActiveTagPrereqConfig 	A limited-time offer or event defined by the game server.
===Attacks===
Unit attacks are somewhat complicated. Each unit has a list of weapons, and each weapon has a list of abilities. Ability statistics are stored in a separate file, BattleAbilities.json. Unit rank, weapon, and ability statistics are combined to produce the attack stats, as follows:
 mindmg = (floor(weapon.base_damage_min * ability.damageFromWeapon)
 + ability.damage) * (1 + (rank.power * ability.damageFromUnit * 0.02))
 maxdmg = (floor(weapon.base_damage_max * ability.damageFromWeapon)
 + ability.damage) * (1 + (rank.power * ability.damageFromUnit * 0.02))
 crit = (weapon.base_critPercent * ability.critFromWeapon)
 + ability.criticalHitPercent + (rank.critical * ability.critFromUnit)
 + ability.criticalBonuses[target_type]
 offense = (weapon.base_ATK * ability.attackFromWeapon) + ability.attack
 + (rank.accuracy * ability.attackFromUnit)
 minrange = ability.minRange
 maxrange = ability.maxRange + weapon.rangeBonus
Fractions are rounded down. A crit value of 5% is considered "normal"; the game does not display crit in the unit attack window if it is equal to 5%.
Other useful fields in the weapon object are:
Field 	Description
ammo 	Ammunition available before reload
name 	Key used to look up weapon name from BattleNations_en.json
reloadTime	Number of turns to reload
All abilities on a weapon share the same ammo pool.
Other useful fields in the ability object are:
Field 	Description
abilityCooldown 	Number of turns before this attack can be reused
ammoRequired 	Ammo used per attack
armorPiercingPercent 	Armor piercing
attackDirection 	front or back
attacksPerUse 	Number of attacks; see also shotsPerAttack
chargeTime 	Prep time
damage_distraction 	Suppression multiplier
damage_distractionBonus	Suppression bonus damage
damageType 	Array of damage types
globalCooldown 	Turns before this weapon can be used again
icon 	Attack icon file name
lineOfFire 	0=Contact, 1=Direct, 2=Precise, 3=Indirect
maxRange 	Maximum range
maxRangeModATK 	Penalty to when target is at range
minHPPercent 	Target's won't be lowered below this percentage
minRange 	Minimum range
name 	Key used to look up ability name
reqs 	Prereqs and costs to research this attack
shotsPerAttack 	Number of shots; see also attacksPerUse
statusEffects 	Status effects such as . The keys reference StatusEffectsConfig.json, and the values give the percentage chance.
targets 	Air, Ground, etc.
==Status Effects==
Status effects like Stun and Poison are described in the file StatusEffectsConfig.json.
dot_AbilityDamageMult	Multiple of the base damage applied by the DoT
dot_BonusDamage 	Damage caused by environmental DoT effects
dot_DamageType 	Damage type
dot_Diminishing 	True if damage diminishes with time
dot_apPercent 	Armor piercing
duration 	Duration of the effect
family 	Which immunity defends against this effect (Fire, Poison, etc)
stun_ArmorDamageMods 	Armor damage modifiers that apply while the effect is active
stun_BlockAction 	True if unit is unable to attack
stun_BlockMovement 	True if unit's defense is reduced
stun_DamageBreak 	True if taking damage ends the effect
stun_DamageMods 	Damage modifiers (example: 1.5x damage while frozen)
type 	dot or stun
==Buildings==
Building information is in Compositions.json. Each building has a set of componentConfigs, many of which are optional.
The StructureMenu block contains the building's name, icon, prereq, and cost to build. Construction contains the buildTime.
Building size on the map is described by the Placeable block, which gives the building's width and height, and tells whether it isMoveable.
Sellable contains the sell price.
===Population===
Houses make a contribution to the player's PopulationCapacity.
Many buildings RequireWorkers. The number needed while the building is in operation is workers. Some buildings canToggle on and off. They need minWorkers for upkeep while they are turned off.
===Rewards===
Assistance gives the rewards for assisting another player's building. There is an interactionLimit to how many times a given building can be assisted per day.
BattleReward gives the reward for raiding the building. The occupy reward is 3.8 times the raid reward, rounded up.
===Upgrades===
Some buildings can be upgraded. They have a BuildingUpgrade block which contains a list of levels. Each level has an upgradeCost and upgradeTime. There are several other fields in this block that influence the operation of the building, as explained below.
===Production===
The Taxes block describes buildings that automatically produce output on a certain schedule, such as houses, orchards, and the Supply Drop. It contains a paymentInterval, which gives the time in minutes (unlike most other times in the game files). The production output is given by rewards.
Houses can be upgraded to increase the revenue generated. The produced is multiplied by the output percentage from the BuildingUpgrade section, and is multiplied by XPoutput.
ResourceProducer buildings such as the Stone Quarry and Iron Mine generate output constantly, without the need for user interaction. The resource is identified by outputType, and it is produced at the given outputRate per hour, multiplied by the output percentage from BuildingUpgrade.
JobList contains a list of jobs that can be made by shops, farms, ranches, and mills. This includes both regular goods and quest-related items. The demandCategory is unreliable, so consult Economy.json to be sure. Only the job identifiers are stored in Buildings.json; the full information is in JobInfo.json. The cost is multiplied by the input percentage from BuildingUpgrade, and the rewards are multiplied by output. The buildTime is in seconds, as usual.
===Healing===
Hospitals and repair bays contain a Healing block, which contains the messages displayed by certain actions.
The BuildingUpgrade section has a number of important fields for healing buildings. The maximumHealingQueueSize tells how many units can be waiting for treatment (not counting the one currently being healed). Costs are multiplied by the input percentage, and time required is multiplied by time.
===Training===
ProjectList contains a list of units that the building can train. The level of the building required to train a unit is found in that unit's buildingLevel field, and the player level is in the prereq structure. Some units have a visibilityPrereq, and won't show up in the in-game build list until a certain condition is met (such as an active promotional offer).
===Defense===
DefenseStructure has information about structures that can participate in battles, including their radius and repairTime. The combat statistics are in the BattleUnits.json file, identified by unitId.
Garrison buildings have a radius and unitCount.
===Bonus Decor===
Some decorations give a bonus to nearby buildings. The RadialMod block gives the stats that are affected and the radius of the buff. The tags field gives a list of building types that receive the bonus.
There is usually a limit to the number of bonuses a building can receive. The maxModStack tells the maximum number of decors of exactly the same type that can affect a single building (only 3 Moats can stack modifiers, for example). In other cases, several different decorations may be in the same modCategory. For example, a Farm can't get bonuses from both a Water Tower and Concrete Reservoir, because they are both in the Irrigation category. Bonus categories are defined in RadialMod.json.
Buildings that can be buffed have a RadialModBuffable block that tells which tags they repond to.