From e4cda4309e05fbe424e1a238ce4dd51c9b235517 Mon Sep 17 00:00:00 2001 From: Avi Weinstock Date: Thu, 6 May 2021 14:50:16 -0400 Subject: [PATCH] Add `DamageKind`, and make piercing damage partially ignore damage resistence. - Tweak bow/staff M1 stats. --- assets/common/abilities/axe/doublestrike.ron | 2 + assets/common/abilities/axe/leap.ron | 1 + assets/common/abilities/axe/spin.ron | 1 + assets/common/abilities/axesimple/dash.ron | 1 + .../abilities/axesimple/doublestrike.ron | 4 +- assets/common/abilities/bow/basic.ron | 4 +- assets/common/abilities/bow/charged.ron | 1 + .../abilities/custom/beastclaws/basic.ron | 1 + .../custom/birdlargebreathe/triplestrike.ron | 3 ++ .../custom/birdlargefire/fireshockwave.ron | 1 + .../custom/birdlargefire/triplestrike.ron | 3 ++ .../abilities/custom/husk/singlestrike.ron | 1 + .../abilities/custom/husk/triplestrike.ron | 3 ++ .../custom/mindflayer/necroticvortex.ron | 1 + .../abilities/custom/minotaur/charge.ron | 3 +- .../abilities/custom/minotaur/cleave.ron | 1 + .../custom/minotaur/cripplingstrike.ron | 1 + .../custom/quadlowbasic/singlestrike.ron | 1 + .../custom/quadlowbasic/triplestrike.ron | 3 ++ .../abilities/custom/quadlowbreathe/dash.ron | 1 + .../custom/quadlowbreathe/triplestrike.ron | 3 ++ .../abilities/custom/quadlowquick/dash.ron | 1 + .../custom/quadlowquick/quadstrike.ron | 4 ++ .../custom/quadlowranged/singlestrike.ron | 1 + .../abilities/custom/quadlowtail/charged.ron | 1 + .../custom/quadlowtail/triplestrike.ron | 3 ++ .../custom/quadmedbasic/singlestrike.ron | 1 + .../custom/quadmedbasic/triplestrike.ron | 3 ++ .../abilities/custom/quadmedcharge/dash.ron | 1 + .../custom/quadmedcharge/doublestrike.ron | 2 + .../abilities/custom/quadmedhoof/basic.ron | 1 + .../custom/quadmedjump/doublestrike.ron | 2 + .../abilities/custom/quadmedjump/leap.ron | 1 + .../custom/quadmedjump/quickleap.ron | 1 + .../abilities/custom/quadmedquick/dash.ron | 1 + .../custom/quadmedquick/triplestrike.ron | 3 ++ .../custom/quadsmallbasic/singlestrike.ron | 1 + .../custom/stonegolemfist/shockwave.ron | 1 + .../custom/stonegolemfist/singlestrike.ron | 1 + .../abilities/custom/stonegolemfist/spin.ron | 1 + .../abilities/custom/theropodbasic/dash.ron | 3 +- .../custom/theropodbasic/singlestrike.ron | 1 + .../custom/theropodbasic/triplestrike.ron | 3 ++ .../custom/theropodbird/singlestrike.ron | 1 + .../custom/theropodbird/triplestrike.ron | 3 ++ .../custom/wendigomagic/singlestrike.ron | 1 + assets/common/abilities/dagger/tempbasic.ron | 1 + assets/common/abilities/empty/basic.ron | 1 + assets/common/abilities/farming/basic.ron | 1 + assets/common/abilities/hammer/charged.ron | 1 + assets/common/abilities/hammer/leap.ron | 1 + .../common/abilities/hammer/singlestrike.ron | 1 + .../abilities/hammersimple/doublestrike.ron | 4 +- assets/common/abilities/pick/swing.ron | 1 + assets/common/abilities/shield/tempbasic.ron | 1 + assets/common/abilities/spear/dash.ron | 1 + .../common/abilities/spear/doublestrike.ron | 4 +- assets/common/abilities/staff/firebomb.ron | 4 +- .../common/abilities/staff/fireshockwave.ron | 1 + assets/common/abilities/sword/dash.ron | 1 + assets/common/abilities/sword/spin.ron | 1 + .../common/abilities/sword/triplestrike.ron | 3 ++ assets/common/abilities/swordsimple/dash.ron | 1 + .../abilities/swordsimple/doublestrike.ron | 4 +- common/src/combat.rs | 43 ++++++++++++++++--- common/src/comp/ability.rs | 24 ++++++++++- common/src/comp/projectile.rs | 5 ++- common/src/lib.rs | 2 +- common/src/states/basic_beam.rs | 5 ++- common/src/states/basic_melee.rs | 5 ++- common/src/states/charged_melee.rs | 5 ++- common/src/states/charged_ranged.rs | 5 ++- common/src/states/combo_melee.rs | 6 ++- common/src/states/dash_melee.rs | 6 ++- common/src/states/leap_melee.rs | 5 ++- common/src/states/shockwave.rs | 7 ++- common/src/states/spin_melee.rs | 5 ++- common/systems/src/buff.rs | 7 ++- server/src/cmd.rs | 3 +- server/src/events/entity_manipulation.rs | 10 +++-- server/src/state_ext.rs | 1 + server/src/sys/object.rs | 4 +- .../audio/sfx/event_mapper/combat/tests.rs | 4 ++ voxygen/src/hud/bag.rs | 3 +- 84 files changed, 232 insertions(+), 37 deletions(-) diff --git a/assets/common/abilities/axe/doublestrike.ron b/assets/common/abilities/axe/doublestrike.ron index a128d8b9ef..545aab3ae9 100644 --- a/assets/common/abilities/axe/doublestrike.ron +++ b/assets/common/abilities/axe/doublestrike.ron @@ -13,6 +13,7 @@ ComboMelee( base_swing_duration: 0.075, base_recover_duration: 0.35, forward_movement: 0.5, + damage_kind: Slashing, ), ( stage: 2, @@ -27,6 +28,7 @@ ComboMelee( base_swing_duration: 0.1, base_recover_duration: 0.35, forward_movement: 0.25, + damage_kind: Slashing, ), ], initial_energy_gain: 25, diff --git a/assets/common/abilities/axe/leap.ron b/assets/common/abilities/axe/leap.ron index c86c081483..156d6cc98f 100644 --- a/assets/common/abilities/axe/leap.ron +++ b/assets/common/abilities/axe/leap.ron @@ -11,4 +11,5 @@ LeapMelee( max_angle: 30.0, forward_leap_strength: 20.0, vertical_leap_strength: 8.0, + damage_kind: Slashing, ) diff --git a/assets/common/abilities/axe/spin.ron b/assets/common/abilities/axe/spin.ron index c638a62ad2..df0320d9c2 100644 --- a/assets/common/abilities/axe/spin.ron +++ b/assets/common/abilities/axe/spin.ron @@ -15,4 +15,5 @@ SpinMelee( num_spins: 1, specifier: None, target: Some(OutOfGroup), + damage_kind: Slashing, ) diff --git a/assets/common/abilities/axesimple/dash.ron b/assets/common/abilities/axesimple/dash.ron index 388bad9bf0..6a646ae020 100644 --- a/assets/common/abilities/axesimple/dash.ron +++ b/assets/common/abilities/axesimple/dash.ron @@ -16,4 +16,5 @@ DashMelee( recover_duration: 1.2, charge_through: true, is_interruptible: true, + damage_kind: Slashing, ) diff --git a/assets/common/abilities/axesimple/doublestrike.ron b/assets/common/abilities/axesimple/doublestrike.ron index 05df0249cd..2a87b78073 100644 --- a/assets/common/abilities/axesimple/doublestrike.ron +++ b/assets/common/abilities/axesimple/doublestrike.ron @@ -13,6 +13,7 @@ ComboMelee( base_swing_duration: 0.12, base_recover_duration: 0.6, forward_movement: 3.5, + damage_kind: Slashing, ), ( stage: 2, @@ -27,6 +28,7 @@ ComboMelee( base_swing_duration: 0.15, base_recover_duration: 1.2, forward_movement: 4.5, + damage_kind: Slashing, ), ], initial_energy_gain: 0, @@ -37,4 +39,4 @@ ComboMelee( scales_from_combo: 0, is_interruptible: false, ori_modifier: 0.6, -) \ No newline at end of file +) diff --git a/assets/common/abilities/bow/basic.ron b/assets/common/abilities/bow/basic.ron index f384fe59de..d86b0d684f 100644 --- a/assets/common/abilities/bow/basic.ron +++ b/assets/common/abilities/bow/basic.ron @@ -1,9 +1,9 @@ BasicRanged( energy_cost: 0, - buildup_duration: 0.5, + buildup_duration: 0.4, recover_duration: 0.3, projectile: Arrow( - damage: 70.0, + damage: 90.0, knockback: 5.0, energy_regen: 40, ), diff --git a/assets/common/abilities/bow/charged.ron b/assets/common/abilities/bow/charged.ron index cdb976a808..482c17396b 100644 --- a/assets/common/abilities/bow/charged.ron +++ b/assets/common/abilities/bow/charged.ron @@ -14,4 +14,5 @@ ChargedRanged( initial_projectile_speed: 120.0, scaled_projectile_speed: 160.0, move_speed: 0.3, + damage_kind: Piercing, ) diff --git a/assets/common/abilities/custom/beastclaws/basic.ron b/assets/common/abilities/custom/beastclaws/basic.ron index 449aa4b206..2a0a24f044 100644 --- a/assets/common/abilities/custom/beastclaws/basic.ron +++ b/assets/common/abilities/custom/beastclaws/basic.ron @@ -9,4 +9,5 @@ BasicMelee( range: 5.0, max_angle: 120.0, damage_effect: None, + damage_kind: Slashing, ) diff --git a/assets/common/abilities/custom/birdlargebreathe/triplestrike.ron b/assets/common/abilities/custom/birdlargebreathe/triplestrike.ron index 52dd0df667..eb332435a4 100644 --- a/assets/common/abilities/custom/birdlargebreathe/triplestrike.ron +++ b/assets/common/abilities/custom/birdlargebreathe/triplestrike.ron @@ -13,6 +13,7 @@ ComboMelee( base_swing_duration: 0.1, base_recover_duration: 0.3, forward_movement: 2.0, + damage_kind: Slashing, ), ( stage: 2, @@ -27,6 +28,7 @@ ComboMelee( base_swing_duration: 0.1, base_recover_duration: 0.3, forward_movement: 1.5, + damage_kind: Slashing, ), ( stage: 3, @@ -41,6 +43,7 @@ ComboMelee( base_swing_duration: 0.1, base_recover_duration: 0.3, forward_movement: 1.5, + damage_kind: Slashing, ), ], initial_energy_gain: 0, diff --git a/assets/common/abilities/custom/birdlargefire/fireshockwave.ron b/assets/common/abilities/custom/birdlargefire/fireshockwave.ron index e7e1f67a0f..c951d349f6 100644 --- a/assets/common/abilities/custom/birdlargefire/fireshockwave.ron +++ b/assets/common/abilities/custom/birdlargefire/fireshockwave.ron @@ -12,4 +12,5 @@ Shockwave( shockwave_duration: 0.5, requires_ground: false, move_efficiency: 0.1, + damage_kind: Energy, ) diff --git a/assets/common/abilities/custom/birdlargefire/triplestrike.ron b/assets/common/abilities/custom/birdlargefire/triplestrike.ron index 52dd0df667..eb332435a4 100644 --- a/assets/common/abilities/custom/birdlargefire/triplestrike.ron +++ b/assets/common/abilities/custom/birdlargefire/triplestrike.ron @@ -13,6 +13,7 @@ ComboMelee( base_swing_duration: 0.1, base_recover_duration: 0.3, forward_movement: 2.0, + damage_kind: Slashing, ), ( stage: 2, @@ -27,6 +28,7 @@ ComboMelee( base_swing_duration: 0.1, base_recover_duration: 0.3, forward_movement: 1.5, + damage_kind: Slashing, ), ( stage: 3, @@ -41,6 +43,7 @@ ComboMelee( base_swing_duration: 0.1, base_recover_duration: 0.3, forward_movement: 1.5, + damage_kind: Slashing, ), ], initial_energy_gain: 0, diff --git a/assets/common/abilities/custom/husk/singlestrike.ron b/assets/common/abilities/custom/husk/singlestrike.ron index ffa369593d..5d4aa94c8b 100644 --- a/assets/common/abilities/custom/husk/singlestrike.ron +++ b/assets/common/abilities/custom/husk/singlestrike.ron @@ -13,6 +13,7 @@ ComboMelee( base_swing_duration: 0.07, base_recover_duration: 0.25, forward_movement: 0.5, + damage_kind: Crushing, ), ], initial_energy_gain: 0, diff --git a/assets/common/abilities/custom/husk/triplestrike.ron b/assets/common/abilities/custom/husk/triplestrike.ron index 304a5f4194..d14f182feb 100644 --- a/assets/common/abilities/custom/husk/triplestrike.ron +++ b/assets/common/abilities/custom/husk/triplestrike.ron @@ -13,6 +13,7 @@ ComboMelee( base_swing_duration: 0.07, base_recover_duration: 0.2, forward_movement: 1.0, + damage_kind: Crushing, ), ( stage: 2, @@ -27,6 +28,7 @@ ComboMelee( base_swing_duration: 0.07, base_recover_duration: 0.2, forward_movement: 0.0, + damage_kind: Crushing, ), ( stage: 3, @@ -41,6 +43,7 @@ ComboMelee( base_swing_duration: 0.07, base_recover_duration: 0.2, forward_movement: 1.0, + damage_kind: Crushing, ), ], initial_energy_gain: 0, diff --git a/assets/common/abilities/custom/mindflayer/necroticvortex.ron b/assets/common/abilities/custom/mindflayer/necroticvortex.ron index 3b9e308d96..896b380b62 100644 --- a/assets/common/abilities/custom/mindflayer/necroticvortex.ron +++ b/assets/common/abilities/custom/mindflayer/necroticvortex.ron @@ -15,4 +15,5 @@ SpinMelee( num_spins: 1, specifier: Some(CultistVortex), target: None, + damage_kind: Energy, ) diff --git a/assets/common/abilities/custom/minotaur/charge.ron b/assets/common/abilities/custom/minotaur/charge.ron index 8c85351616..d84e388687 100644 --- a/assets/common/abilities/custom/minotaur/charge.ron +++ b/assets/common/abilities/custom/minotaur/charge.ron @@ -16,4 +16,5 @@ DashMelee( recover_duration: 0.5, charge_through: false, is_interruptible: false, -) \ No newline at end of file + damage_kind: Piercing, +) diff --git a/assets/common/abilities/custom/minotaur/cleave.ron b/assets/common/abilities/custom/minotaur/cleave.ron index 5f92519648..dff30a6fe4 100644 --- a/assets/common/abilities/custom/minotaur/cleave.ron +++ b/assets/common/abilities/custom/minotaur/cleave.ron @@ -15,4 +15,5 @@ ChargedMelee( hit_timing: 0.8, recover_duration: 0.5, specifier: Some(GroundCleave), + damage_kind: Slashing, ) diff --git a/assets/common/abilities/custom/minotaur/cripplingstrike.ron b/assets/common/abilities/custom/minotaur/cripplingstrike.ron index f941011081..6fce13daa8 100644 --- a/assets/common/abilities/custom/minotaur/cripplingstrike.ron +++ b/assets/common/abilities/custom/minotaur/cripplingstrike.ron @@ -14,4 +14,5 @@ BasicMelee( strength: Value(0.5), chance: 1.0, ))), + damage_kind: Slashing, ) diff --git a/assets/common/abilities/custom/quadlowbasic/singlestrike.ron b/assets/common/abilities/custom/quadlowbasic/singlestrike.ron index 319d99ca6d..8f60297e99 100644 --- a/assets/common/abilities/custom/quadlowbasic/singlestrike.ron +++ b/assets/common/abilities/custom/quadlowbasic/singlestrike.ron @@ -13,6 +13,7 @@ ComboMelee( base_swing_duration: 0.07, base_recover_duration: 0.4, forward_movement: 3.0, + damage_kind: Crushing, ), ], initial_energy_gain: 0, diff --git a/assets/common/abilities/custom/quadlowbasic/triplestrike.ron b/assets/common/abilities/custom/quadlowbasic/triplestrike.ron index 826a07f2f7..3fae8726f5 100644 --- a/assets/common/abilities/custom/quadlowbasic/triplestrike.ron +++ b/assets/common/abilities/custom/quadlowbasic/triplestrike.ron @@ -13,6 +13,7 @@ ComboMelee( base_swing_duration: 0.07, base_recover_duration: 0.3, forward_movement: 2.0, + damage_kind: Crushing, ), ( stage: 2, @@ -27,6 +28,7 @@ ComboMelee( base_swing_duration: 0.07, base_recover_duration: 0.3, forward_movement: 1.5, + damage_kind: Crushing, ), ( stage: 3, @@ -41,6 +43,7 @@ ComboMelee( base_swing_duration: 0.07, base_recover_duration: 0.3, forward_movement: 1.5, + damage_kind: Crushing, ), ], initial_energy_gain: 0, diff --git a/assets/common/abilities/custom/quadlowbreathe/dash.ron b/assets/common/abilities/custom/quadlowbreathe/dash.ron index e4c80e1829..2c101ee339 100644 --- a/assets/common/abilities/custom/quadlowbreathe/dash.ron +++ b/assets/common/abilities/custom/quadlowbreathe/dash.ron @@ -16,4 +16,5 @@ DashMelee( recover_duration: 0.8, charge_through: true, is_interruptible: false, + damage_kind: Crushing, ) diff --git a/assets/common/abilities/custom/quadlowbreathe/triplestrike.ron b/assets/common/abilities/custom/quadlowbreathe/triplestrike.ron index c59cce365b..19320571bb 100644 --- a/assets/common/abilities/custom/quadlowbreathe/triplestrike.ron +++ b/assets/common/abilities/custom/quadlowbreathe/triplestrike.ron @@ -13,6 +13,7 @@ ComboMelee( base_swing_duration: 0.1, base_recover_duration: 0.3, forward_movement: 2.0, + damage_kind: Crushing, ), ( stage: 2, @@ -27,6 +28,7 @@ ComboMelee( base_swing_duration: 0.1, base_recover_duration: 0.3, forward_movement: 1.5, + damage_kind: Crushing, ), ( stage: 3, @@ -41,6 +43,7 @@ ComboMelee( base_swing_duration: 0.1, base_recover_duration: 0.3, forward_movement: 1.5, + damage_kind: Crushing, ), ], initial_energy_gain: 0, diff --git a/assets/common/abilities/custom/quadlowquick/dash.ron b/assets/common/abilities/custom/quadlowquick/dash.ron index 3527c0f0a1..5130e840cd 100644 --- a/assets/common/abilities/custom/quadlowquick/dash.ron +++ b/assets/common/abilities/custom/quadlowquick/dash.ron @@ -16,4 +16,5 @@ DashMelee( recover_duration: 0.5, charge_through: true, is_interruptible: false, + damage_kind: Crushing, ) diff --git a/assets/common/abilities/custom/quadlowquick/quadstrike.ron b/assets/common/abilities/custom/quadlowquick/quadstrike.ron index 31f339d8d4..2bd6e570f3 100644 --- a/assets/common/abilities/custom/quadlowquick/quadstrike.ron +++ b/assets/common/abilities/custom/quadlowquick/quadstrike.ron @@ -13,6 +13,7 @@ ComboMelee( base_swing_duration: 0.1, base_recover_duration: 0.1, forward_movement: 1.5, + damage_kind: Crushing, ), ( stage: 2, @@ -27,6 +28,7 @@ ComboMelee( base_swing_duration: 0.07, base_recover_duration: 0.1, forward_movement: 0.8, + damage_kind: Crushing, ), ( stage: 3, @@ -41,6 +43,7 @@ ComboMelee( base_swing_duration: 0.07, base_recover_duration: 0.1, forward_movement: 0.8, + damage_kind: Crushing, ), ( stage: 4, @@ -55,6 +58,7 @@ ComboMelee( base_swing_duration: 0.07, base_recover_duration: 0.1, forward_movement: 0.8, + damage_kind: Crushing, ), ], initial_energy_gain: 0, diff --git a/assets/common/abilities/custom/quadlowranged/singlestrike.ron b/assets/common/abilities/custom/quadlowranged/singlestrike.ron index 0491b36f0d..7d36295027 100644 --- a/assets/common/abilities/custom/quadlowranged/singlestrike.ron +++ b/assets/common/abilities/custom/quadlowranged/singlestrike.ron @@ -13,6 +13,7 @@ ComboMelee( base_swing_duration: 0.1, base_recover_duration: 0.4, forward_movement: 3.0, + damage_kind: Crushing, ), ], initial_energy_gain: 0, diff --git a/assets/common/abilities/custom/quadlowtail/charged.ron b/assets/common/abilities/custom/quadlowtail/charged.ron index afba4713eb..fb03117f1c 100644 --- a/assets/common/abilities/custom/quadlowtail/charged.ron +++ b/assets/common/abilities/custom/quadlowtail/charged.ron @@ -14,4 +14,5 @@ ChargedMelee( swing_duration: 0.7, hit_timing: 0.9, recover_duration: 1.2, + damage_kind: Crushing, ) diff --git a/assets/common/abilities/custom/quadlowtail/triplestrike.ron b/assets/common/abilities/custom/quadlowtail/triplestrike.ron index 968461e069..a35efe048e 100644 --- a/assets/common/abilities/custom/quadlowtail/triplestrike.ron +++ b/assets/common/abilities/custom/quadlowtail/triplestrike.ron @@ -13,6 +13,7 @@ ComboMelee( base_swing_duration: 0.1, base_recover_duration: 0.2, forward_movement: 2.0, + damage_kind: Crushing, ), ( stage: 2, @@ -27,6 +28,7 @@ ComboMelee( base_swing_duration: 0.1, base_recover_duration: 0.2, forward_movement: 1.0, + damage_kind: Crushing, ), ( stage: 3, @@ -41,6 +43,7 @@ ComboMelee( base_swing_duration: 0.1, base_recover_duration: 0.2, forward_movement: 1.0, + damage_kind: Crushing, ), ], initial_energy_gain: 0, diff --git a/assets/common/abilities/custom/quadmedbasic/singlestrike.ron b/assets/common/abilities/custom/quadmedbasic/singlestrike.ron index ec5e118f31..fef9810b42 100644 --- a/assets/common/abilities/custom/quadmedbasic/singlestrike.ron +++ b/assets/common/abilities/custom/quadmedbasic/singlestrike.ron @@ -13,6 +13,7 @@ ComboMelee( base_swing_duration: 0.1, base_recover_duration: 0.4, forward_movement: 1.0, + damage_kind: Crushing, ), ], initial_energy_gain: 0, diff --git a/assets/common/abilities/custom/quadmedbasic/triplestrike.ron b/assets/common/abilities/custom/quadmedbasic/triplestrike.ron index b4727b9941..4b8544b345 100644 --- a/assets/common/abilities/custom/quadmedbasic/triplestrike.ron +++ b/assets/common/abilities/custom/quadmedbasic/triplestrike.ron @@ -13,6 +13,7 @@ ComboMelee( base_swing_duration: 0.07, base_recover_duration: 0.2, forward_movement: 1.0, + damage_kind: Crushing, ), ( stage: 2, @@ -27,6 +28,7 @@ ComboMelee( base_swing_duration: 0.07, base_recover_duration: 0.2, forward_movement: 0.0, + damage_kind: Crushing, ), ( stage: 3, @@ -41,6 +43,7 @@ ComboMelee( base_swing_duration: 0.07, base_recover_duration: 0.2, forward_movement: 1.0, + damage_kind: Crushing, ), ], initial_energy_gain: 0, diff --git a/assets/common/abilities/custom/quadmedcharge/dash.ron b/assets/common/abilities/custom/quadmedcharge/dash.ron index d6399d7e22..388e3d0ede 100644 --- a/assets/common/abilities/custom/quadmedcharge/dash.ron +++ b/assets/common/abilities/custom/quadmedcharge/dash.ron @@ -16,4 +16,5 @@ DashMelee( recover_duration: 1.1, charge_through: true, is_interruptible: false, + damage_kind: Crushing, ) diff --git a/assets/common/abilities/custom/quadmedcharge/doublestrike.ron b/assets/common/abilities/custom/quadmedcharge/doublestrike.ron index a8215e41c9..9ec940c20f 100644 --- a/assets/common/abilities/custom/quadmedcharge/doublestrike.ron +++ b/assets/common/abilities/custom/quadmedcharge/doublestrike.ron @@ -13,6 +13,7 @@ ComboMelee( base_swing_duration: 0.1, base_recover_duration: 0.3, forward_movement: 1.0, + damage_kind: Crushing, ), ( stage: 2, @@ -27,6 +28,7 @@ ComboMelee( base_swing_duration: 0.1, base_recover_duration: 0.3, forward_movement: 0.5, + damage_kind: Crushing, ), ], initial_energy_gain: 0, diff --git a/assets/common/abilities/custom/quadmedhoof/basic.ron b/assets/common/abilities/custom/quadmedhoof/basic.ron index 73c4e7d739..ce330235d1 100644 --- a/assets/common/abilities/custom/quadmedhoof/basic.ron +++ b/assets/common/abilities/custom/quadmedhoof/basic.ron @@ -9,4 +9,5 @@ BasicMelee( range: 1.2, max_angle: 50.0, damage_effect: None, + damage_kind: Crushing, ) diff --git a/assets/common/abilities/custom/quadmedjump/doublestrike.ron b/assets/common/abilities/custom/quadmedjump/doublestrike.ron index 251b3d789d..635eb2bfac 100644 --- a/assets/common/abilities/custom/quadmedjump/doublestrike.ron +++ b/assets/common/abilities/custom/quadmedjump/doublestrike.ron @@ -13,6 +13,7 @@ ComboMelee( base_swing_duration: 0.1, base_recover_duration: 0.3, forward_movement: 1.0, + damage_kind: Crushing, ), ( stage: 2, @@ -27,6 +28,7 @@ ComboMelee( base_swing_duration: 0.1, base_recover_duration: 0.3, forward_movement: 1.5, + damage_kind: Crushing, ), ], initial_energy_gain: 0, diff --git a/assets/common/abilities/custom/quadmedjump/leap.ron b/assets/common/abilities/custom/quadmedjump/leap.ron index 436316738f..15a470ac97 100644 --- a/assets/common/abilities/custom/quadmedjump/leap.ron +++ b/assets/common/abilities/custom/quadmedjump/leap.ron @@ -11,4 +11,5 @@ LeapMelee( max_angle: 180.0, forward_leap_strength: 40.0, vertical_leap_strength: 10.0, + damage_kind: Crushing, ) diff --git a/assets/common/abilities/custom/quadmedjump/quickleap.ron b/assets/common/abilities/custom/quadmedjump/quickleap.ron index 242a1ab31e..0a701ea0c7 100644 --- a/assets/common/abilities/custom/quadmedjump/quickleap.ron +++ b/assets/common/abilities/custom/quadmedjump/quickleap.ron @@ -11,4 +11,5 @@ LeapMelee( max_angle: 180.0, forward_leap_strength: 20.0, vertical_leap_strength: 5.0, + damage_kind: Crushing, ) diff --git a/assets/common/abilities/custom/quadmedquick/dash.ron b/assets/common/abilities/custom/quadmedquick/dash.ron index c0601cda52..e305185db5 100644 --- a/assets/common/abilities/custom/quadmedquick/dash.ron +++ b/assets/common/abilities/custom/quadmedquick/dash.ron @@ -16,4 +16,5 @@ DashMelee( recover_duration: 0.5, charge_through: true, is_interruptible: false, + damage_kind: Crushing, ) diff --git a/assets/common/abilities/custom/quadmedquick/triplestrike.ron b/assets/common/abilities/custom/quadmedquick/triplestrike.ron index aa51ae76f4..cdf07c952d 100644 --- a/assets/common/abilities/custom/quadmedquick/triplestrike.ron +++ b/assets/common/abilities/custom/quadmedquick/triplestrike.ron @@ -13,6 +13,7 @@ ComboMelee( base_swing_duration: 0.15, base_recover_duration: 0.4, forward_movement: 0.3, + damage_kind: Crushing, ), ( stage: 2, @@ -27,6 +28,7 @@ ComboMelee( base_swing_duration: 0.15, base_recover_duration: 0.3, forward_movement: 0.5, + damage_kind: Crushing, ), ( stage: 3, @@ -41,6 +43,7 @@ ComboMelee( base_swing_duration: 0.15, base_recover_duration: 0.3, forward_movement: 0.5, + damage_kind: Crushing, ), ], initial_energy_gain: 0, diff --git a/assets/common/abilities/custom/quadsmallbasic/singlestrike.ron b/assets/common/abilities/custom/quadsmallbasic/singlestrike.ron index 76a8b37fae..4ce36a7a0f 100644 --- a/assets/common/abilities/custom/quadsmallbasic/singlestrike.ron +++ b/assets/common/abilities/custom/quadsmallbasic/singlestrike.ron @@ -13,6 +13,7 @@ ComboMelee( base_swing_duration: 0.15, base_recover_duration: 0.3, forward_movement: 1.0, + damage_kind: Crushing, ), ], initial_energy_gain: 0, diff --git a/assets/common/abilities/custom/stonegolemfist/shockwave.ron b/assets/common/abilities/custom/stonegolemfist/shockwave.ron index 6f9d397774..5d6781e2b1 100644 --- a/assets/common/abilities/custom/stonegolemfist/shockwave.ron +++ b/assets/common/abilities/custom/stonegolemfist/shockwave.ron @@ -12,4 +12,5 @@ Shockwave( shockwave_duration: 1.0, requires_ground: true, move_efficiency: 0.05, + damage_kind: Crushing, ) diff --git a/assets/common/abilities/custom/stonegolemfist/singlestrike.ron b/assets/common/abilities/custom/stonegolemfist/singlestrike.ron index 71203402ee..74d2853a78 100644 --- a/assets/common/abilities/custom/stonegolemfist/singlestrike.ron +++ b/assets/common/abilities/custom/stonegolemfist/singlestrike.ron @@ -13,6 +13,7 @@ ComboMelee( base_swing_duration: 0.1, base_recover_duration: 0.9, forward_movement: 3.0, + damage_kind: Crushing, ), ], initial_energy_gain: 0, diff --git a/assets/common/abilities/custom/stonegolemfist/spin.ron b/assets/common/abilities/custom/stonegolemfist/spin.ron index 4bf92f1709..5035e8ba67 100644 --- a/assets/common/abilities/custom/stonegolemfist/spin.ron +++ b/assets/common/abilities/custom/stonegolemfist/spin.ron @@ -15,4 +15,5 @@ SpinMelee( num_spins: 1, specifier: None, target: Some(OutOfGroup), + damage_kind: Crushing, ) diff --git a/assets/common/abilities/custom/theropodbasic/dash.ron b/assets/common/abilities/custom/theropodbasic/dash.ron index 1bfb83ce33..c26e06ec18 100644 --- a/assets/common/abilities/custom/theropodbasic/dash.ron +++ b/assets/common/abilities/custom/theropodbasic/dash.ron @@ -16,4 +16,5 @@ DashMelee( recover_duration: 1.1, charge_through: true, is_interruptible: false, -) \ No newline at end of file + damage_kind: Crushing, +) diff --git a/assets/common/abilities/custom/theropodbasic/singlestrike.ron b/assets/common/abilities/custom/theropodbasic/singlestrike.ron index d382808d7a..17c2f98b28 100644 --- a/assets/common/abilities/custom/theropodbasic/singlestrike.ron +++ b/assets/common/abilities/custom/theropodbasic/singlestrike.ron @@ -13,6 +13,7 @@ ComboMelee( base_swing_duration: 0.15, base_recover_duration: 0.4, forward_movement: 3.0, + damage_kind: Crushing, ), ], initial_energy_gain: 0, diff --git a/assets/common/abilities/custom/theropodbasic/triplestrike.ron b/assets/common/abilities/custom/theropodbasic/triplestrike.ron index 2cb48e34bb..5c19bf5d62 100644 --- a/assets/common/abilities/custom/theropodbasic/triplestrike.ron +++ b/assets/common/abilities/custom/theropodbasic/triplestrike.ron @@ -13,6 +13,7 @@ ComboMelee( base_swing_duration: 0.15, base_recover_duration: 0.3, forward_movement: 1.0, + damage_kind: Crushing, ), ( stage: 2, @@ -27,6 +28,7 @@ ComboMelee( base_swing_duration: 0.15, base_recover_duration: 0.15, forward_movement: 1.0, + damage_kind: Crushing, ), ( stage: 3, @@ -41,6 +43,7 @@ ComboMelee( base_swing_duration: 0.125, base_recover_duration: 0.9, forward_movement: 1.0, + damage_kind: Crushing, ), ], initial_energy_gain: 0, diff --git a/assets/common/abilities/custom/theropodbird/singlestrike.ron b/assets/common/abilities/custom/theropodbird/singlestrike.ron index 80450f2269..db41b51c21 100644 --- a/assets/common/abilities/custom/theropodbird/singlestrike.ron +++ b/assets/common/abilities/custom/theropodbird/singlestrike.ron @@ -13,6 +13,7 @@ ComboMelee( base_swing_duration: 0.15, base_recover_duration: 0.4, forward_movement: 3.0, + damage_kind: Crushing, ), ], initial_energy_gain: 0, diff --git a/assets/common/abilities/custom/theropodbird/triplestrike.ron b/assets/common/abilities/custom/theropodbird/triplestrike.ron index be2a5f623c..0ae2472f83 100644 --- a/assets/common/abilities/custom/theropodbird/triplestrike.ron +++ b/assets/common/abilities/custom/theropodbird/triplestrike.ron @@ -13,6 +13,7 @@ ComboMelee( base_swing_duration: 0.15, base_recover_duration: 0.3, forward_movement: 1.0, + damage_kind: Crushing, ), ( stage: 2, @@ -27,6 +28,7 @@ ComboMelee( base_swing_duration: 0.15, base_recover_duration: 0.15, forward_movement: 1.0, + damage_kind: Crushing, ), ( stage: 3, @@ -41,6 +43,7 @@ ComboMelee( base_swing_duration: 0.125, base_recover_duration: 0.9, forward_movement: 1.0, + damage_kind: Crushing, ), ], initial_energy_gain: 0, diff --git a/assets/common/abilities/custom/wendigomagic/singlestrike.ron b/assets/common/abilities/custom/wendigomagic/singlestrike.ron index c6667ccfab..c6fe60fade 100644 --- a/assets/common/abilities/custom/wendigomagic/singlestrike.ron +++ b/assets/common/abilities/custom/wendigomagic/singlestrike.ron @@ -13,6 +13,7 @@ ComboMelee( base_swing_duration: 0.2, base_recover_duration: 0.4, forward_movement: 5.0, + damage_kind: Crushing, ), ], initial_energy_gain: 0, diff --git a/assets/common/abilities/dagger/tempbasic.ron b/assets/common/abilities/dagger/tempbasic.ron index 5149caf41c..5f345614fc 100644 --- a/assets/common/abilities/dagger/tempbasic.ron +++ b/assets/common/abilities/dagger/tempbasic.ron @@ -9,4 +9,5 @@ BasicMelee( range: 3.5, max_angle: 20.0, damage_effect: None, + damage_kind: Piercing, ) diff --git a/assets/common/abilities/empty/basic.ron b/assets/common/abilities/empty/basic.ron index 10d9ae81d8..0732fe0d93 100644 --- a/assets/common/abilities/empty/basic.ron +++ b/assets/common/abilities/empty/basic.ron @@ -9,4 +9,5 @@ BasicMelee( range: 3.5, max_angle: 15.0, damage_effect: None, + damage_kind: Crushing, ) diff --git a/assets/common/abilities/farming/basic.ron b/assets/common/abilities/farming/basic.ron index 44e52a5711..559e9f7e22 100644 --- a/assets/common/abilities/farming/basic.ron +++ b/assets/common/abilities/farming/basic.ron @@ -9,4 +9,5 @@ BasicMelee( range: 3.5, max_angle: 20.0, damage_effect: None, + damage_kind: Crushing, ) diff --git a/assets/common/abilities/hammer/charged.ron b/assets/common/abilities/hammer/charged.ron index 55d470c984..c148f9695e 100644 --- a/assets/common/abilities/hammer/charged.ron +++ b/assets/common/abilities/hammer/charged.ron @@ -14,4 +14,5 @@ ChargedMelee( swing_duration: 0.12, hit_timing: 0.2, recover_duration: 0.3, + damage_kind: Crushing, ) diff --git a/assets/common/abilities/hammer/leap.ron b/assets/common/abilities/hammer/leap.ron index a7e8f51bc8..42d1064cf8 100644 --- a/assets/common/abilities/hammer/leap.ron +++ b/assets/common/abilities/hammer/leap.ron @@ -11,4 +11,5 @@ LeapMelee( max_angle: 360.0, forward_leap_strength: 20.0, vertical_leap_strength: 8.0, + damage_kind: Crushing, ) diff --git a/assets/common/abilities/hammer/singlestrike.ron b/assets/common/abilities/hammer/singlestrike.ron index 33ce8d94fd..5a7657c7ea 100644 --- a/assets/common/abilities/hammer/singlestrike.ron +++ b/assets/common/abilities/hammer/singlestrike.ron @@ -12,6 +12,7 @@ ComboMelee( base_swing_duration: 0.1, base_recover_duration: 0.45, forward_movement: 0.0, + damage_kind: Crushing, )], initial_energy_gain: 50, max_energy_gain: 150, diff --git a/assets/common/abilities/hammersimple/doublestrike.ron b/assets/common/abilities/hammersimple/doublestrike.ron index a8ca1b7c13..4bc8e7f3b2 100644 --- a/assets/common/abilities/hammersimple/doublestrike.ron +++ b/assets/common/abilities/hammersimple/doublestrike.ron @@ -13,6 +13,7 @@ ComboMelee( base_swing_duration: 0.08, base_recover_duration: 0.6, forward_movement: 3.5, + damage_kind: Crushing, ), ( stage: 2, @@ -27,6 +28,7 @@ ComboMelee( base_swing_duration: 0.25, base_recover_duration: 1.2, forward_movement: 2.0, + damage_kind: Crushing, ), ], initial_energy_gain: 0, @@ -37,4 +39,4 @@ ComboMelee( scales_from_combo: 0, is_interruptible: false, ori_modifier: 0.6, -) \ No newline at end of file +) diff --git a/assets/common/abilities/pick/swing.ron b/assets/common/abilities/pick/swing.ron index 44e52a5711..c2ab7d9fcc 100644 --- a/assets/common/abilities/pick/swing.ron +++ b/assets/common/abilities/pick/swing.ron @@ -9,4 +9,5 @@ BasicMelee( range: 3.5, max_angle: 20.0, damage_effect: None, + damage_kind: Piercing, ) diff --git a/assets/common/abilities/shield/tempbasic.ron b/assets/common/abilities/shield/tempbasic.ron index 5e7e156fe7..c952ce5d5c 100644 --- a/assets/common/abilities/shield/tempbasic.ron +++ b/assets/common/abilities/shield/tempbasic.ron @@ -9,4 +9,5 @@ BasicMelee( range: 3.0, max_angle: 120.0, damage_effect: None, + damage_kind: Crushing, ) diff --git a/assets/common/abilities/spear/dash.ron b/assets/common/abilities/spear/dash.ron index cdfb6f93cb..f72771b1e7 100644 --- a/assets/common/abilities/spear/dash.ron +++ b/assets/common/abilities/spear/dash.ron @@ -16,4 +16,5 @@ DashMelee( recover_duration: 0.5, charge_through: true, is_interruptible: true, + damage_kind: Piercing, ) diff --git a/assets/common/abilities/spear/doublestrike.ron b/assets/common/abilities/spear/doublestrike.ron index 1bb7d2b346..e7e1c92980 100644 --- a/assets/common/abilities/spear/doublestrike.ron +++ b/assets/common/abilities/spear/doublestrike.ron @@ -13,6 +13,7 @@ ComboMelee( base_swing_duration: 0.075, base_recover_duration: 0.4, forward_movement: 0.7, + damage_kind: Piercing, ), ( stage: 2, @@ -27,6 +28,7 @@ ComboMelee( base_swing_duration: 0.1, base_recover_duration: 0.5, forward_movement: 0.7, + damage_kind: Piercing, ), ], initial_energy_gain: 0, @@ -37,4 +39,4 @@ ComboMelee( scales_from_combo: 2, is_interruptible: false, ori_modifier: 0.75, -) \ No newline at end of file +) diff --git a/assets/common/abilities/staff/firebomb.ron b/assets/common/abilities/staff/firebomb.ron index 32e3d23eff..6564328543 100644 --- a/assets/common/abilities/staff/firebomb.ron +++ b/assets/common/abilities/staff/firebomb.ron @@ -1,9 +1,9 @@ BasicRanged( energy_cost: 0, buildup_duration: 0.5, - recover_duration: 0.35, + recover_duration: 0.4, projectile: Fireball( - damage: 100.0, + damage: 90.0, radius: 4.0, energy_regen: 50, ), diff --git a/assets/common/abilities/staff/fireshockwave.ron b/assets/common/abilities/staff/fireshockwave.ron index e7e1f67a0f..c951d349f6 100644 --- a/assets/common/abilities/staff/fireshockwave.ron +++ b/assets/common/abilities/staff/fireshockwave.ron @@ -12,4 +12,5 @@ Shockwave( shockwave_duration: 0.5, requires_ground: false, move_efficiency: 0.1, + damage_kind: Energy, ) diff --git a/assets/common/abilities/sword/dash.ron b/assets/common/abilities/sword/dash.ron index 5900974c2b..d567cb4757 100644 --- a/assets/common/abilities/sword/dash.ron +++ b/assets/common/abilities/sword/dash.ron @@ -16,4 +16,5 @@ DashMelee( recover_duration: 0.5, charge_through: true, is_interruptible: true, + damage_kind: Piercing, ) diff --git a/assets/common/abilities/sword/spin.ron b/assets/common/abilities/sword/spin.ron index 171d2ec2d2..ac5cdee91f 100644 --- a/assets/common/abilities/sword/spin.ron +++ b/assets/common/abilities/sword/spin.ron @@ -15,4 +15,5 @@ SpinMelee( num_spins: 3, specifier: None, target: Some(OutOfGroup), + damage_kind: Slashing, ) diff --git a/assets/common/abilities/sword/triplestrike.ron b/assets/common/abilities/sword/triplestrike.ron index d2c1848bc2..ea05f387d8 100644 --- a/assets/common/abilities/sword/triplestrike.ron +++ b/assets/common/abilities/sword/triplestrike.ron @@ -13,6 +13,7 @@ ComboMelee( base_swing_duration: 0.075, base_recover_duration: 0.15, forward_movement: 0.5, + damage_kind: Slashing, ), ( stage: 2, @@ -27,6 +28,7 @@ ComboMelee( base_swing_duration: 0.1, base_recover_duration: 0.3, forward_movement: 0.0, + damage_kind: Slashing, ), ( stage: 3, @@ -41,6 +43,7 @@ ComboMelee( base_swing_duration: 0.1, base_recover_duration: 0.35, forward_movement: 1.2, + damage_kind: Piercing, ), ], initial_energy_gain: 0, diff --git a/assets/common/abilities/swordsimple/dash.ron b/assets/common/abilities/swordsimple/dash.ron index 8ca171dc87..7a4e478edb 100644 --- a/assets/common/abilities/swordsimple/dash.ron +++ b/assets/common/abilities/swordsimple/dash.ron @@ -16,4 +16,5 @@ DashMelee( recover_duration: 0.9, charge_through: true, is_interruptible: true, + damage_kind: Piercing, ) diff --git a/assets/common/abilities/swordsimple/doublestrike.ron b/assets/common/abilities/swordsimple/doublestrike.ron index 0149a1d010..5aefeb50a6 100644 --- a/assets/common/abilities/swordsimple/doublestrike.ron +++ b/assets/common/abilities/swordsimple/doublestrike.ron @@ -13,6 +13,7 @@ ComboMelee( base_swing_duration: 0.08, base_recover_duration: 0.5, forward_movement: 2.5, + damage_kind: Slashing, ), ( stage: 2, @@ -27,6 +28,7 @@ ComboMelee( base_swing_duration: 0.1, base_recover_duration: 0.7, forward_movement: 2.0, + damage_kind: Slashing, ), ], initial_energy_gain: 0, @@ -37,4 +39,4 @@ ComboMelee( scales_from_combo: 0, is_interruptible: false, ori_modifier: 0.7, -) \ No newline at end of file +) diff --git a/common/src/combat.rs b/common/src/combat.rs index b79c837e1e..d57e219e96 100644 --- a/common/src/combat.rs +++ b/common/src/combat.rs @@ -122,9 +122,11 @@ impl Attack { target: &TargetInfo, source: AttackSource, dir: Dir, + kind: DamageKind, mut emit_outcome: impl FnMut(Outcome), ) -> f32 { - let damage_reduction = Damage::compute_damage_reduction(target.inventory, target.stats); + let damage_reduction = + Damage::compute_damage_reduction(target.inventory, target.stats, Some(kind)); let block_reduction = match source { AttackSource::Melee => { if let (Some(CharacterState::BasicBlock(data)), Some(ori)) = @@ -177,8 +179,13 @@ impl Attack { .filter(|d| d.target.map_or(true, |t| t == target_group)) .filter(|d| !(matches!(d.target, Some(GroupTarget::OutOfGroup)) && target_dodging)) { - let damage_reduction = - Attack::compute_damage_reduction(&target, attack_source, dir, |o| emit_outcome(o)); + let damage_reduction = Attack::compute_damage_reduction( + &target, + attack_source, + dir, + damage.damage.kind, + |o| emit_outcome(o), + ); let change = damage.damage.calculate_health_change( damage_reduction, attacker.map(|a| a.uid), @@ -497,17 +504,36 @@ pub enum DamageSource { Other, } +/// DamageKind for the purpose of differentiating damage reduction +#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, Serialize, Deserialize)] +pub enum DamageKind { + /// Arrows/Sword dash + Piercing, + /// Swords/axes + Slashing, + /// Hammers + Crushing, + /// Staves/sceptres (TODO: differentiate further once there are more magic + /// weapons) + Energy, +} + #[cfg(not(target_arch = "wasm32"))] #[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct Damage { pub source: DamageSource, + pub kind: DamageKind, pub value: f32, } #[cfg(not(target_arch = "wasm32"))] impl Damage { /// Returns the total damage reduction provided by all equipped items - pub fn compute_damage_reduction(inventory: Option<&Inventory>, stats: Option<&Stats>) -> f32 { + pub fn compute_damage_reduction( + inventory: Option<&Inventory>, + stats: Option<&Stats>, + kind: Option, + ) -> f32 { let inventory_dr = if let Some(inventory) = inventory { let protection = inventory .equipped_items() @@ -524,6 +550,13 @@ impl Damage { }) .sum::>(); + let kind_modifier = if matches!(kind, Some(DamageKind::Piercing)) { + 0.75 + } else { + 1.0 + }; + let protection = protection.map(|dr| dr * kind_modifier); + const FIFTY_PERCENT_DR_THRESHOLD: f32 = 60.0; match protection { @@ -842,7 +875,7 @@ pub fn combat_rating( // Assumes a "standard" max health of 100 let health_rating = health.base_max() as f32 / 100.0 - / (1.0 - Damage::compute_damage_reduction(Some(inventory), None)).max(0.00001); + / (1.0 - Damage::compute_damage_reduction(Some(inventory), None, None)).max(0.00001); // Assumes a standard person has earned 20 skill points in the general skill // tree and 10 skill points for the weapon skill tree diff --git a/common/src/comp/ability.rs b/common/src/comp/ability.rs index 37a4da3fe8..4ff76486b2 100644 --- a/common/src/comp/ability.rs +++ b/common/src/comp/ability.rs @@ -1,6 +1,6 @@ use crate::{ assets::{self, Asset}, - combat::{self, CombatEffect, Knockback}, + combat::{self, CombatEffect, DamageKind, Knockback}, comp::{ aura, beam, buff, inventory::item::tool::ToolKind, projectile::ProjectileConstructor, skills, Body, CharacterState, EnergySource, LightEmitter, StateUpdate, @@ -69,6 +69,7 @@ pub enum CharacterAbility { range: f32, max_angle: f32, damage_effect: Option, + damage_kind: DamageKind, }, BasicRanged { energy_cost: f32, @@ -116,6 +117,7 @@ pub enum CharacterAbility { recover_duration: f32, charge_through: bool, is_interruptible: bool, + damage_kind: DamageKind, }, BasicBlock { buildup_duration: f32, @@ -156,6 +158,7 @@ pub enum CharacterAbility { knockback: f32, forward_leap_strength: f32, vertical_leap_strength: f32, + damage_kind: DamageKind, }, SpinMelee { buildup_duration: f32, @@ -174,6 +177,7 @@ pub enum CharacterAbility { num_spins: u32, specifier: Option, target: Option, + damage_kind: DamageKind, }, ChargedMelee { energy_cost: f32, @@ -192,6 +196,7 @@ pub enum CharacterAbility { hit_timing: f32, recover_duration: f32, specifier: Option, + damage_kind: DamageKind, }, ChargedRanged { energy_cost: f32, @@ -209,6 +214,7 @@ pub enum CharacterAbility { initial_projectile_speed: f32, scaled_projectile_speed: f32, move_speed: f32, + damage_kind: DamageKind, }, Shockwave { energy_cost: f32, @@ -224,6 +230,7 @@ pub enum CharacterAbility { shockwave_duration: f32, requires_ground: bool, move_efficiency: f32, + damage_kind: DamageKind, }, BasicBeam { buildup_duration: f32, @@ -296,6 +303,7 @@ impl Default for CharacterAbility { range: 3.5, max_angle: 15.0, damage_effect: None, + damage_kind: DamageKind::Crushing, } } } @@ -1198,6 +1206,7 @@ impl From<(&CharacterAbility, AbilityInfo)> for CharacterState { max_angle, damage_effect, energy_cost: _, + damage_kind, } => CharacterState::BasicMelee(basic_melee::Data { static_data: basic_melee::StaticData { buildup_duration: Duration::from_secs_f32(*buildup_duration), @@ -1210,6 +1219,7 @@ impl From<(&CharacterAbility, AbilityInfo)> for CharacterState { max_angle: *max_angle, damage_effect: *damage_effect, ability_info, + damage_kind: *damage_kind, }, timer: Duration::default(), stage_section: StageSection::Buildup, @@ -1270,6 +1280,7 @@ impl From<(&CharacterAbility, AbilityInfo)> for CharacterState { recover_duration, charge_through, is_interruptible, + damage_kind, } => CharacterState::DashMelee(dash_melee::Data { static_data: dash_melee::StaticData { base_damage: *base_damage, @@ -1289,6 +1300,7 @@ impl From<(&CharacterAbility, AbilityInfo)> for CharacterState { recover_duration: Duration::from_secs_f32(*recover_duration), is_interruptible: *is_interruptible, ability_info, + damage_kind: *damage_kind, }, auto_charge: false, timer: Duration::default(), @@ -1376,6 +1388,7 @@ impl From<(&CharacterAbility, AbilityInfo)> for CharacterState { max_angle, forward_leap_strength, vertical_leap_strength, + damage_kind, } => CharacterState::LeapMelee(leap_melee::Data { static_data: leap_melee::StaticData { buildup_duration: Duration::from_secs_f32(*buildup_duration), @@ -1390,6 +1403,7 @@ impl From<(&CharacterAbility, AbilityInfo)> for CharacterState { forward_leap_strength: *forward_leap_strength, vertical_leap_strength: *vertical_leap_strength, ability_info, + damage_kind: *damage_kind, }, timer: Duration::default(), stage_section: StageSection::Buildup, @@ -1412,6 +1426,7 @@ impl From<(&CharacterAbility, AbilityInfo)> for CharacterState { num_spins, specifier, target, + damage_kind, } => CharacterState::SpinMelee(spin_melee::Data { static_data: spin_melee::StaticData { buildup_duration: Duration::from_secs_f32(*buildup_duration), @@ -1431,6 +1446,7 @@ impl From<(&CharacterAbility, AbilityInfo)> for CharacterState { target: *target, ability_info, specifier: *specifier, + damage_kind: *damage_kind, }, timer: Duration::default(), consecutive_spins: 1, @@ -1454,6 +1470,7 @@ impl From<(&CharacterAbility, AbilityInfo)> for CharacterState { range, max_angle, specifier, + damage_kind, } => CharacterState::ChargedMelee(charged_melee::Data { static_data: charged_melee::StaticData { energy_cost: *energy_cost, @@ -1473,6 +1490,7 @@ impl From<(&CharacterAbility, AbilityInfo)> for CharacterState { recover_duration: Duration::from_secs_f32(*recover_duration), ability_info, specifier: *specifier, + damage_kind: *damage_kind, }, stage_section: StageSection::Charge, timer: Duration::default(), @@ -1495,6 +1513,7 @@ impl From<(&CharacterAbility, AbilityInfo)> for CharacterState { initial_projectile_speed, scaled_projectile_speed, move_speed, + damage_kind, } => CharacterState::ChargedRanged(charged_ranged::Data { static_data: charged_ranged::StaticData { buildup_duration: Duration::from_secs_f32(*buildup_duration), @@ -1512,6 +1531,7 @@ impl From<(&CharacterAbility, AbilityInfo)> for CharacterState { scaled_projectile_speed: *scaled_projectile_speed, move_speed: *move_speed, ability_info, + damage_kind: *damage_kind, }, timer: Duration::default(), stage_section: StageSection::Buildup, @@ -1560,6 +1580,7 @@ impl From<(&CharacterAbility, AbilityInfo)> for CharacterState { shockwave_duration, requires_ground, move_efficiency, + damage_kind, } => CharacterState::Shockwave(shockwave::Data { static_data: shockwave::StaticData { buildup_duration: Duration::from_secs_f32(*buildup_duration), @@ -1575,6 +1596,7 @@ impl From<(&CharacterAbility, AbilityInfo)> for CharacterState { requires_ground: *requires_ground, move_efficiency: *move_efficiency, ability_info, + damage_kind: *damage_kind, }, timer: Duration::default(), stage_section: StageSection::Buildup, diff --git a/common/src/comp/projectile.rs b/common/src/comp/projectile.rs index abe493ba96..392ed68ed9 100644 --- a/common/src/comp/projectile.rs +++ b/common/src/comp/projectile.rs @@ -1,7 +1,7 @@ use crate::{ combat::{ Attack, AttackDamage, AttackEffect, CombatBuff, CombatEffect, CombatRequirement, Damage, - DamageSource, GroupTarget, Knockback, KnockbackDir, + DamageKind, DamageSource, GroupTarget, Knockback, KnockbackDir, }, comp::item::Reagent, uid::Uid, @@ -85,6 +85,7 @@ impl ProjectileConstructor { let damage = AttackDamage::new( Damage { source: DamageSource::Projectile, + kind: DamageKind::Piercing, value: damage, }, Some(GroupTarget::OutOfGroup), @@ -115,6 +116,7 @@ impl ProjectileConstructor { let damage = AttackDamage::new( Damage { source: DamageSource::Explosion, + kind: DamageKind::Energy, value: damage, }, Some(GroupTarget::OutOfGroup), @@ -144,6 +146,7 @@ impl ProjectileConstructor { let damage = AttackDamage::new( Damage { source: DamageSource::Explosion, + kind: DamageKind::Energy, value: damage, }, Some(GroupTarget::OutOfGroup), diff --git a/common/src/lib.rs b/common/src/lib.rs index d4d8f6a094..a3792863a7 100644 --- a/common/src/lib.rs +++ b/common/src/lib.rs @@ -82,9 +82,9 @@ pub mod volumes; #[cfg(not(target_arch = "wasm32"))] pub use cached_spatial_grid::CachedSpatialGrid; -pub use combat::DamageSource; #[cfg(not(target_arch = "wasm32"))] pub use combat::{Damage, GroupTarget, Knockback, KnockbackDir}; +pub use combat::{DamageKind, DamageSource}; #[cfg(not(target_arch = "wasm32"))] pub use comp::inventory::loadout_builder::LoadoutBuilder; #[cfg(not(target_arch = "wasm32"))] diff --git a/common/src/states/basic_beam.rs b/common/src/states/basic_beam.rs index aaf9dabea6..41959d660f 100644 --- a/common/src/states/basic_beam.rs +++ b/common/src/states/basic_beam.rs @@ -1,7 +1,7 @@ use crate::{ combat::{ - Attack, AttackDamage, AttackEffect, CombatEffect, CombatRequirement, Damage, DamageSource, - GroupTarget, + Attack, AttackDamage, AttackEffect, CombatEffect, CombatRequirement, Damage, DamageKind, + DamageSource, GroupTarget, }, comp::{beam, Body, CharacterState, EnergyChange, EnergySource, Ori, Pos, StateUpdate}, event::ServerEvent, @@ -114,6 +114,7 @@ impl CharacterBehavior for Data { let mut damage = AttackDamage::new( Damage { source: DamageSource::Energy, + kind: DamageKind::Energy, value: self.static_data.damage, }, Some(GroupTarget::OutOfGroup), diff --git a/common/src/states/basic_melee.rs b/common/src/states/basic_melee.rs index c59d175de5..1c0db13f2a 100644 --- a/common/src/states/basic_melee.rs +++ b/common/src/states/basic_melee.rs @@ -5,7 +5,7 @@ use crate::{ behavior::{CharacterBehavior, JoinData}, utils::*, }, - Damage, DamageSource, GroupTarget, Knockback, KnockbackDir, + Damage, DamageKind, DamageSource, GroupTarget, Knockback, KnockbackDir, }; use serde::{Deserialize, Serialize}; use std::time::Duration; @@ -33,6 +33,8 @@ pub struct StaticData { pub damage_effect: Option, /// What key is used to press ability pub ability_info: AbilityInfo, + /// Which kind of damage does this attack deal + pub damage_kind: DamageKind, } #[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)] @@ -103,6 +105,7 @@ impl CharacterBehavior for Data { let mut damage = AttackDamage::new( Damage { source: DamageSource::Melee, + kind: self.static_data.damage_kind, value: self.static_data.base_damage as f32, }, Some(GroupTarget::OutOfGroup), diff --git a/common/src/states/charged_melee.rs b/common/src/states/charged_melee.rs index bb12d5b462..6a5f9ef3b9 100644 --- a/common/src/states/charged_melee.rs +++ b/common/src/states/charged_melee.rs @@ -7,7 +7,7 @@ use crate::{ behavior::{CharacterBehavior, JoinData}, utils::{StageSection, *}, }, - Damage, DamageSource, GroupTarget, Knockback, KnockbackDir, + Damage, DamageKind, DamageSource, GroupTarget, Knockback, KnockbackDir, }; use serde::{Deserialize, Serialize}; use std::time::Duration; @@ -49,6 +49,8 @@ pub struct StaticData { pub ability_info: AbilityInfo, /// Used to specify the melee attack to the frontend pub specifier: Option, + /// What kind of damage the attack does + pub damage_kind: DamageKind, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] @@ -170,6 +172,7 @@ impl CharacterBehavior for Data { let damage = AttackDamage::new( Damage { source: DamageSource::Melee, + kind: self.static_data.damage_kind, value: self.static_data.initial_damage as f32 + self.charge_amount * self.static_data.scaled_damage as f32, }, diff --git a/common/src/states/charged_ranged.rs b/common/src/states/charged_ranged.rs index 7d06447438..9fa94ad283 100644 --- a/common/src/states/charged_ranged.rs +++ b/common/src/states/charged_ranged.rs @@ -1,7 +1,7 @@ use crate::{ combat::{ Attack, AttackDamage, AttackEffect, CombatBuff, CombatEffect, CombatRequirement, Damage, - DamageSource, GroupTarget, Knockback, KnockbackDir, + DamageKind, DamageSource, GroupTarget, Knockback, KnockbackDir, }, comp::{ projectile, Body, CharacterState, EnergyChange, EnergySource, LightEmitter, Projectile, @@ -46,6 +46,8 @@ pub struct StaticData { pub move_speed: f32, /// What key is used to press ability pub ability_info: AbilityInfo, + /// What kind of damage the attack does + pub damage_kind: DamageKind, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] @@ -107,6 +109,7 @@ impl CharacterBehavior for Data { let damage = AttackDamage::new( Damage { source: DamageSource::Projectile, + kind: self.static_data.damage_kind, value: self.static_data.initial_damage as f32 + charge_frac * self.static_data.scaled_damage as f32, }, diff --git a/common/src/states/combo_melee.rs b/common/src/states/combo_melee.rs index c42df5dd34..3ae9689c37 100644 --- a/common/src/states/combo_melee.rs +++ b/common/src/states/combo_melee.rs @@ -5,7 +5,7 @@ use crate::{ behavior::{CharacterBehavior, JoinData}, utils::*, }, - Damage, DamageSource, GroupTarget, Knockback, KnockbackDir, + Damage, DamageKind, DamageSource, GroupTarget, Knockback, KnockbackDir, }; use serde::{Deserialize, Serialize}; use std::time::Duration; @@ -37,6 +37,8 @@ pub struct Stage { pub base_recover_duration: T, /// How much forward movement there is in the swing portion of the stage pub forward_movement: f32, + /// What kind of damage this stage of the attack does + pub damage_kind: DamageKind, } impl Stage { @@ -54,6 +56,7 @@ impl Stage { base_swing_duration: Duration::from_secs_f32(self.base_swing_duration), base_recover_duration: Duration::from_secs_f32(self.base_recover_duration), forward_movement: self.forward_movement, + damage_kind: self.damage_kind, } } @@ -195,6 +198,7 @@ impl CharacterBehavior for Data { let damage = AttackDamage::new( Damage { source: DamageSource::Melee, + kind: self.static_data.stage_data[stage_index].damage_kind, value: damage as f32, }, Some(GroupTarget::OutOfGroup), diff --git a/common/src/states/dash_melee.rs b/common/src/states/dash_melee.rs index 1cea70c771..5179cae07e 100644 --- a/common/src/states/dash_melee.rs +++ b/common/src/states/dash_melee.rs @@ -5,7 +5,7 @@ use crate::{ behavior::{CharacterBehavior, JoinData}, utils::*, }, - Damage, DamageSource, GroupTarget, Knockback, KnockbackDir, + Damage, DamageKind, DamageSource, GroupTarget, Knockback, KnockbackDir, }; use serde::{Deserialize, Serialize}; use std::time::Duration; @@ -47,6 +47,8 @@ pub struct StaticData { pub is_interruptible: bool, /// What key is used to press ability pub ability_info: AbilityInfo, + /// What kind of damage the attack does + pub damage_kind: DamageKind, } #[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)] @@ -141,6 +143,7 @@ impl CharacterBehavior for Data { let damage = AttackDamage::new( Damage { source: DamageSource::Melee, + kind: self.static_data.damage_kind, value: self.static_data.base_damage as f32 + charge_frac * self.static_data.scaled_damage as f32, }, @@ -291,6 +294,7 @@ impl CharacterBehavior for Data { let damage = AttackDamage::new( Damage { source: DamageSource::Melee, + kind: self.static_data.damage_kind, value: self.static_data.base_damage as f32 + charge_frac * self.static_data.scaled_damage as f32, }, diff --git a/common/src/states/leap_melee.rs b/common/src/states/leap_melee.rs index 7231ab45c3..bbe307bc08 100644 --- a/common/src/states/leap_melee.rs +++ b/common/src/states/leap_melee.rs @@ -5,7 +5,7 @@ use crate::{ behavior::{CharacterBehavior, JoinData}, utils::{StageSection, *}, }, - Damage, DamageSource, GroupTarget, Knockback, KnockbackDir, + Damage, DamageKind, DamageSource, GroupTarget, Knockback, KnockbackDir, }; use serde::{Deserialize, Serialize}; use std::time::Duration; @@ -37,6 +37,8 @@ pub struct StaticData { pub vertical_leap_strength: f32, /// What key is used to press ability pub ability_info: AbilityInfo, + /// What kind of damage the attack does + pub damage_kind: DamageKind, } #[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)] @@ -157,6 +159,7 @@ impl CharacterBehavior for Data { let damage = AttackDamage::new( Damage { source: DamageSource::Melee, + kind: self.static_data.damage_kind, value: self.static_data.base_damage as f32, }, Some(GroupTarget::OutOfGroup), diff --git a/common/src/states/shockwave.rs b/common/src/states/shockwave.rs index 640129480a..6a2cbd99a4 100644 --- a/common/src/states/shockwave.rs +++ b/common/src/states/shockwave.rs @@ -1,7 +1,7 @@ use crate::{ combat::{ - Attack, AttackDamage, AttackEffect, CombatEffect, CombatRequirement, Damage, DamageSource, - GroupTarget, Knockback, + Attack, AttackDamage, AttackEffect, CombatEffect, CombatRequirement, Damage, DamageKind, + DamageSource, GroupTarget, Knockback, }, comp::{shockwave, CharacterState, StateUpdate}, event::ServerEvent, @@ -42,6 +42,8 @@ pub struct StaticData { pub move_efficiency: f32, /// What key is used to press ability pub ability_info: AbilityInfo, + /// What kind of damage the attack does + pub damage_kind: DamageKind, } #[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)] @@ -88,6 +90,7 @@ impl CharacterBehavior for Data { let damage = AttackDamage::new( Damage { source: DamageSource::Shockwave, + kind: self.static_data.damage_kind, value: self.static_data.damage as f32, }, Some(GroupTarget::OutOfGroup), diff --git a/common/src/states/spin_melee.rs b/common/src/states/spin_melee.rs index 8730d86f34..fe7f6ae51a 100644 --- a/common/src/states/spin_melee.rs +++ b/common/src/states/spin_melee.rs @@ -1,7 +1,7 @@ use crate::{ combat::{ Attack, AttackDamage, AttackEffect, CombatBuff, CombatEffect, CombatRequirement, Damage, - DamageSource, GroupTarget, Knockback, + DamageKind, DamageSource, GroupTarget, Knockback, }, comp::{tool::ToolKind, CharacterState, EnergyChange, EnergySource, Melee, StateUpdate}, consts::GRAVITY, @@ -51,6 +51,8 @@ pub struct StaticData { pub ability_info: AbilityInfo, /// Used to specify the melee attack to the frontend pub specifier: Option, + /// What kind of damage the attack does + pub damage_kind: DamageKind, } #[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)] @@ -124,6 +126,7 @@ impl CharacterBehavior for Data { let mut damage = AttackDamage::new( Damage { source: DamageSource::Melee, + kind: self.static_data.damage_kind, value: self.static_data.base_damage as f32, }, self.static_data.target, diff --git a/common/systems/src/buff.rs b/common/systems/src/buff.rs index 71137c4540..33595ab6b5 100644 --- a/common/systems/src/buff.rs +++ b/common/systems/src/buff.rs @@ -77,8 +77,11 @@ impl<'a> System<'a> for Sys { } } - let damage_reduction = - Damage::compute_damage_reduction(read_data.inventories.get(entity), Some(&stat)); + let damage_reduction = Damage::compute_damage_reduction( + read_data.inventories.get(entity), + Some(&stat), + None, + ); if (damage_reduction - 1.0).abs() < f32::EPSILON { for (id, buff) in buff_comp.buffs.iter() { if !buff.kind.is_buff() { diff --git a/server/src/cmd.rs b/server/src/cmd.rs index 219e5e477e..f926d462a6 100644 --- a/server/src/cmd.rs +++ b/server/src/cmd.rs @@ -28,7 +28,7 @@ use common::{ terrain::{Block, BlockKind, SpriteKind, TerrainChunkSize}, uid::Uid, vol::RectVolSize, - Damage, DamageSource, Explosion, LoadoutBuilder, RadiusEffect, + Damage, DamageKind, DamageSource, Explosion, LoadoutBuilder, RadiusEffect, }; use common_net::{ msg::{DisconnectReason, Notification, PlayerListUpdate, ServerGeneral}, @@ -1670,6 +1670,7 @@ fn handle_explosion( effects: vec![ RadiusEffect::Entity(Effect::Damage(Damage { source: DamageSource::Explosion, + kind: DamageKind::Energy, value: 100.0 * power, })), RadiusEffect::TerrainDestruction(power), diff --git a/server/src/events/entity_manipulation.rs b/server/src/events/entity_manipulation.rs index 1151f79638..6a0dbada4d 100644 --- a/server/src/events/entity_manipulation.rs +++ b/server/src/events/entity_manipulation.rs @@ -26,7 +26,7 @@ use common::{ uid::{Uid, UidAllocator}, util::Dir, vol::ReadVol, - Damage, DamageSource, Explosion, GroupTarget, RadiusEffect, + Damage, DamageKind, DamageSource, Explosion, GroupTarget, RadiusEffect, }; use common_net::{msg::ServerGeneral, sync::WorldSyncExt}; use common_state::BlockChange; @@ -491,10 +491,14 @@ pub fn handle_land_on_ground(server: &Server, entity: EcsEntity, vel: Vec3) if let Some(mut health) = state.ecs().write_storage::().get_mut(entity) { let damage = Damage { source: DamageSource::Falling, + kind: DamageKind::Crushing, value: falldmg, }; - let damage_reduction = - Damage::compute_damage_reduction(inventories.get(entity), stats.get(entity)); + let damage_reduction = Damage::compute_damage_reduction( + inventories.get(entity), + stats.get(entity), + Some(DamageKind::Crushing), + ); let change = damage.calculate_health_change(damage_reduction, None, false, 0.0, 1.0); health.change_by(change); } diff --git a/server/src/state_ext.rs b/server/src/state_ext.rs index 84db6304a2..2301a20813 100644 --- a/server/src/state_ext.rs +++ b/server/src/state_ext.rs @@ -125,6 +125,7 @@ impl StateExt for State { combat::Damage::compute_damage_reduction( inventories.get(entity), stats.get(entity), + Some(damage.kind), ), source, false, diff --git a/server/src/sys/object.rs b/server/src/sys/object.rs index 0f388a223f..b7ca5ce30c 100644 --- a/server/src/sys/object.rs +++ b/server/src/sys/object.rs @@ -3,7 +3,7 @@ use common::{ effect::Effect, event::{EventBus, ServerEvent}, resources::DeltaTime, - Damage, DamageSource, Explosion, RadiusEffect, + Damage, DamageKind, DamageSource, Explosion, RadiusEffect, }; use common_ecs::{Job, Origin, Phase, System}; use specs::{Entities, Join, Read, ReadStorage, WriteStorage}; @@ -56,6 +56,7 @@ impl<'a> System<'a> for Sys { effects: vec![ RadiusEffect::Entity(Effect::Damage(Damage { source: DamageSource::Explosion, + kind: DamageKind::Energy, value: 400.0, })), RadiusEffect::Entity(Effect::PoiseChange(PoiseChange { @@ -150,6 +151,7 @@ impl<'a> System<'a> for Sys { effects: vec![ RadiusEffect::Entity(Effect::Damage(Damage { source: DamageSource::Explosion, + kind: DamageKind::Energy, value: 50.0, })), RadiusEffect::Entity(Effect::PoiseChange(PoiseChange { diff --git a/voxygen/src/audio/sfx/event_mapper/combat/tests.rs b/voxygen/src/audio/sfx/event_mapper/combat/tests.rs index 35cb0f7c24..19856b36ab 100644 --- a/voxygen/src/audio/sfx/event_mapper/combat/tests.rs +++ b/voxygen/src/audio/sfx/event_mapper/combat/tests.rs @@ -1,6 +1,7 @@ use super::*; use crate::audio::sfx::SfxEvent; use common::{ + combat::DamageKind, comp::{ inventory::loadout_builder::LoadoutBuilder, item::tool::ToolKind, CharacterAbilityType, CharacterState, InputKind, Item, @@ -80,6 +81,7 @@ fn maps_basic_melee() { max_angle: 1.0, ability_info: empty_ability_info(), damage_effect: None, + damage_kind: DamageKind::Slashing, }, timer: Duration::default(), stage_section: states::utils::StageSection::Buildup, @@ -125,6 +127,7 @@ fn matches_ability_stage() { base_swing_duration: Duration::from_millis(200), base_recover_duration: Duration::from_millis(400), forward_movement: 0.5, + damage_kind: DamageKind::Slashing, }], initial_energy_gain: 0.0, max_energy_gain: 100.0, @@ -183,6 +186,7 @@ fn ignores_different_ability_stage() { base_swing_duration: Duration::from_millis(200), base_recover_duration: Duration::from_millis(400), forward_movement: 0.5, + damage_kind: DamageKind::Slashing, }], initial_energy_gain: 0.0, max_energy_gain: 100.0, diff --git a/voxygen/src/hud/bag.rs b/voxygen/src/hud/bag.rs index 82db41dfcf..c9baa92f9b 100644 --- a/voxygen/src/hud/bag.rs +++ b/voxygen/src/hud/bag.rs @@ -785,7 +785,8 @@ impl<'a> Widget for Bag<'a> { }); let protection_txt = format!( "{}%", - (100.0 * Damage::compute_damage_reduction(Some(inventory), Some(self.stats))) + (100.0 + * Damage::compute_damage_reduction(Some(inventory), Some(self.stats), None,)) as i32 ); let health_txt = format!("{}", (self.health.maximum() as f32 / 10.0) as usize);