PkmnLib_rs/src/static_data/species_data/ability.rs

49 lines
1.4 KiB
Rust
Raw Normal View History

2022-06-11 18:51:37 +00:00
use crate::static_data::EffectParameter;
use crate::StringKey;
/// An ability is a passive effect in battle that is attached to a Pokemon.
#[derive(Debug)]
pub struct Ability {
/// The name of the ability.
name: StringKey,
/// The name of the script effect of the ability.
effect: StringKey,
/// The parameters for the script effect of the ability.
parameters: Vec<EffectParameter>,
}
impl Ability {
/// Instantiates a new ability.
pub fn new(name: &StringKey, effect: &StringKey, parameters: Vec<EffectParameter>) -> Self {
Self {
name: name.clone(),
effect: effect.clone(),
parameters,
}
}
/// The name of the ability.
pub fn name(&self) -> &StringKey {
&self.name
}
/// The name of the script effect of the ability.
pub fn effect(&self) -> &StringKey {
&self.effect
}
/// The parameters for the script effect of the ability.
pub fn parameters(&self) -> &Vec<EffectParameter> {
&self.parameters
}
}
2022-07-01 16:20:16 +00:00
/// An ability index allows us to find an ability on a form. It combines a bool for whether the
/// ability is hidden or not, and then an index of the ability.
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
2022-08-20 10:22:12 +00:00
#[repr(C)]
2022-07-01 16:20:16 +00:00
pub struct AbilityIndex {
/// Whether or not the ability we're referring to is a hidden ability.
pub hidden: bool,
/// The index of the ability.
pub index: u8,
}