Damage

From World Flipper Wiki
Jump to navigation Jump to search

This page goes over the damage formula used in-game.

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.

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:

  • 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 1.5x when the boss is downed, and only applies when the boss is downed. 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. Further multiplied by 1.5x when the target is weak 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.

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 +200% ATK buff and a +200% SD buff would result in a (1+2)*(1+2) = 9x multiplier to skill damage, compared to a +400% ATK buff and a +0% SD buff yielding only a (1+4)*1 = 5x multiplier to skill damage. There also exist other more unusual effects described in detail in the following section.

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 A ? B : C means if A, then B; otherwise, C. Input C is optional and defaults to 1. Variables directly from the code are used when possible, but some are made up. Uncertain segments are marked in red.

  1. Base damage. unitAttack is the base attack of the attacker. attackModifier is the sum of all attack modifiers to the attacker from weapons, abilities, souls, and buffs. attackModifier cannot go below -0.5.
  2. SD only; base SD. If the damage arises from a skill, additional flat damage is dealt to the target. randomInt(0, 2) is a random integer between 0 and 2, inclusive of both. skillBaseDamage is usually within 100 and is generally insignificant.
  3. Elements. Weak deals with elemental advantage, and Hostile determines whether the damage is dealt to a player or monster. Monsters with an elemental weakness take 1.5x damage from units or attacks of that element. In addition, they only deal 0.5x damage to units of that element.
  4. Resistance. totalResist 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 +150% resistance corresponds to a multiplier of 1/(1 + 1.5) = 0.4, whereas a -150% resistance corresponds to a multiplier of 1 - (-1.5) = 2.5. totalResist is the sum of resistance down effects inflicted by you on the enemy (caps at -150%), by the enemy on itself, and by poison (-10%).
  5. Downed. targetHasPinch 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. statModifierPinchSlayer is the sum of all break/down damage modifiers to the attacker from weapons, abilities, souls, and buffs.
  6. Guarded. targetHasGuard checks the player's guard status. Guarding is active for player targets when moving toward a monster attack at high speed, and gives a 0.2x damage multiplier.
  7. Status effects. conditionSlayer 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. raceSlayer 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. skillSlayer is the race modifier associated with a skill, as is the case for Azel.
  9. Adversity. statModifierAdversity is the sum of all adversity modifiers to the attacker from weapons, abilities, souls, and buffs. This multiplier scales linearly with attackerFractionHealthLost, the fraction of health that the attacker has lost. Not yet applicable to the global server.
  10. DA only; DA damage. statModifierDirectAttackDamage is the sum of all direct attack damage modifiers to the attacker from weapons, abilities, souls, and buffs.
  11. DA only; multihit. statModifierAdditionalDirectAttackDamage is the additional damage dealt by multi-hit, and statModifierAdditionalDirectAttackTimes is the number of multi-hits. Example: Sonia's Abi3 gives her a multi-hit of x2/+50%, so statModifierAdditionalDirectAttackDamage = 0.5 and statModifierAdditionalDirectAttackTimes = 2. In other words, Sonia's multi-hit causes her to do two attacks, each at (1 + 0.5)/2 = 0.75 times their usual strength.
  12. PF only; PF damage. statModifierPowerFlipDamage is the sum of all power flip damage modifiers to the attacker from weapons, abilities, souls, and buffs.
  13. PF only; PF multipliers. statModifierPowerFlipLvDamage 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. statModifierPowerFlipLvDamageSlayer 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. statModifierSkillDamage is the sum of all skill damage modifiers to the attacker from weapons, abilities, souls, and buffs. skillMultiplier 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. currentCombos is capped at 9999.
  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. randomFloat is uniformly distributed between -0.05 and +0.05, causing the damage to fluctuate between 0.95x and 1.05x of its deterministic value.
  20. Flat damage reduction. elementDamageCut 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.