pub struct CombatHandler {
pub(crate) state: CombatState,
pub(crate) buf: DenseBuffer,
pub(crate) engine: RotationEngine,
pub(crate) rng: SimRng,
pub(crate) rng_seeded: bool,
pub(crate) names: Vec<Box<str>>,
pub(crate) last_resource_sync: SimTime,
}Fields§
§state: CombatState§buf: DenseBuffer§engine: RotationEngine§rng: SimRng§rng_seeded: boolGuards against a roll reaching the placeholder RNG before on_sim_start installs the real seed.
names: Vec<Box<str>>§last_resource_sync: SimTimeImplementations§
Source§impl CombatHandler
impl CombatHandler
pub(in handler) fn emit_enemy_lifecycle( &self, sink: &mut TelemetrySink, kind: EncounterTelemetryEventKind, target: EnemyIdx, now: SimTime, transform: Option<SpatialTransform>, )
pub(in handler) fn handle_encounter_death( &mut self, target: EnemyIdx, scope: DeathEventScope, now: SimTime, telemetry: &mut TelemetrySink, )
pub(in handler) fn handle_encounter_despawn( &mut self, pull: PullId, epoch: u32, target: EnemyIdx, kind: EncounterDespawnKind, ctx: &mut SimContext<'_>, )
pub(in handler) fn handle_group_completion( &mut self, pull: PullId, epoch: u32, group: GroupId, now: SimTime, )
pub(in handler) fn handle_pull_completion( &mut self, pull: PullId, epoch: u32, finalize: bool, ctx: &mut SimContext<'_>, )
pub(in handler) fn mark_encounter_terminated( &mut self, now: SimTime, )
pub(in handler) fn record_encounter_stalled( &mut self, )
pub(super) fn accepts_death_scope(&self, scope: DeathEventScope) -> bool
pub(super) fn accepts_death_target(&self, target: EnemyIdx) -> bool
pub(super) fn on_despawn_transition( &mut self, target: EnemyIdx, ctx: &mut SimContext<'_>, ) -> EnemyDespawnOutcome
pub(super) fn maybe_schedule_group_completion( &mut self, enemy: EnemyIdx, now: SimTime, )
pub(super) fn active_pull_required_groups_complete(&self) -> bool
pub(super) fn all_required_groups_complete(&self) -> bool
pub(super) fn all_required_enemies_dead(&self) -> bool
pub(super) fn record_script_error(&mut self, pull: PullId, message: String)
Source§impl CombatHandler
impl CombatHandler
pub(in handler) fn handle_raid_event( &mut self, index: usize, ctx: &mut SimContext<'_>, )
pub(in handler) fn handle_external_buff( &mut self, index: usize, ctx: &mut SimContext<'_>, )
pub(in handler) fn handle_raid_add_despawn( &mut self, target: EnemyIdx, activation_generation: u64, encounter_generation: PullLifecycleGeneration, ctx: &mut SimContext<'_>, )
pub(super) fn handle_raid_add_event( &mut self, raw_target: usize, duration: SimTime, ctx: &mut SimContext<'_>, )
Source§impl CombatHandler
impl CombatHandler
pub(super) fn apply_player_reset( &mut self, flags: PlayerResetFlags, next_pull: PullId, now: SimTime, ctx: &mut SimContext<'_>, ) -> bool
Source§impl CombatHandler
impl CombatHandler
pub(in handler) fn schedule_encounter_start( &mut self, )
pub(in handler) fn schedule_run_timed_events( &mut self, )
pub(in handler) fn handle_wave_activation( &mut self, pull: PullId, epoch: u32, wave: WaveId, now: SimTime, )
pub(in handler) fn handle_enemy_activation( &mut self, pull: PullId, epoch: u32, target: EnemyIdx, ctx: &mut SimContext<'_>, )
pub(in handler) fn handle_retarget( &mut self, pull: PullId, epoch: u32, ctx: &mut SimContext<'_>, )
pub(in handler) fn handle_movement( &mut self, pull: PullId, epoch: u32, actor: PositionedActorRef, transform: SpatialTransform, ctx: &mut SimContext<'_>, )
pub(super) fn schedule_pull_timeline( &mut self, pull_id: PullId, epoch: u32, started_at: SimTime, initial: bool, )
pub(super) fn schedule_wave_enemies( &mut self, pull: PullId, epoch: u32, wave: WaveId, pull_started_at: SimTime, ready_at: SimTime, )
pub(super) fn schedule_scripted_death( &mut self, enemy: EnemyIdx, activated_at: SimTime, generation: PullLifecycleGeneration, )
pub(super) fn schedule_newly_ready_waves( &mut self, pull: PullId, epoch: u32, now: SimTime, )
pub(super) fn apply_pending_target_precombat( &mut self, now: SimTime, telemetry: &mut TelemetrySink, )
pub(super) fn schedule_retarget(&mut self, now: SimTime)
pub(super) fn schedule_forced_optional_despawns( &mut self, pull: PullId, epoch: u32, now: SimTime, )
Source§impl CombatHandler
impl CombatHandler
pub(super) fn on_aura_tick_impl( &mut self, event: AuraEventRef, ctx: &mut SimContext<'_>, )
pub(super) fn on_aura_expire_impl( &mut self, event: AuraEventRef, ctx: &mut SimContext<'_>, )
pub(super) fn on_external_buff_impl( &mut self, index: usize, ctx: &mut SimContext<'_>, )
Source§impl CombatHandler
impl CombatHandler
pub(super) fn on_cast_complete_impl( &mut self, event: Event, ctx: &mut SimContext<'_>, )
pub(super) fn on_triggered_spell_impl( &mut self, spell_id: SpellIdx, source: ActorId, target: ActorId, ctx: &mut SimContext<'_>, )
pub(super) fn on_spell_impact_impl( &mut self, impact_id: u32, ctx: &mut SimContext<'_>, )
pub(super) fn on_spell_launch_impl( &mut self, impact_id: u32, ctx: &mut SimContext<'_>, )
pub(super) fn on_channel_tick_impl( &mut self, spell_id: SpellIdx, source: ActorId, target: EnemyIdx, generation: u64, ctx: &mut SimContext<'_>, )
pub(super) fn on_actor_movement_impl( &mut self, actor: ActorId, moving: bool, generation: u64, ctx: &mut SimContext<'_>, )
pub(super) fn on_cooldown_ready_impl( &mut self, _cooldown_key: SpellIdx, ctx: &mut SimContext<'_>, )
pub(super) fn cast_time_ms_impl( &self, spell_id: SpellIdx, empower_rank: u8, ) -> u32
pub(super) fn break_player_action_auras( &mut self, target: EnemyIdx, now: SimTime, telemetry: &mut TelemetrySink, )
fn process_spell_travel_event( &mut self, impact_id: u32, event: SpellTravelEvent, ctx: &mut SimContext<'_>, )
Source§impl CombatHandler
impl CombatHandler
pub(super) fn on_guardian_action_impl( &mut self, guardian_id: u32, guardian_generation: u32, ability_index: usize, ctx: &mut SimContext<'_>, )
pub(super) fn on_guardian_expire_impl( &mut self, guardian_id: u32, guardian_generation: u32, ctx: &mut SimContext<'_>, )
pub(super) fn on_pet_action_impl( &mut self, auto_attack_index: usize, ctx: &mut SimContext<'_>, )
pub(super) fn on_proc_heartbeat_impl(&mut self, ctx: &mut SimContext<'_>)
pub(super) fn on_auto_attack_impl( &mut self, source: ActorId, target: EnemyIdx, ctx: &mut SimContext<'_>, )
pub(super) fn on_enemy_auto_attack_impl( &mut self, source: EnemyIdx, target: ActorId, ctx: &mut SimContext<'_>, )
Source§impl CombatHandler
impl CombatHandler
pub(super) fn on_death_impl( &mut self, target: EnemyIdx, scope: DeathEventScope, ctx: &mut SimContext<'_>, )
pub(super) fn on_despawn_impl( &mut self, target: EnemyIdx, ctx: &mut SimContext<'_>, ) -> EnemyDespawnOutcome
pub(super) fn on_encounter_despawn_impl( &mut self, scope: PullScope, target: EnemyIdx, kind: EncounterDespawnKind, ctx: &mut SimContext<'_>, )
pub(super) fn on_group_complete_impl( &mut self, scope: PullScope, group: GroupId, ctx: &mut SimContext<'_>, )
pub(super) fn on_pull_complete_impl( &mut self, scope: PullScope, finalize: bool, ctx: &mut SimContext<'_>, )
pub(super) fn on_encounter_terminate_impl( &mut self, _reason: EncounterTerminationReason, ctx: &mut SimContext<'_>, )
pub(super) fn on_wave_activate_impl( &mut self, scope: PullScope, wave: WaveId, ctx: &mut SimContext<'_>, )
pub(super) fn on_enemy_activate_impl( &mut self, scope: PullScope, target: EnemyIdx, ctx: &mut SimContext<'_>, )
pub(super) fn on_retarget_impl( &mut self, scope: PullScope, ctx: &mut SimContext<'_>, )
pub(super) fn on_encounter_move_impl( &mut self, scope: PullScope, actor: PositionedActorRef, transform: SpatialTransform, ctx: &mut SimContext<'_>, )
pub(super) fn on_raid_event_impl( &mut self, index: usize, ctx: &mut SimContext<'_>, )
pub(super) fn on_raid_add_despawn_impl( &mut self, target: EnemyIdx, activation_generation: u64, encounter_generation: PullLifecycleGeneration, ctx: &mut SimContext<'_>, )
pub(crate) fn cleanup_inactive_enemy_effects( &mut self, target: EnemyIdx, now: SimTime, telemetry: &mut TelemetrySink, )
pub(super) fn cleanup_inactive_enemy( &mut self, target: EnemyIdx, now: SimTime, telemetry: &mut TelemetrySink, )
fn terminate_channel_targeting(&mut self, target: EnemyIdx, now: SimTime)
Source§impl CombatHandler
impl CombatHandler
pub(super) fn introspect_impl(&self) -> SpecIntrospection
pub(super) fn attach_decision_trace_impl( &mut self, sink: Arc<dyn DecisionTraceSink>, )
pub(super) fn paperdoll_impl(&self) -> Paperdoll
Source§impl CombatHandler
impl CombatHandler
pub(super) fn on_sim_start_impl(&mut self, ctx: &mut SimContext<'_>)
pub(super) fn on_player_ready_impl( &mut self, ctx: &mut SimContext<'_>, ) -> Option<SpecAction>
pub(super) fn on_event_queue_empty_impl(&mut self, _ctx: &mut SimContext<'_>)
pub(super) fn encounter_termination_time_impl(&self) -> Option<SimTime>
pub(super) fn flush_scheduled_impl(&mut self, push: &mut dyn FnMut(Event))
pub(super) fn take_runtime_error_impl(&mut self) -> Option<SpecRuntimeError>
pub(super) fn reset_impl(&mut self)
pub(super) fn total_damage_impl(&self) -> f64
fn schedule_initial_enemy_auto_attacks(&mut self, now: SimTime)
fn live_player(&self) -> Option<()>
fn prepare_player_ready( &mut self, now: SimTime, telemetry: &mut TelemetrySink, ) -> Option<()>
fn cast_readiness_properties(&self, spell_id: u32) -> (bool, bool)
fn readiness_deadlines(&self, now: SimTime) -> (SimTime, bool, SimTime)
fn next_rotation_action( &mut self, cast_active: bool, now: SimTime, ) -> Option<SpecAction>
fn gcd_queue_gate( &self, now: SimTime, gcd_ready: SimTime, is_off_gcd: bool, ) -> Option<SpecAction>
Source§impl CombatHandler
impl CombatHandler
pub(super) fn on_hook_timer_impl( &mut self, timer_id: u32, source: ActorId, target: Option<EnemyIdx>, ctx: &mut SimContext<'_>, )
Source§impl CombatHandler
impl CombatHandler
pub fn from_built(built: BuiltCombatSystem) -> Self
pub fn state(&self) -> &CombatState
pub fn state_mut(&mut self) -> &mut CombatState
pub fn buf_mut(&mut self) -> &mut DenseBuffer
pub fn state_and_buf_mut(&mut self) -> (&mut CombatState, &mut DenseBuffer)
Sourcepub fn with_combat_ctx<R>(
&mut self,
sink: &mut TelemetrySink,
request: CombatCtxRequest,
apply: impl FnOnce(&mut CombatCtx<'_>) -> R,
) -> R
pub fn with_combat_ctx<R>( &mut self, sink: &mut TelemetrySink, request: CombatCtxRequest, apply: impl FnOnce(&mut CombatCtx<'_>) -> R, ) -> R
Runs an operation with a combat context borrowing this handler’s runtime state.
Sourcepub fn with_hook_ctx<R>(
&mut self,
sink: &mut TelemetrySink,
request: HookCtxRequest,
apply: impl FnOnce(&mut HookCtx<'_>) -> R,
) -> R
pub fn with_hook_ctx<R>( &mut self, sink: &mut TelemetrySink, request: HookCtxRequest, apply: impl FnOnce(&mut HookCtx<'_>) -> R, ) -> R
Runs an operation with a hook context borrowing this handler’s runtime state.
pub(crate) fn assert_rng_seeded(&self)
pub(crate) fn evaluate_rotation(&mut self, now: SimTime) -> Option<SpecAction>
Sourcepub(crate) fn evaluate_rotation_while_casting(
&mut self,
now: SimTime,
) -> Option<SpecAction>
pub(crate) fn evaluate_rotation_while_casting( &mut self, now: SimTime, ) -> Option<SpecAction>
Evaluate a busy actor’s APL with ordinary spells masked so a usable_while_casting action can surface.
Sourcefn log_mask_transitions(
&mut self,
now: SimTime,
masked_reasons: &[(u32, CastReject)],
)
fn log_mask_transitions( &mut self, now: SimTime, masked_reasons: &[(u32, CastReject)], )
Trace each change in why a spell is masked out of rotation evaluation.
REJECT_CANCAST only fires for the spell the rotation actually selected.
A spell that is unavailable all fight therefore never appears in a trace.
A BUFFER_STATE dump reads is_enabled = 0 for it, because it is taken after this pre-pass.
This is the only place the real mask reason is observable.
fn evaluate_rotation_unmasked( &mut self, now: SimTime, masked_reasons: &[(u32, CastReject)], ) -> Option<SpecAction>
Trait Implementations§
Source§impl Debug for CombatHandler
impl Debug for CombatHandler
Source§impl SpecHandler for CombatHandler
impl SpecHandler for CombatHandler
fn on_sim_start(&mut self, ctx: &mut SimContext<'_>)
fn on_player_ready(&mut self, ctx: &mut SimContext<'_>) -> Option<SpecAction>
fn on_cast_complete(&mut self, event: Event, ctx: &mut SimContext<'_>)
fn on_triggered_spell( &mut self, spell_id: SpellIdx, source: ActorId, target: ActorId, ctx: &mut SimContext<'_>, )
fn on_spell_impact(&mut self, impact_id: u32, ctx: &mut SimContext<'_>)
fn on_spell_launch(&mut self, impact_id: u32, ctx: &mut SimContext<'_>)
fn on_guardian_action( &mut self, guardian_id: u32, guardian_generation: u32, ability_index: usize, ctx: &mut SimContext<'_>, )
fn on_guardian_expire( &mut self, guardian_id: u32, guardian_generation: u32, ctx: &mut SimContext<'_>, )
fn on_pet_action(&mut self, auto_attack_index: usize, ctx: &mut SimContext<'_>)
fn on_aura_tick(&mut self, event: AuraEventRef, ctx: &mut SimContext<'_>)
fn on_channel_tick( &mut self, spell_id: SpellIdx, source: ActorId, target: EnemyIdx, generation: u64, ctx: &mut SimContext<'_>, )
fn on_aura_expire(&mut self, event: AuraEventRef, ctx: &mut SimContext<'_>)
fn on_proc_heartbeat(&mut self, ctx: &mut SimContext<'_>)
fn on_death( &mut self, target: EnemyIdx, scope: DeathEventScope, ctx: &mut SimContext<'_>, )
Source§fn on_despawn(
&mut self,
target: EnemyIdx,
ctx: &mut SimContext<'_>,
) -> EnemyDespawnOutcome
fn on_despawn( &mut self, target: EnemyIdx, ctx: &mut SimContext<'_>, ) -> EnemyDespawnOutcome
Despawn an enemy through the canonical combat cleanup boundary.
fn on_encounter_despawn( &mut self, scope: PullScope, target: EnemyIdx, kind: EncounterDespawnKind, ctx: &mut SimContext<'_>, )
fn on_group_complete( &mut self, scope: PullScope, group: GroupId, ctx: &mut SimContext<'_>, )
fn on_pull_complete( &mut self, scope: PullScope, finalize: bool, ctx: &mut SimContext<'_>, )
fn on_encounter_terminate( &mut self, reason: EncounterTerminationReason, ctx: &mut SimContext<'_>, )
fn on_wave_activate( &mut self, scope: PullScope, wave: WaveId, ctx: &mut SimContext<'_>, )
fn on_enemy_activate( &mut self, scope: PullScope, target: EnemyIdx, ctx: &mut SimContext<'_>, )
fn on_retarget(&mut self, scope: PullScope, ctx: &mut SimContext<'_>)
fn on_encounter_move( &mut self, scope: PullScope, actor: PositionedActorRef, transform: SpatialTransform, ctx: &mut SimContext<'_>, )
Source§fn on_event_queue_empty(&mut self, ctx: &mut SimContext<'_>)
fn on_event_queue_empty(&mut self, ctx: &mut SimContext<'_>)
Called only when the shared event queue is empty.
Source§fn encounter_termination_time(&self) -> Option<SimTime>
fn encounter_termination_time(&self) -> Option<SimTime>
Exact termination timestamp once the encounter policy is satisfied.
Source§fn on_hook_timer(
&mut self,
timer_id: u32,
source: ActorId,
target: Option<EnemyIdx>,
ctx: &mut SimContext<'_>,
)
fn on_hook_timer( &mut self, timer_id: u32, source: ActorId, target: Option<EnemyIdx>, ctx: &mut SimContext<'_>, )
A
HookTimer scheduled via the combat layer’s schedule_hook came due.fn on_auto_attack( &mut self, source: ActorId, target: EnemyIdx, ctx: &mut SimContext<'_>, )
fn on_enemy_auto_attack( &mut self, source: EnemyIdx, target: ActorId, ctx: &mut SimContext<'_>, )
fn on_actor_movement( &mut self, actor: ActorId, moving: bool, generation: u64, ctx: &mut SimContext<'_>, )
fn on_raid_event(&mut self, index: usize, ctx: &mut SimContext<'_>)
fn on_raid_add_despawn( &mut self, target: EnemyIdx, activation_generation: u64, encounter_generation: PullLifecycleGeneration, ctx: &mut SimContext<'_>, )
fn on_external_buff(&mut self, index: usize, ctx: &mut SimContext<'_>)
fn on_cooldown_ready( &mut self, cooldown_key: SpellIdx, ctx: &mut SimContext<'_>, )
fn flush_scheduled(&mut self, push: &mut dyn FnMut(Event))
Source§fn take_runtime_error(&mut self) -> Option<SpecRuntimeError>
fn take_runtime_error(&mut self) -> Option<SpecRuntimeError>
Take a fatal event-processing failure, if the handler recorded one.
fn total_damage(&self) -> f64
Source§fn cast_time_ms(&self, spell_id: SpellIdx, empower_rank: u8) -> u32
fn cast_time_ms(&self, spell_id: SpellIdx, empower_rank: u8) -> u32
Cast time in milliseconds; 0 for instants.
fn introspect(&self) -> SpecIntrospection
fn attach_decision_trace(&mut self, sink: Arc<dyn DecisionTraceSink>)
fn paperdoll(&self) -> Option<Paperdoll>
Auto Trait Implementations§
impl Freeze for CombatHandler
impl !RefUnwindSafe for CombatHandler
impl Send for CombatHandler
impl !Sync for CombatHandler
impl Unpin for CombatHandler
impl UnsafeUnpin for CombatHandler
impl !UnwindSafe for CombatHandler
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
Mutably borrows from an owned value. Read more
§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>
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 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>
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