This commit is contained in:
Adam Whitehurst 2020-01-05 15:21:37 -08:00
parent 542f06eef4
commit 5bba0a96fc
5 changed files with 13 additions and 13 deletions

View File

@ -55,7 +55,7 @@ pub enum Debug {
Possess, Possess,
} }
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Armor { pub enum Armor {
// TODO: Don't make armor be a body part. Wearing enemy's head is funny but also a creepy thing to do. // TODO: Don't make armor be a body part. Wearing enemy's head is funny but also a creepy thing to do.
Helmet, Helmet,
@ -72,7 +72,7 @@ pub enum Armor {
} }
//TODO: Do we even need this? //TODO: Do we even need this?
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Consumable { pub enum Consumable {
Apple, Apple,
Cheese, Cheese,
@ -83,13 +83,13 @@ pub enum Consumable {
PotionMinor, PotionMinor,
} }
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Ingredient { pub enum Ingredient {
Flower, Flower,
Grass, Grass,
} }
#[derive(Clone, Debug, Default, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct ToolData { pub struct ToolData {
pub kind: ToolKind, pub kind: ToolKind,
equip_time_millis: u64, equip_time_millis: u64,
@ -99,7 +99,7 @@ pub struct ToolData {
base_damage: u64, base_damage: u64,
} }
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum ItemKind { pub enum ItemKind {
Tool(ToolData), Tool(ToolData),
Armor { kind: Armor, power: u32 }, Armor { kind: Armor, power: u32 },

View File

@ -14,10 +14,10 @@ pub struct BasicAttackState {
impl StateHandler for BasicAttackState { impl StateHandler for BasicAttackState {
fn new(ecs_data: &EcsStateData) -> Self { fn new(ecs_data: &EcsStateData) -> Self {
let tool_data = let tool_data =
if let Some(Tool(data)) = ecs_data.stats.equipment.main.as_ref().map(|i| &i.kind) { if let Some(Tool(data)) = ecs_data.stats.equipment.main.as_ref().map(|i| i.kind) {
data data
} else { } else {
&ToolData::default() ToolData::default()
}; };
Self { Self {
remaining_duration: tool_data.attack_duration(), remaining_duration: tool_data.attack_duration(),

View File

@ -18,10 +18,10 @@ pub struct ChargeAttackState {
impl StateHandler for ChargeAttackState { impl StateHandler for ChargeAttackState {
fn new(ecs_data: &EcsStateData) -> Self { fn new(ecs_data: &EcsStateData) -> Self {
let tool_data = let tool_data =
if let Some(Tool(data)) = ecs_data.stats.equipment.main.as_ref().map(|i| &i.kind) { if let Some(Tool(data)) = ecs_data.stats.equipment.main.as_ref().map(|i| i.kind) {
data data
} else { } else {
&ToolData::default() ToolData::default()
}; };
Self { Self {
remaining_duration: tool_data.attack_duration(), remaining_duration: tool_data.attack_duration(),

View File

@ -15,10 +15,10 @@ pub struct RollState {
impl StateHandler for RollState { impl StateHandler for RollState {
fn new(ecs_data: &EcsStateData) -> Self { fn new(ecs_data: &EcsStateData) -> Self {
let tool_data = let tool_data =
if let Some(Tool(data)) = ecs_data.stats.equipment.main.as_ref().map(|i| &i.kind) { if let Some(Tool(data)) = ecs_data.stats.equipment.main.as_ref().map(|i| i.kind) {
data data
} else { } else {
&ToolData::default() ToolData::default()
}; };
Self { Self {
remaining_duration: tool_data.attack_duration(), remaining_duration: tool_data.attack_duration(),

View File

@ -15,10 +15,10 @@ pub struct WieldState {
impl StateHandler for WieldState { impl StateHandler for WieldState {
fn new(ecs_data: &EcsStateData) -> Self { fn new(ecs_data: &EcsStateData) -> Self {
let tool_data = let tool_data =
if let Some(Tool(data)) = ecs_data.stats.equipment.main.as_ref().map(|i| &i.kind) { if let Some(Tool(data)) = ecs_data.stats.equipment.main.as_ref().map(|i| i.kind) {
data data
} else { } else {
&ToolData::default() ToolData::default()
}; };
Self { Self {
equip_delay: tool_data.equip_time(), equip_delay: tool_data.equip_time(),