Skip to main content

CombatInstance

Struct CombatInstance 

Source
pub struct CombatInstance {
    spatial: SpatialQueryHandle,
    aura_totals_revisions: AuraTotalsRevisions,
    active_aura_bindings: ActiveAuraBindings,
    pub(super) buff_totals_caches: BuffTotalsCaches,
    projection_dirty: ProjectionDirty,
    projection_dirty_at: SimTime,
    aura_projection_dirty: AuraProjectionDirty,
    /* private fields */
}
Expand description

Mutable state owned by one combat handler and reset between iterations.

Fields§

§spatial: SpatialQueryHandle§aura_totals_revisions: AuraTotalsRevisions§active_aura_bindings: ActiveAuraBindings§buff_totals_caches: BuffTotalsCaches§projection_dirty: ProjectionDirty§projection_dirty_at: SimTime§aura_projection_dirty: AuraProjectionDirty

Implementations§

Source§

impl CombatInstance

Source

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

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

Source§

impl CombatInstance

Source

pub fn schedule_movement_window( &mut self, program: &CombatProgram, 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 school_lock_ready_at( &self, actor: ActorId, schools: SpellSchoolMask, now: SimTime, ) -> Option<SimTime>

Source

pub(crate) fn begin_actor_cast(&mut self, actor: ActorId, active: ActiveCast)

Source§

impl CombatInstance

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

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

Source

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

Source§

impl CombatInstance

Source

pub(crate) fn pop_first_active_aura_binding( &mut self, actor: ActorId, ) -> Option<ConcreteAuraBinding>

Source

pub(crate) fn for_each_active_aura_intersection( &self, actor: ActorId, relevant: (&[u64], &[u64]), visit: impl FnMut(LocalAuraIdx, ConcreteAuraBinding), )

Source

pub(crate) fn for_each_active_static_total_aura( &self, actor: ActorId, relevant: &[u64], visit: impl FnMut(LocalAuraIdx, ConcreteAuraBinding, u16), )

Source

pub(crate) fn for_each_active_aura_local( &self, actor: ActorId, local: LocalAuraIdx, visit: impl FnMut(ConcreteAuraBinding), )

Source

pub(crate) fn first_active_aura_intersection( &self, actor: ActorId, relevant: &[u64], ) -> Option<ConcreteAuraBinding>

Source

pub(crate) fn actor_aura_revision(&self, actor: ActorId) -> Option<u64>

Source

pub(crate) fn player_scaling_revision(&self) -> u64

Source

pub(crate) fn cached_player_scaling_buffs( &self, revision: u64, ) -> Option<PlayerScalingBuffs>

Source

pub(crate) fn cache_player_scaling_buffs( &self, revision: u64, buffs: PlayerScalingBuffs, )

Source

pub(crate) fn cached_actor_buff_totals( &self, actor: ActorId, revision: u64, ) -> Option<BuffTotals>

Source

pub(crate) fn cache_actor_buff_totals( &self, actor: ActorId, revision: u64, totals: &BuffTotals, )

Source

pub(crate) fn cached_actor_only_buff_totals( &self, actor: ActorId, revision: u64, owner_revision: u64, ) -> Option<BuffTotals>

Source

pub(crate) fn cache_actor_only_buff_totals( &self, actor: ActorId, revision: u64, owner_revision: u64, totals: &BuffTotals, )

Source§

impl CombatInstance

Source

pub(crate) fn cached_damage_buff_projection( &self, actor: ActorId, key: DamageProjectionKey, ) -> Option<DamageBuffProjection>

Source

pub(crate) fn cache_damage_buff_projection( &self, actor: ActorId, key: DamageProjectionKey, projection: DamageBuffProjection, )

Source§

impl CombatInstance

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_runtime<T>(&mut self, runtime: T)
where T: SpecRuntime,

Replace the resettable per-spec runtime state.

Source§

impl CombatInstance

Source

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

Source

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

Canonical maximum health for an exact encounter enemy.

Source

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

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

Source

pub fn enemy_health_fraction( &self, program: &CombatProgram, 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, program: &CombatProgram, actor: ActorId, now: SimTime, ) -> Option<f64>

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

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, program: &CombatProgram)

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 fn set_attack_position(&mut self, position: AttackPosition, _at: SimTime)

Source

pub fn retarget( &mut self, program: &CombatProgram, at: SimTime, ) -> 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, program: &CombatProgram, source: EnemyIdx, now: SimTime, )

Source

pub(crate) fn enemy_belongs_to_pull( &self, program: &CombatProgram, 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 CombatInstance

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§

impl CombatInstance

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 CombatInstance

Source

pub(crate) fn mark_projection_dirty( &mut self, dirty: ProjectionDirty, at: SimTime, )

Source

pub(crate) fn take_projection_dirty( &mut self, ) -> Option<(ProjectionDirty, SimTime)>

Source

pub(crate) fn mark_aura_projection_dirty( &mut self, index: AuraProjectionDependencyIdx, )

Source

pub(crate) fn pop_aura_projection_dirty( &mut self, ) -> Option<AuraProjectionDependencyIdx>

Source

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

Source

pub(crate) fn clear_aura_projection_dirty(&mut self)

Source

pub(crate) fn clear_projection_dirty(&mut self)

Source§

impl CombatInstance

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, program: &CombatProgram, 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, at: SimTime, ) -> 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 spell_target_in_range( &self, program: &CombatProgram, spell: LocalSpellIdx, target: EnemyIdx, ) -> bool

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

Source

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

Source

pub(crate) fn spell_target_in_range_profile( &self, program: &CombatProgram, profile: &CastProfile, target: EnemyIdx, ) -> bool

Source

pub(crate) fn spell_target_in_range_profile_with_buffs( &self, program: &CombatProgram, profile: &CastProfile, target: EnemyIdx, ) -> bool

Source

pub(crate) fn spell_target_in_range_profile_with_maximum( &self, program: &CombatProgram, profile: &CastProfile, target: EnemyIdx, maximum: f64, ) -> bool

Source§

impl CombatInstance

Source

pub(crate) fn new( program: &CombatProgram, runtime: CombatRuntime, buffer: BoundDenseBuffer, ) -> Result<Self, EngineError>

Source

pub fn player_crit(&self) -> f64

Current player critical-strike chance in percentage points.

Source

pub fn rppm_tracker_count(&self) -> usize

Source

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

Trait Implementations§

Source§

impl Debug for CombatInstance

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
§

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

§

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