Separated knockback out from basicmelee. Added weapon for cyclops boss to use, and added 1 ability to it.

This commit is contained in:
Sam 2020-08-05 17:49:04 -05:00
parent 43398afa0c
commit 66b0fee3c7
11 changed files with 79 additions and 2 deletions

View File

@ -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,
),
)
),
)

View File

@ -519,6 +519,11 @@
"voxel.weapon.shield.wood-0", "voxel.weapon.shield.wood-0",
(0.0, 0.0, 0.0), (-90.0, 90.0, 0.0), 2.4, (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 // Lanterns
Lantern("Black0"): Png( Lantern("Black0"): Png(
"element.icons.lantern_black-0", "element.icons.lantern_black-0",

View File

@ -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"): ( Sword("BasicSword"): (
vox_spec: ("weapon.sword.rusty_2h", (-1.5, -6.5, -4.0)), vox_spec: ("weapon.sword.rusty_2h", (-1.5, -6.5, -4.0)),
color: None color: None

BIN
assets/voxygen/voxel/weapon/npcweapon/cyclops_hammer.vox (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -50,6 +50,7 @@ pub enum CharacterAbility {
buildup_duration: Duration, buildup_duration: Duration,
recover_duration: Duration, recover_duration: Duration,
base_healthchange: i32, base_healthchange: i32,
knockback: f32,
range: f32, range: f32,
max_angle: f32, max_angle: f32,
}, },
@ -250,6 +251,7 @@ impl From<&CharacterAbility> for CharacterState {
buildup_duration, buildup_duration,
recover_duration, recover_duration,
base_healthchange, base_healthchange,
knockback,
range, range,
max_angle, max_angle,
energy_cost: _, energy_cost: _,
@ -258,6 +260,7 @@ impl From<&CharacterAbility> for CharacterState {
buildup_duration: *buildup_duration, buildup_duration: *buildup_duration,
recover_duration: *recover_duration, recover_duration: *recover_duration,
base_healthchange: *base_healthchange, base_healthchange: *base_healthchange,
knockback: *knockback,
range: *range, range: *range,
max_angle: *max_angle, max_angle: *max_angle,
}), }),

View File

@ -16,6 +16,7 @@ pub enum ToolKind {
Dagger(String), Dagger(String),
Staff(String), Staff(String),
Shield(String), Shield(String),
NpcWeapon(String),
Debug(String), Debug(String),
Farming(String), Farming(String),
/// This is an placeholder item, it is used by non-humanoid npcs to attack /// 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::Dagger(_) => Hands::OneHand,
ToolKind::Staff(_) => Hands::TwoHand, ToolKind::Staff(_) => Hands::TwoHand,
ToolKind::Shield(_) => Hands::OneHand, ToolKind::Shield(_) => Hands::OneHand,
ToolKind::NpcWeapon(_) => Hands::TwoHand,
ToolKind::Debug(_) => Hands::TwoHand, ToolKind::Debug(_) => Hands::TwoHand,
ToolKind::Farming(_) => Hands::TwoHand, ToolKind::Farming(_) => Hands::TwoHand,
ToolKind::Empty => Hands::OneHand, ToolKind::Empty => Hands::OneHand,
@ -53,6 +55,7 @@ pub enum ToolCategory {
Dagger, Dagger,
Staff, Staff,
Shield, Shield,
NpcWeapon,
Debug, Debug,
Farming, Farming,
Empty, Empty,
@ -68,6 +71,7 @@ impl From<&ToolKind> for ToolCategory {
ToolKind::Dagger(_) => ToolCategory::Dagger, ToolKind::Dagger(_) => ToolCategory::Dagger,
ToolKind::Staff(_) => ToolCategory::Staff, ToolKind::Staff(_) => ToolCategory::Staff,
ToolKind::Shield(_) => ToolCategory::Shield, ToolKind::Shield(_) => ToolCategory::Shield,
ToolKind::NpcWeapon(_) => ToolCategory::NpcWeapon,
ToolKind::Debug(_) => ToolCategory::Debug, ToolKind::Debug(_) => ToolCategory::Debug,
ToolKind::Farming(_) => ToolCategory::Farming, ToolKind::Farming(_) => ToolCategory::Farming,
ToolKind::Empty => ToolCategory::Empty, ToolKind::Empty => ToolCategory::Empty,
@ -141,6 +145,7 @@ impl Tool {
buildup_duration: Duration::from_millis(700), buildup_duration: Duration::from_millis(700),
recover_duration: Duration::from_millis(300), recover_duration: Duration::from_millis(300),
base_healthchange: (-120.0 * self.base_power()) as i32, base_healthchange: (-120.0 * self.base_power()) as i32,
knockback: 0.0,
range: 3.5, range: 3.5,
max_angle: 20.0, max_angle: 20.0,
}, },
@ -157,6 +162,7 @@ impl Tool {
buildup_duration: Duration::from_millis(700), buildup_duration: Duration::from_millis(700),
recover_duration: Duration::from_millis(150), recover_duration: Duration::from_millis(150),
base_healthchange: (-50.0 * self.base_power()) as i32, base_healthchange: (-50.0 * self.base_power()) as i32,
knockback: 0.0,
range: 3.5, range: 3.5,
max_angle: 20.0, max_angle: 20.0,
}], }],
@ -202,6 +208,7 @@ impl Tool {
buildup_duration: Duration::from_millis(100), buildup_duration: Duration::from_millis(100),
recover_duration: Duration::from_millis(400), recover_duration: Duration::from_millis(400),
base_healthchange: (-50.0 * self.base_power()) as i32, base_healthchange: (-50.0 * self.base_power()) as i32,
knockback: 0.0,
range: 3.5, range: 3.5,
max_angle: 20.0, max_angle: 20.0,
}, },
@ -220,6 +227,7 @@ impl Tool {
buildup_duration: Duration::from_millis(0), buildup_duration: Duration::from_millis(0),
recover_duration: Duration::from_millis(300), recover_duration: Duration::from_millis(300),
base_healthchange: (-10.0 * self.base_power()) as i32, base_healthchange: (-10.0 * self.base_power()) as i32,
knockback: 0.0,
range: 5.0, range: 5.0,
max_angle: 20.0, max_angle: 20.0,
}, },
@ -228,6 +236,7 @@ impl Tool {
buildup_duration: Duration::from_millis(0), buildup_duration: Duration::from_millis(0),
recover_duration: Duration::from_millis(1000), recover_duration: Duration::from_millis(1000),
base_healthchange: (150.0 * self.base_power()) as i32, base_healthchange: (150.0 * self.base_power()) as i32,
knockback: 0.0,
range: 100.0, range: 100.0,
max_angle: 90.0, max_angle: 90.0,
}, },
@ -239,6 +248,7 @@ impl Tool {
buildup_duration: Duration::from_millis(0), buildup_duration: Duration::from_millis(0),
recover_duration: Duration::from_millis(300), recover_duration: Duration::from_millis(300),
base_healthchange: (-10.0 * self.base_power()) as i32, base_healthchange: (-10.0 * self.base_power()) as i32,
knockback: 0.0,
range: 5.0, range: 5.0,
max_angle: 20.0, max_angle: 20.0,
}, },
@ -247,6 +257,7 @@ impl Tool {
buildup_duration: Duration::from_millis(0), buildup_duration: Duration::from_millis(0),
recover_duration: Duration::from_millis(1000), recover_duration: Duration::from_millis(1000),
base_healthchange: (350.0 * self.base_power()) as i32, base_healthchange: (350.0 * self.base_power()) as i32,
knockback: 0.0,
range: 100.0, range: 100.0,
max_angle: 90.0, max_angle: 90.0,
}, },
@ -258,6 +269,7 @@ impl Tool {
buildup_duration: Duration::from_millis(100), buildup_duration: Duration::from_millis(100),
recover_duration: Duration::from_millis(300), recover_duration: Duration::from_millis(300),
base_healthchange: (-40.0 * self.base_power()) as i32, base_healthchange: (-40.0 * self.base_power()) as i32,
knockback: 0.0,
range: 3.5, range: 3.5,
max_angle: 20.0, max_angle: 20.0,
}, },
@ -324,11 +336,35 @@ impl Tool {
buildup_duration: Duration::from_millis(100), buildup_duration: Duration::from_millis(100),
recover_duration: Duration::from_millis(400), recover_duration: Duration::from_millis(400),
base_healthchange: (-40.0 * self.base_power()) as i32, base_healthchange: (-40.0 * self.base_power()) as i32,
knockback: 0.0,
range: 3.0, range: 3.0,
max_angle: 120.0, max_angle: 120.0,
}, },
BasicBlock, 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) => { Debug(kind) => {
if kind == "Boost" { if kind == "Boost" {
vec![ vec![
@ -372,6 +408,7 @@ impl Tool {
buildup_duration: Duration::from_millis(0), buildup_duration: Duration::from_millis(0),
recover_duration: Duration::from_millis(1000), recover_duration: Duration::from_millis(1000),
base_healthchange: -20, base_healthchange: -20,
knockback: 0.0,
range: 3.5, range: 3.5,
max_angle: 15.0, max_angle: 15.0,
}], }],

View File

@ -70,6 +70,7 @@ impl LoadoutBuilder {
buildup_duration: Duration::from_millis(600), buildup_duration: Duration::from_millis(600),
recover_duration: Duration::from_millis(100), recover_duration: Duration::from_millis(100),
base_healthchange: -(body.base_dmg() as i32), base_healthchange: -(body.base_dmg() as i32),
knockback: 0.0,
range: body.base_range(), range: body.base_range(),
max_angle: 20.0, max_angle: 20.0,
}), }),

