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

damage DamageData

Returns

float

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

attacks List<RangedAttackData>
defense float

Returns

float

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

melee MeleeData
defense float

Returns

float

Dps(RangedAttackData, float)

Damage per second of one ranged channel against a matching defense value.

public static float Dps(RangedAttackData attack, float defense)

Parameters

attack RangedAttackData
defense float

Returns

float

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

health float
reduction float

Returns

double

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

kind DamageKind
defense float
physicalPierce float
magicalPierce float

Returns

float

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

damage DamageData
physical float
magical float
poison float

Returns

float

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

investment int
ratio float

Returns

int

TowerDps(TowerAsset, float)

Total DPS of a tower tier (ranged channels plus all barracks soldiers).

public static float TowerDps(TowerAsset tower, float defense)

Parameters

tower TowerAsset
defense float

Returns

float