Class CombatMath
- Namespace
- TDMaker.Editor
- Assembly
- TDMaker.Editor.dll
Editor-side estimates of combat numbers. Mirrors the simulation's reduction rules (physical, magical, explosion/electric at half physical, poison, true) but ignores rounding, status effects and incoming-damage multipliers, so values are approximate ("≈").
public static class CombatMath
- Inheritance
-
CombatMath
- Inherited Members
Fields
ArmorLevels
Defense levels used in stat tables.
public static readonly float[] ArmorLevels
Field Value
- float[]
Methods
AverageHit(DamageData)
Average rolled damage of a packet.
public static float AverageHit(DamageData damage)
Parameters
damageDamageData
Returns
Dps(List<RangedAttackData>, float)
Sum of all ranged channels' DPS against a matching defense value.
public static float Dps(List<RangedAttackData> attacks, float defense)
Parameters
attacksList<RangedAttackData>defensefloat
Returns
Dps(MeleeData, float)
Damage per second of a melee attack against a matching defense value; zero when disabled.
public static float Dps(MeleeData melee, float defense)
Parameters
Returns
Dps(RangedAttackData, float)
Damage per second of one ranged channel against a matching defense value.
public static float Dps(RangedAttackData attack, float defense)
Parameters
attackRangedAttackDatadefensefloat
Returns
EffectiveHp(float, float)
Hit points needed to kill a unit through a given reduction; infinite at full reduction.
public static double EffectiveHp(float health, float reduction)
Parameters
Returns
Reduction(DamageKind, float, float, float)
Fraction removed from a hit of kind when the target's matching defense is defense.
For physical-derived kinds the defense is physical armor; for magical it is magic resistance; for poison, poison resistance.
public static float Reduction(DamageKind kind, float defense, float physicalPierce = 0, float magicalPierce = 0)
Parameters
kindDamageKinddefensefloatphysicalPiercefloatmagicalPiercefloat
Returns
ReductionAgainst(DamageData, float, float, float)
Reduction a target with the given armor values applies to damage.
public static float ReductionAgainst(DamageData damage, float physical, float magical, float poison)
Parameters
damageDamageDataphysicalfloatmagicalfloatpoisonfloat
Returns
Refund(int, float)
Gold refunded when selling after the first wave has started, using the simulation's rounding.
public static int Refund(int investment, float ratio)
Parameters
Returns
TowerDps(TowerAsset, float)
Total DPS of a tower tier (ranged channels plus all barracks soldiers).
public static float TowerDps(TowerAsset tower, float defense)
Parameters
towerTowerAssetdefensefloat