pub struct FightEngine { /* private fields */ }Expand description
Bounded, deterministic driver for fight simulations.
Implementations§
Source§impl FightEngine
impl FightEngine
pub fn new( game_config: SharedGameConfig, behaviors: Arc<BehaviorRegistry>, seed: Seed, ) -> Self
Sourcepub fn breakdown(&self, outcome: FightOutcome) -> Option<FightBreakdown>
pub fn breakdown(&self, outcome: FightOutcome) -> Option<FightBreakdown>
Per-source damage/heal breakdown of the fight this engine last ran.
The engine stops at EndFight without processing it, so the summary
never reaches OverlordState here — this is how a simulation, a PvP
precalculation or a test reads it.
Sourcepub fn start(
&mut self,
state: OverlordState,
prepare_fight_type: PrepareFightType,
) -> Result<FightSim, FightError>
pub fn start( &mut self, state: OverlordState, prepare_fight_type: PrepareFightType, ) -> Result<FightSim, FightError>
Prepare a fight on a copy of the player’s state. Any pre-existing
active_fight is discarded — the sim owns the whole fight lifecycle.
Sourcepub fn step(
&mut self,
sim: &mut FightSim,
) -> Result<Option<FightResult>, FightError>
pub fn step( &mut self, sim: &mut FightSim, ) -> Result<Option<FightResult>, FightError>
Advance the fight by exactly one game tick (100 ticker units).
Returns Some(result) once the fight has ended.
Sourcepub fn run(
&mut self,
state: OverlordState,
prepare_fight_type: PrepareFightType,
max_game_ticks: u64,
) -> Result<FightOutcome, FightError>
pub fn run( &mut self, state: OverlordState, prepare_fight_type: PrepareFightType, max_game_ticks: u64, ) -> Result<FightOutcome, FightError>
Run the fight to completion, executing at most max_game_ticks steps.
Total by construction: always returns, with FightResult::Undecided
when the budget is exhausted.
Sourcepub fn run_prepared(
&mut self,
sim: &mut FightSim,
max_game_ticks: u64,
) -> Result<FightOutcome, FightError>
pub fn run_prepared( &mut self, sim: &mut FightSim, max_game_ticks: u64, ) -> Result<FightOutcome, FightError>
Drive an already-started fight to completion.
Split out of run so a caller that must touch the prepared
state before the first step — the A2-BAL-001 calibration installing a
frozen reference build, see FightSim::state_mut — still goes through
the same bounded, deterministic loop rather than reimplementing it.
Auto Trait Implementations§
impl Freeze for FightEngine
impl !RefUnwindSafe for FightEngine
impl Send for FightEngine
impl Sync for FightEngine
impl Unpin for FightEngine
impl !UnwindSafe for FightEngine
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> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§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>
§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].