Fixes build, style fixes.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
880ea55a67
commit
ca75177354
|
@ -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,
|
||||
) {
|
||||
}
|
||||
|
|
|
@ -10,8 +10,8 @@ pub struct ScriptSet {
|
|||
impl ScriptSet {
|
||||
pub fn add(&mut self, script: Box<dyn Script>) -> 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<Option<Box<dyn Script>>>,
|
||||
{
|
||||
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();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue