pub struct UpgradeableFighter {
pub attribute_basis: EnumMap<AttributeType, u32>,
/* private fields */
}
Fields§
§attribute_basis: EnumMap<AttributeType, u32>
The base attributes without any equipment, or other boosts
Implementations§
Source§impl UpgradeableFighter
impl UpgradeableFighter
Sourcepub fn insert_gem(
&mut self,
gem: Gem,
slot: EquipmentSlot,
) -> Result<Option<Gem>, Gem>
pub fn insert_gem( &mut self, gem: Gem, slot: EquipmentSlot, ) -> Result<Option<Gem>, Gem>
Inserts a gem on the item in the specified slot If the gem could be inserted the old gem (if any) will be returned
§Errors
Will return Err
if the gem could not be inserted. It will contain
the gem you tried to insert
Sourcepub fn extract_gem(&mut self, slot: EquipmentSlot) -> Option<Gem>
pub fn extract_gem(&mut self, slot: EquipmentSlot) -> Option<Gem>
Removes the gem at the provided slot and returns the old gem, if any
Sourcepub fn use_potion(&mut self, potion: Potion, slot: usize) -> Option<Potion>
pub fn use_potion(&mut self, potion: Potion, slot: usize) -> Option<Potion>
Uses a potion in the provided slot and returns the old potion, if any
Sourcepub fn remove_potion(&mut self, slot: usize) -> Option<Potion>
pub fn remove_potion(&mut self, slot: usize) -> Option<Potion>
Removes the potion at the provided slot and returns the old potion, if any
Sourcepub fn equip(
&mut self,
item: Item,
slot: EquipmentSlot,
) -> Result<Option<Item>, Item>
pub fn equip( &mut self, item: Item, slot: EquipmentSlot, ) -> Result<Option<Item>, Item>
Equip the provided item. If the item could be equiped, the previous item will be returned
§Errors
Will return Err
if the item could not be equipped. It will contain
the item you tried to insert
Sourcepub fn unequip(&mut self, slot: EquipmentSlot) -> Option<Item>
pub fn unequip(&mut self, slot: EquipmentSlot) -> Option<Item>
Unequips the item at the provided slot and returns the old item, if any
pub fn from_other(other: &OtherPlayer) -> Self
Source§impl UpgradeableFighter
impl UpgradeableFighter
pub fn attributes(&self) -> EnumMap<AttributeType, u32>
pub fn hit_points(&self, attributes: &EnumMap<AttributeType, u32>) -> i64
Trait Implementations§
Source§impl Clone for UpgradeableFighter
impl Clone for UpgradeableFighter
Source§fn clone(&self) -> UpgradeableFighter
fn clone(&self) -> UpgradeableFighter
Returns a copy 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 moreAuto Trait Implementations§
impl Freeze for UpgradeableFighter
impl RefUnwindSafe for UpgradeableFighter
impl Send for UpgradeableFighter
impl Sync for UpgradeableFighter
impl Unpin for UpgradeableFighter
impl UnwindSafe for UpgradeableFighter
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