Skip to main content

CombatHandler

Struct CombatHandler 

Source
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: bool

Guards against a roll reaching the placeholder RNG before on_sim_start installs the real seed.

§names: Vec<Box<str>>§last_resource_sync: SimTime

Implementations§

Source§

impl CombatHandler

Source

pub(in handler) fn emit_enemy_lifecycle( &self, sink: &mut TelemetrySink, kind: EncounterTelemetryEventKind, target: EnemyIdx, now: SimTime, transform: Option<SpatialTransform>, )

Source

pub(in handler) fn handle_encounter_death( &mut self, target: EnemyIdx, scope: DeathEventScope, now: SimTime, telemetry: &mut TelemetrySink, )

Source

pub(in handler) fn handle_encounter_despawn( &mut self, pull: PullId, epoch: u32, target: EnemyIdx, kind: EncounterDespawnKind, ctx: &mut SimContext<'_>, )

Source

pub(in handler) fn handle_group_completion( &mut self, pull: PullId, epoch: u32, group: GroupId, now: SimTime, )

Source

pub(in handler) fn handle_pull_completion( &mut self, pull: PullId, epoch: u32, finalize: bool, ctx: &mut SimContext<'_>, )

Source

pub(in handler) fn mark_encounter_terminated( &mut self, now: SimTime, )

Source

pub(in handler) fn record_encounter_stalled( &mut self, )

Source

pub(super) fn accepts_death_scope(&self, scope: DeathEventScope) -> bool

Source

pub(super) fn accepts_death_target(&self, target: EnemyIdx) -> bool

Source

pub(super) fn on_despawn_transition( &mut self, target: EnemyIdx, ctx: &mut SimContext<'_>, ) -> EnemyDespawnOutcome

Source

pub(super) fn maybe_schedule_group_completion( &mut self, enemy: EnemyIdx, now: SimTime, )

Source

pub(super) fn active_pull_required_groups_complete(&self) -> bool

Source

pub(super) fn all_required_groups_complete(&self) -> bool

Source

pub(super) fn all_required_enemies_dead(&self) -> bool

Source

pub(super) fn record_script_error(&mut self, pull: PullId, message: String)

Source§

impl CombatHandler

Source

pub(in handler) fn handle_raid_event( &mut self, index: usize, ctx: &mut SimContext<'_>, )

Source

pub(in handler) fn handle_external_buff( &mut self, index: usize, ctx: &mut SimContext<'_>, )

Source

pub(in handler) fn handle_raid_add_despawn( &mut self, target: EnemyIdx, activation_generation: u64, encounter_generation: PullLifecycleGeneration, ctx: &mut SimContext<'_>, )

Source

pub(super) fn handle_raid_add_event( &mut self, raw_target: usize, duration: SimTime, ctx: &mut SimContext<'_>, )

Source§

impl CombatHandler

Source

pub(super) fn apply_player_reset( &mut self, flags: PlayerResetFlags, next_pull: PullId, now: SimTime, ctx: &mut SimContext<'_>, ) -> bool

Source§

impl CombatHandler

Source

pub(in handler) fn schedule_encounter_start( &mut self, )

Source

pub(in handler) fn schedule_run_timed_events( &mut self, )

Source

pub(in handler) fn handle_wave_activation( &mut self, pull: PullId, epoch: u32, wave: WaveId, now: SimTime, )

Source

pub(in handler) fn handle_enemy_activation( &mut self, pull: PullId, epoch: u32, target: EnemyIdx, ctx: &mut SimContext<'_>, )

Source

pub(in handler) fn handle_retarget( &mut self, pull: PullId, epoch: u32, ctx: &mut SimContext<'_>, )

Source

pub(in handler) fn handle_movement( &mut self, pull: PullId, epoch: u32, actor: PositionedActorRef, transform: SpatialTransform, ctx: &mut SimContext<'_>, )

Source

pub(super) fn schedule_pull_timeline( &mut self, pull_id: PullId, epoch: u32, started_at: SimTime, initial: bool, )

Source

pub(super) fn schedule_wave_enemies( &mut self, pull: PullId, epoch: u32, wave: WaveId, pull_started_at: SimTime, ready_at: SimTime, )

Source

pub(super) fn schedule_scripted_death( &mut self, enemy: EnemyIdx, activated_at: SimTime, generation: PullLifecycleGeneration, )

Source

pub(super) fn schedule_newly_ready_waves( &mut self, pull: PullId, epoch: u32, now: SimTime, )

Source

pub(super) fn apply_pending_target_precombat( &mut self, now: SimTime, telemetry: &mut TelemetrySink, )

Source

pub(super) fn schedule_retarget(&mut self, now: SimTime)

Source

pub(super) fn schedule_forced_optional_despawns( &mut self, pull: PullId, epoch: u32, now: SimTime, )

Source§

impl CombatHandler

Source

pub(super) fn on_aura_tick_impl( &mut self, event: AuraEventRef, ctx: &mut SimContext<'_>, )

Source

pub(super) fn on_aura_expire_impl( &mut self, event: AuraEventRef, ctx: &mut SimContext<'_>, )

Source

pub(super) fn on_external_buff_impl( &mut self, index: usize, ctx: &mut SimContext<'_>, )

Source§

impl CombatHandler

Source

pub(super) fn on_cast_complete_impl( &mut self, event: Event, ctx: &mut SimContext<'_>, )

Source

pub(super) fn on_triggered_spell_impl( &mut self, spell_id: SpellIdx, source: ActorId, target: ActorId, ctx: &mut SimContext<'_>, )

Source

pub(super) fn on_spell_impact_impl( &mut self, impact_id: u32, ctx: &mut SimContext<'_>, )

Source

pub(super) fn on_spell_launch_impl( &mut self, impact_id: u32, ctx: &mut SimContext<'_>, )

Source

pub(super) fn on_channel_tick_impl( &mut self, spell_id: SpellIdx, source: ActorId, target: EnemyIdx, generation: u64, ctx: &mut SimContext<'_>, )

Source

pub(super) fn on_actor_movement_impl( &mut self, actor: ActorId, moving: bool, generation: u64, ctx: &mut SimContext<'_>, )

Source

pub(super) fn on_cooldown_ready_impl( &mut self, _cooldown_key: SpellIdx, ctx: &mut SimContext<'_>, )

Source

pub(super) fn cast_time_ms_impl( &self, spell_id: SpellIdx, empower_rank: u8, ) -> u32

Source

pub(super) fn break_player_action_auras( &mut self, target: EnemyIdx, now: SimTime, telemetry: &mut TelemetrySink, )

Source

fn process_spell_travel_event( &mut self, impact_id: u32, event: SpellTravelEvent, ctx: &mut SimContext<'_>, )

Source§

impl CombatHandler

Source

pub(super) fn on_guardian_action_impl( &mut self, guardian_id: u32, guardian_generation: u32, ability_index: usize, ctx: &mut SimContext<'_>, )

Source

pub(super) fn on_guardian_expire_impl( &mut self, guardian_id: u32, guardian_generation: u32, ctx: &mut SimContext<'_>, )

Source

pub(super) fn on_pet_action_impl( &mut self, auto_attack_index: usize, ctx: &mut SimContext<'_>, )

Source

pub(super) fn on_proc_heartbeat_impl(&mut self, ctx: &mut SimContext<'_>)

Source

pub(super) fn on_auto_attack_impl( &mut self, source: ActorId, target: EnemyIdx, ctx: &mut SimContext<'_>, )

Source

pub(super) fn on_enemy_auto_attack_impl( &mut self, source: EnemyIdx, target: ActorId, ctx: &mut SimContext<'_>, )

Source§

impl CombatHandler

Source

pub(super) fn on_death_impl( &mut self, target: EnemyIdx, scope: DeathEventScope, ctx: &mut SimContext<'_>, )

Source

pub(super) fn on_despawn_impl( &mut self, target: EnemyIdx, ctx: &mut SimContext<'_>, ) -> EnemyDespawnOutcome

Source

pub(super) fn on_encounter_despawn_impl( &mut self, scope: PullScope, target: EnemyIdx, kind: EncounterDespawnKind, ctx: &mut SimContext<'_>, )

Source

pub(super) fn on_group_complete_impl( &mut self, scope: PullScope, group: GroupId, ctx: &mut SimContext<'_>, )

Source

pub(super) fn on_pull_complete_impl( &mut self, scope: PullScope, finalize: bool, ctx: &mut SimContext<'_>, )

Source

pub(super) fn on_encounter_terminate_impl( &mut self, _reason: EncounterTerminationReason, ctx: &mut SimContext<'_>, )

Source

pub(super) fn on_wave_activate_impl( &mut self, scope: PullScope, wave: WaveId, ctx: &mut SimContext<'_>, )

Source

pub(super) fn on_enemy_activate_impl( &mut self, scope: PullScope, target: EnemyIdx, ctx: &mut SimContext<'_>, )

Source

pub(super) fn on_retarget_impl( &mut self, scope: PullScope, ctx: &mut SimContext<'_>, )

Source

pub(super) fn on_encounter_move_impl( &mut self, scope: PullScope, actor: PositionedActorRef, transform: SpatialTransform, ctx: &mut SimContext<'_>, )

Source

pub(super) fn on_raid_event_impl( &mut self, index: usize, ctx: &mut SimContext<'_>, )

Source

pub(super) fn on_raid_add_despawn_impl( &mut self, target: EnemyIdx, activation_generation: u64, encounter_generation: PullLifecycleGeneration, ctx: &mut SimContext<'_>, )

Source

pub(crate) fn cleanup_inactive_enemy_effects( &mut self, target: EnemyIdx, now: SimTime, telemetry: &mut TelemetrySink, )

Source

pub(super) fn cleanup_inactive_enemy( &mut self, target: EnemyIdx, now: SimTime, telemetry: &mut TelemetrySink, )

Source

fn terminate_channel_targeting(&mut self, target: EnemyIdx, now: SimTime)

Source§

impl CombatHandler

Source

pub(super) fn introspect_impl(&self) -> SpecIntrospection

Source

pub(super) fn attach_decision_trace_impl( &mut self, sink: Arc<dyn DecisionTraceSink>, )

Source

pub(super) fn paperdoll_impl(&self) -> Paperdoll

Source§

impl CombatHandler

Source

pub(super) fn on_sim_start_impl(&mut self, ctx: &mut SimContext<'_>)

Source

pub(super) fn on_player_ready_impl( &mut self, ctx: &mut SimContext<'_>, ) -> Option<SpecAction>

Source

pub(super) fn on_event_queue_empty_impl(&mut self, _ctx: &mut SimContext<'_>)

Source

pub(super) fn encounter_termination_time_impl(&self) -> Option<SimTime>

Source

pub(super) fn flush_scheduled_impl(&mut self, push: &mut dyn FnMut(Event))

Source

pub(super) fn take_runtime_error_impl(&mut self) -> Option<SpecRuntimeError>

Source

pub(super) fn reset_impl(&mut self)

Source

pub(super) fn total_damage_impl(&self) -> f64

Source

fn schedule_initial_enemy_auto_attacks(&mut self, now: SimTime)

Source

fn live_player(&self) -> Option<()>

Source

fn prepare_player_ready( &mut self, now: SimTime, telemetry: &mut TelemetrySink, ) -> Option<()>

Source

fn cast_readiness_properties(&self, spell_id: u32) -> (bool, bool)

Source

fn readiness_deadlines(&self, now: SimTime) -> (SimTime, bool, SimTime)

Source

fn next_rotation_action( &mut self, cast_active: bool, now: SimTime, ) -> Option<SpecAction>

Source

fn gcd_queue_gate( &self, now: SimTime, gcd_ready: SimTime, is_off_gcd: bool, ) -> Option<SpecAction>

Source§

impl CombatHandler

Source

pub(super) fn on_hook_timer_impl( &mut self, timer_id: u32, source: ActorId, target: Option<EnemyIdx>, ctx: &mut SimContext<'_>, )

Source§

impl CombatHandler

Source

pub fn from_built(built: BuiltCombatSystem) -> Self

Source

pub fn state(&self) -> &CombatState

Source

pub fn state_mut(&mut self) -> &mut CombatState

Source

pub fn buf_mut(&mut self) -> &mut DenseBuffer

Source

pub fn state_and_buf_mut(&mut self) -> (&mut CombatState, &mut DenseBuffer)

Source

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.

Source

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.

Source

pub(crate) fn assert_rng_seeded(&self)

Source

pub(crate) fn evaluate_rotation(&mut self, now: SimTime) -> Option<SpecAction>

Source

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.

Source

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.

Source

fn evaluate_rotation_unmasked( &mut self, now: SimTime, masked_reasons: &[(u32, CastReject)], ) -> Option<SpecAction>

Trait Implementations§

Source§

impl Debug for CombatHandler

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl SpecHandler for CombatHandler

Source§

fn on_sim_start(&mut self, ctx: &mut SimContext<'_>)

Source§

fn on_player_ready(&mut self, ctx: &mut SimContext<'_>) -> Option<SpecAction>

Source§

fn on_cast_complete(&mut self, event: Event, ctx: &mut SimContext<'_>)

Source§

fn on_triggered_spell( &mut self, spell_id: SpellIdx, source: ActorId, target: ActorId, ctx: &mut SimContext<'_>, )

Source§

fn on_spell_impact(&mut self, impact_id: u32, ctx: &mut SimContext<'_>)

Source§

fn on_spell_launch(&mut self, impact_id: u32, ctx: &mut SimContext<'_>)

Source§

fn on_guardian_action( &mut self, guardian_id: u32, guardian_generation: u32, ability_index: usize, ctx: &mut SimContext<'_>, )

Source§

fn on_guardian_expire( &mut self, guardian_id: u32, guardian_generation: u32, ctx: &mut SimContext<'_>, )

Source§

fn on_pet_action(&mut self, auto_attack_index: usize, ctx: &mut SimContext<'_>)

Source§

fn on_aura_tick(&mut self, event: AuraEventRef, ctx: &mut SimContext<'_>)

Source§

fn on_channel_tick( &mut self, spell_id: SpellIdx, source: ActorId, target: EnemyIdx, generation: u64, ctx: &mut SimContext<'_>, )

Source§

fn on_aura_expire(&mut self, event: AuraEventRef, ctx: &mut SimContext<'_>)

Source§

fn on_proc_heartbeat(&mut self, ctx: &mut SimContext<'_>)

Source§

fn on_death( &mut self, target: EnemyIdx, scope: DeathEventScope, ctx: &mut SimContext<'_>, )

Source§

fn on_despawn( &mut self, target: EnemyIdx, ctx: &mut SimContext<'_>, ) -> EnemyDespawnOutcome

Despawn an enemy through the canonical combat cleanup boundary.
Source§

fn on_encounter_despawn( &mut self, scope: PullScope, target: EnemyIdx, kind: EncounterDespawnKind, ctx: &mut SimContext<'_>, )

Source§

fn on_group_complete( &mut self, scope: PullScope, group: GroupId, ctx: &mut SimContext<'_>, )

Source§

fn on_pull_complete( &mut self, scope: PullScope, finalize: bool, ctx: &mut SimContext<'_>, )

Source§

fn on_encounter_terminate( &mut self, reason: EncounterTerminationReason, ctx: &mut SimContext<'_>, )

Source§

fn on_wave_activate( &mut self, scope: PullScope, wave: WaveId, ctx: &mut SimContext<'_>, )

Source§

fn on_enemy_activate( &mut self, scope: PullScope, target: EnemyIdx, ctx: &mut SimContext<'_>, )

Source§

fn on_retarget(&mut self, scope: PullScope, ctx: &mut SimContext<'_>)

Source§

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<'_>)

Called only when the shared event queue is empty.
Source§

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<'_>, )

A HookTimer scheduled via the combat layer’s schedule_hook came due.
Source§

fn on_auto_attack( &mut self, source: ActorId, target: EnemyIdx, ctx: &mut SimContext<'_>, )

Source§

fn on_enemy_auto_attack( &mut self, source: EnemyIdx, target: ActorId, ctx: &mut SimContext<'_>, )

Source§

fn on_actor_movement( &mut self, actor: ActorId, moving: bool, generation: u64, ctx: &mut SimContext<'_>, )

Source§

fn on_raid_event(&mut self, index: usize, ctx: &mut SimContext<'_>)

Source§

fn on_raid_add_despawn( &mut self, target: EnemyIdx, activation_generation: u64, encounter_generation: PullLifecycleGeneration, ctx: &mut SimContext<'_>, )

Source§

fn on_external_buff(&mut self, index: usize, ctx: &mut SimContext<'_>)

Source§

fn on_cooldown_ready( &mut self, cooldown_key: SpellIdx, ctx: &mut SimContext<'_>, )

Source§

fn flush_scheduled(&mut self, push: &mut dyn FnMut(Event))

Source§

fn take_runtime_error(&mut self) -> Option<SpecRuntimeError>

Take a fatal event-processing failure, if the handler recorded one.
Source§

fn reset(&mut self)

Reset mutable per-iteration state without reallocating.
Source§

fn total_damage(&self) -> f64

Source§

fn cast_time_ms(&self, spell_id: SpellIdx, empower_rank: u8) -> u32

Cast time in milliseconds; 0 for instants.
Source§

fn introspect(&self) -> SpecIntrospection

Source§

fn attach_decision_trace(&mut self, sink: Arc<dyn DecisionTraceSink>)

Source§

fn paperdoll(&self) -> Option<Paperdoll>

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
Source§

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

Source§

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