View File

@ -14,6 +14,8 @@ pub struct Data {
pub recover_duration: Duration, pub recover_duration: Duration,
/// Base damage (negative) or healing (positive) /// Base damage (negative) or healing (positive)
pub base_healthchange: i32, pub base_healthchange: i32,
/// Knockback
pub knockback: f32,
/// Max range /// Max range
pub range: f32, pub range: f32,
/// Max angle (45.0 will give you a 90.0 angle window) /// Max angle (45.0 will give you a 90.0 angle window)
@ -38,6 +40,7 @@ impl CharacterBehavior for Data {
.unwrap_or_default(), .unwrap_or_default(),
recover_duration: self.recover_duration, recover_duration: self.recover_duration,
base_healthchange: self.base_healthchange, base_healthchange: self.base_healthchange,
knockback: self.knockback,
range: self.range, range: self.range,
max_angle: self.max_angle, max_angle: self.max_angle,
exhausted: false, exhausted: false,
@ -50,13 +53,14 @@ impl CharacterBehavior for Data {
max_angle: self.max_angle.to_radians(), max_angle: self.max_angle.to_radians(),
applied: false, applied: false,
hit_count: 0, hit_count: 0,
knockback: 0.0, knockback: self.knockback,
}); });
update.character = CharacterState::BasicMelee(Data { update.character = CharacterState::BasicMelee(Data {
buildup_duration: self.buildup_duration, buildup_duration: self.buildup_duration,
recover_duration: self.recover_duration, recover_duration: self.recover_duration,
base_healthchange: self.base_healthchange, base_healthchange: self.base_healthchange,
knockback: self.knockback,
range: self.range, range: self.range,
max_angle: self.max_angle, max_angle: self.max_angle,
exhausted: true, exhausted: true,
@ -70,6 +74,7 @@ impl CharacterBehavior for Data {
.checked_sub(Duration::from_secs_f32(data.dt.0)) .checked_sub(Duration::from_secs_f32(data.dt.0))
.unwrap_or_default(), .unwrap_or_default(),
base_healthchange: self.base_healthchange, base_healthchange: self.base_healthchange,
knockback: self.knockback,
range: self.range, range: self.range,
max_angle: self.max_angle, max_angle: self.max_angle,
exhausted: true, exhausted: true,

View File

@ -147,6 +147,7 @@ impl<'a> System<'a> for Sys {
buildup_duration: Duration::from_millis(0), buildup_duration: Duration::from_millis(0),
recover_duration: Duration::from_millis(400), recover_duration: Duration::from_millis(400),
base_healthchange: -40, base_healthchange: -40,
knockback: 0.0,
range: 3.5, range: 3.5,
max_angle: 15.0, max_angle: 15.0,
}), }),
@ -277,6 +278,7 @@ impl<'a> System<'a> for Sys {
buildup_duration: Duration::from_millis(800), buildup_duration: Duration::from_millis(800),
recover_duration: Duration::from_millis(200), recover_duration: Duration::from_millis(200),
base_healthchange: -100, base_healthchange: -100,
knockback: 0.0,
range: 3.5, range: 3.5,
max_angle: 60.0, max_angle: 60.0,
}), }),

