xanarch-td/scripts/utils/DamageCalc.gd
2026-06-03 21:53:16 -04:00

22 lines
639 B
GDScript

## DamageCalc.gd
## Applies armor/attack type damage multipliers per the Squadron TD matrix.
class_name DamageCalc
enum AttackType { NORMAL, EXPLOSIVE, CONCUSSIVE, CHAOS }
enum ArmorType { LIGHT, MEDIUM, HEAVY, UNARMORED }
# [attack_type][armor_type] = multiplier
const MATRIX: Array = [
# NORMAL
[1.00, 1.00, 1.00, 1.00],
# EXPLOSIVE
[0.75, 1.00, 1.50, 0.75],
# CONCUSSIVE
[1.50, 0.75, 0.50, 1.00],
# CHAOS
[1.00, 1.00, 1.00, 1.00],
]
static func calculate(base_damage: int, attack_type: AttackType, armor_type: ArmorType) -> int:
var multiplier: float = MATRIX[attack_type][armor_type]
return int(base_damage * multiplier)