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.
Auto Trait Implementations§
impl Freeze for CombatFormulas
impl RefUnwindSafe for CombatFormulas
impl Send for CombatFormulas
impl Sync for CombatFormulas
impl Unpin for CombatFormulas
impl UnsafeUnpin for CombatFormulas
impl UnwindSafe for CombatFormulas
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.