View File

@ -79,6 +79,7 @@ fn get_tool_kind(kind: &ToolKind) -> String {
ToolKind::Shield(_) => "Shield".to_string(), ToolKind::Shield(_) => "Shield".to_string(),
ToolKind::Debug(_) => "Debug".to_string(), ToolKind::Debug(_) => "Debug".to_string(),
ToolKind::Farming(_) => "Farming".to_string(), ToolKind::Farming(_) => "Farming".to_string(),
ToolKind::NpcWeapon(_) => "NpcWeapon".to_string(),
ToolKind::Empty => "Empty".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::Shield(x) => x.clone(),
ToolKind::Debug(x) => x.clone(), ToolKind::Debug(x) => x.clone(),
ToolKind::Farming(x) => x.clone(), ToolKind::Farming(x) => x.clone(),
ToolKind::NpcWeapon(x) => x.clone(),
ToolKind::Empty => "".to_string(), ToolKind::Empty => "".to_string(),
} }
} }

View File

@ -75,6 +75,7 @@ fn tool_desc(tool: &Tool, desc: &str) -> String {
ToolKind::Dagger(_) => "Dagger", ToolKind::Dagger(_) => "Dagger",
ToolKind::Staff(_) => "Staff", ToolKind::Staff(_) => "Staff",
ToolKind::Shield(_) => "Shield", ToolKind::Shield(_) => "Shield",
ToolKind::NpcWeapon(_) => "Npc Weapon",
ToolKind::Debug(_) => "Debug", ToolKind::Debug(_) => "Debug",
ToolKind::Farming(_) => "Farming Tool", ToolKind::Farming(_) => "Farming Tool",
ToolKind::Empty => "Empty", ToolKind::Empty => "Empty",