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: SpatialQueryHandleImplementations§
Source§impl CombatState
impl CombatState
Sourcepub fn has_aura_state(
&self,
buf: &DenseBuffer,
actor: ActorId,
required: AuraState,
now: SimTime,
) -> bool
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
impl CombatState
pub fn begin_actor_cast( &mut self, actor: ActorId, spell_id: SpellIdx, schools: SpellSchoolMask, ends_at: SimTime, interruptible: bool, )
pub fn schedule_movement_window( &mut self, 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 begin_player_cast( &mut self, spell_id: SpellIdx, schools: SpellSchoolMask, ends_at: SimTime, empower_rank: u8, target: EnemyIdx, )
Source§impl CombatState
impl CombatState
Sourcepub fn spec_config<T>(&self) -> Option<&T>where
T: SpecConfig,
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.
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_config<T>(&mut self, config: T)where
T: SpecConfig,
pub fn set_spec_config<T>(&mut self, config: T)where
T: SpecConfig,
Replace the immutable per-spec configuration.
Sourcepub fn bug_enabled(&self, bug: &GameBug) -> bool
pub fn bug_enabled(&self, bug: &GameBug) -> bool
Whether a registered live-game bug is modeled in this run.
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 CombatState
impl CombatState
pub fn enemy_definition(&self, enemy: EnemyIdx) -> Option<&EnemyActorDefinition>
pub fn enemy(&self, enemy: EnemyIdx) -> Option<&EnemyState>
Sourcepub fn enemy_max_health(&self, enemy: EnemyIdx) -> Option<f64>
pub fn enemy_max_health(&self, enemy: EnemyIdx) -> Option<f64>
Canonical maximum health for an exact encounter enemy.
Sourcepub fn enemy_health(&self, enemy: EnemyIdx, now: SimTime) -> Option<f64>
pub fn enemy_health(&self, enemy: EnemyIdx, now: SimTime) -> Option<f64>
Canonical health for an exact encounter enemy at engine time now.
Sourcepub fn enemy_health_fraction(
&self,
enemy: EnemyIdx,
now: SimTime,
) -> Option<f64>
pub fn enemy_health_fraction( &self, enemy: EnemyIdx, now: SimTime, ) -> Option<f64>
Canonical health fraction for an exact encounter enemy at engine time now.
Sourcepub fn actor_health_fraction(&self, actor: ActorId, now: SimTime) -> Option<f64>
pub fn actor_health_fraction(&self, actor: ActorId, now: SimTime) -> Option<f64>
Canonical live health fraction for any actor addressable by combat effects.
pub fn enemy_definitions( &self, ) -> impl ExactSizeIterator<Item = &EnemyActorDefinition>
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)
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.
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 const fn set_attack_position(&mut self, position: AttackPosition)
Sourcepub fn retarget(&mut self) -> Option<EnemyIdx>
pub fn retarget(&mut self) -> 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, source: EnemyIdx, now: SimTime)
pub(crate) fn enemy_belongs_to_pull( &self, 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 CombatState
impl CombatState
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 CombatState
impl CombatState
pub fn spell_local(&self, spell_id: u32) -> Option<LocalSpellIdx>
pub fn aura_local(&self, aura_id: u32) -> Option<LocalAuraIdx>
pub fn item_rppm_local(&self, item_id: u32) -> Option<LocalRppmIdx>
pub fn system_rppm_local(&self, driver_spell_id: u32) -> Option<LocalRppmIdx>
pub fn enchant_rppm_local(&self, enchantment_id: u32) -> Option<LocalRppmIdx>
pub fn enchant_buff_spell_id(&self, enchantment_id: u32) -> Option<u32>
pub fn spell_data(&self, spell_id: u32) -> Option<(LocalSpellIdx, &SpellData)>
pub fn spell(&self, local: LocalSpellIdx) -> &SpellData
pub fn spells(&self) -> &[SpellData]
pub fn aura(&self, local: LocalAuraIdx) -> &AuraData
pub fn auras(&self) -> &[AuraData]
pub fn precombat_auras(&self) -> &[LocalAuraIdx]
pub fn talent_aura_stacks(&self) -> &[(LocalAuraIdx, u8)]
pub fn rppm_tracker(&self, tracker: LocalRppmIdx) -> Option<&RppmTracker>
Source§impl CombatState
impl CombatState
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>
pub(crate) fn aura_local_for_key(&self, key: AuraKey) -> Option<LocalAuraIdx>
Source§impl CombatState
impl CombatState
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, source: ActorId, target: EnemyIdx) -> bool
pub fn has_line_of_sight(&self, 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,
) -> Result<(), SpatialQueryError>
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.
pub fn spatial_query(&self) -> &dyn SpatialQuery
Sourcepub fn spell_target_in_range(
&self,
spell_id: SpellIdx,
target: EnemyIdx,
) -> bool
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.
pub(crate) fn spell_target_in_range_with_buffs( &self, buf: &DenseBuffer, spell_id: SpellIdx, target: EnemyIdx, ) -> bool
fn spell_target_in_range_with_maximum( &self, spell_id: SpellIdx, target: EnemyIdx, maximum: f64, ) -> bool
Source§impl CombatState
impl CombatState
Sourcepub fn telemetry_scope(
&self,
source: ActorId,
target: EnemyIdx,
) -> Option<TelemetryScope>
pub fn telemetry_scope( &self, source: ActorId, target: EnemyIdx, ) -> Option<TelemetryScope>
Exact source/target ownership scope for telemetry emitted against target.
Sourcepub fn telemetry_targets(&self) -> Vec<TargetMetadata>
pub fn telemetry_targets(&self) -> Vec<TargetMetadata>
Deterministic target dictionary in immutable encounter identity order.
Sourcepub fn aura_telemetry_scope(&self, key: AuraKey) -> AuraTelemetryScope
pub fn aura_telemetry_scope(&self, key: AuraKey) -> AuraTelemetryScope
Pull/group ownership for an exact aura instance.
Source§impl CombatState
impl CombatState
pub(crate) fn new( defs: CombatDefs, index: CombatIndex, runtime: CombatRuntime, config: CombatConfig, ) -> Result<Self, EngineError>
Source§impl CombatState
impl CombatState
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
fn crowd_control_active( &self, actor: ActorId, kind: CrowdControlKind, now: SimTime, ) -> bool
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CombatState
impl !RefUnwindSafe for CombatState
impl Send for CombatState
impl !Sync for CombatState
impl Unpin for CombatState
impl UnsafeUnpin for CombatState
impl !UnwindSafe for CombatState
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