Implements the script source methods on all current structs that implement it.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2022-06-12 18:41:49 +02:00
parent f0bc62ce19
commit 00f66bbf59
5 changed files with 27 additions and 8 deletions

View File

@@ -92,6 +92,8 @@ pub struct Pokemon<'a> {
ability_script: ScriptContainer,
status_script: ScriptContainer,
volatile: Arc<RwLock<ScriptSet>>,
script_source_data: RwLock<ScriptSourceData>,
}
impl<'a> Pokemon<'a> {
@@ -154,6 +156,7 @@ impl<'a> Pokemon<'a> {
ability_script: ScriptContainer::default(),
status_script: ScriptContainer::default(),
volatile: Default::default(),
script_source_data: Default::default(),
};
pokemon.recalculate_flat_stats();
pokemon
@@ -535,11 +538,18 @@ impl<'a> Pokemon<'a> {
impl<'a> ScriptSource<'a> for Pokemon<'a> {
fn get_script_count(&self) -> usize {
todo!()
let mut c = 3;
if let Some(battle_data) = &self.battle_data {
if let Some(battle) = battle_data.battle.upgrade() {
c += battle.read().sides()[battle_data.battle_side_index as usize]
.get_script_count();
}
}
c
}
fn get_script_source_data(&self) -> &RwLock<ScriptSourceData> {
todo!()
&self.script_source_data
}
fn get_own_scripts(&self, scripts: &mut Vec<ScriptWrapper>) {