pub struct CombatHandler {
pub(crate) program: CombatProgram,
pub(crate) instance: CombatInstance,
pub(crate) engine: RotationEngine,
pub(crate) rng: SimRng,
pub(crate) rng_seeded: bool,
pub(crate) last_resource_sync: SimTime,
}Fields§
§program: CombatProgram§instance: CombatInstance§engine: RotationEngine§rng: SimRng§rng_seeded: boolGuards against a roll reaching the placeholder RNG before on_sim_start installs the real seed.
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, buff: ExternalBuffBinding, 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: ScheduledSpellBinding, source: ActorId, target: ActorId, ctx: &mut SimContext<'_>, )
pub(super) fn on_spell_impact_impl( &mut self, impact: PendingImpactBinding, ctx: &mut SimContext<'_>, )
pub(super) fn on_spell_launch_impl( &mut self, impact: PendingImpactBinding, ctx: &mut SimContext<'_>, )
pub(super) fn on_channel_tick_impl( &mut self, spell: ScheduledSpellBinding, 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, spell: ScheduledSpellBinding, ctx: &mut SimContext<'_>, )
pub(super) fn cast_time_ms_impl( &self, spell: ScheduledSpellBinding, empower_rank: u8, ) -> u32
pub(super) fn cast_time_ms_for_candidate( &self, candidate: CastCandidate, 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: PendingImpactBinding, event: SpellTravelEvent, ctx: &mut SimContext<'_>, )
Source§impl CombatHandler
impl CombatHandler
pub(super) fn on_guardian_action_impl( &mut self, guardian: GuardianEventBinding, ctx: &mut SimContext<'_>, )
pub(super) fn on_guardian_expire_impl( &mut self, guardian: GuardianEventBinding, ctx: &mut SimContext<'_>, )
pub(super) fn on_pet_action_impl( &mut self, action: PetActionBinding, 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, event: RaidEventBinding, 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 initialize_precombat_state( &mut self, telemetry: &mut TelemetrySink, )
pub(super) fn initialize_periodic_drivers( &mut self, telemetry: &mut TelemetrySink, )
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 selected_candidate( &self, spell_id: u32, target: EnemyIdx, ) -> Option<CastCandidate>
fn readiness_deadlines(&self, now: SimTime) -> (SimTime, bool, SimTime)
fn rotation_decision_mode_at(&self, now: SimTime) -> RotationDecisionMode
fn next_rotation_action( &mut self, lock_mode: LockMode, now: SimTime, gcd_ready: SimTime, ) -> (Option<SpecAction>, Option<SimTime>)
fn next_gcd_locked_action( &mut self, now: SimTime, gcd_ready: SimTime, ) -> (Option<SpecAction>, Option<SimTime>)
fn gcd_queue_eligible_at(&self, gcd_ready: SimTime) -> SimTime
fn with_earlier_wake( action: SpecAction, locked_wake: Option<SimTime>, ) -> 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: HookTimerBinding, source: ActorId, target: Option<EnemyIdx>, ctx: &mut SimContext<'_>, )
Source§impl CombatHandler
impl CombatHandler
pub fn from_built(built: BuiltCombatSystem) -> Self
pub fn program(&self) -> HookProgramView<'_>
Sourcepub fn current_target(&self) -> Option<EnemyIdx>
pub fn current_target(&self) -> Option<EnemyIdx>
Current selected enemy, if the encounter has an eligible target.
Sourcepub fn spec_runtime<T>(&self) -> Option<&T>where
T: SpecRuntime,
pub fn spec_runtime<T>(&self) -> Option<&T>where
T: SpecRuntime,
Read the specialization-owned runtime without exposing the combat instance.
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>
pub(crate) fn evaluate_rotation_with_trace( &mut self, now: SimTime, trace_enabled: bool, ) -> Option<SpecAction>
Sourcepub(crate) fn evaluate_rotation_while_locked(
&mut self,
lock_mode: LockMode,
now: SimTime,
) -> Option<SpecAction>
pub(crate) fn evaluate_rotation_while_locked( &mut self, lock_mode: LockMode, now: SimTime, ) -> Option<SpecAction>
Evaluate a locked actor’s APL with actions that cannot execute through every active lock masked.
fn actor_is_ready_for_lazy_rotation(&self, now: SimTime) -> bool
fn evaluate_rotation_lazily(&mut self, now: SimTime) -> Option<SpecAction>
fn mask_lazy_candidate( &mut self, binding: RotationSpellBinding, masked: &mut Vec<(SpellSlotHandle, i32)>, ) -> bool
fn exact_rotation_decision_horizon(&mut self, now: SimTime) -> Option<SimTime>
Sourcefn log_mask_transitions(
&mut self,
now: SimTime,
masked_reasons: Option<&[(u32, CastReject)]>,
trace_enabled: bool,
)
fn log_mask_transitions( &mut self, now: SimTime, masked_reasons: Option<&[(u32, CastReject)]>, trace_enabled: bool, )
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_compiled_rotation(&mut self, now: SimTime) -> EvalResult
fn resolve_rotation_result( &mut self, now: SimTime, result: EvalResult, decision_horizon: Option<SimTime>, ) -> Option<SpecAction>
fn resolve_cast_result( &mut self, now: SimTime, result: EvalResult, decision_horizon: Option<SimTime>, ) -> Option<SpecAction>
fn rotation_fallthrough( &self, _now: SimTime, decision_horizon: Option<SimTime>, ) -> Option<SpecAction>
Trait Implementations§
Source§impl Debug for CombatHandler
impl Debug for CombatHandler
Source§impl SpecHandler for CombatHandler
impl SpecHandler for CombatHandler
Source§fn install_target_metadata(&self, sink: &mut TelemetrySink)
fn install_target_metadata(&self, sink: &mut TelemetrySink)
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: ScheduledSpellBinding, source: ActorId, target: ActorId, ctx: &mut SimContext<'_>, )
fn on_spell_impact( &mut self, impact: PendingImpactBinding, ctx: &mut SimContext<'_>, )
fn on_spell_launch( &mut self, impact: PendingImpactBinding, ctx: &mut SimContext<'_>, )
fn on_guardian_action( &mut self, guardian: GuardianEventBinding, ctx: &mut SimContext<'_>, )
fn on_guardian_expire( &mut self, guardian: GuardianEventBinding, ctx: &mut SimContext<'_>, )
fn on_pet_action(&mut self, action: PetActionBinding, ctx: &mut SimContext<'_>)
fn on_aura_tick(&mut self, event: AuraEventRef, ctx: &mut SimContext<'_>)
fn on_channel_tick( &mut self, spell: ScheduledSpellBinding, 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
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<'_>)
Source§fn encounter_termination_time(&self) -> Option<SimTime>
fn encounter_termination_time(&self) -> Option<SimTime>
Source§fn on_hook_timer(
&mut self,
timer: HookTimerBinding,
source: ActorId,
target: Option<EnemyIdx>,
ctx: &mut SimContext<'_>,
)
fn on_hook_timer( &mut self, timer: HookTimerBinding, source: ActorId, target: Option<EnemyIdx>, ctx: &mut SimContext<'_>, )
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, movement: ActorMovementBinding, moving: bool, ctx: &mut SimContext<'_>, )
fn on_raid_event(&mut self, event: RaidEventBinding, ctx: &mut SimContext<'_>)
fn on_raid_add_despawn(&mut self, add: RaidAddBinding, ctx: &mut SimContext<'_>)
fn on_external_buff( &mut self, buff: ExternalBuffBinding, ctx: &mut SimContext<'_>, )
fn on_cooldown_ready( &mut self, spell: ScheduledSpellBinding, 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>
fn total_damage(&self) -> f64
Source§fn cast_time_ms(&self, spell: ScheduledSpellBinding, empower_rank: u8) -> u32
fn cast_time_ms(&self, spell: ScheduledSpellBinding, empower_rank: u8) -> u32
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
§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