Browse Source

shield and unit item stats

pbs
jake 5 years ago
parent
commit
b0c6d10590
  1. 18
      src/entity/item/shield.rs
  2. 58
      src/entity/item/unit.rs
  3. 60
      src/ship/item_stats.rs

18
src/entity/item/shield.rs

@ -1,6 +1,6 @@
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 ShieldType {
Barrier,
Shield,
@ -25,8 +25,8 @@ pub enum ShieldType {
CelestialShield,
InvisibleGuard,
SacredGuard,
SPartsver116,
SPartsver201,
SPartsVer116,
SPartsVer201,
LightRelief,
ShieldOfDelsaber,
ForceWall,
@ -39,7 +39,7 @@ pub enum ShieldType {
RegenerateGear,
RegeneGearAdv,
FlowensShield,
CustomBarrierveroo,
CustomBarrierVerOo,
DbsShield,
RedRing,
TripolicShield,
@ -144,7 +144,7 @@ pub enum ShieldType {
BunnyEars,
CatEars,
ThreeSeals,
GodsShieldkouryu,
GodsShieldKouryu,
DfShield,
FromTheDepths,
DeRolLeShield,
@ -195,8 +195,8 @@ impl ShieldType {
ShieldType::CelestialShield => [0x01, 0x02, 0x14],
ShieldType::InvisibleGuard => [0x01, 0x02, 0x15],
ShieldType::SacredGuard => [0x01, 0x02, 0x16],
ShieldType::SPartsver116 => [0x01, 0x02, 0x17],
ShieldType::SPartsver201 => [0x01, 0x02, 0x18],
ShieldType::SPartsVer116 => [0x01, 0x02, 0x17],
ShieldType::SPartsVer201 => [0x01, 0x02, 0x18],
ShieldType::LightRelief => [0x01, 0x02, 0x19],
ShieldType::ShieldOfDelsaber => [0x01, 0x02, 0x1A],
ShieldType::ForceWall => [0x01, 0x02, 0x1B],
@ -209,7 +209,7 @@ impl ShieldType {
ShieldType::RegenerateGear => [0x01, 0x02, 0x22],
ShieldType::RegeneGearAdv => [0x01, 0x02, 0x23],
ShieldType::FlowensShield => [0x01, 0x02, 0x24],
ShieldType::CustomBarrierveroo => [0x01, 0x02, 0x25],
ShieldType::CustomBarrierVerOo => [0x01, 0x02, 0x25],
ShieldType::DbsShield => [0x01, 0x02, 0x26],
ShieldType::RedRing => [0x01, 0x02, 0x27],
ShieldType::TripolicShield => [0x01, 0x02, 0x28],
@ -314,7 +314,7 @@ impl ShieldType {
ShieldType::BunnyEars => [0x01, 0x02, 0x8B],
ShieldType::CatEars => [0x01, 0x02, 0x8C],
ShieldType::ThreeSeals => [0x01, 0x02, 0x8D],
ShieldType::GodsShieldkouryu => [0x01, 0x02, 0x8E],
ShieldType::GodsShieldKouryu => [0x01, 0x02, 0x8E],
ShieldType::DfShield => [0x01, 0x02, 0x8F],
ShieldType::FromTheDepths => [0x01, 0x02, 0x90],
ShieldType::DeRolLeShield => [0x01, 0x02, 0x91],

58
src/entity/item/unit.rs

@ -1,7 +1,7 @@
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 UnitType {
KnightPower,
GeneralPower,
@ -75,6 +75,34 @@ pub enum UnitType {
CureConfuse,
CureFreeze,
CureShock,
YasakaniMagatama,
V101,
V501,
V502,
V801,
Limiter,
Adept,
SwordsmanLore,
ProofOfSwordSaint,
Smartlink,
DivineProtection,
HeavenlyBattle,
HeavenlyPower,
HeavenlyMind,
HeavenlyArms,
HeavenlyLegs,
HeavenlyBody,
HeavenlyLuck,
HeavenlyAbility,
CenturionAbility,
FriendRing,
HeavenlyHP,
HeavenlyTP,
HeavenlyResist,
HeavenlyTechnique,
HPRessurection,
TPRessurection,
PBIncrease,
}
impl UnitType {
@ -152,6 +180,34 @@ impl UnitType {
UnitType::CureConfuse => [0x01, 0x03, 0x45],
UnitType::CureFreeze => [0x01, 0x03, 0x46],
UnitType::CureShock => [0x01, 0x03, 0x47],
UnitType::YasakaniMagatama => [0x01, 0x03, 0x48],
UnitType::V101 => [0x01, 0x03, 0x49],
UnitType::V501 => [0x01, 0x03, 0x4A],
UnitType::V502 => [0x01, 0x03, 0x4B],
UnitType::V801 => [0x01, 0x03, 0x4C],
UnitType::Limiter => [0x01, 0x03, 0x4D],
UnitType::Adept => [0x01, 0x03, 0x4E],
UnitType::SwordsmanLore => [0x01, 0x03, 0x4F],
UnitType::ProofOfSwordSaint => [0x01, 0x03, 0x50],
UnitType::Smartlink => [0x01, 0x03, 0x51],
UnitType::DivineProtection => [0x01, 0x03, 0x52],
UnitType::HeavenlyBattle => [0x01, 0x03, 0x53],
UnitType::HeavenlyPower => [0x01, 0x03, 0x54],
UnitType::HeavenlyMind => [0x01, 0x03, 0x55],
UnitType::HeavenlyArms => [0x01, 0x03, 0x56],
UnitType::HeavenlyLegs => [0x01, 0x03, 0x57],
UnitType::HeavenlyBody => [0x01, 0x03, 0x58],
UnitType::HeavenlyLuck => [0x01, 0x03, 0x59],
UnitType::HeavenlyAbility => [0x01, 0x03, 0x5A],
UnitType::CenturionAbility => [0x01, 0x03, 0x5B],
UnitType::FriendRing => [0x01, 0x03, 0x5C],
UnitType::HeavenlyHP => [0x01, 0x03, 0x5D],
UnitType::HeavenlyTP => [0x01, 0x03, 0x5E],
UnitType::HeavenlyResist => [0x01, 0x03, 0x5F],
UnitType::HeavenlyTechnique => [0x01, 0x03, 0x60],
UnitType::HPRessurection => [0x01, 0x03, 0x61],
UnitType::TPRessurection => [0x01, 0x03, 0x62],
UnitType::PBIncrease => [0x01, 0x03, 0x63],
}
}
}

60
src/ship/item_stats.rs

@ -4,12 +4,8 @@ use std::fs::File;
use std::io::Read;
use crate::entity::item::armor::ArmorType;
use crate::entity::item::shield::ShieldType;
use crate::entity::item::unit::UnitType;
fn load_data_file<T: serde::de::DeserializeOwned>(path: &str) -> T {
@ -21,11 +17,6 @@ fn load_data_file<T: serde::de::DeserializeOwned>(path: &str) -> T {
}
struct WeaponStats {
}
@ -46,16 +37,32 @@ struct ArmorStats {
edk: i32,
}
#[derive(Debug, Copy, Clone, Serialize, Deserialize)]
struct ShieldStats {
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,
}
#[derive(Debug, Copy, Clone, Serialize, Deserialize)]
struct UnitStats {
stars: u32,
stat: u32,
amount: u32,
team_points: u32,
modifier: u32,
}
fn armor_stats() -> HashMap<ArmorType, ArmorStats> {
let armor_stats: HashMap<String, ArmorStats> = load_data_file("data/item_stats/armor_stats.toml");
armor_stats.iter()
@ -64,6 +71,21 @@ fn armor_stats() -> HashMap<ArmorType, ArmorStats> {
}).collect()
}
fn shield_stats() -> HashMap<ShieldType, ShieldStats> {
let shield_stats: HashMap<String, ShieldStats> = load_data_file("data/item_stats/shield_stats.toml");
shield_stats.iter()
.map(|(name, stats)| {
(name.parse().unwrap(), *stats)
}).collect()
}
fn unit_stats() -> HashMap<UnitType, UnitStats> {
let unit_stats: HashMap<String, UnitStats> = load_data_file("data/item_stats/unit_stats.toml");
unit_stats.iter()
.map(|(name, stats)| {
(name.parse().unwrap(), *stats)
}).collect()
}
#[cfg(test)]
mod test {
@ -75,5 +97,15 @@ mod test {
assert!(astat.get(&ArmorType::CrimsonCoat).unwrap().stars == 11);
}
#[test]
fn test_shield_stats() {
let sstat = shield_stats();
assert!(sstat.get(&ShieldType::RedRing).unwrap().stars == 11);
}
#[test]
fn test_unit_stats() {
let ustat = unit_stats();
assert!(ustat.get(&UnitType::ElfArm).unwrap().stars == 5);
}
}
Loading…
Cancel
Save