Skip to main content

CombatState

Struct CombatState 

Source
pub struct CombatState {
    pub defs: CombatDefs,
    pub index: CombatIndex,
    pub runtime: CombatRuntime,
    pub config: CombatConfig,
    spatial: SpatialQueryHandle,
}
Expand description

All static combat data plus mutable non-buffer state, grouped into sub-structs.

Fields§

§defs: CombatDefs§index: CombatIndex§runtime: CombatRuntime§config: CombatConfig§spatial: SpatialQueryHandle

Implementations§

Source§

impl CombatState

Source

pub fn has_aura_state( &self, buf: &DenseBuffer, actor: ActorId, required: AuraState, now: SimTime, ) -> bool

Resolve health-derived and aura-granted state for either friendly or hostile actors.

Source§

impl CombatState

Source

pub fn begin_actor_cast( &mut self, actor: ActorId, spell_id: SpellIdx, schools: SpellSchoolMask, ends_at: SimTime, interruptible: bool, )

Source

pub fn schedule_movement_window( &mut self, actor: ActorId, starts_at: SimTime, duration: SimTime, )

Source

pub fn movement_state(&self, actor: ActorId) -> MovementState

Source

pub fn school_locked( &self, actor: ActorId, schools: SpellSchoolMask, now: SimTime, ) -> bool

Source

pub(crate) fn begin_player_cast( &mut self, spell_id: SpellIdx, schools: SpellSchoolMask, ends_at: SimTime, empower_rank: u8, target: EnemyIdx, )

Source§

impl CombatState

Source

pub fn spec_config<T>(&self) -> Option<&T>
where T: SpecConfig,

Downcast the opaque per-spec config to T, or None if it is a different type.

Source

pub fn spec_runtime<T>(&self) -> Option<&T>
where T: SpecRuntime,

Downcast the mutable per-spec runtime state to T.

Source

pub fn spec_runtime_mut<T>(&mut self) -> Option<&mut T>
where T: SpecRuntime,

Mutable downcast of the per-spec runtime state to T.

Source

pub fn set_spec_config<T>(&mut self, config: T)
where T: SpecConfig,

Replace the immutable per-spec configuration.

Source

pub fn bug_enabled(&self, bug: &GameBug) -> bool

Whether a registered live-game bug is modeled in this run.

Source

pub fn set_spec_runtime<T>(&mut self, runtime: T)
where T: SpecRuntime,

Replace the resettable per-spec runtime state.

Source§

impl CombatState

Source

pub fn enemy_definition(&self, enemy: EnemyIdx) -> Option<&EnemyActorDefinition>

Source

pub fn enemy(&self, enemy: EnemyIdx) -> Option<&EnemyState>

Source

pub fn enemy_max_health(&self, enemy: EnemyIdx) -> Option<f64>

Canonical maximum health for an exact encounter enemy.

Source

pub fn enemy_health(&self, enemy: EnemyIdx, now: SimTime) -> Option<f64>

Canonical health for an exact encounter enemy at engine time now.

Source

pub fn enemy_health_fraction( &self, enemy: EnemyIdx, now: SimTime, ) -> Option<f64>

Canonical health fraction for an exact encounter enemy at engine time now.

Source

pub fn actor_health_fraction(&self, actor: ActorId, now: SimTime) -> Option<f64>

Canonical live health fraction for any actor addressable by combat effects.

Source

pub fn enemy_definitions( &self, ) -> impl ExactSizeIterator<Item = &EnemyActorDefinition>

Source

pub fn enemies(&self) -> impl ExactSizeIterator<Item = &EnemyState>

Source

pub fn active_enemy_count(&self) -> i32

Returns the number of active enemies.

§Panics

Panics if a validated encounter exceeds the engine’s supported enemy count.

Source

pub fn active_alive_enemy_count(&self) -> i32

Returns the number of active, living enemies.

§Panics

Panics if a validated encounter exceeds the engine’s supported enemy count.

Source

pub fn reset_enemies(&mut self)

Restores enemy and spatial state to the validated encounter definition.

§Panics

Panics if rebuilding a previously validated spatial scene fails.

Source

pub fn is_valid_target(&self, enemy: EnemyIdx) -> bool

