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,
}
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
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.
Helmet,
@ -72,7 +72,7 @@ pub enum Armor {
}
//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 {
Apple,
Cheese,
@ -83,13 +83,13 @@ pub enum Consumable {
PotionMinor,
}
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Ingredient {
Flower,
Grass,
}
#[derive(Clone, Debug, Default, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct ToolData {
pub kind: ToolKind,
equip_time_millis: u64,
@ -99,7 +99,7 @@ pub struct ToolData {
base_damage: u64,
}
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum ItemKind {
Tool(ToolData),
Armor { kind: Armor, power: u32 },

View File

@ -14,10 +14,10 @@ pub struct BasicAttackState {
impl StateHandler for BasicAttackState {
fn new(ecs_data: &EcsStateData) -> Self {
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
} else {
&ToolData::default()
ToolData::default()
};
Self {
remaining_duration: tool_data.attack_duration(),

View File

@ -18,10 +18,10 @@ pub struct ChargeAttackState {
impl StateHandler for ChargeAttackState {
fn new(ecs_data: &EcsStateData) -> Self {
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
} else {
&ToolData::default()
ToolData::default()
};
Self {
remaining_duration: tool_data.attack_duration(),

View File

@ -15,10 +15,10 @@ pub struct RollState {
impl StateHandler for RollState {
fn new(ecs_data: &EcsStateData) -> Self {
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
} else {
&ToolData::default()
ToolData::default()
};
Self {
remaining_duration: tool_data.attack_duration(),

View File

@ -15,10 +15,10 @@ pub struct WieldState {
impl StateHandler for WieldState {
fn new(ecs_data: &EcsStateData) -> Self {
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
} else {
&ToolData::default()
ToolData::default()
};
Self {
equip_delay: tool_data.equip_time(),