diff --git a/assets/common/items/npc_weapons/npcweapon/cyclops_hammer.ron b/assets/common/items/npc_weapons/npcweapon/cyclops_hammer.ron new file mode 100644 index 0000000000..904f65a5e0 --- /dev/null +++ b/assets/common/items/npc_weapons/npcweapon/cyclops_hammer.ron @@ -0,0 +1,13 @@ +Item( + name: "Cyclops Hammer", + description: "Wielded by a mighty cyclops.", + kind: Tool( + ( + kind: NpcWeapon("CyclopsHammer"), + stats: ( + equip_time_millis: 500, + power: 1.00, + ), + ) + ), +) diff --git a/assets/voxygen/item_image_manifest.ron b/assets/voxygen/item_image_manifest.ron index 7e2ebda6f1..6b98dedcf4 100644 --- a/assets/voxygen/item_image_manifest.ron +++ b/assets/voxygen/item_image_manifest.ron @@ -519,6 +519,11 @@ "voxel.weapon.shield.wood-0", (0.0, 0.0, 0.0), (-90.0, 90.0, 0.0), 2.4, ), + // Npc weapons (for test purposes, remove when done) + Tool(NpcWeapon("CyclopsHammer")): VoxTrans( + "voxel.weapon.npcweapon.cyclops_hammer", + (2.0, -1.0, 0.0), (-135.0, 90.0, 0.0), 1.1, + ), // Lanterns Lantern("Black0"): Png( "element.icons.lantern_black-0", diff --git a/assets/voxygen/voxel/humanoid_main_weapon_manifest.ron b/assets/voxygen/voxel/humanoid_main_weapon_manifest.ron index 79969d1c5c..d967085b4a 100644 --- a/assets/voxygen/voxel/humanoid_main_weapon_manifest.ron +++ b/assets/voxygen/voxel/humanoid_main_weapon_manifest.ron @@ -1,4 +1,9 @@ -({ //Swords +({ // Npc weapons (for test purposes, remove when done) + NpcWeapon("CyclopsHammer"): ( + vox_spec: ("weapon.npcweapon.cyclops_hammer", (-2.5, -7.5, -5.0)), + color: None + ), + //Swords Sword("BasicSword"): ( vox_spec: ("weapon.sword.rusty_2h", (-1.5, -6.5, -4.0)), color: None diff --git a/assets/voxygen/voxel/weapon/npcweapon/cyclops_hammer.vox b/assets/voxygen/voxel/weapon/npcweapon/cyclops_hammer.vox new file mode 100644 index 0000000000..93bf3d1752 --- /dev/null +++ b/assets/voxygen/voxel/weapon/npcweapon/cyclops_hammer.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ef11b80feaf3144e07c4779baa8eaf248e4311e3c927e050193f254ff7136111 +size 29267 diff --git a/common/src/comp/ability.rs b/common/src/comp/ability.rs index 3f4931de89..e921cc1767 100644 --- a/common/src/comp/ability.rs +++ b/common/src/comp/ability.rs @@ -50,6 +50,7 @@ pub enum CharacterAbility { buildup_duration: Duration, recover_duration: Duration, base_healthchange: i32, + knockback: f32, range: f32, max_angle: f32, }, @@ -250,6 +251,7 @@ impl From<&CharacterAbility> for CharacterState { buildup_duration, recover_duration, base_healthchange, + knockback, range, max_angle, energy_cost: _, @@ -258,6 +260,7 @@ impl From<&CharacterAbility> for CharacterState { buildup_duration: *buildup_duration, recover_duration: *recover_duration, base_healthchange: *base_healthchange, + knockback: *knockback, range: *range, max_angle: *max_angle, }), diff --git a/common/src/comp/inventory/item/tool.rs b/common/src/comp/inventory/item/tool.rs index 8b36fa8756..2b6338a2f2 100644 --- a/common/src/comp/inventory/item/tool.rs +++ b/common/src/comp/inventory/item/tool.rs @@ -16,6 +16,7 @@ pub enum ToolKind { Dagger(String), Staff(String), Shield(String), + NpcWeapon(String), Debug(String), Farming(String), /// This is an placeholder item, it is used by non-humanoid npcs to attack @@ -32,6 +33,7 @@ impl ToolKind { ToolKind::Dagger(_) => Hands::OneHand, ToolKind::Staff(_) => Hands::TwoHand, ToolKind::Shield(_) => Hands::OneHand, + ToolKind::NpcWeapon(_) => Hands::TwoHand, ToolKind::Debug(_) => Hands::TwoHand, ToolKind::Farming(_) => Hands::TwoHand, ToolKind::Empty => Hands::OneHand, @@ -53,6 +55,7 @@ pub enum ToolCategory { Dagger, Staff, Shield, + NpcWeapon, Debug, Farming, Empty, @@ -68,6 +71,7 @@ impl From<&ToolKind> for ToolCategory { ToolKind::Dagger(_) => ToolCategory::Dagger, ToolKind::Staff(_) => ToolCategory::Staff, ToolKind::Shield(_) => ToolCategory::Shield, + ToolKind::NpcWeapon(_) => ToolCategory::NpcWeapon, ToolKind::Debug(_) => ToolCategory::Debug, ToolKind::Farming(_) => ToolCategory::Farming, ToolKind::Empty => ToolCategory::Empty, @@ -141,6 +145,7 @@ impl Tool { buildup_duration: Duration::from_millis(700), recover_duration: Duration::from_millis(300), base_healthchange: (-120.0 * self.base_power()) as i32, + knockback: 0.0, range: 3.5, max_angle: 20.0, }, @@ -157,6 +162,7 @@ impl Tool { buildup_duration: Duration::from_millis(700), recover_duration: Duration::from_millis(150), base_healthchange: (-50.0 * self.base_power()) as i32, + knockback: 0.0, range: 3.5, max_angle: 20.0, }], @@ -202,6 +208,7 @@ impl Tool { buildup_duration: Duration::from_millis(100), recover_duration: Duration::from_millis(400), base_healthchange: (-50.0 * self.base_power()) as i32, + knockback: 0.0, range: 3.5, max_angle: 20.0, }, @@ -220,6 +227,7 @@ impl Tool { buildup_duration: Duration::from_millis(0), recover_duration: Duration::from_millis(300), base_healthchange: (-10.0 * self.base_power()) as i32, + knockback: 0.0, range: 5.0, max_angle: 20.0, }, @@ -228,6 +236,7 @@ impl Tool { buildup_duration: Duration::from_millis(0), recover_duration: Duration::from_millis(1000), base_healthchange: (150.0 * self.base_power()) as i32, + knockback: 0.0, range: 100.0, max_angle: 90.0, }, @@ -239,6 +248,7 @@ impl Tool { buildup_duration: Duration::from_millis(0), recover_duration: Duration::from_millis(300), base_healthchange: (-10.0 * self.base_power()) as i32, + knockback: 0.0, range: 5.0, max_angle: 20.0, }, @@ -247,6 +257,7 @@ impl Tool { buildup_duration: Duration::from_millis(0), recover_duration: Duration::from_millis(1000), base_healthchange: (350.0 * self.base_power()) as i32, + knockback: 0.0, range: 100.0, max_angle: 90.0, }, @@ -258,6 +269,7 @@ impl Tool { buildup_duration: Duration::from_millis(100), recover_duration: Duration::from_millis(300), base_healthchange: (-40.0 * self.base_power()) as i32, + knockback: 0.0, range: 3.5, max_angle: 20.0, }, @@ -324,11 +336,35 @@ impl Tool { buildup_duration: Duration::from_millis(100), recover_duration: Duration::from_millis(400), base_healthchange: (-40.0 * self.base_power()) as i32, + knockback: 0.0, range: 3.0, max_angle: 120.0, }, BasicBlock, ], + NpcWeapon(kind) => { + if kind == "CyclopsHammer" { + vec![BasicMelee { + energy_cost: 0, + buildup_duration: Duration::from_millis(0), + recover_duration: Duration::from_millis(300), + knockback: 20.0, + base_healthchange: -200, + range: 10.0, + max_angle: 120.0, + }] + } else { + vec![BasicMelee { + energy_cost: 0, + buildup_duration: Duration::from_millis(100), + recover_duration: Duration::from_millis(300), + base_healthchange: -10, + knockback: 0.0, + range: 1.0, + max_angle: 30.0, + }] + } + }, Debug(kind) => { if kind == "Boost" { vec![ @@ -372,6 +408,7 @@ impl Tool { buildup_duration: Duration::from_millis(0), recover_duration: Duration::from_millis(1000), base_healthchange: -20, + knockback: 0.0, range: 3.5, max_angle: 15.0, }], diff --git a/common/src/loadout_builder.rs b/common/src/loadout_builder.rs index 24d41c39ab..3f40faccb9 100644 --- a/common/src/loadout_builder.rs +++ b/common/src/loadout_builder.rs @@ -70,6 +70,7 @@ impl LoadoutBuilder { buildup_duration: Duration::from_millis(600), recover_duration: Duration::from_millis(100), base_healthchange: -(body.base_dmg() as i32), + knockback: 0.0, range: body.base_range(), max_angle: 20.0, }), diff --git a/common/src/states/basic_melee.rs b/common/src/states/basic_melee.rs index caead1a54c..e234668661 100644 --- a/common/src/states/basic_melee.rs +++ b/common/src/states/basic_melee.rs @@ -14,6 +14,8 @@ pub struct Data { pub recover_duration: Duration, /// Base damage (negative) or healing (positive) pub base_healthchange: i32, + /// Knockback + pub knockback: f32, /// Max range pub range: f32, /// Max angle (45.0 will give you a 90.0 angle window) @@ -38,6 +40,7 @@ impl CharacterBehavior for Data { .unwrap_or_default(), recover_duration: self.recover_duration, base_healthchange: self.base_healthchange, + knockback: self.knockback, range: self.range, max_angle: self.max_angle, exhausted: false, @@ -50,13 +53,14 @@ impl CharacterBehavior for Data { max_angle: self.max_angle.to_radians(), applied: false, hit_count: 0, - knockback: 0.0, + knockback: self.knockback, }); update.character = CharacterState::BasicMelee(Data { buildup_duration: self.buildup_duration, recover_duration: self.recover_duration, base_healthchange: self.base_healthchange, + knockback: self.knockback, range: self.range, max_angle: self.max_angle, exhausted: true, @@ -70,6 +74,7 @@ impl CharacterBehavior for Data { .checked_sub(Duration::from_secs_f32(data.dt.0)) .unwrap_or_default(), base_healthchange: self.base_healthchange, + knockback: self.knockback, range: self.range, max_angle: self.max_angle, exhausted: true, diff --git a/server/src/sys/terrain.rs b/server/src/sys/terrain.rs index 6ba5401ac7..a48c16356f 100644 --- a/server/src/sys/terrain.rs +++ b/server/src/sys/terrain.rs @@ -147,6 +147,7 @@ impl<'a> System<'a> for Sys { buildup_duration: Duration::from_millis(0), recover_duration: Duration::from_millis(400), base_healthchange: -40, + knockback: 0.0, range: 3.5, max_angle: 15.0, }), @@ -277,6 +278,7 @@ impl<'a> System<'a> for Sys { buildup_duration: Duration::from_millis(800), recover_duration: Duration::from_millis(200), base_healthchange: -100, + knockback: 0.0, range: 3.5, max_angle: 60.0, }), diff --git a/tools/src/main.rs b/tools/src/main.rs index 37ee04f4c0..c5b2455f97 100644 --- a/tools/src/main.rs +++ b/tools/src/main.rs @@ -79,6 +79,7 @@ fn get_tool_kind(kind: &ToolKind) -> String { ToolKind::Shield(_) => "Shield".to_string(), ToolKind::Debug(_) => "Debug".to_string(), ToolKind::Farming(_) => "Farming".to_string(), + ToolKind::NpcWeapon(_) => "NpcWeapon".to_string(), ToolKind::Empty => "Empty".to_string(), } } @@ -94,6 +95,7 @@ fn get_tool_kind_kind(kind: &ToolKind) -> String { ToolKind::Shield(x) => x.clone(), ToolKind::Debug(x) => x.clone(), ToolKind::Farming(x) => x.clone(), + ToolKind::NpcWeapon(x) => x.clone(), ToolKind::Empty => "".to_string(), } } diff --git a/voxygen/src/hud/util.rs b/voxygen/src/hud/util.rs index 2847cb221d..8b23ca3d6c 100644 --- a/voxygen/src/hud/util.rs +++ b/voxygen/src/hud/util.rs @@ -75,6 +75,7 @@ fn tool_desc(tool: &Tool, desc: &str) -> String { ToolKind::Dagger(_) => "Dagger", ToolKind::Staff(_) => "Staff", ToolKind::Shield(_) => "Shield", + ToolKind::NpcWeapon(_) => "Npc Weapon", ToolKind::Debug(_) => "Debug", ToolKind::Farming(_) => "Farming Tool", ToolKind::Empty => "Empty",