Source

pub const fn current_target(&self) -> Option<EnemyIdx>

Source

pub const fn attack_position(&self) -> AttackPosition

Source

pub const fn set_attack_position(&mut self, position: AttackPosition)

Source

pub fn retarget(&mut self) -> Option<EnemyIdx>

Select the active pull’s preferred enemy when eligible, otherwise its lowest eligible id.

Source

pub fn activate_enemy(&mut self, enemy: EnemyIdx, at: SimTime) -> bool

Source

pub fn refresh_enemy_health(&mut self, enemy: EnemyIdx, now: SimTime)

Source

pub fn enemy_time_to_die(&self, enemy: EnemyIdx, now: SimTime) -> Option<f64>

Source

pub fn apply_enemy_damage( &mut self, enemy: EnemyIdx, amount: f64, at: SimTime, ) -> Result<Option<BecameDead>, SpecRuntimeError>

Apply damage to one enemy and report whether the hit caused its death transition.

§Errors

Returns SpecRuntimeError when enemy is absent from the active encounter state.

Source

pub(crate) fn schedule_enemy_auto_attack( &mut self, source: EnemyIdx, target: ActorId, at: SimTime, )

Source

pub(crate) fn grant_enemy_invulnerability( &mut self, target: EnemyIdx, until: SimTime, )

Source

pub(crate) fn enemy_is_invulnerable( &self, target: EnemyIdx, now: SimTime, ) -> bool

Source

pub(crate) fn enemy_auto_attack_is_current( &self, source: EnemyIdx, at: SimTime, ) -> bool

Source

pub(crate) fn apply_enemy_parry_haste(&mut self, source: EnemyIdx, now: SimTime)

Source

pub(crate) fn enemy_belongs_to_pull( &self, enemy: EnemyIdx, pull: PullId, ) -> bool

Source

pub(crate) fn transition_enemy_despawn( &mut self, enemy: EnemyIdx, at: SimTime, ) -> EnemyDespawnOutcome

Source

pub(crate) fn finalize_scripted_enemy_death( &mut self, enemy: EnemyIdx, at: SimTime, ) -> Result<bool, SpecRuntimeError>

Source

pub(super) fn enemy_mut(&mut self, enemy: EnemyIdx) -> Option<&mut EnemyState>

Source§

impl CombatState

Source

pub fn friendly_actor_health(&self, actor: ActorId) -> Option<f64>

Current absolute health for a friendly actor.

Source

pub fn friendly_actor_max_health(&self, actor: ActorId) -> Option<f64>

Maximum absolute health for a friendly actor.

Source

pub fn is_friendly_actor_alive(&self, actor: ActorId) -> bool

Source

pub fn grant_friendly_immunity_window(&mut self, window: IncomingImmunityWindow)

Adds a bounded friendly-actor immunity for encounter/raid-event orchestration.

Source

pub(crate) fn set_friendly_actor_health_fraction( &mut self, actor: ActorId, fraction: f64, ) -> Option<f64>

Source

pub(crate) fn apply_friendly_actor_damage( &mut self, actor: ActorId, amount: f64, ) -> Option<f64>

Source

pub(crate) fn transition_friendly_actor_to_dead( &mut self, actor: ActorId, ) -> bool

Source

pub(crate) fn apply_friendly_actor_heal( &mut self, actor: ActorId, amount: f64, ) -> Option<f64>

Source

pub(crate) fn activate_pet_health( &mut self, actor: ActorId, maximum: f64, ) -> bool

Source

pub(crate) fn deactivate_pet_health(&mut self, actor: ActorId) -> bool

Source§

impl CombatState

Source

pub fn spell_local(&self, spell_id: u32) -> Option<LocalSpellIdx>

Source

pub fn aura_local(&self, aura_id: u32) -> Option<LocalAuraIdx>

Source

pub fn item_rppm_local(&self, item_id: u32) -> Option<LocalRppmIdx>

Source

pub fn system_rppm_local(&self, driver_spell_id: u32) -> Option<LocalRppmIdx>

Source

pub fn enchant_rppm_local(&self, enchantment_id: u32) -> Option<LocalRppmIdx>

Source

