Make Ability a trait
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2022-11-27 17:47:51 +01:00
parent 996a35ffa4
commit e04f61d9e6
9 changed files with 50 additions and 31 deletions

View File

@@ -86,7 +86,7 @@ pub struct Pokemon {
ability_index: AbilityIndex,
/// An ability can be overriden to an arbitrary ability. This is for example used for the Mummy
/// ability.
override_ability: Option<Ability>,
override_ability: Option<Arc<dyn Ability>>,
/// If in battle, we have additional data.
battle_data: RwLock<Option<PokemonBattleData>>,
@@ -416,7 +416,7 @@ impl Pokemon {
self.override_ability.is_some()
}
/// Returns the currently active ability.
pub fn active_ability(&self) -> &Ability {
pub fn active_ability(&self) -> &Arc<dyn Ability> {
if let Some(v) = &self.override_ability {
return v;
}