pub struct CombatFormulas;Expand description
Stateless damage resolution functions.
Implementations§
Source§impl CombatFormulas
impl CombatFormulas
Sourcepub fn resolve(
event: &DamageEvent,
attacker: &CombatStats,
defender: &CombatStats,
resistances: &ResistanceProfile,
) -> HitResult
pub fn resolve( event: &DamageEvent, attacker: &CombatStats, defender: &CombatStats, resistances: &ResistanceProfile, ) -> HitResult
Resolve a single damage event, returning a HitResult.
Uses the provided roll value (from attacker’s entropy or RNG) instead of
an actual RNG call, making the system fully deterministic and seedable.
Sourcepub fn splash_damage(
base_result: &HitResult,
splash_radius: f32,
distance: f32,
) -> f32
pub fn splash_damage( base_result: &HitResult, splash_radius: f32, distance: f32, ) -> f32
Splash damage — apply a full hit result at reduced strength to multiple targets.
Sourcepub fn entropy_damage(
base_damage: f32,
defender_entropy: f32,
attacker_entropy_amp: f32,
) -> f32
pub fn entropy_damage( base_damage: f32, defender_entropy: f32, attacker_entropy_amp: f32, ) -> f32
Entropy damage — additional chaos damage based on defender’s current entropy.
High-entropy targets take bonus damage; low-entropy targets are unaffected.
Sourcepub fn gravity_damage(
base_damage: f32,
attacker_pos: Vec3,
defender_pos: Vec3,
) -> f32
pub fn gravity_damage( base_damage: f32, attacker_pos: Vec3, defender_pos: Vec3, ) -> f32
Gravity damage — scales with relative height difference between attacker and defender.
Sourcepub fn temporal_slow_factor(damage: f32, defender_max_hp: f32) -> f32
pub fn temporal_slow_factor(damage: f32, defender_max_hp: f32) -> f32
Temporal damage — slows time for the defender based on damage dealt. Returns a slow factor in [0, 1] where 0 = full stop, 1 = normal.
Sourcepub fn dps(
damage_per_hit: f32,
hits_per_second: f32,
crit_chance: f32,
crit_mult: f32,
) -> f32
pub fn dps( damage_per_hit: f32, hits_per_second: f32, crit_chance: f32, crit_mult: f32, ) -> f32
Damage-per-second — useful for comparing damage sources.
Sourcepub fn effective_hp(hp: f32, armor: f32) -> f32
pub fn effective_hp(hp: f32, armor: f32) -> f32
Effective HP — actual HP accounting for armor reduction.