pub fn enchant_buff_spell_id(&self, enchantment_id: u32) -> Option<u32>

Source

pub fn spell_data(&self, spell_id: u32) -> Option<(LocalSpellIdx, &SpellData)>

Source

pub fn spell(&self, local: LocalSpellIdx) -> &SpellData

Source

pub fn spells(&self) -> &[SpellData]

Source

pub fn aura(&self, local: LocalAuraIdx) -> &AuraData

Source

pub fn auras(&self) -> &[AuraData]

Source

pub fn precombat_auras(&self) -> &[LocalAuraIdx]

Source

pub fn talent_aura_stacks(&self) -> &[(LocalAuraIdx, u8)]

Source

pub fn rppm_tracker(&self, tracker: LocalRppmIdx) -> Option<&RppmTracker>

Source§

impl CombatState

Source

pub fn schedule(&mut self, event: Event)

Source

pub fn drain_events(&mut self) -> Drain<'_, Event>

Source

pub(crate) fn record_runtime_error(&mut self, error: SpecRuntimeError)

Source

pub(crate) const fn has_runtime_error(&self) -> bool

Source

pub(crate) fn take_runtime_error(&mut self) -> Option<SpecRuntimeError>

Source

pub(crate) fn aura_local_for_key(&self, key: AuraKey) -> Option<LocalAuraIdx>

Source§

impl CombatState

Source

pub fn actor_transform(&self, actor: ActorId) -> Option<SpatialTransform>

Live transform for a player/pet/enemy source. Pets use the owner’s player transform.

Source

pub fn has_line_of_sight(&self, source: ActorId, target: EnemyIdx) -> bool

Visibility includes layer separation, explicit fixture blocks, and static obstacles.

Source

pub fn relocate_actor( &mut self, actor: PositionedActorRef, transform: SpatialTransform, ) -> Result<(), SpatialQueryError>

Atomically update the validated canonical transform and spatial index.

§Errors

Returns SpatialQueryError when the transform is invalid or the actor is unavailable.

Source

pub fn spatial_query(&self) -> &dyn SpatialQuery

Source

pub fn spell_target_in_range( &self, spell_id: SpellIdx, target: EnemyIdx, ) -> bool

Shared inclusive hostile range/layer/LOS gate for casts and APL projection.

Source

pub(crate) fn spell_target_in_range_with_buffs( &self, buf: &DenseBuffer, spell_id: SpellIdx, target: EnemyIdx, ) -> bool

Source

fn spell_target_in_range_with_maximum( &self, spell_id: SpellIdx, target: EnemyIdx, maximum: f64, ) -> bool

Source§

impl CombatState

Source

pub fn telemetry_scope( &self, source: ActorId, target: EnemyIdx, ) -> Option<TelemetryScope>

Exact source/target ownership scope for telemetry emitted against target.

Source

pub fn telemetry_targets(&self) -> Vec<TargetMetadata>

Deterministic target dictionary in immutable encounter identity order.

Source

pub fn aura_telemetry_scope(&self, key: AuraKey) -> AuraTelemetryScope

Pull/group ownership for an exact aura instance.

Source§

impl CombatState

Source

pub(crate) fn new( defs: CombatDefs, index: CombatIndex, runtime: CombatRuntime, config: CombatConfig, ) -> Result<Self, EngineError>

Source§

impl CombatState

Source

pub fn apply_crowd_control( &mut self, actor: ActorId, kind: CrowdControlKind, group: DiminishingGroup, duration: SimTime, now: SimTime, ) -> CrowdControlApplication

Apply control to any combat actor with the TrinityCore 100/50/25/immune ladder.

Source

pub(crate) fn apply_crowd_control_duration( &mut self, actor: ActorId, kind: CrowdControlKind, group: DiminishingGroup, duration: CrowdControlDuration, now: SimTime, ) -> CrowdControlApplication

Source

pub(crate) fn actor_cast_blocked_by_control( &self, actor: ActorId, now: SimTime, ) -> bool

Source

fn crowd_control_active( &self, actor: ActorId, kind: CrowdControlKind, now: SimTime, ) -> bool

Trait Implementations§

Source§

impl Debug for CombatState

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> SpecConfig for T
where T: Any + Debug + Send,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more