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: AuraProjectionDirtyImplementations§
Source§impl CombatInstance
impl CombatInstance
Sourcepub fn has_aura_state(
&self,
program: &CombatProgram,
actor: ActorId,
required: AuraState,
now: SimTime,
) -> bool
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
impl CombatInstance
pub fn schedule_movement_window( &mut self, program: &CombatProgram, actor: ActorId, starts_at: SimTime, duration: SimTime, )
pub fn movement_state(&self, actor: ActorId) -> MovementState
pub fn school_locked( &self, actor: ActorId, schools: SpellSchoolMask, now: SimTime, ) -> bool
pub(crate) fn school_lock_ready_at( &self, actor: ActorId, schools: SpellSchoolMask, now: SimTime, ) -> Option<SimTime>
pub(crate) fn begin_actor_cast(&mut self, actor: ActorId, active: ActiveCast)
Source§impl CombatInstance
impl CombatInstance
Sourcepub fn apply_crowd_control(
&mut self,
actor: ActorId,
kind: CrowdControlKind,
group: DiminishingGroup,
duration: SimTime,
now: SimTime,
) -> CrowdControlApplication
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.
pub(crate) fn apply_crowd_control_duration( &mut self, actor: ActorId, kind: CrowdControlKind, group: DiminishingGroup, duration: CrowdControlDuration, now: SimTime, ) -> CrowdControlApplication
pub(crate) fn actor_cast_blocked_by_control( &self, actor: ActorId, now: SimTime, ) -> bool
pub(crate) fn actor_control_ready_at( &self, actor: ActorId, now: SimTime, ) -> Option<SimTime>
fn actor_has_permanent_cast_control(&self, actor: ActorId) -> bool
Source§impl CombatInstance
impl CombatInstance
pub(crate) fn pop_first_active_aura_binding( &mut self, actor: ActorId, ) -> Option<ConcreteAuraBinding>
pub(crate) fn for_each_active_aura_intersection( &self, actor: ActorId, relevant: (&[u64], &[u64]), visit: impl FnMut(LocalAuraIdx, ConcreteAuraBinding), )
pub(crate) fn for_each_active_static_total_aura( &self, actor: ActorId, relevant: &[u64], visit: impl FnMut(LocalAuraIdx, ConcreteAuraBinding, u16), )
pub(crate) fn for_each_active_aura_local( &self, actor: ActorId, local: LocalAuraIdx, visit: impl FnMut(ConcreteAuraBinding), )
pub(crate) fn first_active_aura_intersection( &self, actor: ActorId, relevant: &[u64], ) -> Option<ConcreteAuraBinding>
pub(crate) fn actor_aura_revision(&self, actor: ActorId) -> Option<u64>
pub(crate) fn player_scaling_revision(&self) -> u64
pub(crate) fn cached_player_scaling_buffs( &self, revision: u64, ) -> Option<PlayerScalingBuffs>
pub(crate) fn cache_player_scaling_buffs( &self, revision: u64, buffs: PlayerScalingBuffs, )
pub(crate) fn cached_actor_buff_totals( &self, actor: ActorId, revision: u64, ) -> Option<BuffTotals>
pub(crate) fn cache_actor_buff_totals( &self, actor: ActorId, revision: u64, totals: &BuffTotals, )
pub(crate) fn cached_actor_only_buff_totals( &self, actor: ActorId, revision: u64, owner_revision: u64, ) -> Option<BuffTotals>
pub(crate) fn cache_actor_only_buff_totals( &self, actor: ActorId, revision: u64, owner_revision: u64, totals: &BuffTotals, )
Source§impl CombatInstance
impl CombatInstance
pub(crate) fn cached_damage_buff_projection( &self, actor: ActorId, key: DamageProjectionKey, ) -> Option<DamageBuffProjection>
pub(crate) fn cache_damage_buff_projection( &self, actor: ActorId, key: DamageProjectionKey, projection: DamageBuffProjection, )
Source§impl CombatInstance
impl CombatInstance
Sourcepub fn spec_runtime<T>(&self) -> Option<&T>where
T: SpecRuntime,
pub fn spec_runtime<T>(&self) -> Option<&T>where
T: SpecRuntime,
Downcast the mutable per-spec runtime state to T.
Sourcepub fn spec_runtime_mut<T>(&mut self) -> Option<&mut T>where
T: SpecRuntime,
pub fn spec_runtime_mut<T>(&mut self) -> Option<&mut T>where
T: SpecRuntime,
Mutable downcast of the per-spec runtime state to T.
Sourcepub fn set_spec_runtime<T>(&mut self, runtime: T)where
T: SpecRuntime,
pub fn set_spec_runtime<T>(&mut self, runtime: T)where
T: SpecRuntime,
Replace the resettable per-spec runtime state.
Source§impl CombatInstance
impl CombatInstance
pub fn enemy(&self, enemy: EnemyIdx) -> Option<&EnemyState>
Sourcepub fn enemy_max_health(
&self,
program: &CombatProgram,
enemy: EnemyIdx,
) -> Option<f64>
pub fn enemy_max_health( &self, program: &CombatProgram, enemy: EnemyIdx, ) -> Option<f64>
Canonical maximum health for an exact encounter enemy.
Sourcepub fn enemy_health(
&self,
program: &CombatProgram,
enemy: EnemyIdx,
now: SimTime,
) -> Option<f64>
pub fn enemy_health( &self, program: &CombatProgram, enemy: EnemyIdx, now: SimTime, ) -> Option<f64>
Canonical health for an exact encounter enemy at engine time now.
Sourcepub fn enemy_health_fraction(
&self,
program: &CombatProgram,
enemy: EnemyIdx,
now: SimTime,
) -> Option<f64>
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.
Sourcepub fn actor_health_fraction(
&self,
program: &CombatProgram,
actor: ActorId,
now: SimTime,
) -> Option<f64>
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.
pub fn enemies(&self) -> impl ExactSizeIterator<Item = &EnemyState>
Sourcepub fn active_enemy_count(&self) -> i32
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.
Sourcepub fn active_alive_enemy_count(&self) -> i32
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.
Sourcepub fn reset_enemies(&mut self, program: &CombatProgram)
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.
pub fn is_valid_target(&self, enemy: EnemyIdx) -> bool
pub const fn current_target(&self) -> Option<EnemyIdx>
pub const fn attack_position(&self) -> AttackPosition
pub fn set_attack_position(&mut self, position: AttackPosition, _at: SimTime)
Sourcepub fn retarget(
&mut self,
program: &CombatProgram,
at: SimTime,
) -> Option<EnemyIdx>
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.
pub fn activate_enemy(&mut self, enemy: EnemyIdx, at: SimTime) -> bool
pub fn refresh_enemy_health(&mut self, enemy: EnemyIdx, now: SimTime)
pub fn enemy_time_to_die(&self, enemy: EnemyIdx, now: SimTime) -> Option<f64>
Sourcepub fn apply_enemy_damage(
&mut self,
enemy: EnemyIdx,
amount: f64,
at: SimTime,
) -> Result<Option<BecameDead>, SpecRuntimeError>
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.
pub(crate) fn schedule_enemy_auto_attack( &mut self, source: EnemyIdx, target: ActorId, at: SimTime, )
pub(crate) fn grant_enemy_invulnerability( &mut self, target: EnemyIdx, until: SimTime, )
pub(crate) fn enemy_is_invulnerable( &self, target: EnemyIdx, now: SimTime, ) -> bool
pub(crate) fn enemy_auto_attack_is_current( &self, source: EnemyIdx, at: SimTime, ) -> bool
pub(crate) fn apply_enemy_parry_haste( &mut self, program: &CombatProgram, source: EnemyIdx, now: SimTime, )
pub(crate) fn enemy_belongs_to_pull( &self, program: &CombatProgram, enemy: EnemyIdx, pull: PullId, ) -> bool
pub(crate) fn transition_enemy_despawn( &mut self, enemy: EnemyIdx, at: SimTime, ) -> EnemyDespawnOutcome
pub(crate) fn finalize_scripted_enemy_death( &mut self, enemy: EnemyIdx, at: SimTime, ) -> Result<bool, SpecRuntimeError>
pub(super) fn enemy_mut(&mut self, enemy: EnemyIdx) -> Option<&mut EnemyState>
Source§impl CombatInstance
impl CombatInstance
pub fn schedule(&mut self, event: Event)
pub fn drain_events(&mut self) -> Drain<'_, Event>
pub(crate) fn record_runtime_error(&mut self, error: SpecRuntimeError)
pub(crate) const fn has_runtime_error(&self) -> bool
pub(crate) fn take_runtime_error(&mut self) -> Option<SpecRuntimeError>
Source§impl CombatInstance
impl CombatInstance
Sourcepub fn friendly_actor_health(&self, actor: ActorId) -> Option<f64>
pub fn friendly_actor_health(&self, actor: ActorId) -> Option<f64>
Current absolute health for a friendly actor.
Sourcepub fn friendly_actor_max_health(&self, actor: ActorId) -> Option<f64>
pub fn friendly_actor_max_health(&self, actor: ActorId) -> Option<f64>
Maximum absolute health for a friendly actor.
pub fn is_friendly_actor_alive(&self, actor: ActorId) -> bool
Sourcepub fn grant_friendly_immunity_window(&mut self, window: IncomingImmunityWindow)
pub fn grant_friendly_immunity_window(&mut self, window: IncomingImmunityWindow)
Adds a bounded friendly-actor immunity for encounter/raid-event orchestration.
pub(crate) fn set_friendly_actor_health_fraction( &mut self, actor: ActorId, fraction: f64, ) -> Option<f64>
pub(crate) fn apply_friendly_actor_damage( &mut self, actor: ActorId, amount: f64, ) -> Option<f64>
pub(crate) fn transition_friendly_actor_to_dead( &mut self, actor: ActorId, ) -> bool
pub(crate) fn apply_friendly_actor_heal( &mut self, actor: ActorId, amount: f64, ) -> Option<f64>
pub(crate) fn activate_pet_health( &mut self, actor: ActorId, maximum: f64, ) -> bool
pub(crate) fn deactivate_pet_health(&mut self, actor: ActorId) -> bool
Source§impl CombatInstance
impl CombatInstance
pub(crate) fn mark_projection_dirty( &mut self, dirty: ProjectionDirty, at: SimTime, )
pub(crate) fn take_projection_dirty( &mut self, ) -> Option<(ProjectionDirty, SimTime)>
pub(crate) fn mark_aura_projection_dirty( &mut self, index: AuraProjectionDependencyIdx, )
pub(crate) fn pop_aura_projection_dirty( &mut self, ) -> Option<AuraProjectionDependencyIdx>
pub(crate) const fn aura_projections_are_dirty(&self) -> bool
pub(crate) fn clear_aura_projection_dirty(&mut self)
pub(crate) fn clear_projection_dirty(&mut self)
Source§impl CombatInstance
impl CombatInstance
Sourcepub fn actor_transform(&self, actor: ActorId) -> Option<SpatialTransform>
pub fn actor_transform(&self, actor: ActorId) -> Option<SpatialTransform>
Live transform for a player/pet/enemy source. Pets use the owner’s player transform.
Sourcepub fn has_line_of_sight(
&self,
program: &CombatProgram,
source: ActorId,
target: EnemyIdx,
) -> bool
pub fn has_line_of_sight( &self, program: &CombatProgram, source: ActorId, target: EnemyIdx, ) -> bool
Visibility includes layer separation, explicit fixture blocks, and static obstacles.
Sourcepub fn relocate_actor(
&mut self,
actor: PositionedActorRef,
transform: SpatialTransform,
at: SimTime,
) -> Result<(), SpatialQueryError>
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.
Sourcepub fn spell_target_in_range(
&self,
program: &CombatProgram,
spell: LocalSpellIdx,
target: EnemyIdx,
) -> bool
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.
pub(crate) fn spatial_query(&self) -> &dyn SpatialQuery
pub(crate) fn spell_target_in_range_profile( &self, program: &CombatProgram, profile: &CastProfile, target: EnemyIdx, ) -> bool
pub(crate) fn spell_target_in_range_profile_with_buffs( &self, program: &CombatProgram, profile: &CastProfile, target: EnemyIdx, ) -> bool
pub(crate) fn spell_target_in_range_profile_with_maximum( &self, program: &CombatProgram, profile: &CastProfile, target: EnemyIdx, maximum: f64, ) -> bool
Source§impl CombatInstance
impl CombatInstance
pub(crate) fn new( program: &CombatProgram, runtime: CombatRuntime, buffer: BoundDenseBuffer, ) -> Result<Self, EngineError>
Sourcepub fn player_crit(&self) -> f64
pub fn player_crit(&self) -> f64
Current player critical-strike chance in percentage points.
pub fn rppm_tracker_count(&self) -> usize
pub fn rppm_tracker(&self, tracker: LocalRppmIdx) -> Option<&RppmTracker>
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for CombatInstance
impl !RefUnwindSafe for CombatInstance
impl Send for CombatInstance
impl !Sync for CombatInstance
impl Unpin for CombatInstance
impl UnsafeUnpin for CombatInstance
impl !UnwindSafe for CombatInstance
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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