//! `Attack` type. use crate::{bin::OptU16, err::*, fixed::{Angle, Unit}}; /// Reads an `Attack` object. pub fn read(b: &[u8]) -> ResultS { read_data! { endian: BIG, buf: b, size: 16, start: 0, data { let ptype = OptU16[0]; let rep = u16[2]; let error = Angle[4]; let range = Unit[6]; let shape = u16[8]; let ofs_x = Unit[10]; let ofs_y = Unit[12]; let ofs_z = Unit[14]; } } Ok(Attack{ptype, rep, error, range, shape, ofs_x, ofs_y, ofs_z}) } /// The definition of a monster's attack. #[cfg_attr(feature = "serde_obj", derive(serde::Serialize))] #[derive(Debug, Eq, PartialEq)] pub struct Attack { pub ptype: OptU16, pub rep: u16, pub error: Angle, pub range: Unit, pub shape: u16, pub ofs_x: Unit, pub ofs_y: Unit, pub ofs_z: Unit, } // EOF