Damage

Types of Damage
There are four main types of damage.
 * Direct attacks (DA). This occurs when your units collide directly with the target at low combo.
 * Power flips (PF). This occurs when your units launch off the flippers at high combo (9, 15, and 39 for LV. 1, 2, and 3 power flips).
 * Skill damage (SD). This occurs when your units cast damaging skills.
 * Ability damage (AD). This occurs when your units do damage with their abilities. This source of damage is not yet available in the global server.

Basics
The full reconstructed damage formula is shown in the following section. In this section, rather than analyze it in full, we focus on heuristics and intuitive understanding. Generally speaking, there are six relevant factors: There also exist other more unusual effects described in detail in the following section. Buffs corresponding to the same factor are additive; the different factors are then multiplied together. Because these independent factors multiply, buffs should be spread out over each factor rather than concentrated on just one. For instance, a  ATK buff and a   SD buff would result in a   multiplier to skill damage, compared to a   ATK buff and a   SD buff yielding only a   multiplier to skill damage.
 *  Unit 's base attack. The sum of the attack of the equipped weapon, the main's attack stat, and a quarter of the unison's attack stat.
 * Unit's attack modifier. The sum of all attack buffs on the unit.
 * Unit's damage type modifier. The sum of all buffs of a certain damage type (DA/PF/SD/AD) on the unit.
 * Target's status effects and unit's status modifiers. The sum of all active non-downed status modifiers (often called punishers) on the unit. Status modifiers are active if the target is afflicted with the status.
 * Target's downed status and unit's downed modifiers. The sum of all active downed modifiers on the unit. Further multiplied by . Separate from other status modifiers.
 * Target's elemental resistance and unit's elemental advantage. The sum of all resistance modifiers on the target corresponding to the damage source's element. The damage source is the leader in PF, the three main characters in DA, and any of the six characters in SD and AD.

