pub struct PityCounter { /* private fields */ }Implementations§
Source§impl PityCounter
impl PityCounter
Sourcepub fn new(limit: u16) -> Result<PityCounter, LoopError>
pub fn new(limit: u16) -> Result<PityCounter, LoopError>
At least one reward in each limit accepted attempts, including the first.
Sourcepub fn attempt(&mut self, natural_success: bool) -> bool
pub fn attempt(&mut self, natural_success: bool) -> bool
Call only after the host confirms an eligible event. Successful natural rolls reset the same counter. The returned reward must be applied once.
Sourcepub fn attempt_outcome(&mut self, attempt: PityAttempt) -> PityOutcome
pub fn attempt_outcome(&mut self, attempt: PityAttempt) -> PityOutcome
Inspect the reason while retaining immediate legacy reward commitment.
Use PityDelivery if destination insertion can fail.
use ferravex_play::gameplay::pity::{PityAttempt, PityCounter, PityOutcome};
let mut pity = PityCounter::new(1).unwrap();
assert_eq!(pity.attempt_outcome(PityAttempt::Deferred), PityOutcome::Deferred);
assert_eq!(pity.attempt_outcome(PityAttempt::Accepted { natural_success: true }),
PityOutcome::Natural);pub fn misses(&self) -> u16
pub fn reset(&mut self)
Trait Implementations§
Source§impl Clone for PityCounter
impl Clone for PityCounter
Source§fn clone(&self) -> PityCounter
fn clone(&self) -> PityCounter
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PityCounter
impl Debug for PityCounter
impl Copy for PityCounter
Auto Trait Implementations§
impl Freeze for PityCounter
impl RefUnwindSafe for PityCounter
impl Send for PityCounter
impl Sync for PityCounter
impl Unpin for PityCounter
impl UnwindSafe for PityCounter
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