PkmnLib_rs/src/static_data/moves/move_data.rs

76 lines
1.4 KiB
Rust
Raw Normal View History

use self::super::secondary_effect::SecondaryEffect;
use std::collections::HashSet;
#[derive(PartialEq, Debug)]
pub enum MoveCategory {
Physical,
Special,
Status,
}
#[derive(PartialEq, Debug)]
#[allow(dead_code)]
pub enum MoveTarget {
Adjacent,
AdjacentAlly,
AdjacentAllySelf,
AdjacentOpponent,
All,
AllAdjacent,
AllAdjacentOpponent,
AllAlly,
AllOpponent,
Any,
RandomOpponent,
SelfUse,
}
#[derive(PartialEq, Debug)]
pub struct MoveData {
name: String,
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: &str,
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.to_string(),
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)
}
}