Formula
The maximum damage that can be dealt is 9,999,999,999. In practice, the maximum attainable damage is around 99,999,999. The full damage formula is given by 1  unitAttack * (1 + max(-0.5, attackModifier)) subject to a number of conditional damage multipliers 2 + createdBySkillAction? (randomInt(0, 2) + skillBaseDamage) 3 * WeakAndHostile ? 1.5 : NotWeakAndNotHostile ? 0.5 4 * totalResist > 0 ? 1/(1 + totalResist) : (1 - totalResist) 5 * targetHasPinch ? 1.5 * (1 + statModifierPinchSlayer) 6 * targetHasGuard ? 0.2 7 * (1 + conditionSlayer) 8 * (1 + raceSlayer) * createdBySkillAction ? (1 + skillSlayer) 9 * (1 + statModifierAdversity) * attackerFractionHealthLost 10 * createdByDirectAttack ? (1 + statModifierDirectAttackDamage) 11     * (1 + statModifierAdditionalDirectAttackDamage) / statModifierAdditionalDirectAttackTimes 12 * createdByPowerFlipAction ? (1 + statModifierPowerFlipDamage) 13 * createdByPowerFlipAction AND ChargeLevel > 0 ? (1 + statModifierPowerFlipLvDamage * (1 + statModifierPowerFlipLvDamageSlayer)) 14 * createdBySkillAction ? (1 + statModifierSkillDamage) * skillMultiplier 15     * enablesComboBonus ? (1 + 0.005 * CurrentCombos) 16     * enablesCoffinCountBonus ? (1 + 0.026 * TotalCoffinCounts) 17     * enablesBuffCountBonus ? (1 + 0.1 * TotalBuffCounts) 18     * enablesRangeBonus ? (1 + min(0.5, Distance^2/700)) 19 * (1 + randomFloat(-0.05, 0.05)) 20 - elementDamageCut 21 * targetIsInvincible ? 0 which we will go over line by line. The calculation is performed line by line; do not follow standard order of operations. The notation  means. Input  is optional and defaults to. Variables directly from the code are used when possible, but some are made up. Uncertain segments are marked in red.


 * 1) Base damage.   is the base attack of the attacker.   is the sum of all attack modifiers to the attacker from weapons, abilities, souls, and buffs.   cannot go below.
 * 2) SD only; base SD. If the damage arises from a skill, additional flat damage is dealt to the target.   is a random integer between   and , inclusive of both.   is usually within   and is generally insignificant.
 * 3) Elements.   deals with elemental advantage, and   determines whether the damage is dealt to a player or monster. Monsters with an elemental weakness take   damage from units or attacks of that element. In addition, they only deal   damage to units of that element.
 * 4) Resistance.   is the total elemental resistance the target has against damage of that element, which can be positive or negative. The damage multiplier is defined piecewise for positive and negative values. Example: a   resistance corresponds to a multiplier of , whereas a   resistance corresponds to a multiplier of  .   is the sum of resistance down effects inflicted by you on the enemy (caps at  ), by the enemy on itself, and by poison.
 * 5) Downed.   checks the monster's break/down status, which occurs momentarily after breaking all of a target's weak points, after a skill chain, or once sufficiently many hits are dealt during fever.   is the sum of all break/down damage modifiers to the attacker from weapons, abilities, souls, and buffs.
 * 6) Guarded.   checks the player's guard status. Guarding is active for player targets when moving toward a monster attack at high speed, and gives a   damage multiplier.
 * 7) Status effects.   is the sum of all status effect modifiers from weapons, abilities, souls, and buffs to a target subject to those status effects and applies, for example, via Bianca's Abi2 and Cipher's Abi1.
 * 8) Race.   is the sum of all race modifiers from weapons, abilities, souls, and buffs to a target with a given race, and applies, for example, via Vyron's Abi3.   is the race modifier associated with a skill, as is the case for Azel.
 * 9) Adversity.   is the sum of all adversity modifiers to the attacker from weapons, abilities, souls, and buffs. This multiplier scales linearly with , the fraction of health that the attacker has lost. Not yet applicable to the global server.
 * 10) DA only; DA damage.   is the sum of all direct attack damage modifiers to the attacker from weapons, abilities, souls, and buffs.
 * 11) DA only; multihit.   is the additional damage dealt by multi-hit, and   is the number of multi-hits. Example: Sonia's Abi3 gives her a multi-hit of , so   and  . In other words, Sonia's multi-hit causes her to do two attacks, each at   times their usual strength.
 * 12) PF only; PF damage.   is the sum of all power flip damage modifiers to the attacker from weapons, abilities, souls, and buffs.
 * 13) PF only; PF multipliers.   is a multiplier to power flip damage that depends on the level (1, 2, 3) and type (sword, fist, bow, special, support) of power flip.   is an additional multiplier to the damage for specific power flip levels and applies, for example, via Rolf's Abi3.
 * 14) SD only; skill damage.   is the sum of all skill damage modifiers to the attacker from weapons, abilities, souls, and buffs.   is the multiplier associated with the attacker's skill. If the skill has multiple projectiles, then this is the multiplier associated with one projectile.
 * 15) SD only; combo multiplier. This applies, for example, via Kannon's skill.   is capped at.
 * 16) SD only; coffin multiplier. This applies, for example, via Luna's skill.
 * 17) SD only; buff multiplier. This applies, for example, via Ellya's skill.
 * 18) SD only; distance multiplier. This applies via Selgir's skill. This multiplier scales as the squared distance.
 * 19) Random fluctuation.   is uniformly distributed between   and , causing the damage to fluctuate between   and   of its deterministic value.
 * 20) Flat damage reduction.   accounts for flat elemental damage resistance the target has against damage of that element, and applies, for example, via Walter's skill.
 * 21) Invincibility. This accounts for whether the target is currently targetable and applies, for example, during Orochi Adv's body phase.