Rework of FFI, adding a value identifier, so we can keep knowledge of data even when data moves.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2022-10-08 13:15:04 +02:00
parent 84ddf0307d
commit 41b40ef98e
38 changed files with 582 additions and 230 deletions

View File

@@ -1,9 +1,11 @@
use crate::static_data::EffectParameter;
use crate::StringKey;
use crate::{StringKey, ValueIdentifiable, ValueIdentifier};
/// An ability is a passive effect in battle that is attached to a Pokemon.
#[derive(Debug)]
pub struct Ability {
/// A unique identifier so we know what value this is.
identifier: ValueIdentifier,
/// The name of the ability.
name: StringKey,
/// The name of the script effect of the ability.
@@ -16,6 +18,7 @@ impl Ability {
/// Instantiates a new ability.
pub fn new(name: &StringKey, effect: &StringKey, parameters: Vec<EffectParameter>) -> Self {
Self {
identifier: Default::default(),
name: name.clone(),
effect: effect.clone(),
parameters,
@@ -36,6 +39,12 @@ impl Ability {
}
}
impl ValueIdentifiable for Ability {
fn value_identifier(&self) -> ValueIdentifier {
self.identifier
}
}
/// 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)]