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

@@ -17,9 +17,9 @@ use pkmn_lib::dynamic_data::Gen7MiscLibrary;
use pkmn_lib::script_implementations::wasm::script_resolver::WebAssemblyScriptResolver;
use pkmn_lib::static_data::{
AbilityImpl, AbilityLibrary, BattleItemCategory, DataLibrary, EffectParameter, Form, GrowthRateLibrary, ItemImpl,
ItemLibrary, LearnableMoves, LibrarySettings, LookupGrowthRate, MoveDataImpl, MoveLibrary, NatureImpl,
NatureLibrary, SecondaryEffect, SecondaryEffectImpl, Species, StaticData, StaticStatisticSet, Statistic,
TypeLibrary,
ItemLibrary, LearnableMoves, LearnableMovesImpl, LibrarySettings, LookupGrowthRate, MoveDataImpl, MoveLibrary,
NatureImpl, NatureLibrary, SecondaryEffect, SecondaryEffectImpl, Species, StaticData, StaticStatisticSet,
Statistic, TypeLibrary,
};
use pkmn_lib::StringKey;
@@ -368,8 +368,8 @@ where
)
}
fn parse_moves(value: &Value, move_library: &MoveLibrary) -> LearnableMoves {
let mut moves = LearnableMoves::default();
fn parse_moves(value: &Value, move_library: &MoveLibrary) -> Box<dyn LearnableMoves> {
let mut moves = LearnableMovesImpl::default();
let level_moves = value.get("levelMoves").unwrap().as_array().unwrap();
for level_move in level_moves {
@@ -379,7 +379,7 @@ fn parse_moves(value: &Value, move_library: &MoveLibrary) -> LearnableMoves {
moves.add_level_move(level, &name);
}
moves
Box::new(moves)
}
fn parse_effect_parameter(value: &Value) -> EffectParameter {