Skip to main content

wowlab_engine_combat/state/
mod.rs

1//! Combat state: typed data structures for the combat system.
2
3mod aura_state;
4pub(crate) mod buff_effect;
5mod casting;
6pub(crate) mod combat_state;
7pub(crate) mod config;
8mod control;
9pub(crate) mod damage;
10mod deferred_work;
11pub(crate) mod defs;
12pub(crate) mod ground_effect;
13mod health;
14mod orchestration;
15pub(crate) mod resource;
16
17pub(crate) use aura_state::AuraState;
18pub(crate) use buff_effect::{BuffEffect, BuffTotals, MAX_AURA_BUFF_EFFECTS, try_push_effect};
19pub(crate) use casting::{ActiveCast, MovementState, SchoolLockout};
20pub(crate) use combat_state::{
21    AttackPosition, CombatConfig, CombatDefs, CombatIndex, CombatRuntime, CombatRuntimeInit,
22    CombatState, ImpactEffectRngState,
23};
24pub(crate) use config::{BaseStats, ScratchBuffers, ScratchDisposition, with_scratch};
25pub(crate) use control::{
26    ControlDeadline, CrowdControlApplication, CrowdControlDuration, CrowdControlKind,
27    DiminishingGroup, DiminishingState,
28};
29pub(crate) use damage::{
30    ActiveSpellGate, DamageEffectRef, DamageReplication, DamageSource, DamageTransfer,
31    DamageTransferTiming, HealthThresholdDirection, MAX_CDR_EFFECTS, RuntimeDamageDef,
32    WeaponApType, resolved_damage_base_points,
33};
34pub(crate) use deferred_work::{DeferredWork, DeferredWorkQueue, PendingAuraExpireHook};
35pub(crate) use defs::{
36    AccumulatingImpactProc, AuraApplicationEvent, AuraData, AuraTickBehavior, AutoAttackData,
37    CastHookFn, CritChargeReduction, DriverSpellModifier, DynamicTickAction,
38    EmpowerReleaseAdjustment, EmpowerReleaseHookFn, GuardianAbility, GuardianAbilityState,
39    GuardianEvent, GuardianHandle, GuardianInstance, GuardianSpec, ImpactActorFilter,
40    ImpactChanceScale, ImpactEffectProc, ImpactEvent, ImpactProc, ImpactProcFn, ImpactSource,
41    LandedImpactEvent, LandedImpactProc, MAX_AURA_APPLICATION_EXCLUSIONS, PassiveDriverEffect,
42    PendingEffectProgram, PendingHookTimer, PendingSpellImpact, PendingTimerAction, PeriodicData,
43    PeriodicDriver, PeriodicKind, PetAbilityCondition, PetActionBar, PetActionState,
44    PetOwnerCoefficients, PetStatSnapshot, ProcDriver, ProcEventKind, ProcHitMask, ProcPhaseMask,
45    ProcProvenance, ProcSourceKind, ProcTriggerSide, ResourceGainEvent, ResourceGainProc,
46    ResourceGainProcAttempts, ResourcePool, ResourceThresholdTrigger, SpellAvailability,
47    SpellBehavior, SpellChannel, SpellChannelBehavior, SpellChannelCompletion, SpellChannelTiming,
48    SpellCooldown, SpellCost, SpellDamagePolicy, SpellData, SpellEffectData, SpellEffectRange,
49    SpellEquipmentRequirements, SpellFormRequirements, SpellGroup, SpellOverride,
50    SpellRequirements, SpellTargeting, SwingEvent, SwingHand, SwingHookFn, SwingMissChanceHookFn,
51    SwingReplacement, SwingReplacementHookFn, TriggerProgramPredicateFn, WeaponEnchantBinding,
52    WeaponImbueBinding,
53};
54pub(crate) use ground_effect::{GroundEffectSpec, PendingGroundPulse};
55pub(crate) use health::{
56    AbsorbEffect, AbsorbKind, ActiveAbsorb, HealthPool, IncomingImmunityWindow,
57    OverkillAbsorbDecision, OverkillAbsorbEvent, OverkillAbsorbScriptContext,
58    OverkillAbsorbScriptFn,
59};
60pub(crate) use orchestration::{EncounterRuntime, EnemyCompletion};
61pub(crate) use resource::{
62    RUNE_COUNT, RUNE_RECHARGE_SECONDS, ResourceGain, ResourceGainScaling, ResourceGainSource,
63    RuneState,
64};
65pub(crate) use wowlab_engine_rng::{RppmTracker, ThresholdTracker};
66pub(crate) use wowlab_types::combat::SpellGroupRule;
67
68/// Local spell index scoped to a single [`CombatState`].
69#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
70#[must_use]
71pub struct LocalSpellIdx(pub(crate) u8);
72
73/// Local aura index scoped to a single [`CombatState`].
74#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
75#[must_use]
76pub struct LocalAuraIdx(pub(crate) u8);
77
78/// Local RPPM tracker index scoped to a single [`CombatState`].
79#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
80#[must_use]
81pub struct LocalRppmIdx(pub(crate) u8);
82
83/// Local accumulated-threshold tracker index scoped to a single [`CombatState`].
84#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
85#[must_use]
86pub struct LocalThresholdIdx(pub(crate) u8);
87
88impl LocalSpellIdx {
89    pub const fn new(index: u8) -> Self {
90        Self(index)
91    }
92
93    #[must_use]
94    pub const fn raw(&self) -> u8 {
95        self.0
96    }
97
98    #[inline]
99    #[must_use]
100    pub const fn as_usize(&self) -> usize {
101        self.0 as usize
102    }
103}
104
105impl LocalAuraIdx {
106    pub const fn new(index: u8) -> Self {
107        Self(index)
108    }
109
110    #[must_use]
111    pub const fn raw(&self) -> u8 {
112        self.0
113    }
114
115    #[inline]
116    #[must_use]
117    pub const fn as_usize(&self) -> usize {
118        self.0 as usize
119    }
120}
121
122impl LocalRppmIdx {
123    pub const fn new(index: u8) -> Self {
124        Self(index)
125    }
126
127    #[must_use]
128    pub const fn raw(&self) -> u8 {
129        self.0
130    }
131
132    #[inline]
133    #[must_use]
134    pub const fn as_usize(&self) -> usize {
135        self.0 as usize
136    }
137}
138
139impl LocalThresholdIdx {
140    pub const fn new(index: u8) -> Self {
141        Self(index)
142    }
143
144    #[must_use]
145    pub const fn raw(&self) -> u8 {
146        self.0
147    }
148
149    #[inline]
150    #[must_use]
151    pub const fn as_usize(&self) -> usize {
152        self.0 as usize
153    }
154}