Damage Calculation

The complete damage formula reverse-engineered from the IL2CPP runtime. Covers NumberUnit math, BasicShipStatus, BasicSkillData, DamageInfo structs, and the full 28+ modifier category chain.

28+ modifiers BattleManager DamageInfo v1.1.80

NumberUnit Math

All large numbers in Darkstar use the NumberUnit encoding to handle values that exceed standard floating-point precision. A NumberUnit stores two components:

value = quotient * 10^exponent

For example, a ship with fPowerQuotient = 3.45 and iPowerExponent = 12 has a base ATK of 3.45 × 1012 (3.45 trillion). All arithmetic in the damage pipeline operates on NumberUnit values.

Implementation

NumberUnit arithmetic normalizes after each operation: the quotient is kept in [1.0, 10.0) and the exponent is adjusted accordingly. This prevents precision loss during the multi-step damage calculation.

Core Structs

3 structs

BasicShipStatus

The runtime stats struct for a ship during battle. Defined at TypeDefIndex: 273 in the IL2CPP dump.

FieldTypeOffsetNotes
eBattleSideBattleSide0x0Which side this ship is on
eShipTypeShipMainType0x4Ship type (Player, Enemy, ArenaShip, etc.)
eDamageTypeAttackDamageType0x14Weapon type (MachineGun, Missile, Laser, Lightning)
MaxShieldNumberUnit0x40Maximum shield value
MaxHPNumberUnit0x50Maximum hit points
PowerNumberUnit0x80Attack power (ATK)
AutoRepairNumberUnit0x88HP regeneration rate
ChargingShieldNumberUnit0x90Shield recharge rate
fAttackSpeedfloat0xA4Attacks per second
fPercentRatefloat0xB4Percentage rate modifier
iAdmiralIDint0xC8Equipped admiral proto ID
No DEF or MDEF Fields

BasicShipStatus has no defense stat fields. There is no DEF, no MDEF, and no "magic defense" anywhere in the struct. Defense is handled entirely through percentage-based DamageReduction float fields on ShipController (see Defense Reduction below).

BasicSkillData

The resolved skill parameters for the current attack action. Defined at TypeDefIndex: 274.

FieldTypeOffsetNotes
eTypeSkillType0xCNormal attack, active skill, passive, etc.
eTargetTypeSkillTargetType0x10Target selection method
iTargetCountint0x1CNumber of targets hit (-1 = all)
fPowerfloat0x40Skill power coefficient
fCriticalDamageBonusfloat0x48Skill-specific crit damage bonus
eDamageTypeAttackDamageType0x4CWeapon type for this skill (MachineGun, Missile, Laser, Lightning)

DamageInfo

The output structure produced by the damage calculation pipeline. Defined at TypeDefIndex: 276. Contains 24 fields; key ones shown below.

FieldTypeOffsetNotes
eTargetSideBattleSide0x0Target's battle side
eShipTypeShipMainType0x4Attacker's ship type
eTargetShipTypeShipMainType0x8Target's ship type
eHitEventHitEventType0xCHit type (normal, crit, etc.)
DamageNumberUnit0x28Final damage after all modifiers
eDamageTypeAttackDamageType0x60Weapon type (MachineGun, Missile, Laser, Lightning)
bIsDoubleShotbool0xA8Whether this is a double-shot hit
fDoubleShotDamagefloat0xACDouble-shot damage multiplier

Damage Calculation Chain

The damage formula is a multi-step pipeline executed by BattleManager. Each step applies a category of modifiers. The chain proceeds in this order:

Step 1: Base Damage

BaseDamage = Power * fPower

The attacker's Power (NumberUnit at offset 0x80 in BasicShipStatus) is multiplied by the skill's fPower coefficient (float at offset 0x40 in BasicSkillData).

Step 2: Damage Reduction

PostReduction = BaseDamage * (1.0 - DamageReduction)

Defense is a flat percentage reduction stored in ShipController float fields. There is no diminishing-returns curve, no scaling constant, and no separate physical/magical defense split. The reduction fields are:

FieldOffsetPropertyTypeApplies To
mfDamageReductionBonus0x7829All damage (universal)
mfNormalDamageReductionBonus0x7C38Normal attacks only
mfSkillDamageReductionBonus0x8039Skill attacks only
mfBossDamageReductionBonus0x8440Boss damage only
mfArenaReductionBonus0xA062Arena PvP only

