|
@ -3,7 +3,7 @@ use serde::{Serialize, Deserialize}; |
|
|
|
|
|
|
|
|
#[derive(Debug, Copy, Clone, PartialEq, Eq, Ord, PartialOrd)]
|
|
|
#[derive(Debug, Copy, Clone, PartialEq, Eq, Ord, PartialOrd)]
|
|
|
pub enum Attribute {
|
|
|
pub enum Attribute {
|
|
|
Native,
|
|
|
|
|
|
|
|
|
Native = 1,
|
|
|
ABeast,
|
|
|
ABeast,
|
|
|
Machine,
|
|
|
Machine,
|
|
|
Dark,
|
|
|
Dark,
|
|
@ -16,10 +16,16 @@ pub struct WeaponAttribute { |
|
|
pub value: i8,
|
|
|
pub value: i8,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
impl WeaponAttribute {
|
|
|
|
|
|
pub fn value(&self) -> [u8; 2] {
|
|
|
|
|
|
[self.attr as u8, self.value as u8]
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(Debug, Copy, Clone, PartialEq)]
|
|
|
#[derive(Debug, Copy, Clone, PartialEq)]
|
|
|
pub enum WeaponSpecial {
|
|
|
pub enum WeaponSpecial {
|
|
|
Draw,
|
|
|
|
|
|
|
|
|
Draw = 1,
|
|
|
Drain,
|
|
|
Drain,
|
|
|
Fill,
|
|
|
Fill,
|
|
|
Gush,
|
|
|
Gush,
|
|
@ -61,6 +67,12 @@ pub enum WeaponSpecial { |
|
|
Demons,
|
|
|
Demons,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
impl WeaponSpecial {
|
|
|
|
|
|
pub fn value(&self) -> u8 {
|
|
|
|
|
|
*self as u8
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, enum_utils::FromStr, derive_more::Display)]
|
|
|
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, enum_utils::FromStr, derive_more::Display)]
|
|
|
pub enum WeaponType {
|
|
|
pub enum WeaponType {
|
|
|
Saber,
|
|
|
Saber,
|
|
@ -879,7 +891,16 @@ impl Weapon { |
|
|
let mut result = [0u8; 16];
|
|
|
let mut result = [0u8; 16];
|
|
|
result[0..3].copy_from_slice(&self.weapon.value());
|
|
|
result[0..3].copy_from_slice(&self.weapon.value());
|
|
|
result[3] = self.grind;
|
|
|
result[3] = self.grind;
|
|
|
// TODO: percents
|
|
|
|
|
|
|
|
|
result[4] = self.special.map(|s| s.value()).unwrap_or(0);
|
|
|
|
|
|
|
|
|
|
|
|
if self.tekked == false {
|
|
|
|
|
|
result[4] += 0x80
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
result[6..8].copy_from_slice(&self.attrs[0].map(|s| s.value()).unwrap_or([0,0]));
|
|
|
|
|
|
result[8..10].copy_from_slice(&self.attrs[1].map(|s| s.value()).unwrap_or([0,0]));
|
|
|
|
|
|
result[10..12].copy_from_slice(&self.attrs[2].map(|s| s.value()).unwrap_or([0,0]));
|
|
|
|
|
|
|
|
|
result
|
|
|
result
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|