Loads more work on battling, initial stretch to run a turn done.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -1,8 +1,13 @@
|
||||
use crate::static_data::SecondaryEffect;
|
||||
use crate::StringKey;
|
||||
use std::collections::HashSet;
|
||||
use hashbrown::HashSet;
|
||||
|
||||
#[cfg(feature = "serde")]
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Debug)]
|
||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "serde", serde(rename_all = "snake_case"))]
|
||||
pub enum MoveCategory {
|
||||
Physical = 0,
|
||||
Special = 1,
|
||||
@@ -10,6 +15,7 @@ pub enum MoveCategory {
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Debug)]
|
||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||
pub enum MoveTarget {
|
||||
Adjacent = 0,
|
||||
AdjacentAlly,
|
||||
@@ -25,6 +31,7 @@ pub enum MoveTarget {
|
||||
Any,
|
||||
|
||||
RandomOpponent,
|
||||
#[cfg_attr(feature = "serde", serde(rename = "Self"))]
|
||||
SelfUse,
|
||||
}
|
||||
|
||||
@@ -39,7 +46,7 @@ pub struct MoveData {
|
||||
target: MoveTarget,
|
||||
priority: i8,
|
||||
secondary_effect: SecondaryEffect,
|
||||
flags: HashSet<String>,
|
||||
flags: HashSet<StringKey>,
|
||||
}
|
||||
|
||||
impl MoveData {
|
||||
@@ -53,7 +60,7 @@ impl MoveData {
|
||||
target: MoveTarget,
|
||||
priority: i8,
|
||||
secondary_effect: SecondaryEffect,
|
||||
flags: HashSet<String>,
|
||||
flags: HashSet<StringKey>,
|
||||
) -> MoveData {
|
||||
MoveData {
|
||||
name: name.clone(),
|
||||
@@ -99,7 +106,11 @@ impl MoveData {
|
||||
&self.secondary_effect
|
||||
}
|
||||
|
||||
pub fn has_flag(&self, key: &str) -> bool {
|
||||
pub fn has_secondary_effect(&self) -> bool {
|
||||
self.secondary_effect.effect_name() != &StringKey::empty()
|
||||
}
|
||||
|
||||
pub fn has_flag(&self, key: &StringKey) -> bool {
|
||||
self.flags.contains(key)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user