This commit is contained in:
@@ -11,12 +11,14 @@ use crate::dynamic_data::script_handling::{ScriptSource, ScriptSourceData, Scrip
|
||||
use crate::dynamic_data::ScriptContainer;
|
||||
use crate::dynamic_data::TargetList;
|
||||
use crate::static_data::{MoveData, TypeIdentifier};
|
||||
use crate::{PkmnResult, PokemonError};
|
||||
use crate::{PkmnResult, PokemonError, ValueIdentifiable, ValueIdentifier};
|
||||
|
||||
/// A hit data is the data for a single hit, on a single target.
|
||||
#[derive(Default, Debug)]
|
||||
#[cfg_attr(feature = "wasm", derive(unique_type_id_derive::UniqueTypeId))]
|
||||
|
||||
pub struct HitData {
|
||||
/// A unique identifier so we know what value this is.
|
||||
identifier: ValueIdentifier,
|
||||
/// Whether or not the hit is critical.
|
||||
critical: AtomicBool,
|
||||
/// The base power of the hit.
|
||||
@@ -85,8 +87,10 @@ impl HitData {
|
||||
|
||||
/// An executing move is the data of the move for while it is executing.
|
||||
#[derive(Debug)]
|
||||
#[cfg_attr(feature = "wasm", derive(unique_type_id_derive::UniqueTypeId))]
|
||||
|
||||
pub struct ExecutingMove {
|
||||
/// A unique identifier so we know what value this is.
|
||||
identifier: ValueIdentifier,
|
||||
/// The number of hits this move has.
|
||||
number_of_hits: u8,
|
||||
/// A list of hits for this move. For multi target multi hit moves, this stores the hits linearly,
|
||||
@@ -122,6 +126,7 @@ impl ExecutingMove {
|
||||
hits.push(HitData::default())
|
||||
}
|
||||
Self {
|
||||
identifier: Default::default(),
|
||||
number_of_hits,
|
||||
hits,
|
||||
user,
|
||||
@@ -218,3 +223,15 @@ impl ScriptSource for ExecutingMove {
|
||||
self.user.get_own_scripts(scripts);
|
||||
}
|
||||
}
|
||||
|
||||
impl ValueIdentifiable for ExecutingMove {
|
||||
fn value_identifier(&self) -> ValueIdentifier {
|
||||
self.identifier
|
||||
}
|
||||
}
|
||||
|
||||
impl ValueIdentifiable for HitData {
|
||||
fn value_identifier(&self) -> ValueIdentifier {
|
||||
self.identifier
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user