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 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.
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
Mutably borrows from an owned value. Read more
§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> 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>
Wrap the input message
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>,
Applies the layer to a service and wraps it in [
Layered].