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

This commit is contained in:
2022-11-28 20:20:46 +01:00
parent d4b1cadad0
commit c1e09c654b
6 changed files with 48 additions and 29 deletions

View File

@@ -30,7 +30,7 @@ pub struct Form {
/// The possible hidden abilities a Pokemon with this form can have.
hidden_abilities: Vec<StringKey>,
/// The moves a Pokemon with this form can learn.
moves: LearnableMoves,
moves: Box<dyn LearnableMoves>,
/// Arbitrary flags can be set on a form for scripting use.
flags: HashSet<StringKey>,
}
@@ -46,7 +46,7 @@ impl Form {
base_stats: StaticStatisticSet<u16>,
abilities: Vec<StringKey>,
hidden_abilities: Vec<StringKey>,
moves: LearnableMoves,
moves: Box<dyn LearnableMoves>,
flags: HashSet<StringKey>,
) -> Form {
Form {
@@ -96,8 +96,10 @@ impl Form {
pub fn hidden_abilities(&self) -> &Vec<StringKey> {
&self.hidden_abilities
}
#[allow(clippy::borrowed_box)]
/// The moves a Pokemon with this form can learn.
pub fn moves(&self) -> &LearnableMoves {
pub fn moves(&self) -> &Box<dyn LearnableMoves> {
&self.moves
}
/// Arbitrary flags can be set on a form for scripting use.