Initial commit, implements most of the static_data side.
This commit is contained in:
75
src/static_data/moves/move_data.rs
Normal file
75
src/static_data/moves/move_data.rs
Normal file
@@ -0,0 +1,75 @@
|
||||
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: String,
|
||||
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,
|
||||
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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user