diff --git a/src/dynamic_data/script_handling/script.rs b/src/dynamic_data/script_handling/script.rs index 117a7c5..107cdb6 100644 --- a/src/dynamic_data/script_handling/script.rs +++ b/src/dynamic_data/script_handling/script.rs @@ -26,17 +26,18 @@ pub trait Script { fn on_before_turn(&mut self, _choice: &TurnChoice) {} fn change_speed(&mut self, _choice: &TurnChoice, _speed: &mut u32) {} fn change_priority(&mut self, _choice: &TurnChoice, _priority: &mut i8) {} - fn change_attack(&mut self, _choice: &TurnChoice, _moveName: &mut StringKey) {} - fn change_number_of_hits(&mut self, _choice: &TurnChoice, _numberOfHits: &mut u8) {} + fn change_attack(&mut self, _choice: &TurnChoice, _move_name: &mut StringKey) {} + fn change_number_of_hits(&mut self, _choice: &TurnChoice, _number_of_hits: &mut u8) {} fn prevent_attack(&mut self, _move: &ExecutingMove, _prevent: &mut bool) {} fn fail_attack(&mut self, _move: &ExecutingMove, _fail: &mut bool) {} fn stop_before_attack(&mut self, _move: &ExecutingMove, _stop: &mut bool) {} fn on_before_attack(&mut self, _move: &ExecutingMove) {} - fn fail_incoming_attack(&mut self, _move: &ExecutingMove, target: &Pokemon, _fail: &mut bool) {} + fn fail_incoming_attack(&mut self, _move: &ExecutingMove, _target: &Pokemon, _fail: &mut bool) { + } fn is_invulnerable( &mut self, _move: &ExecutingMove, - target: &Pokemon, + _target: &Pokemon, _invulnerable: &mut bool, ) { } diff --git a/src/dynamic_data/script_handling/script_set.rs b/src/dynamic_data/script_handling/script_set.rs index c17f7bf..623e91b 100644 --- a/src/dynamic_data/script_handling/script_set.rs +++ b/src/dynamic_data/script_handling/script_set.rs @@ -10,8 +10,8 @@ pub struct ScriptSet { impl ScriptSet { pub fn add(&mut self, script: Box) -> ScriptContainer { if let Some(lock) = self.scripts.get(script.name()) { - let existing = lock.get(); - if let Some(v) = &*existing { + let mut existing = lock.get(); + if let Some(v) = &mut *existing { v.stack(); return lock.clone(); } @@ -30,8 +30,8 @@ impl ScriptSet { F: Fn() -> PkmnResult>>, { if let Some(lock) = self.scripts.get(key) { - let existing = lock.get(); - if let Some(v) = &*existing { + let mut existing = lock.get(); + if let Some(v) = &mut *existing { v.stack(); return Ok(Some(lock.clone())); } @@ -54,13 +54,13 @@ impl ScriptSet { pub fn remove(&mut self, key: &StringKey) { let value = self.scripts.shift_remove(key); if let Some(script) = value { - script.get().as_ref().as_ref().unwrap().on_remove(); + script.get().as_mut().unwrap().on_remove(); } } pub fn clear(&mut self) { for script in &self.scripts { - script.1.get().as_ref().as_ref().unwrap().on_remove(); + script.1.get().as_mut().unwrap().on_remove(); } self.scripts.clear(); }