Clippy fixes, additional WASM registration work
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
@@ -175,7 +175,7 @@ pub struct MoveChoice {
|
||||
choice_data: Box<CommonChoiceData>,
|
||||
}
|
||||
|
||||
impl<'user, 'library> MoveChoice {
|
||||
impl MoveChoice {
|
||||
/// Initializes the data for a new move choice.
|
||||
pub fn new(user: Arc<Pokemon>, used_move: Arc<LearnedMove>, target_side: u8, target_index: u8) -> Self {
|
||||
Self {
|
||||
|
||||
@@ -18,7 +18,7 @@ pub struct EventHook {
|
||||
evt_hook_function: Vec<fn(&Box<&Event>)>,
|
||||
}
|
||||
|
||||
impl<'battle, 'library> EventHook {
|
||||
impl EventHook {
|
||||
/// Register a new listener. This will start receiving all events in the battle. Multiple event
|
||||
/// listeners can exist at the same time. Note that for these functions the event will be disposed
|
||||
/// of after the event is finished being sent.
|
||||
|
||||
@@ -25,7 +25,7 @@ impl ChoiceQueue {
|
||||
/// Dequeues the next turn choice to be executed. This gives ownership to the callee, and replaces
|
||||
/// our own reference to the turn choice with an empty spot. It also increments the current position
|
||||
/// by one.
|
||||
pub fn dequeue<'b>(&'b mut self) -> TurnChoice {
|
||||
pub fn dequeue(&mut self) -> TurnChoice {
|
||||
let c = self.queue[self.current].take();
|
||||
self.current += 1;
|
||||
c.unwrap()
|
||||
|
||||
@@ -11,7 +11,7 @@ use crate::static_data::MoveTarget;
|
||||
pub type TargetList = Vec<Option<Arc<Pokemon>>>;
|
||||
|
||||
/// This returns all Pokemon in the battle.
|
||||
fn get_all_targets<'b, 'library>(battle: &Battle) -> TargetList {
|
||||
fn get_all_targets(battle: &Battle) -> TargetList {
|
||||
let mut v = Vec::with_capacity(battle.pokemon_per_side() as usize * battle.number_of_sides() as usize);
|
||||
for side in battle.sides() {
|
||||
for pokemon in side.pokemon().deref() {
|
||||
@@ -31,7 +31,7 @@ fn get_opposite_side(side: u8) -> u8 {
|
||||
|
||||
/// Gets all Pokemon that are adjacent to of directly opposite of a Pokemon. This means the target,
|
||||
/// the Pokemon left of it, the Pokemon right of it, and the Pokemon opposite of it.
|
||||
fn get_all_adjacent_opponent<'b, 'library>(side: u8, index: u8, battle: &Battle) -> TargetList {
|
||||
fn get_all_adjacent_opponent(side: u8, index: u8, battle: &Battle) -> TargetList {
|
||||
let left = index as i32 - 1;
|
||||
let right = index + 1;
|
||||
if left < 0 && right >= battle.pokemon_per_side() {
|
||||
@@ -76,7 +76,7 @@ fn get_all_adjacent_opponent<'b, 'library>(side: u8, index: u8, battle: &Battle)
|
||||
|
||||
/// Gets all Pokemon that are adjacent to a Pokemon. This includes the target, the Pokemon to the
|
||||
/// left of it, and the Pokemon to the right of it.
|
||||
fn get_all_adjacent<'b, 'library>(side: u8, index: u8, battle: &Battle) -> TargetList {
|
||||
fn get_all_adjacent(side: u8, index: u8, battle: &Battle) -> TargetList {
|
||||
let left = index as i32 - 1;
|
||||
let right = index + 1;
|
||||
if left < 0 && right >= battle.pokemon_per_side() {
|
||||
@@ -102,7 +102,7 @@ fn get_all_adjacent<'b, 'library>(side: u8, index: u8, battle: &Battle) -> Targe
|
||||
}
|
||||
|
||||
/// Gets the target for a specific move target type, given the targeted position.
|
||||
pub fn resolve_targets<'b, 'library>(side: u8, index: u8, target: MoveTarget, battle: &Battle) -> TargetList {
|
||||
pub fn resolve_targets(side: u8, index: u8, target: MoveTarget, battle: &Battle) -> TargetList {
|
||||
match target {
|
||||
// These all resolve to a single position. We let the client deal with where the target is,
|
||||
// and just return the Pokemon at that given target here.
|
||||
|
||||
@@ -14,7 +14,7 @@ pub trait MiscLibrary: Debug {
|
||||
/// Returns whether or not a Pokemon is allowed to flee or switch out.
|
||||
fn can_flee(&self, choice: &TurnChoice) -> bool;
|
||||
/// Returns the move we need to use if we can't use another move. Typically Struggle.
|
||||
fn replacement_move<'func>(&'func self, user: &Arc<Pokemon>, target_side: u8, target_index: u8) -> TurnChoice;
|
||||
fn replacement_move(&self, user: &Arc<Pokemon>, target_side: u8, target_index: u8) -> TurnChoice;
|
||||
// TODO: can evolve from level up?
|
||||
// TODO: get time
|
||||
}
|
||||
@@ -41,7 +41,7 @@ impl Gen7MiscLibrary {
|
||||
Some(SecondaryEffect::new(-1.0, StringKey::new("struggle"), vec![])),
|
||||
HashSet::new(),
|
||||
));
|
||||
let struggle_learned_move = Arc::new(LearnedMove::new(&struggle_data.clone(), MoveLearnMethod::Unknown));
|
||||
let struggle_learned_move = Arc::new(LearnedMove::new(&struggle_data, MoveLearnMethod::Unknown));
|
||||
Self { struggle_learned_move }
|
||||
}
|
||||
}
|
||||
@@ -57,7 +57,7 @@ impl MiscLibrary for Gen7MiscLibrary {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn replacement_move<'func>(&'func self, user: &Arc<Pokemon>, target_side: u8, target_index: u8) -> TurnChoice {
|
||||
fn replacement_move(&self, user: &Arc<Pokemon>, target_side: u8, target_index: u8) -> TurnChoice {
|
||||
self.struggle_learned_move.restore_all_uses();
|
||||
TurnChoice::Move(MoveChoice::new(
|
||||
user.clone(),
|
||||
|
||||
@@ -55,7 +55,7 @@ pub struct Battle {
|
||||
script_source_data: RwLock<ScriptSourceData>,
|
||||
}
|
||||
|
||||
impl<'own, 'library> Battle {
|
||||
impl Battle {
|
||||
/// Initializes a new battle.
|
||||
pub fn new(
|
||||
library: Arc<DynamicLibrary>,
|
||||
|
||||
@@ -43,7 +43,7 @@ pub struct BattleSide {
|
||||
script_source_data: RwLock<ScriptSourceData>,
|
||||
}
|
||||
|
||||
impl<'own, 'library> BattleSide {
|
||||
impl BattleSide {
|
||||
/// Instantiates a battle side.
|
||||
pub fn new(index: u8, pokemon_per_side: u8) -> Self {
|
||||
let mut pokemon = Vec::with_capacity(pokemon_per_side as usize);
|
||||
|
||||
@@ -260,7 +260,7 @@ impl Pokemon {
|
||||
}
|
||||
let script = self
|
||||
.library
|
||||
.load_item_script(&self.held_item.read().as_ref().unwrap())
|
||||
.load_item_script(self.held_item.read().as_ref().unwrap())
|
||||
.unwrap();
|
||||
if script.is_none() {
|
||||
return false;
|
||||
|
||||
@@ -9,7 +9,7 @@ pub struct PokemonParty {
|
||||
pokemon: Vec<Option<Arc<Pokemon>>>,
|
||||
}
|
||||
|
||||
impl<'own, 'library> PokemonParty {
|
||||
impl PokemonParty {
|
||||
/// Instantiates a party with a set size.
|
||||
pub fn new(size: usize) -> Self {
|
||||
let mut pokemon = Vec::with_capacity(size);
|
||||
|
||||
@@ -225,8 +225,6 @@ mod tests {
|
||||
use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering};
|
||||
|
||||
use crate::dynamic_data::script_handling::script::ScriptContainer;
|
||||
use crate::dynamic_data::DynamicLibrary;
|
||||
use crate::static_data::EffectParameter;
|
||||
use crate::StringKey;
|
||||
|
||||
use super::*;
|
||||
|
||||
Reference in New Issue
Block a user