load armor stats
This commit is contained in:
parent
0dbd588e3b
commit
d0a84af1c3
@ -1,6 +1,6 @@
|
|||||||
use serde::{Serialize, Deserialize};
|
use serde::{Serialize, Deserialize};
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, PartialEq, Serialize, Deserialize, enum_utils::FromStr, derive_more::Display)]
|
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq, Serialize, Deserialize, enum_utils::FromStr, derive_more::Display)]
|
||||||
pub enum ArmorType {
|
pub enum ArmorType {
|
||||||
Frame,
|
Frame,
|
||||||
Armor,
|
Armor,
|
||||||
@ -32,16 +32,16 @@ pub enum ArmorType {
|
|||||||
RevivalGarment,
|
RevivalGarment,
|
||||||
SpiritGarment,
|
SpiritGarment,
|
||||||
StinkFrame,
|
StinkFrame,
|
||||||
DPartsver101,
|
DPartsVer101,
|
||||||
DPartsver210,
|
DPartsVer210,
|
||||||
ParasiteWeardeRol,
|
ParasiteWearDeRol,
|
||||||
ParasiteWearnelgal,
|
ParasiteWearNelgal,
|
||||||
ParasiteWearvajulla,
|
ParasiteWearVajulla,
|
||||||
SensePlate,
|
SensePlate,
|
||||||
GravitonPlate,
|
GravitonPlate,
|
||||||
AttributePlate,
|
AttributePlate,
|
||||||
FlowensFrame,
|
FlowensFrame,
|
||||||
CustomFrameveroo,
|
CustomFrameVerOo,
|
||||||
DbsArmor,
|
DbsArmor,
|
||||||
GuardWave,
|
GuardWave,
|
||||||
DfField,
|
DfField,
|
||||||
@ -49,7 +49,7 @@ pub enum ArmorType {
|
|||||||
ChuChuFever,
|
ChuChuFever,
|
||||||
LoveHeart,
|
LoveHeart,
|
||||||
FlameGarment,
|
FlameGarment,
|
||||||
VirusArmorlafuteria,
|
VirusArmorLafuteria,
|
||||||
BrightnessCircle,
|
BrightnessCircle,
|
||||||
AuraField,
|
AuraField,
|
||||||
ElectroFrame,
|
ElectroFrame,
|
||||||
@ -69,7 +69,7 @@ pub enum ArmorType {
|
|||||||
RedCoat,
|
RedCoat,
|
||||||
Thirteen,
|
Thirteen,
|
||||||
MotherGarb,
|
MotherGarb,
|
||||||
MotherGarb2,
|
MotherGarbPlus,
|
||||||
DressPlate,
|
DressPlate,
|
||||||
Sweetheart,
|
Sweetheart,
|
||||||
IgnitionCloak,
|
IgnitionCloak,
|
||||||
@ -125,16 +125,16 @@ impl ArmorType {
|
|||||||
ArmorType::RevivalGarment => [0x01, 0x01, 0x1B],
|
ArmorType::RevivalGarment => [0x01, 0x01, 0x1B],
|
||||||
ArmorType::SpiritGarment => [0x01, 0x01, 0x1C],
|
ArmorType::SpiritGarment => [0x01, 0x01, 0x1C],
|
||||||
ArmorType::StinkFrame => [0x01, 0x01, 0x1D],
|
ArmorType::StinkFrame => [0x01, 0x01, 0x1D],
|
||||||
ArmorType::DPartsver101 => [0x01, 0x01, 0x1E],
|
ArmorType::DPartsVer101 => [0x01, 0x01, 0x1E],
|
||||||
ArmorType::DPartsver210 => [0x01, 0x01, 0x1F],
|
ArmorType::DPartsVer210 => [0x01, 0x01, 0x1F],
|
||||||
ArmorType::ParasiteWeardeRol => [0x01, 0x01, 0x20],
|
ArmorType::ParasiteWearDeRol => [0x01, 0x01, 0x20],
|
||||||
ArmorType::ParasiteWearnelgal => [0x01, 0x01, 0x21],
|
ArmorType::ParasiteWearNelgal => [0x01, 0x01, 0x21],
|
||||||
ArmorType::ParasiteWearvajulla => [0x01, 0x01, 0x22],
|
ArmorType::ParasiteWearVajulla => [0x01, 0x01, 0x22],
|
||||||
ArmorType::SensePlate => [0x01, 0x01, 0x23],
|
ArmorType::SensePlate => [0x01, 0x01, 0x23],
|
||||||
ArmorType::GravitonPlate => [0x01, 0x01, 0x24],
|
ArmorType::GravitonPlate => [0x01, 0x01, 0x24],
|
||||||
ArmorType::AttributePlate => [0x01, 0x01, 0x25],
|
ArmorType::AttributePlate => [0x01, 0x01, 0x25],
|
||||||
ArmorType::FlowensFrame => [0x01, 0x01, 0x26],
|
ArmorType::FlowensFrame => [0x01, 0x01, 0x26],
|
||||||
ArmorType::CustomFrameveroo => [0x01, 0x01, 0x27],
|
ArmorType::CustomFrameVerOo => [0x01, 0x01, 0x27],
|
||||||
ArmorType::DbsArmor => [0x01, 0x01, 0x28],
|
ArmorType::DbsArmor => [0x01, 0x01, 0x28],
|
||||||
ArmorType::GuardWave => [0x01, 0x01, 0x29],
|
ArmorType::GuardWave => [0x01, 0x01, 0x29],
|
||||||
ArmorType::DfField => [0x01, 0x01, 0x2A],
|
ArmorType::DfField => [0x01, 0x01, 0x2A],
|
||||||
@ -142,7 +142,7 @@ impl ArmorType {
|
|||||||
ArmorType::ChuChuFever => [0x01, 0x01, 0x2C],
|
ArmorType::ChuChuFever => [0x01, 0x01, 0x2C],
|
||||||
ArmorType::LoveHeart => [0x01, 0x01, 0x2D],
|
ArmorType::LoveHeart => [0x01, 0x01, 0x2D],
|
||||||
ArmorType::FlameGarment => [0x01, 0x01, 0x2E],
|
ArmorType::FlameGarment => [0x01, 0x01, 0x2E],
|
||||||
ArmorType::VirusArmorlafuteria => [0x01, 0x01, 0x2F],
|
ArmorType::VirusArmorLafuteria => [0x01, 0x01, 0x2F],
|
||||||
ArmorType::BrightnessCircle => [0x01, 0x01, 0x30],
|
ArmorType::BrightnessCircle => [0x01, 0x01, 0x30],
|
||||||
ArmorType::AuraField => [0x01, 0x01, 0x31],
|
ArmorType::AuraField => [0x01, 0x01, 0x31],
|
||||||
ArmorType::ElectroFrame => [0x01, 0x01, 0x32],
|
ArmorType::ElectroFrame => [0x01, 0x01, 0x32],
|
||||||
@ -162,7 +162,7 @@ impl ArmorType {
|
|||||||
ArmorType::RedCoat => [0x01, 0x01, 0x40],
|
ArmorType::RedCoat => [0x01, 0x01, 0x40],
|
||||||
ArmorType::Thirteen => [0x01, 0x01, 0x41],
|
ArmorType::Thirteen => [0x01, 0x01, 0x41],
|
||||||
ArmorType::MotherGarb => [0x01, 0x01, 0x42],
|
ArmorType::MotherGarb => [0x01, 0x01, 0x42],
|
||||||
ArmorType::MotherGarb2 => [0x01, 0x01, 0x43],
|
ArmorType::MotherGarbPlus => [0x01, 0x01, 0x43],
|
||||||
ArmorType::DressPlate => [0x01, 0x01, 0x44],
|
ArmorType::DressPlate => [0x01, 0x01, 0x44],
|
||||||
ArmorType::Sweetheart => [0x01, 0x01, 0x45],
|
ArmorType::Sweetheart => [0x01, 0x01, 0x45],
|
||||||
ArmorType::IgnitionCloak => [0x01, 0x01, 0x46],
|
ArmorType::IgnitionCloak => [0x01, 0x01, 0x46],
|
||||||
|
79
src/ship/item_stats.rs
Normal file
79
src/ship/item_stats.rs
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
use std::collections::HashMap;
|
||||||
|
use serde::{Serialize, Deserialize};
|
||||||
|
use std::fs::File;
|
||||||
|
use std::io::Read;
|
||||||
|
|
||||||
|
use crate::entity::item::armor::ArmorType;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
fn load_data_file<T: serde::de::DeserializeOwned>(path: &str) -> T {
|
||||||
|
let mut f = File::open(path).unwrap();
|
||||||
|
let mut s = String::new();
|
||||||
|
f.read_to_string(&mut s);
|
||||||
|
|
||||||
|
toml::from_str::<T>(s.as_str()).unwrap()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
struct WeaponStats {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Copy, Clone, Serialize, Deserialize)]
|
||||||
|
struct ArmorStats {
|
||||||
|
stars: u32,
|
||||||
|
dfp: i32,
|
||||||
|
evp: i32,
|
||||||
|
dfp_modifier: u32,
|
||||||
|
evp_modifier: u32,
|
||||||
|
team_points: u32,
|
||||||
|
level_req: u32,
|
||||||
|
efr: i32,
|
||||||
|
eic: i32,
|
||||||
|
eth: i32,
|
||||||
|
elt: i32,
|
||||||
|
edk: i32,
|
||||||
|
}
|
||||||
|
|
||||||
|
struct ShieldStats {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
struct UnitStats {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
fn armor_stats() -> HashMap<ArmorType, ArmorStats> {
|
||||||
|
let armor_stats: HashMap<String, ArmorStats> = load_data_file("data/item_stats/armor_stats.toml");
|
||||||
|
armor_stats.iter()
|
||||||
|
.map(|(name, stats)| {
|
||||||
|
(name.parse().unwrap(), *stats)
|
||||||
|
}).collect()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_armor_stats() {
|
||||||
|
let astat = armor_stats();
|
||||||
|
assert!(astat.get(&ArmorType::CrimsonCoat).unwrap().stars == 11);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -3,6 +3,7 @@ pub mod location;
|
|||||||
pub mod character;
|
pub mod character;
|
||||||
pub mod room;
|
pub mod room;
|
||||||
pub mod items;
|
pub mod items;
|
||||||
|
pub mod item_stats;
|
||||||
pub mod map;
|
pub mod map;
|
||||||
pub mod monster;
|
pub mod monster;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user