The appropriate reduction is selected based on attack context (normal vs skill vs boss, Arena vs PvE). All reduction applies identically regardless of weapon type (MachineGun, Missile, Laser, Lightning).

Step 3: Critical Hit

if (random() < CritChance):
    PostCrit = PostDefense * CritDamage
else:
    PostCrit = PostDefense

Crit chance is checked per hit. If the skill has a non-zero SkillCritChance, it overrides the ship's base crit rate. Same for SkillCritDamage.

Step 4: Modifier Categories (28+)

After the base/defense/crit calculation, the engine applies 28+ categories of multiplicative and additive modifiers. These come from equipment, admirals, memory cards, gemstones, buildings, buffs, debuffs, and mode-specific effects.

#CategorySourceType
1Weapon ATK%Equipped weaponMultiplicative
2Armor HP%Equipped armorMultiplicative
3Accessory BonusEquipped accessoryMultiplicative
4Admiral Equip EffectsEquipped admiral (up to 35 slots)Additive within, multiplicative across
5Admiral Owned EffectsAll owned admiralsAdditive
6Ship Owned EffectsAll owned shipsAdditive
7Memory Card EquipEquipped memory cardsAdditive within category
8Memory Card HoldAll owned memory cardsAdditive
9Gemstone EffectsSocketed gemstonesAdditive
10Gemstone Set BonusGemstone collection completionMultiplicative
11Building BonusesBase buildingsAdditive
12Artifact PassiveEquipped artifactsVaries
13Skill Damage%Skill-specific damage bonusMultiplicative
14Weakness Damage%WeaknessDamageUp_Bonus (PropertyType 37)Multiplicative
15Target Type BonusBonus vs. specific eMainTypeMultiplicative
16Boss Damage%Extra damage to boss targetsMultiplicative
17Normal Damage%Extra damage to non-boss targetsMultiplicative
18Weapon Type Damage%Per-weapon bonuses (MachineGun/Missile/Laser/Lightning, PropertyTypes 651–658)Multiplicative
19Drone Type Damage%Per-drone bonuses (Scout/Frigate/Helicopter/Striker/Destroyer/Cruiser, PropertyTypes 659–664)Multiplicative
20Active Skill Damage%Bonus to active (non-basic) skillsMultiplicative
21Basic Attack Damage%Bonus to basic attacks onlyMultiplicative
22Crit Damage% BonusAdditive to crit multiplierAdditive to CritDamage
23All Damage%Universal damage multiplierMultiplicative
24Damage Reduction (target)Target's damage reduction statMultiplicative (inverse)
25Buff: ATK UpTemporary combat buffMultiplicative
26Debuff: Damage Reduction DownTarget debuff reducing damage reductionMultiplicative
27Mode-Specific MultiplierChronos bonus, Raid multiplier, etc.Multiplicative
28Awakening BonusShip/equipment awakening tier bonusMultiplicative
Ordering Matters

The exact order of modifier application affects the final result due to multiplicative vs. additive stacking. Categories that are additive within themselves but multiplicative with other categories must be summed first, then multiplied. The engine processes them in the order shown above.

Simplified Formula

FinalDamage =
    Power
    * fPower (skill coefficient)
    * (1.0 - DamageReduction)
    * CritMultiplier
    * ProductOf(All Multiplicative Modifiers)
    * (1 + SumOf(All Additive Modifiers))

In practice, the formula is more nuanced because some modifier categories stack additively within their group before being multiplied with other groups. The exact behavior for each PropertyType is defined in BattleManager's damage calculation logic (the exact method name has not been confirmed in the IL2CPP dump).

DPS Estimation

EffectiveDPS =
    FinalDamage
    * AttackSpeed
    * (1 + CritChance * (CritDamage - 1))
    * TargetCount

This gives the expected damage per second accounting for crit probability. For AoE skills with iMaxTargetCount = -1, multiply by the average number of targets present.

Open Questions
  • Are there damage floors or ceilings? LimitedMaxDamage (PropertyType 701) exists but its behavior is unknown.
  • How do damage-over-time (DoT) effects interact with the modifier chain?
  • Is there a separate formula for healing, or does it reuse the damage pipeline with inverted sign?
  • How do weapon-type damage bonuses (PropertyTypes 651–658) interact with the type-specific reduction fields?
  • What is the exact stacking behavior when multiple reduction fields apply simultaneously?
  • How does DamageReflection_Function (PropertyType 1003) work?