pub struct PrestigeSystem {
pub prestige_level: u32,
pub prestige_currency: u64,
pub lifetime_currency: u64,
pub current_player_level: u32,
}Expand description
Tracks prestige level, cumulative prestige currency, and bonus multipliers.
Fields§
§prestige_level: u32§prestige_currency: u64§lifetime_currency: u64Cumulative currency earned across all prestiges.
current_player_level: u32Implementations§
Source§impl PrestigeSystem
impl PrestigeSystem
pub fn new() -> Self
Sourcepub fn can_prestige(&self) -> bool
pub fn can_prestige(&self) -> bool
Whether the player is eligible to prestige.
Sourcepub fn prestige(&mut self) -> Result<u64, String>
pub fn prestige(&mut self) -> Result<u64, String>
Perform a prestige reset.
Returns the amount of prestige currency earned.
Sourcepub fn get_bonus_multiplier(&self) -> f32
pub fn get_bonus_multiplier(&self) -> f32
Bonus multiplier applied to experience/rewards based on prestige level.
Sourcepub fn spend_currency(&mut self, amount: u64) -> Result<(), String>
pub fn spend_currency(&mut self, amount: u64) -> Result<(), String>
Spend prestige currency; returns error if insufficient.
pub fn set_player_level(&mut self, level: u32)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PrestigeSystem
impl RefUnwindSafe for PrestigeSystem
impl Send for PrestigeSystem
impl Sync for PrestigeSystem
impl Unpin for PrestigeSystem
impl UnsafeUnpin for PrestigeSystem
impl UnwindSafe for PrestigeSystem
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.