2021-01-30 21:29:59 +00:00
|
|
|
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(
|
2021-01-31 16:31:22 +00:00
|
|
|
name: &str,
|
2021-01-30 21:29:59 +00:00
|
|
|
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 {
|
2021-01-31 16:31:22 +00:00
|
|
|
name: name.to_string(),
|
2021-01-30 21:29:59 +00:00
|
|
|
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)
|
|
|
|
}
|
|
|
|
}
|