This commit is contained in:
@@ -23,6 +23,7 @@ pub struct LearnedMove {
|
||||
#[derive(Copy, Clone, Debug, Default)]
|
||||
#[repr(u8)]
|
||||
#[cfg_attr(feature = "serde", derive(serde_repr::Serialize_repr, serde_repr::Deserialize_repr))]
|
||||
#[cfg_attr(feature = "rune", derive(rune::Any))]
|
||||
pub enum MoveLearnMethod {
|
||||
/// We do not know the learn method.
|
||||
#[default]
|
||||
@@ -44,28 +45,18 @@ impl LearnedMove {
|
||||
}
|
||||
|
||||
/// The immutable move information of the move.
|
||||
pub fn move_data(&self) -> &Arc<dyn MoveData> {
|
||||
&self.move_data
|
||||
}
|
||||
pub fn move_data(&self) -> &Arc<dyn MoveData> { &self.move_data }
|
||||
/// The maximal power points for this move.
|
||||
pub fn max_pp(&self) -> u8 {
|
||||
self.move_data.base_usages() + self.max_pp_modification
|
||||
}
|
||||
pub fn max_pp(&self) -> u8 { self.move_data.base_usages() + self.max_pp_modification }
|
||||
|
||||
/// The amount by which the maximal power points have been modified for this move.
|
||||
/// This could for example be due to PP Ups.
|
||||
pub fn max_pp_modification(&self) -> u8 {
|
||||
self.max_pp_modification
|
||||
}
|
||||
pub fn max_pp_modification(&self) -> u8 { self.max_pp_modification }
|
||||
|
||||
/// The amount of remaining power points. If this is 0, we can not use the move anymore.
|
||||
pub fn remaining_pp(&self) -> u8 {
|
||||
self.remaining_pp.load(Ordering::Relaxed)
|
||||
}
|
||||
pub fn remaining_pp(&self) -> u8 { self.remaining_pp.load(Ordering::Relaxed) }
|
||||
/// The way the move was learned.
|
||||
pub fn learn_method(&self) -> MoveLearnMethod {
|
||||
self.learn_method
|
||||
}
|
||||
pub fn learn_method(&self) -> MoveLearnMethod { self.learn_method }
|
||||
|
||||
/// Try and reduce the PP by a certain amount. If the amount is higher than the current uses,
|
||||
/// return false. Otherwise, reduce the PP, and return true.
|
||||
@@ -81,9 +72,7 @@ impl LearnedMove {
|
||||
}
|
||||
|
||||
/// Set the remaining PP to the max amount of PP.
|
||||
pub fn restore_all_uses(&self) {
|
||||
self.remaining_pp.store(self.max_pp(), Ordering::SeqCst);
|
||||
}
|
||||
pub fn restore_all_uses(&self) { self.remaining_pp.store(self.max_pp(), Ordering::SeqCst); }
|
||||
|
||||
/// Restore the remaining PP by a certain amount. Will prevent it from going above max PP.
|
||||
pub fn restore_uses(&self, mut uses: u8) {
|
||||
|
||||
Reference in New Issue
Block a user