PkmnLib_rs/src/static_data/moves/move_data.rs

76 lines
1.4 KiB
Rust
Raw Normal View History

2022-06-11 18:51:37 +00:00
use crate::static_data::SecondaryEffect;
use crate::StringKey;
use std::collections::HashSet;
#[derive(PartialEq, Debug)]
pub enum MoveCategory {
Physical,
Special,
Status,
}
#[derive(PartialEq, Debug)]
pub enum MoveTarget {
Adjacent,
AdjacentAlly,
AdjacentAllySelf,
AdjacentOpponent,
All,
AllAdjacent,
AllAdjacentOpponent,
AllAlly,
AllOpponent,
Any,
RandomOpponent,
SelfUse,
}
#[derive(PartialEq, Debug)]
pub struct MoveData {
name: StringKey,
move_type: u8,
category: MoveCategory,
base_power: u8,
accuracy: u8,
base_usages: u8,
target: MoveTarget,
priority: i8,
secondary_effect: SecondaryEffect,
flags: HashSet<String>,
}
impl MoveData {
pub fn new(
name: &StringKey,
move_type: u8,
category: MoveCategory,
base_power: u8,
accuracy: u8,
base_usages: u8,
target: MoveTarget,
priority: i8,
secondary_effect: SecondaryEffect,
flags: HashSet<String>,
) -> MoveData {
MoveData {
name: name.clone(),
move_type,
category,
base_power,
accuracy,
base_usages,
target,
priority,
secondary_effect,
flags,
}
}
pub fn has_flag(&self, key: &str) -> bool {
self.flags.contains(key)
}
}