mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'aweinstock/damage-types' into 'master'
Add `DamageKind`, and make piercing damage partially ignore damage resistence. See merge request veloren/veloren!2262
This commit is contained in:
commit
a2999ce96f
@ -13,6 +13,7 @@ ComboMelee(
|
|||||||
base_swing_duration: 0.075,
|
base_swing_duration: 0.075,
|
||||||
base_recover_duration: 0.35,
|
base_recover_duration: 0.35,
|
||||||
forward_movement: 0.5,
|
forward_movement: 0.5,
|
||||||
|
damage_kind: Slashing,
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
stage: 2,
|
stage: 2,
|
||||||
@ -27,6 +28,7 @@ ComboMelee(
|
|||||||
base_swing_duration: 0.1,
|
base_swing_duration: 0.1,
|
||||||
base_recover_duration: 0.35,
|
base_recover_duration: 0.35,
|
||||||
forward_movement: 0.25,
|
forward_movement: 0.25,
|
||||||
|
damage_kind: Slashing,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
initial_energy_gain: 25,
|
initial_energy_gain: 25,
|
||||||
|
@ -11,4 +11,5 @@ LeapMelee(
|
|||||||
max_angle: 30.0,
|
max_angle: 30.0,
|
||||||
forward_leap_strength: 20.0,
|
forward_leap_strength: 20.0,
|
||||||
vertical_leap_strength: 8.0,
|
vertical_leap_strength: 8.0,
|
||||||
|
damage_kind: Slashing,
|
||||||
)
|
)
|
||||||
|
@ -15,4 +15,5 @@ SpinMelee(
|
|||||||
num_spins: 1,
|
num_spins: 1,
|
||||||
specifier: None,
|
specifier: None,
|
||||||
target: Some(OutOfGroup),
|
target: Some(OutOfGroup),
|
||||||
|
damage_kind: Slashing,
|
||||||
)
|
)
|
||||||
|
@ -16,4 +16,5 @@ DashMelee(
|
|||||||
recover_duration: 1.2,
|
recover_duration: 1.2,
|
||||||
charge_through: true,
|
charge_through: true,
|
||||||
is_interruptible: true,
|
is_interruptible: true,
|
||||||
|
damage_kind: Slashing,
|
||||||
)
|
)
|
||||||
|
@ -13,6 +13,7 @@ ComboMelee(
|
|||||||
base_swing_duration: 0.12,
|
base_swing_duration: 0.12,
|
||||||
base_recover_duration: 0.6,
|
base_recover_duration: 0.6,
|
||||||
forward_movement: 3.5,
|
forward_movement: 3.5,
|
||||||
|
damage_kind: Slashing,
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
stage: 2,
|
stage: 2,
|
||||||
@ -27,6 +28,7 @@ ComboMelee(
|
|||||||
base_swing_duration: 0.15,
|
base_swing_duration: 0.15,
|
||||||
base_recover_duration: 1.2,
|
base_recover_duration: 1.2,
|
||||||
forward_movement: 4.5,
|
forward_movement: 4.5,
|
||||||
|
damage_kind: Slashing,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
initial_energy_gain: 0,
|
initial_energy_gain: 0,
|
||||||
@ -37,4 +39,4 @@ ComboMelee(
|
|||||||
scales_from_combo: 0,
|
scales_from_combo: 0,
|
||||||
is_interruptible: false,
|
is_interruptible: false,
|
||||||
ori_modifier: 0.6,
|
ori_modifier: 0.6,
|
||||||
)
|
)
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
BasicRanged(
|
BasicRanged(
|
||||||
energy_cost: 0,
|
energy_cost: 0,
|
||||||
buildup_duration: 0.5,
|
buildup_duration: 0.4,
|
||||||
recover_duration: 0.3,
|
recover_duration: 0.3,
|
||||||
projectile: Arrow(
|
projectile: Arrow(
|
||||||
damage: 70.0,
|
damage: 90.0,
|
||||||
knockback: 5.0,
|
knockback: 5.0,
|
||||||
energy_regen: 40,
|
energy_regen: 40,
|
||||||
),
|
),
|
||||||
|
@ -14,4 +14,5 @@ ChargedRanged(
|
|||||||
initial_projectile_speed: 120.0,
|
initial_projectile_speed: 120.0,
|
||||||
scaled_projectile_speed: 160.0,
|
scaled_projectile_speed: 160.0,
|
||||||
move_speed: 0.3,
|
move_speed: 0.3,
|
||||||
|
damage_kind: Piercing,
|
||||||
)
|
)
|
||||||
|
@ -9,4 +9,5 @@ BasicMelee(
|
|||||||
range: 5.0,
|
range: 5.0,
|
||||||
max_angle: 120.0,
|
max_angle: 120.0,
|
||||||
damage_effect: None,
|
damage_effect: None,
|
||||||
|
damage_kind: Slashing,
|
||||||
)
|
)
|
||||||
|
@ -13,6 +13,7 @@ ComboMelee(
|
|||||||
base_swing_duration: 0.1,
|
base_swing_duration: 0.1,
|
||||||
base_recover_duration: 0.3,
|
base_recover_duration: 0.3,
|
||||||
forward_movement: 2.0,
|
forward_movement: 2.0,
|
||||||
|
damage_kind: Slashing,
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
stage: 2,
|
stage: 2,
|
||||||
@ -27,6 +28,7 @@ ComboMelee(
|
|||||||
base_swing_duration: 0.1,
|
base_swing_duration: 0.1,
|
||||||
base_recover_duration: 0.3,
|
base_recover_duration: 0.3,
|
||||||
forward_movement: 1.5,
|
forward_movement: 1.5,
|
||||||
|
damage_kind: Slashing,
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
stage: 3,
|
stage: 3,
|
||||||
@ -41,6 +43,7 @@ ComboMelee(
|
|||||||
base_swing_duration: 0.1,
|
base_swing_duration: 0.1,
|
||||||
base_recover_duration: 0.3,
|
base_recover_duration: 0.3,
|
||||||
forward_movement: 1.5,
|
forward_movement: 1.5,
|
||||||
|
damage_kind: Slashing,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
initial_energy_gain: 0,
|
initial_energy_gain: 0,
|
||||||
|
@ -12,4 +12,5 @@ Shockwave(
|
|||||||
shockwave_duration: 0.5,
|
shockwave_duration: 0.5,
|
||||||
requires_ground: false,
|
requires_ground: false,
|
||||||
move_efficiency: 0.1,
|
move_efficiency: 0.1,
|
||||||
|
damage_kind: Energy,
|
||||||
)
|
)
|
||||||
|
@ -13,6 +13,7 @@ ComboMelee(
|
|||||||
base_swing_duration: 0.1,
|
base_swing_duration: 0.1,
|
||||||
base_recover_duration: 0.3,
|
base_recover_duration: 0.3,
|
||||||
forward_movement: 2.0,
|
forward_movement: 2.0,
|
||||||
|
damage_kind: Slashing,
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
stage: 2,
|
stage: 2,
|
||||||
@ -27,6 +28,7 @@ ComboMelee(
|
|||||||
base_swing_duration: 0.1,
|
base_swing_duration: 0.1,
|
||||||
base_recover_duration: 0.3,
|
base_recover_duration: 0.3,
|
||||||
forward_movement: 1.5,
|
forward_movement: 1.5,
|
||||||
|
damage_kind: Slashing,
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
stage: 3,
|
stage: 3,
|
||||||
@ -41,6 +43,7 @@ ComboMelee(
|
|||||||
base_swing_duration: 0.1,
|
base_swing_duration: 0.1,
|
||||||
base_recover_duration: 0.3,
|
base_recover_duration: 0.3,
|
||||||
forward_movement: 1.5,
|
forward_movement: 1.5,
|
||||||
|
damage_kind: Slashing,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
initial_energy_gain: 0,
|
initial_energy_gain: 0,
|
||||||
|
@ -13,6 +13,7 @@ ComboMelee(
|
|||||||
base_swing_duration: 0.07,
|
base_swing_duration: 0.07,
|
||||||
base_recover_duration: 0.25,
|
base_recover_duration: 0.25,
|
||||||
forward_movement: 0.5,
|
forward_movement: 0.5,
|
||||||
|
damage_kind: Crushing,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
initial_energy_gain: 0,
|
initial_energy_gain: 0,
|
||||||
|
@ -13,6 +13,7 @@ ComboMelee(
|
|||||||
base_swing_duration: 0.07,
|
base_swing_duration: 0.07,
|
||||||
base_recover_duration: 0.2,
|
base_recover_duration: 0.2,
|
||||||
forward_movement: 1.0,
|
forward_movement: 1.0,
|
||||||
|
damage_kind: Crushing,
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
stage: 2,
|
stage: 2,
|
||||||
@ -27,6 +28,7 @@ ComboMelee(
|
|||||||
base_swing_duration: 0.07,
|
base_swing_duration: 0.07,
|
||||||
base_recover_duration: 0.2,
|
base_recover_duration: 0.2,
|
||||||
forward_movement: 0.0,
|
forward_movement: 0.0,
|
||||||
|
damage_kind: Crushing,
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
stage: 3,
|
stage: 3,
|
||||||
@ -41,6 +43,7 @@ ComboMelee(
|
|||||||
base_swing_duration: 0.07,
|
base_swing_duration: 0.07,
|
||||||
base_recover_duration: 0.2,
|
base_recover_duration: 0.2,
|
||||||
forward_movement: 1.0,
|
forward_movement: 1.0,
|
||||||
|
damage_kind: Crushing,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
initial_energy_gain: 0,
|
initial_energy_gain: 0,
|
||||||
|
@ -15,4 +15,5 @@ SpinMelee(
|
|||||||
num_spins: 1,
|
num_spins: 1,
|
||||||
specifier: Some(CultistVortex),
|
specifier: Some(CultistVortex),
|
||||||
target: None,
|
target: None,
|
||||||
|
damage_kind: Energy,
|
||||||
)
|
)
|
||||||
|
@ -16,4 +16,5 @@ DashMelee(
|
|||||||
recover_duration: 0.5,
|
recover_duration: 0.5,
|
||||||
charge_through: false,
|
charge_through: false,
|
||||||
is_interruptible: false,
|
is_interruptible: false,
|
||||||
)
|
damage_kind: Piercing,
|
||||||
|
)
|
||||||
|
@ -15,4 +15,5 @@ ChargedMelee(
|
|||||||
hit_timing: 0.8,
|
hit_timing: 0.8,
|
||||||
recover_duration: 0.5,
|
recover_duration: 0.5,
|
||||||
specifier: Some(GroundCleave),
|
specifier: Some(GroundCleave),
|
||||||
|
damage_kind: Slashing,
|
||||||
)
|
)
|
||||||
|
@ -14,4 +14,5 @@ BasicMelee(
|
|||||||
strength: Value(0.5),
|
strength: Value(0.5),
|
||||||
chance: 1.0,
|
chance: 1.0,
|
||||||
))),
|
))),
|
||||||
|
damage_kind: Slashing,
|
||||||
)
|
)
|
||||||
|
@ -13,6 +13,7 @@ ComboMelee(
|
|||||||
base_swing_duration: 0.07,
|
base_swing_duration: 0.07,
|
||||||
base_recover_duration: 0.4,
|
base_recover_duration: 0.4,
|
||||||
forward_movement: 3.0,
|
forward_movement: 3.0,
|
||||||
|
damage_kind: Crushing,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
initial_energy_gain: 0,
|
initial_energy_gain: 0,
|
||||||
|
@ -13,6 +13,7 @@ ComboMelee(
|
|||||||
base_swing_duration: 0.07,
|
base_swing_duration: 0.07,
|
||||||
base_recover_duration: 0.3,
|
base_recover_duration: 0.3,
|
||||||
forward_movement: 2.0,
|
forward_movement: 2.0,
|
||||||
|
damage_kind: Crushing,
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
stage: 2,
|
stage: 2,
|
||||||
@ -27,6 +28,7 @@ ComboMelee(
|
|||||||
base_swing_duration: 0.07,
|
base_swing_duration: 0.07,
|
||||||
base_recover_duration: 0.3,
|
base_recover_duration: 0.3,
|
||||||
forward_movement: 1.5,
|
forward_movement: 1.5,
|
||||||
|
damage_kind: Crushing,
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
stage: 3,
|
stage: 3,
|
||||||
@ -41,6 +43,7 @@ ComboMelee(
|
|||||||
base_swing_duration: 0.07,
|
base_swing_duration: 0.07,
|
||||||
base_recover_duration: 0.3,
|
base_recover_duration: 0.3,
|
||||||
forward_movement: 1.5,
|
forward_movement: 1.5,
|
||||||
|
damage_kind: Crushing,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
initial_energy_gain: 0,
|
initial_energy_gain: 0,
|
||||||
|
@ -16,4 +16,5 @@ DashMelee(
|
|||||||
recover_duration: 0.8,
|
recover_duration: 0.8,
|
||||||
charge_through: true,
|
charge_through: true,
|
||||||
is_interruptible: false,
|
is_interruptible: false,
|
||||||
|
damage_kind: Crushing,
|
||||||
)
|
)
|
||||||
|
@ -13,6 +13,7 @@ ComboMelee(
|
|||||||
base_swing_duration: 0.1,
|
base_swing_duration: 0.1,
|
||||||
base_recover_duration: 0.3,
|
base_recover_duration: 0.3,
|
||||||
forward_movement: 2.0,
|
forward_movement: 2.0,
|
||||||
|
damage_kind: Crushing,
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
stage: 2,
|
stage: 2,
|
||||||
@ -27,6 +28,7 @@ ComboMelee(
|
|||||||
base_swing_duration: 0.1,
|
base_swing_duration: 0.1,
|
||||||
base_recover_duration: 0.3,
|
base_recover_duration: 0.3,
|
||||||
forward_movement: 1.5,
|
forward_movement: 1.5,
|
||||||
|
damage_kind: Crushing,
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
stage: 3,
|
stage: 3,
|
||||||
@ -41,6 +43,7 @@ ComboMelee(
|
|||||||
base_swing_duration: 0.1,
|
base_swing_duration: 0.1,
|
||||||
base_recover_duration: 0.3,
|
base_recover_duration: 0.3,
|
||||||
forward_movement: 1.5,
|
forward_movement: 1.5,
|
||||||
|
damage_kind: Crushing,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
initial_energy_gain: 0,
|
initial_energy_gain: 0,
|
||||||
|
@ -16,4 +16,5 @@ DashMelee(
|
|||||||
recover_duration: 0.5,
|
recover_duration: 0.5,
|
||||||
charge_through: true,
|
charge_through: true,
|
||||||
is_interruptible: false,
|
is_interruptible: false,
|
||||||
|
damage_kind: Crushing,
|
||||||
)
|
)
|
||||||
|
@ -13,6 +13,7 @@ ComboMelee(
|
|||||||
base_swing_duration: 0.1,
|
base_swing_duration: 0.1,
|
||||||
base_recover_duration: 0.1,
|
base_recover_duration: 0.1,
|
||||||
forward_movement: 1.5,
|
forward_movement: 1.5,
|
||||||
|
damage_kind: Crushing,
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
stage: 2,
|
stage: 2,
|
||||||
@ -27,6 +28,7 @@ ComboMelee(
|
|||||||
base_swing_duration: 0.07,
|
base_swing_duration: 0.07,
|
||||||
base_recover_duration: 0.1,
|
base_recover_duration: 0.1,
|
||||||
forward_movement: 0.8,
|
forward_movement: 0.8,
|
||||||
|
damage_kind: Crushing,
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
stage: 3,
|
stage: 3,
|
||||||
@ -41,6 +43,7 @@ ComboMelee(
|
|||||||
base_swing_duration: 0.07,
|
base_swing_duration: 0.07,
|
||||||
base_recover_duration: 0.1,
|
base_recover_duration: 0.1,
|
||||||
forward_movement: 0.8,
|
forward_movement: 0.8,
|
||||||
|
damage_kind: Crushing,
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
stage: 4,
|
stage: 4,
|
||||||
@ -55,6 +58,7 @@ ComboMelee(
|
|||||||
base_swing_duration: 0.07,
|
base_swing_duration: 0.07,
|
||||||
base_recover_duration: 0.1,
|
base_recover_duration: 0.1,
|
||||||
forward_movement: 0.8,
|
forward_movement: 0.8,
|
||||||
|
damage_kind: Crushing,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
initial_energy_gain: 0,
|
initial_energy_gain: 0,
|
||||||
|
@ -13,6 +13,7 @@ ComboMelee(
|
|||||||
base_swing_duration: 0.1,
|
base_swing_duration: 0.1,
|
||||||
base_recover_duration: 0.4,
|
base_recover_duration: 0.4,
|
||||||
forward_movement: 3.0,
|
forward_movement: 3.0,
|
||||||
|
damage_kind: Crushing,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
initial_energy_gain: 0,
|
initial_energy_gain: 0,
|
||||||
|
@ -14,4 +14,5 @@ ChargedMelee(
|
|||||||
swing_duration: 0.7,
|
swing_duration: 0.7,
|
||||||
hit_timing: 0.9,
|
hit_timing: 0.9,
|
||||||
recover_duration: 1.2,
|
recover_duration: 1.2,
|
||||||
|
damage_kind: Crushing,
|
||||||
)
|
)
|
||||||
|
@ -13,6 +13,7 @@ ComboMelee(
|
|||||||
base_swing_duration: 0.1,
|
base_swing_duration: 0.1,
|
||||||
base_recover_duration: 0.2,
|
base_recover_duration: 0.2,
|
||||||
forward_movement: 2.0,
|
forward_movement: 2.0,
|
||||||
|
damage_kind: Crushing,
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
stage: 2,
|
stage: 2,
|
||||||
@ -27,6 +28,7 @@ ComboMelee(
|
|||||||
base_swing_duration: 0.1,
|
base_swing_duration: 0.1,
|
||||||
base_recover_duration: 0.2,
|
base_recover_duration: 0.2,
|
||||||
forward_movement: 1.0,
|
forward_movement: 1.0,
|
||||||
|
damage_kind: Crushing,
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
stage: 3,
|
stage: 3,
|
||||||
@ -41,6 +43,7 @@ ComboMelee(
|
|||||||
base_swing_duration: 0.1,
|
base_swing_duration: 0.1,
|
||||||
base_recover_duration: 0.2,
|
base_recover_duration: 0.2,
|
||||||
forward_movement: 1.0,
|
forward_movement: 1.0,
|
||||||
|
damage_kind: Crushing,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
initial_energy_gain: 0,
|
initial_energy_gain: 0,
|
||||||
|
@ -13,6 +13,7 @@ ComboMelee(
|
|||||||
base_swing_duration: 0.1,
|
base_swing_duration: 0.1,
|
||||||
base_recover_duration: 0.4,
|
base_recover_duration: 0.4,
|
||||||
forward_movement: 1.0,
|
forward_movement: 1.0,
|
||||||
|
damage_kind: Crushing,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
initial_energy_gain: 0,
|
initial_energy_gain: 0,
|
||||||
|
@ -13,6 +13,7 @@ ComboMelee(
|
|||||||
base_swing_duration: 0.07,
|
base_swing_duration: 0.07,
|
||||||
base_recover_duration: 0.2,
|
base_recover_duration: 0.2,
|
||||||
forward_movement: 1.0,
|
forward_movement: 1.0,
|
||||||
|
damage_kind: Crushing,
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
stage: 2,
|
stage: 2,
|
||||||
@ -27,6 +28,7 @@ ComboMelee(
|
|||||||
base_swing_duration: 0.07,
|
base_swing_duration: 0.07,
|
||||||
base_recover_duration: 0.2,
|
base_recover_duration: 0.2,
|
||||||
forward_movement: 0.0,
|
forward_movement: 0.0,
|
||||||
|
damage_kind: Crushing,
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
stage: 3,
|
stage: 3,
|
||||||
@ -41,6 +43,7 @@ ComboMelee(
|
|||||||
base_swing_duration: 0.07,
|
base_swing_duration: 0.07,
|
||||||
base_recover_duration: 0.2,
|
base_recover_duration: 0.2,
|
||||||
forward_movement: 1.0,
|
forward_movement: 1.0,
|
||||||
|
damage_kind: Crushing,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
initial_energy_gain: 0,
|
initial_energy_gain: 0,
|
||||||
|
@ -16,4 +16,5 @@ DashMelee(
|
|||||||
recover_duration: 1.1,
|
recover_duration: 1.1,
|
||||||
charge_through: true,
|
charge_through: true,
|
||||||
is_interruptible: false,
|
is_interruptible: false,
|
||||||
|
damage_kind: Crushing,
|
||||||
)
|
)
|
||||||
|
@ -13,6 +13,7 @@ ComboMelee(
|
|||||||
base_swing_duration: 0.1,
|
base_swing_duration: 0.1,
|
||||||
base_recover_duration: 0.3,
|
base_recover_duration: 0.3,
|
||||||
forward_movement: 1.0,
|
forward_movement: 1.0,
|
||||||
|
damage_kind: Crushing,
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
stage: 2,
|
stage: 2,
|
||||||
@ -27,6 +28,7 @@ ComboMelee(
|
|||||||
base_swing_duration: 0.1,
|
base_swing_duration: 0.1,
|
||||||
base_recover_duration: 0.3,
|
base_recover_duration: 0.3,
|
||||||
forward_movement: 0.5,
|
forward_movement: 0.5,
|
||||||
|
damage_kind: Crushing,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
initial_energy_gain: 0,
|
initial_energy_gain: 0,
|
||||||
|
@ -9,4 +9,5 @@ BasicMelee(
|
|||||||
range: 1.2,
|
range: 1.2,
|
||||||
max_angle: 50.0,
|
max_angle: 50.0,
|
||||||
damage_effect: None,
|
damage_effect: None,
|
||||||
|
damage_kind: Crushing,
|
||||||
)
|
)
|
||||||
|
@ -13,6 +13,7 @@ ComboMelee(
|
|||||||
base_swing_duration: 0.1,
|
base_swing_duration: 0.1,
|
||||||
base_recover_duration: 0.3,
|
base_recover_duration: 0.3,
|
||||||
forward_movement: 1.0,
|
forward_movement: 1.0,
|
||||||
|
damage_kind: Crushing,
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
stage: 2,
|
stage: 2,
|
||||||
@ -27,6 +28,7 @@ ComboMelee(
|
|||||||
base_swing_duration: 0.1,
|
base_swing_duration: 0.1,
|
||||||
base_recover_duration: 0.3,
|
base_recover_duration: 0.3,
|
||||||
forward_movement: 1.5,
|
forward_movement: 1.5,
|
||||||
|
damage_kind: Crushing,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
initial_energy_gain: 0,
|
initial_energy_gain: 0,
|
||||||
|
@ -11,4 +11,5 @@ LeapMelee(
|
|||||||
max_angle: 180.0,
|
max_angle: 180.0,
|
||||||
forward_leap_strength: 40.0,
|
forward_leap_strength: 40.0,
|
||||||
vertical_leap_strength: 10.0,
|
vertical_leap_strength: 10.0,
|
||||||
|
damage_kind: Crushing,
|
||||||
)
|
)
|
||||||
|
@ -11,4 +11,5 @@ LeapMelee(
|
|||||||
max_angle: 180.0,
|
max_angle: 180.0,
|
||||||
forward_leap_strength: 20.0,
|
forward_leap_strength: 20.0,
|
||||||
vertical_leap_strength: 5.0,
|
vertical_leap_strength: 5.0,
|
||||||
|
damage_kind: Crushing,
|
||||||
)
|
)
|
||||||
|
@ -16,4 +16,5 @@ DashMelee(
|
|||||||
recover_duration: 0.5,
|
recover_duration: 0.5,
|
||||||
charge_through: true,
|
charge_through: true,
|
||||||
is_interruptible: false,
|
is_interruptible: false,
|
||||||
|
damage_kind: Crushing,
|
||||||
)
|
)
|
||||||
|
@ -13,6 +13,7 @@ ComboMelee(
|
|||||||
base_swing_duration: 0.15,
|
base_swing_duration: 0.15,
|
||||||
base_recover_duration: 0.4,
|
base_recover_duration: 0.4,
|
||||||
forward_movement: 0.3,
|
forward_movement: 0.3,
|
||||||
|
damage_kind: Crushing,
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
stage: 2,
|
stage: 2,
|
||||||
@ -27,6 +28,7 @@ ComboMelee(
|
|||||||
base_swing_duration: 0.15,
|
base_swing_duration: 0.15,
|
||||||
base_recover_duration: 0.3,
|
base_recover_duration: 0.3,
|
||||||
forward_movement: 0.5,
|
forward_movement: 0.5,
|
||||||
|
damage_kind: Crushing,
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
stage: 3,
|
stage: 3,
|
||||||
@ -41,6 +43,7 @@ ComboMelee(
|
|||||||
base_swing_duration: 0.15,
|
base_swing_duration: 0.15,
|
||||||
base_recover_duration: 0.3,
|
base_recover_duration: 0.3,
|
||||||
forward_movement: 0.5,
|
forward_movement: 0.5,
|
||||||
|
damage_kind: Crushing,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
initial_energy_gain: 0,
|
initial_energy_gain: 0,
|
||||||
|
@ -13,6 +13,7 @@ ComboMelee(
|
|||||||
base_swing_duration: 0.15,
|
base_swing_duration: 0.15,
|
||||||
base_recover_duration: 0.3,
|
base_recover_duration: 0.3,
|
||||||
forward_movement: 1.0,
|
forward_movement: 1.0,
|
||||||
|
damage_kind: Crushing,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
initial_energy_gain: 0,
|
initial_energy_gain: 0,
|
||||||
|
@ -12,4 +12,5 @@ Shockwave(
|
|||||||
shockwave_duration: 1.0,
|
shockwave_duration: 1.0,
|
||||||
requires_ground: true,
|
requires_ground: true,
|
||||||
move_efficiency: 0.05,
|
move_efficiency: 0.05,
|
||||||
|
damage_kind: Crushing,
|
||||||
)
|
)
|
||||||
|
@ -13,6 +13,7 @@ ComboMelee(
|
|||||||
base_swing_duration: 0.1,
|
base_swing_duration: 0.1,
|
||||||
base_recover_duration: 0.9,
|
base_recover_duration: 0.9,
|
||||||
forward_movement: 3.0,
|
forward_movement: 3.0,
|
||||||
|
damage_kind: Crushing,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
initial_energy_gain: 0,
|
initial_energy_gain: 0,
|
||||||
|
@ -15,4 +15,5 @@ SpinMelee(
|
|||||||
num_spins: 1,
|
num_spins: 1,
|
||||||
specifier: None,
|
specifier: None,
|
||||||
target: Some(OutOfGroup),
|
target: Some(OutOfGroup),
|
||||||
|
damage_kind: Crushing,
|
||||||
)
|
)
|
||||||
|
@ -16,4 +16,5 @@ DashMelee(
|
|||||||
recover_duration: 1.1,
|
recover_duration: 1.1,
|
||||||
charge_through: true,
|
charge_through: true,
|
||||||
is_interruptible: false,
|
is_interruptible: false,
|
||||||
)
|
damage_kind: Crushing,
|
||||||
|
)
|
||||||
|
@ -13,6 +13,7 @@ ComboMelee(
|
|||||||
base_swing_duration: 0.15,
|
base_swing_duration: 0.15,
|
||||||
base_recover_duration: 0.4,
|
base_recover_duration: 0.4,
|
||||||
forward_movement: 3.0,
|
forward_movement: 3.0,
|
||||||
|
damage_kind: Crushing,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
initial_energy_gain: 0,
|
initial_energy_gain: 0,
|
||||||
|
@ -13,6 +13,7 @@ ComboMelee(
|
|||||||
base_swing_duration: 0.15,
|
base_swing_duration: 0.15,
|
||||||
base_recover_duration: 0.3,
|
base_recover_duration: 0.3,
|
||||||
forward_movement: 1.0,
|
forward_movement: 1.0,
|
||||||
|
damage_kind: Crushing,
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
stage: 2,
|
stage: 2,
|
||||||
@ -27,6 +28,7 @@ ComboMelee(
|
|||||||
base_swing_duration: 0.15,
|
base_swing_duration: 0.15,
|
||||||
base_recover_duration: 0.15,
|
base_recover_duration: 0.15,
|
||||||
forward_movement: 1.0,
|
forward_movement: 1.0,
|
||||||
|
damage_kind: Crushing,
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
stage: 3,
|
stage: 3,
|
||||||
@ -41,6 +43,7 @@ ComboMelee(
|
|||||||
base_swing_duration: 0.125,
|
base_swing_duration: 0.125,
|
||||||
base_recover_duration: 0.9,
|
base_recover_duration: 0.9,
|
||||||
forward_movement: 1.0,
|
forward_movement: 1.0,
|
||||||
|
damage_kind: Crushing,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
initial_energy_gain: 0,
|
initial_energy_gain: 0,
|
||||||
|
@ -13,6 +13,7 @@ ComboMelee(
|
|||||||
base_swing_duration: 0.15,
|
base_swing_duration: 0.15,
|
||||||
base_recover_duration: 0.4,
|
base_recover_duration: 0.4,
|
||||||
forward_movement: 3.0,
|
forward_movement: 3.0,
|
||||||
|
damage_kind: Crushing,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
initial_energy_gain: 0,
|
initial_energy_gain: 0,
|
||||||
|
@ -13,6 +13,7 @@ ComboMelee(
|
|||||||
base_swing_duration: 0.15,
|
base_swing_duration: 0.15,
|
||||||
base_recover_duration: 0.3,
|
base_recover_duration: 0.3,
|
||||||
forward_movement: 1.0,
|
forward_movement: 1.0,
|
||||||
|
damage_kind: Crushing,
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
stage: 2,
|
stage: 2,
|
||||||
@ -27,6 +28,7 @@ ComboMelee(
|
|||||||
base_swing_duration: 0.15,
|
base_swing_duration: 0.15,
|
||||||
base_recover_duration: 0.15,
|
base_recover_duration: 0.15,
|
||||||
forward_movement: 1.0,
|
forward_movement: 1.0,
|
||||||
|
damage_kind: Crushing,
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
stage: 3,
|
stage: 3,
|
||||||
@ -41,6 +43,7 @@ ComboMelee(
|
|||||||
base_swing_duration: 0.125,
|
base_swing_duration: 0.125,
|
||||||
base_recover_duration: 0.9,
|
base_recover_duration: 0.9,
|
||||||
forward_movement: 1.0,
|
forward_movement: 1.0,
|
||||||
|
damage_kind: Crushing,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
initial_energy_gain: 0,
|
initial_energy_gain: 0,
|
||||||
|
@ -13,6 +13,7 @@ ComboMelee(
|
|||||||
base_swing_duration: 0.2,
|
base_swing_duration: 0.2,
|
||||||
base_recover_duration: 0.4,
|
base_recover_duration: 0.4,
|
||||||
forward_movement: 5.0,
|
forward_movement: 5.0,
|
||||||
|
damage_kind: Crushing,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
initial_energy_gain: 0,
|
initial_energy_gain: 0,
|
||||||
|
@ -9,4 +9,5 @@ BasicMelee(
|
|||||||
range: 3.5,
|
range: 3.5,
|
||||||
max_angle: 20.0,
|
max_angle: 20.0,
|
||||||
damage_effect: None,
|
damage_effect: None,
|
||||||
|
damage_kind: Piercing,
|
||||||
)
|
)
|
||||||
|
@ -9,4 +9,5 @@ BasicMelee(
|
|||||||
range: 3.5,
|
range: 3.5,
|
||||||
max_angle: 15.0,
|
max_angle: 15.0,
|
||||||
damage_effect: None,
|
damage_effect: None,
|
||||||
|
damage_kind: Crushing,
|
||||||
)
|
)
|
||||||
|
@ -9,4 +9,5 @@ BasicMelee(
|
|||||||
range: 3.5,
|
range: 3.5,
|
||||||
max_angle: 20.0,
|
max_angle: 20.0,
|
||||||
damage_effect: None,
|
damage_effect: None,
|
||||||
|
damage_kind: Crushing,
|
||||||
)
|
)
|
||||||
|
@ -14,4 +14,5 @@ ChargedMelee(
|
|||||||
swing_duration: 0.12,
|
swing_duration: 0.12,
|
||||||
hit_timing: 0.2,
|
hit_timing: 0.2,
|
||||||
recover_duration: 0.3,
|
recover_duration: 0.3,
|
||||||
|
damage_kind: Crushing,
|
||||||
)
|
)
|
||||||
|
@ -11,4 +11,5 @@ LeapMelee(
|
|||||||
max_angle: 360.0,
|
max_angle: 360.0,
|
||||||
forward_leap_strength: 20.0,
|
forward_leap_strength: 20.0,
|
||||||
vertical_leap_strength: 8.0,
|
vertical_leap_strength: 8.0,
|
||||||
|
damage_kind: Crushing,
|
||||||
)
|
)
|
||||||
|
@ -12,6 +12,7 @@ ComboMelee(
|
|||||||
base_swing_duration: 0.1,
|
base_swing_duration: 0.1,
|
||||||
base_recover_duration: 0.45,
|
base_recover_duration: 0.45,
|
||||||
forward_movement: 0.0,
|
forward_movement: 0.0,
|
||||||
|
damage_kind: Crushing,
|
||||||
)],
|
)],
|
||||||
initial_energy_gain: 50,
|
initial_energy_gain: 50,
|
||||||
max_energy_gain: 150,
|
max_energy_gain: 150,
|
||||||
|
@ -13,6 +13,7 @@ ComboMelee(
|
|||||||
base_swing_duration: 0.08,
|
base_swing_duration: 0.08,
|
||||||
base_recover_duration: 0.6,
|
base_recover_duration: 0.6,
|
||||||
forward_movement: 3.5,
|
forward_movement: 3.5,
|
||||||
|
damage_kind: Crushing,
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
stage: 2,
|
stage: 2,
|
||||||
@ -27,6 +28,7 @@ ComboMelee(
|
|||||||
base_swing_duration: 0.25,
|
base_swing_duration: 0.25,
|
||||||
base_recover_duration: 1.2,
|
base_recover_duration: 1.2,
|
||||||
forward_movement: 2.0,
|
forward_movement: 2.0,
|
||||||
|
damage_kind: Crushing,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
initial_energy_gain: 0,
|
initial_energy_gain: 0,
|
||||||
@ -37,4 +39,4 @@ ComboMelee(
|
|||||||
scales_from_combo: 0,
|
scales_from_combo: 0,
|
||||||
is_interruptible: false,
|
is_interruptible: false,
|
||||||
ori_modifier: 0.6,
|
ori_modifier: 0.6,
|
||||||
)
|
)
|
||||||
|
@ -9,4 +9,5 @@ BasicMelee(
|
|||||||
range: 3.5,
|
range: 3.5,
|
||||||
max_angle: 20.0,
|
max_angle: 20.0,
|
||||||
damage_effect: None,
|
damage_effect: None,
|
||||||
|
damage_kind: Piercing,
|
||||||
)
|
)
|
||||||
|
@ -9,4 +9,5 @@ BasicMelee(
|
|||||||
range: 3.0,
|
range: 3.0,
|
||||||
max_angle: 120.0,
|
max_angle: 120.0,
|
||||||
damage_effect: None,
|
damage_effect: None,
|
||||||
|
damage_kind: Crushing,
|
||||||
)
|
)
|
||||||
|
@ -16,4 +16,5 @@ DashMelee(
|
|||||||
recover_duration: 0.5,
|
recover_duration: 0.5,
|
||||||
charge_through: true,
|
charge_through: true,
|
||||||
is_interruptible: true,
|
is_interruptible: true,
|
||||||
|
damage_kind: Piercing,
|
||||||
)
|
)
|
||||||
|
@ -13,6 +13,7 @@ ComboMelee(
|
|||||||
base_swing_duration: 0.075,
|
base_swing_duration: 0.075,
|
||||||
base_recover_duration: 0.4,
|
base_recover_duration: 0.4,
|
||||||
forward_movement: 0.7,
|
forward_movement: 0.7,
|
||||||
|
damage_kind: Piercing,
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
stage: 2,
|
stage: 2,
|
||||||
@ -27,6 +28,7 @@ ComboMelee(
|
|||||||
base_swing_duration: 0.1,
|
base_swing_duration: 0.1,
|
||||||
base_recover_duration: 0.5,
|
base_recover_duration: 0.5,
|
||||||
forward_movement: 0.7,
|
forward_movement: 0.7,
|
||||||
|
damage_kind: Piercing,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
initial_energy_gain: 0,
|
initial_energy_gain: 0,
|
||||||
@ -37,4 +39,4 @@ ComboMelee(
|
|||||||
scales_from_combo: 2,
|
scales_from_combo: 2,
|
||||||
is_interruptible: false,
|
is_interruptible: false,
|
||||||
ori_modifier: 0.75,
|
ori_modifier: 0.75,
|
||||||
)
|
)
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
BasicRanged(
|
BasicRanged(
|
||||||
energy_cost: 0,
|
energy_cost: 0,
|
||||||
buildup_duration: 0.5,
|
buildup_duration: 0.5,
|
||||||
recover_duration: 0.35,
|
recover_duration: 0.4,
|
||||||
projectile: Fireball(
|
projectile: Fireball(
|
||||||
damage: 100.0,
|
damage: 90.0,
|
||||||
radius: 4.0,
|
radius: 4.0,
|
||||||
energy_regen: 50,
|
energy_regen: 50,
|
||||||
),
|
),
|
||||||
|
@ -12,4 +12,5 @@ Shockwave(
|
|||||||
shockwave_duration: 0.5,
|
shockwave_duration: 0.5,
|
||||||
requires_ground: false,
|
requires_ground: false,
|
||||||
move_efficiency: 0.1,
|
move_efficiency: 0.1,
|
||||||
|
damage_kind: Energy,
|
||||||
)
|
)
|
||||||
|
@ -16,4 +16,5 @@ DashMelee(
|
|||||||
recover_duration: 0.5,
|
recover_duration: 0.5,
|
||||||
charge_through: true,
|
charge_through: true,
|
||||||
is_interruptible: true,
|
is_interruptible: true,
|
||||||
|
damage_kind: Piercing,
|
||||||
)
|
)
|
||||||
|
@ -15,4 +15,5 @@ SpinMelee(
|
|||||||
num_spins: 3,
|
num_spins: 3,
|
||||||
specifier: None,
|
specifier: None,
|
||||||
target: Some(OutOfGroup),
|
target: Some(OutOfGroup),
|
||||||
|
damage_kind: Slashing,
|
||||||
)
|
)
|
||||||
|
@ -13,6 +13,7 @@ ComboMelee(
|
|||||||
base_swing_duration: 0.075,
|
base_swing_duration: 0.075,
|
||||||
base_recover_duration: 0.15,
|
base_recover_duration: 0.15,
|
||||||
forward_movement: 0.5,
|
forward_movement: 0.5,
|
||||||
|
damage_kind: Slashing,
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
stage: 2,
|
stage: 2,
|
||||||
@ -27,6 +28,7 @@ ComboMelee(
|
|||||||
base_swing_duration: 0.1,
|
base_swing_duration: 0.1,
|
||||||
base_recover_duration: 0.3,
|
base_recover_duration: 0.3,
|
||||||
forward_movement: 0.0,
|
forward_movement: 0.0,
|
||||||
|
damage_kind: Slashing,
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
stage: 3,
|
stage: 3,
|
||||||
@ -41,6 +43,7 @@ ComboMelee(
|
|||||||
base_swing_duration: 0.1,
|
base_swing_duration: 0.1,
|
||||||
base_recover_duration: 0.35,
|
base_recover_duration: 0.35,
|
||||||
forward_movement: 1.2,
|
forward_movement: 1.2,
|
||||||
|
damage_kind: Piercing,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
initial_energy_gain: 0,
|
initial_energy_gain: 0,
|
||||||
|
@ -16,4 +16,5 @@ DashMelee(
|
|||||||
recover_duration: 0.9,
|
recover_duration: 0.9,
|
||||||
charge_through: true,
|
charge_through: true,
|
||||||
is_interruptible: true,
|
is_interruptible: true,
|
||||||
|
damage_kind: Piercing,
|
||||||
)
|
)
|
||||||
|
@ -13,6 +13,7 @@ ComboMelee(
|
|||||||
base_swing_duration: 0.08,
|
base_swing_duration: 0.08,
|
||||||
base_recover_duration: 0.5,
|
base_recover_duration: 0.5,
|
||||||
forward_movement: 2.5,
|
forward_movement: 2.5,
|
||||||
|
damage_kind: Slashing,
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
stage: 2,
|
stage: 2,
|
||||||
@ -27,6 +28,7 @@ ComboMelee(
|
|||||||
base_swing_duration: 0.1,
|
base_swing_duration: 0.1,
|
||||||
base_recover_duration: 0.7,
|
base_recover_duration: 0.7,
|
||||||
forward_movement: 2.0,
|
forward_movement: 2.0,
|
||||||
|
damage_kind: Slashing,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
initial_energy_gain: 0,
|
initial_energy_gain: 0,
|
||||||
@ -37,4 +39,4 @@ ComboMelee(
|
|||||||
scales_from_combo: 0,
|
scales_from_combo: 0,
|
||||||
is_interruptible: false,
|
is_interruptible: false,
|
||||||
ori_modifier: 0.7,
|
ori_modifier: 0.7,
|
||||||
)
|
)
|
||||||
|
@ -122,9 +122,11 @@ impl Attack {
|
|||||||
target: &TargetInfo,
|
target: &TargetInfo,
|
||||||
source: AttackSource,
|
source: AttackSource,
|
||||||
dir: Dir,
|
dir: Dir,
|
||||||
|
kind: DamageKind,
|
||||||
mut emit_outcome: impl FnMut(Outcome),
|
mut emit_outcome: impl FnMut(Outcome),
|
||||||
) -> f32 {
|
) -> 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 {
|
let block_reduction = match source {
|
||||||
AttackSource::Melee => {
|
AttackSource::Melee => {
|
||||||
if let (Some(CharacterState::BasicBlock(data)), Some(ori)) =
|
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| d.target.map_or(true, |t| t == target_group))
|
||||||
.filter(|d| !(matches!(d.target, Some(GroupTarget::OutOfGroup)) && target_dodging))
|
.filter(|d| !(matches!(d.target, Some(GroupTarget::OutOfGroup)) && target_dodging))
|
||||||
{
|
{
|
||||||
let damage_reduction =
|
let damage_reduction = Attack::compute_damage_reduction(
|
||||||
Attack::compute_damage_reduction(&target, attack_source, dir, |o| emit_outcome(o));
|
&target,
|
||||||
|
attack_source,
|
||||||
|
dir,
|
||||||
|
damage.damage.kind,
|
||||||
|
|o| emit_outcome(o),
|
||||||
|
);
|
||||||
let change = damage.damage.calculate_health_change(
|
let change = damage.damage.calculate_health_change(
|
||||||
damage_reduction,
|
damage_reduction,
|
||||||
attacker.map(|a| a.uid),
|
attacker.map(|a| a.uid),
|
||||||
@ -497,17 +504,36 @@ pub enum DamageSource {
|
|||||||
Other,
|
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"))]
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)]
|
#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||||
pub struct Damage {
|
pub struct Damage {
|
||||||
pub source: DamageSource,
|
pub source: DamageSource,
|
||||||
|
pub kind: DamageKind,
|
||||||
pub value: f32,
|
pub value: f32,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(target_arch = "wasm32"))]
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
impl Damage {
|
impl Damage {
|
||||||
/// Returns the total damage reduction provided by all equipped items
|
/// 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<DamageKind>,
|
||||||
|
) -> f32 {
|
||||||
let inventory_dr = if let Some(inventory) = inventory {
|
let inventory_dr = if let Some(inventory) = inventory {
|
||||||
let protection = inventory
|
let protection = inventory
|
||||||
.equipped_items()
|
.equipped_items()
|
||||||
@ -524,6 +550,13 @@ impl Damage {
|
|||||||
})
|
})
|
||||||
.sum::<Option<f32>>();
|
.sum::<Option<f32>>();
|
||||||
|
|
||||||
|
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;
|
const FIFTY_PERCENT_DR_THRESHOLD: f32 = 60.0;
|
||||||
|
|
||||||
match protection {
|
match protection {
|
||||||
@ -842,7 +875,7 @@ pub fn combat_rating(
|
|||||||
// Assumes a "standard" max health of 100
|
// Assumes a "standard" max health of 100
|
||||||
let health_rating = health.base_max() as f32
|
let health_rating = health.base_max() as f32
|
||||||
/ 100.0
|
/ 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
|
// Assumes a standard person has earned 20 skill points in the general skill
|
||||||
// tree and 10 skill points for the weapon skill tree
|
// tree and 10 skill points for the weapon skill tree
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
assets::{self, Asset},
|
assets::{self, Asset},
|
||||||
combat::{self, CombatEffect, Knockback},
|
combat::{self, CombatEffect, DamageKind, Knockback},
|
||||||
comp::{
|
comp::{
|
||||||
aura, beam, buff, inventory::item::tool::ToolKind, projectile::ProjectileConstructor,
|
aura, beam, buff, inventory::item::tool::ToolKind, projectile::ProjectileConstructor,
|
||||||
skills, Body, CharacterState, EnergySource, LightEmitter, StateUpdate,
|
skills, Body, CharacterState, EnergySource, LightEmitter, StateUpdate,
|
||||||
@ -69,6 +69,7 @@ pub enum CharacterAbility {
|
|||||||
range: f32,
|
range: f32,
|
||||||
max_angle: f32,
|
max_angle: f32,
|
||||||
damage_effect: Option<CombatEffect>,
|
damage_effect: Option<CombatEffect>,
|
||||||
|
damage_kind: DamageKind,
|
||||||
},
|
},
|
||||||
BasicRanged {
|
BasicRanged {
|
||||||
energy_cost: f32,
|
energy_cost: f32,
|
||||||
@ -116,6 +117,7 @@ pub enum CharacterAbility {
|
|||||||
recover_duration: f32,
|
recover_duration: f32,
|
||||||
charge_through: bool,
|
charge_through: bool,
|
||||||
is_interruptible: bool,
|
is_interruptible: bool,
|
||||||
|
damage_kind: DamageKind,
|
||||||
},
|
},
|
||||||
BasicBlock {
|
BasicBlock {
|
||||||
buildup_duration: f32,
|
buildup_duration: f32,
|
||||||
@ -156,6 +158,7 @@ pub enum CharacterAbility {
|
|||||||
knockback: f32,
|
knockback: f32,
|
||||||
forward_leap_strength: f32,
|
forward_leap_strength: f32,
|
||||||
vertical_leap_strength: f32,
|
vertical_leap_strength: f32,
|
||||||
|
damage_kind: DamageKind,
|
||||||
},
|
},
|
||||||
SpinMelee {
|
SpinMelee {
|
||||||
buildup_duration: f32,
|
buildup_duration: f32,
|
||||||
@ -174,6 +177,7 @@ pub enum CharacterAbility {
|
|||||||
num_spins: u32,
|
num_spins: u32,
|
||||||
specifier: Option<spin_melee::FrontendSpecifier>,
|
specifier: Option<spin_melee::FrontendSpecifier>,
|
||||||
target: Option<combat::GroupTarget>,
|
target: Option<combat::GroupTarget>,
|
||||||
|
damage_kind: DamageKind,
|
||||||
},
|
},
|
||||||
ChargedMelee {
|
ChargedMelee {
|
||||||
energy_cost: f32,
|
energy_cost: f32,
|
||||||
@ -192,6 +196,7 @@ pub enum CharacterAbility {
|
|||||||
hit_timing: f32,
|
hit_timing: f32,
|
||||||
recover_duration: f32,
|
recover_duration: f32,
|
||||||
specifier: Option<charged_melee::FrontendSpecifier>,
|
specifier: Option<charged_melee::FrontendSpecifier>,
|
||||||
|
damage_kind: DamageKind,
|
||||||
},
|
},
|
||||||
ChargedRanged {
|
ChargedRanged {
|
||||||
energy_cost: f32,
|
energy_cost: f32,
|
||||||
@ -209,6 +214,7 @@ pub enum CharacterAbility {
|
|||||||
initial_projectile_speed: f32,
|
initial_projectile_speed: f32,
|
||||||
scaled_projectile_speed: f32,
|
scaled_projectile_speed: f32,
|
||||||
move_speed: f32,
|
move_speed: f32,
|
||||||
|
damage_kind: DamageKind,
|
||||||
},
|
},
|
||||||
Shockwave {
|
Shockwave {
|
||||||
energy_cost: f32,
|
energy_cost: f32,
|
||||||
@ -224,6 +230,7 @@ pub enum CharacterAbility {
|
|||||||
shockwave_duration: f32,
|
shockwave_duration: f32,
|
||||||
requires_ground: bool,
|
requires_ground: bool,
|
||||||
move_efficiency: f32,
|
move_efficiency: f32,
|
||||||
|
damage_kind: DamageKind,
|
||||||
},
|
},
|
||||||
BasicBeam {
|
BasicBeam {
|
||||||
buildup_duration: f32,
|
buildup_duration: f32,
|
||||||
@ -296,6 +303,7 @@ impl Default for CharacterAbility {
|
|||||||
range: 3.5,
|
range: 3.5,
|
||||||
max_angle: 15.0,
|
max_angle: 15.0,
|
||||||
damage_effect: None,
|
damage_effect: None,
|
||||||
|
damage_kind: DamageKind::Crushing,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1198,6 +1206,7 @@ impl From<(&CharacterAbility, AbilityInfo)> for CharacterState {
|
|||||||
max_angle,
|
max_angle,
|
||||||
damage_effect,
|
damage_effect,
|
||||||
energy_cost: _,
|
energy_cost: _,
|
||||||
|
damage_kind,
|
||||||
} => CharacterState::BasicMelee(basic_melee::Data {
|
} => CharacterState::BasicMelee(basic_melee::Data {
|
||||||
static_data: basic_melee::StaticData {
|
static_data: basic_melee::StaticData {
|
||||||
buildup_duration: Duration::from_secs_f32(*buildup_duration),
|
buildup_duration: Duration::from_secs_f32(*buildup_duration),
|
||||||
@ -1210,6 +1219,7 @@ impl From<(&CharacterAbility, AbilityInfo)> for CharacterState {
|
|||||||
max_angle: *max_angle,
|
max_angle: *max_angle,
|
||||||
damage_effect: *damage_effect,
|
damage_effect: *damage_effect,
|
||||||
ability_info,
|
ability_info,
|
||||||
|
damage_kind: *damage_kind,
|
||||||
},
|
},
|
||||||
timer: Duration::default(),
|
timer: Duration::default(),
|
||||||
stage_section: StageSection::Buildup,
|
stage_section: StageSection::Buildup,
|
||||||
@ -1270,6 +1280,7 @@ impl From<(&CharacterAbility, AbilityInfo)> for CharacterState {
|
|||||||
recover_duration,
|
recover_duration,
|
||||||
charge_through,
|
charge_through,
|
||||||
is_interruptible,
|
is_interruptible,
|
||||||
|
damage_kind,
|
||||||
} => CharacterState::DashMelee(dash_melee::Data {
|
} => CharacterState::DashMelee(dash_melee::Data {
|
||||||
static_data: dash_melee::StaticData {
|
static_data: dash_melee::StaticData {
|
||||||
base_damage: *base_damage,
|
base_damage: *base_damage,
|
||||||
@ -1289,6 +1300,7 @@ impl From<(&CharacterAbility, AbilityInfo)> for CharacterState {
|
|||||||
recover_duration: Duration::from_secs_f32(*recover_duration),
|
recover_duration: Duration::from_secs_f32(*recover_duration),
|
||||||
is_interruptible: *is_interruptible,
|
is_interruptible: *is_interruptible,
|
||||||
ability_info,
|
ability_info,
|
||||||
|
damage_kind: *damage_kind,
|
||||||
},
|
},
|
||||||
auto_charge: false,
|
auto_charge: false,
|
||||||
timer: Duration::default(),
|
timer: Duration::default(),
|
||||||
@ -1376,6 +1388,7 @@ impl From<(&CharacterAbility, AbilityInfo)> for CharacterState {
|
|||||||
max_angle,
|
max_angle,
|
||||||
forward_leap_strength,
|
forward_leap_strength,
|
||||||
vertical_leap_strength,
|
vertical_leap_strength,
|
||||||
|
damage_kind,
|
||||||
} => CharacterState::LeapMelee(leap_melee::Data {
|
} => CharacterState::LeapMelee(leap_melee::Data {
|
||||||
static_data: leap_melee::StaticData {
|
static_data: leap_melee::StaticData {
|
||||||
buildup_duration: Duration::from_secs_f32(*buildup_duration),
|
buildup_duration: Duration::from_secs_f32(*buildup_duration),
|
||||||
@ -1390,6 +1403,7 @@ impl From<(&CharacterAbility, AbilityInfo)> for CharacterState {
|
|||||||
forward_leap_strength: *forward_leap_strength,
|
forward_leap_strength: *forward_leap_strength,
|
||||||
vertical_leap_strength: *vertical_leap_strength,
|
vertical_leap_strength: *vertical_leap_strength,
|
||||||
ability_info,
|
ability_info,
|
||||||
|
damage_kind: *damage_kind,
|
||||||
},
|
},
|
||||||
timer: Duration::default(),
|
timer: Duration::default(),
|
||||||
stage_section: StageSection::Buildup,
|
stage_section: StageSection::Buildup,
|
||||||
@ -1412,6 +1426,7 @@ impl From<(&CharacterAbility, AbilityInfo)> for CharacterState {
|
|||||||
num_spins,
|
num_spins,
|
||||||
specifier,
|
specifier,
|
||||||
target,
|
target,
|
||||||
|
damage_kind,
|
||||||
} => CharacterState::SpinMelee(spin_melee::Data {
|
} => CharacterState::SpinMelee(spin_melee::Data {
|
||||||
static_data: spin_melee::StaticData {
|
static_data: spin_melee::StaticData {
|
||||||
buildup_duration: Duration::from_secs_f32(*buildup_duration),
|
buildup_duration: Duration::from_secs_f32(*buildup_duration),
|
||||||
@ -1431,6 +1446,7 @@ impl From<(&CharacterAbility, AbilityInfo)> for CharacterState {
|
|||||||
target: *target,
|
target: *target,
|
||||||
ability_info,
|
ability_info,
|
||||||
specifier: *specifier,
|
specifier: *specifier,
|
||||||
|
damage_kind: *damage_kind,
|
||||||
},
|
},
|
||||||
timer: Duration::default(),
|
timer: Duration::default(),
|
||||||
consecutive_spins: 1,
|
consecutive_spins: 1,
|
||||||
@ -1454,6 +1470,7 @@ impl From<(&CharacterAbility, AbilityInfo)> for CharacterState {
|
|||||||
range,
|
range,
|
||||||
max_angle,
|
max_angle,
|
||||||
specifier,
|
specifier,
|
||||||
|
damage_kind,
|
||||||
} => CharacterState::ChargedMelee(charged_melee::Data {
|
} => CharacterState::ChargedMelee(charged_melee::Data {
|
||||||
static_data: charged_melee::StaticData {
|
static_data: charged_melee::StaticData {
|
||||||
energy_cost: *energy_cost,
|
energy_cost: *energy_cost,
|
||||||
@ -1473,6 +1490,7 @@ impl From<(&CharacterAbility, AbilityInfo)> for CharacterState {
|
|||||||
recover_duration: Duration::from_secs_f32(*recover_duration),
|
recover_duration: Duration::from_secs_f32(*recover_duration),
|
||||||
ability_info,
|
ability_info,
|
||||||
specifier: *specifier,
|
specifier: *specifier,
|
||||||
|
damage_kind: *damage_kind,
|
||||||
},
|
},
|
||||||
stage_section: StageSection::Charge,
|
stage_section: StageSection::Charge,
|
||||||
timer: Duration::default(),
|
timer: Duration::default(),
|
||||||
@ -1495,6 +1513,7 @@ impl From<(&CharacterAbility, AbilityInfo)> for CharacterState {
|
|||||||
initial_projectile_speed,
|
initial_projectile_speed,
|
||||||
scaled_projectile_speed,
|
scaled_projectile_speed,
|
||||||
move_speed,
|
move_speed,
|
||||||
|
damage_kind,
|
||||||
} => CharacterState::ChargedRanged(charged_ranged::Data {
|
} => CharacterState::ChargedRanged(charged_ranged::Data {
|
||||||
static_data: charged_ranged::StaticData {
|
static_data: charged_ranged::StaticData {
|
||||||
buildup_duration: Duration::from_secs_f32(*buildup_duration),
|
buildup_duration: Duration::from_secs_f32(*buildup_duration),
|
||||||
@ -1512,6 +1531,7 @@ impl From<(&CharacterAbility, AbilityInfo)> for CharacterState {
|
|||||||
scaled_projectile_speed: *scaled_projectile_speed,
|
scaled_projectile_speed: *scaled_projectile_speed,
|
||||||
move_speed: *move_speed,
|
move_speed: *move_speed,
|
||||||
ability_info,
|
ability_info,
|
||||||
|
damage_kind: *damage_kind,
|
||||||
},
|
},
|
||||||
timer: Duration::default(),
|
timer: Duration::default(),
|
||||||
stage_section: StageSection::Buildup,
|
stage_section: StageSection::Buildup,
|
||||||
@ -1560,6 +1580,7 @@ impl From<(&CharacterAbility, AbilityInfo)> for CharacterState {
|
|||||||
shockwave_duration,
|
shockwave_duration,
|
||||||
requires_ground,
|
requires_ground,
|
||||||
move_efficiency,
|
move_efficiency,
|
||||||
|
damage_kind,
|
||||||
} => CharacterState::Shockwave(shockwave::Data {
|
} => CharacterState::Shockwave(shockwave::Data {
|
||||||
static_data: shockwave::StaticData {
|
static_data: shockwave::StaticData {
|
||||||
buildup_duration: Duration::from_secs_f32(*buildup_duration),
|
buildup_duration: Duration::from_secs_f32(*buildup_duration),
|
||||||
@ -1575,6 +1596,7 @@ impl From<(&CharacterAbility, AbilityInfo)> for CharacterState {
|
|||||||
requires_ground: *requires_ground,
|
requires_ground: *requires_ground,
|
||||||
move_efficiency: *move_efficiency,
|
move_efficiency: *move_efficiency,
|
||||||
ability_info,
|
ability_info,
|
||||||
|
damage_kind: *damage_kind,
|
||||||
},
|
},
|
||||||
timer: Duration::default(),
|
timer: Duration::default(),
|
||||||
stage_section: StageSection::Buildup,
|
stage_section: StageSection::Buildup,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
combat::{
|
combat::{
|
||||||
Attack, AttackDamage, AttackEffect, CombatBuff, CombatEffect, CombatRequirement, Damage,
|
Attack, AttackDamage, AttackEffect, CombatBuff, CombatEffect, CombatRequirement, Damage,
|
||||||
DamageSource, GroupTarget, Knockback, KnockbackDir,
|
DamageKind, DamageSource, GroupTarget, Knockback, KnockbackDir,
|
||||||
},
|
},
|
||||||
comp::item::Reagent,
|
comp::item::Reagent,
|
||||||
uid::Uid,
|
uid::Uid,
|
||||||
@ -85,6 +85,7 @@ impl ProjectileConstructor {
|
|||||||
let damage = AttackDamage::new(
|
let damage = AttackDamage::new(
|
||||||
Damage {
|
Damage {
|
||||||
source: DamageSource::Projectile,
|
source: DamageSource::Projectile,
|
||||||
|
kind: DamageKind::Piercing,
|
||||||
value: damage,
|
value: damage,
|
||||||
},
|
},
|
||||||
Some(GroupTarget::OutOfGroup),
|
Some(GroupTarget::OutOfGroup),
|
||||||
@ -115,6 +116,7 @@ impl ProjectileConstructor {
|
|||||||
let damage = AttackDamage::new(
|
let damage = AttackDamage::new(
|
||||||
Damage {
|
Damage {
|
||||||
source: DamageSource::Explosion,
|
source: DamageSource::Explosion,
|
||||||
|
kind: DamageKind::Energy,
|
||||||
value: damage,
|
value: damage,
|
||||||
},
|
},
|
||||||
Some(GroupTarget::OutOfGroup),
|
Some(GroupTarget::OutOfGroup),
|
||||||
@ -144,6 +146,7 @@ impl ProjectileConstructor {
|
|||||||
let damage = AttackDamage::new(
|
let damage = AttackDamage::new(
|
||||||
Damage {
|
Damage {
|
||||||
source: DamageSource::Explosion,
|
source: DamageSource::Explosion,
|
||||||
|
kind: DamageKind::Energy,
|
||||||
value: damage,
|
value: damage,
|
||||||
},
|
},
|
||||||
Some(GroupTarget::OutOfGroup),
|
Some(GroupTarget::OutOfGroup),
|
||||||
|
@ -82,9 +82,9 @@ pub mod volumes;
|
|||||||
|
|
||||||
#[cfg(not(target_arch = "wasm32"))]
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
pub use cached_spatial_grid::CachedSpatialGrid;
|
pub use cached_spatial_grid::CachedSpatialGrid;
|
||||||
pub use combat::DamageSource;
|
|
||||||
#[cfg(not(target_arch = "wasm32"))]
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
pub use combat::{Damage, GroupTarget, Knockback, KnockbackDir};
|
pub use combat::{Damage, GroupTarget, Knockback, KnockbackDir};
|
||||||
|
pub use combat::{DamageKind, DamageSource};
|
||||||
#[cfg(not(target_arch = "wasm32"))]
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
pub use comp::inventory::loadout_builder::LoadoutBuilder;
|
pub use comp::inventory::loadout_builder::LoadoutBuilder;
|
||||||
#[cfg(not(target_arch = "wasm32"))]
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
combat::{
|
combat::{
|
||||||
Attack, AttackDamage, AttackEffect, CombatEffect, CombatRequirement, Damage, DamageSource,
|
Attack, AttackDamage, AttackEffect, CombatEffect, CombatRequirement, Damage, DamageKind,
|
||||||
GroupTarget,
|
DamageSource, GroupTarget,
|
||||||
},
|
},
|
||||||
comp::{beam, Body, CharacterState, EnergyChange, EnergySource, Ori, Pos, StateUpdate},
|
comp::{beam, Body, CharacterState, EnergyChange, EnergySource, Ori, Pos, StateUpdate},
|
||||||
event::ServerEvent,
|
event::ServerEvent,
|
||||||
@ -114,6 +114,7 @@ impl CharacterBehavior for Data {
|
|||||||
let mut damage = AttackDamage::new(
|
let mut damage = AttackDamage::new(
|
||||||
Damage {
|
Damage {
|
||||||
source: DamageSource::Energy,
|
source: DamageSource::Energy,
|
||||||
|
kind: DamageKind::Energy,
|
||||||
value: self.static_data.damage,
|
value: self.static_data.damage,
|
||||||
},
|
},
|
||||||
Some(GroupTarget::OutOfGroup),
|
Some(GroupTarget::OutOfGroup),
|
||||||
|
@ -5,7 +5,7 @@ use crate::{
|
|||||||
behavior::{CharacterBehavior, JoinData},
|
behavior::{CharacterBehavior, JoinData},
|
||||||
utils::*,
|
utils::*,
|
||||||
},
|
},
|
||||||
Damage, DamageSource, GroupTarget, Knockback, KnockbackDir,
|
Damage, DamageKind, DamageSource, GroupTarget, Knockback, KnockbackDir,
|
||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
@ -33,6 +33,8 @@ pub struct StaticData {
|
|||||||
pub damage_effect: Option<CombatEffect>,
|
pub damage_effect: Option<CombatEffect>,
|
||||||
/// What key is used to press ability
|
/// What key is used to press ability
|
||||||
pub ability_info: AbilityInfo,
|
pub ability_info: AbilityInfo,
|
||||||
|
/// Which kind of damage does this attack deal
|
||||||
|
pub damage_kind: DamageKind,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)]
|
#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||||
@ -103,6 +105,7 @@ impl CharacterBehavior for Data {
|
|||||||
let mut damage = AttackDamage::new(
|
let mut damage = AttackDamage::new(
|
||||||
Damage {
|
Damage {
|
||||||
source: DamageSource::Melee,
|
source: DamageSource::Melee,
|
||||||
|
kind: self.static_data.damage_kind,
|
||||||
value: self.static_data.base_damage as f32,
|
value: self.static_data.base_damage as f32,
|
||||||
},
|
},
|
||||||
Some(GroupTarget::OutOfGroup),
|
Some(GroupTarget::OutOfGroup),
|
||||||
|
@ -7,7 +7,7 @@ use crate::{
|
|||||||
behavior::{CharacterBehavior, JoinData},
|
behavior::{CharacterBehavior, JoinData},
|
||||||
utils::{StageSection, *},
|
utils::{StageSection, *},
|
||||||
},
|
},
|
||||||
Damage, DamageSource, GroupTarget, Knockback, KnockbackDir,
|
Damage, DamageKind, DamageSource, GroupTarget, Knockback, KnockbackDir,
|
||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
@ -49,6 +49,8 @@ pub struct StaticData {
|
|||||||
pub ability_info: AbilityInfo,
|
pub ability_info: AbilityInfo,
|
||||||
/// Used to specify the melee attack to the frontend
|
/// Used to specify the melee attack to the frontend
|
||||||
pub specifier: Option<FrontendSpecifier>,
|
pub specifier: Option<FrontendSpecifier>,
|
||||||
|
/// What kind of damage the attack does
|
||||||
|
pub damage_kind: DamageKind,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||||
@ -170,6 +172,7 @@ impl CharacterBehavior for Data {
|
|||||||
let damage = AttackDamage::new(
|
let damage = AttackDamage::new(
|
||||||
Damage {
|
Damage {
|
||||||
source: DamageSource::Melee,
|
source: DamageSource::Melee,
|
||||||
|
kind: self.static_data.damage_kind,
|
||||||
value: self.static_data.initial_damage as f32
|
value: self.static_data.initial_damage as f32
|
||||||
+ self.charge_amount * self.static_data.scaled_damage as f32,
|
+ self.charge_amount * self.static_data.scaled_damage as f32,
|
||||||
},
|
},
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
combat::{
|
combat::{
|
||||||
Attack, AttackDamage, AttackEffect, CombatBuff, CombatEffect, CombatRequirement, Damage,
|
Attack, AttackDamage, AttackEffect, CombatBuff, CombatEffect, CombatRequirement, Damage,
|
||||||
DamageSource, GroupTarget, Knockback, KnockbackDir,
|
DamageKind, DamageSource, GroupTarget, Knockback, KnockbackDir,
|
||||||
},
|
},
|
||||||
comp::{
|
comp::{
|
||||||
projectile, Body, CharacterState, EnergyChange, EnergySource, LightEmitter, Projectile,
|
projectile, Body, CharacterState, EnergyChange, EnergySource, LightEmitter, Projectile,
|
||||||
@ -46,6 +46,8 @@ pub struct StaticData {
|
|||||||
pub move_speed: f32,
|
pub move_speed: f32,
|
||||||
/// What key is used to press ability
|
/// What key is used to press ability
|
||||||
pub ability_info: AbilityInfo,
|
pub ability_info: AbilityInfo,
|
||||||
|
/// What kind of damage the attack does
|
||||||
|
pub damage_kind: DamageKind,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||||
@ -107,6 +109,7 @@ impl CharacterBehavior for Data {
|
|||||||
let damage = AttackDamage::new(
|
let damage = AttackDamage::new(
|
||||||
Damage {
|
Damage {
|
||||||
source: DamageSource::Projectile,
|
source: DamageSource::Projectile,
|
||||||
|
kind: self.static_data.damage_kind,
|
||||||
value: self.static_data.initial_damage as f32
|
value: self.static_data.initial_damage as f32
|
||||||
+ charge_frac * self.static_data.scaled_damage as f32,
|
+ charge_frac * self.static_data.scaled_damage as f32,
|
||||||
},
|
},
|
||||||
|
@ -5,7 +5,7 @@ use crate::{
|
|||||||
behavior::{CharacterBehavior, JoinData},
|
behavior::{CharacterBehavior, JoinData},
|
||||||
utils::*,
|
utils::*,
|
||||||
},
|
},
|
||||||
Damage, DamageSource, GroupTarget, Knockback, KnockbackDir,
|
Damage, DamageKind, DamageSource, GroupTarget, Knockback, KnockbackDir,
|
||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
@ -37,6 +37,8 @@ pub struct Stage<T> {
|
|||||||
pub base_recover_duration: T,
|
pub base_recover_duration: T,
|
||||||
/// How much forward movement there is in the swing portion of the stage
|
/// How much forward movement there is in the swing portion of the stage
|
||||||
pub forward_movement: f32,
|
pub forward_movement: f32,
|
||||||
|
/// What kind of damage this stage of the attack does
|
||||||
|
pub damage_kind: DamageKind,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Stage<f32> {
|
impl Stage<f32> {
|
||||||
@ -54,6 +56,7 @@ impl Stage<f32> {
|
|||||||
base_swing_duration: Duration::from_secs_f32(self.base_swing_duration),
|
base_swing_duration: Duration::from_secs_f32(self.base_swing_duration),
|
||||||
base_recover_duration: Duration::from_secs_f32(self.base_recover_duration),
|
base_recover_duration: Duration::from_secs_f32(self.base_recover_duration),
|
||||||
forward_movement: self.forward_movement,
|
forward_movement: self.forward_movement,
|
||||||
|
damage_kind: self.damage_kind,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,6 +198,7 @@ impl CharacterBehavior for Data {
|
|||||||
let damage = AttackDamage::new(
|
let damage = AttackDamage::new(
|
||||||
Damage {
|
Damage {
|
||||||
source: DamageSource::Melee,
|
source: DamageSource::Melee,
|
||||||
|
kind: self.static_data.stage_data[stage_index].damage_kind,
|
||||||
value: damage as f32,
|
value: damage as f32,
|
||||||
},
|
},
|
||||||
Some(GroupTarget::OutOfGroup),
|
Some(GroupTarget::OutOfGroup),
|
||||||
|
@ -5,7 +5,7 @@ use crate::{
|
|||||||
behavior::{CharacterBehavior, JoinData},
|
behavior::{CharacterBehavior, JoinData},
|
||||||
utils::*,
|
utils::*,
|
||||||
},
|
},
|
||||||
Damage, DamageSource, GroupTarget, Knockback, KnockbackDir,
|
Damage, DamageKind, DamageSource, GroupTarget, Knockback, KnockbackDir,
|
||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
@ -47,6 +47,8 @@ pub struct StaticData {
|
|||||||
pub is_interruptible: bool,
|
pub is_interruptible: bool,
|
||||||
/// What key is used to press ability
|
/// What key is used to press ability
|
||||||
pub ability_info: AbilityInfo,
|
pub ability_info: AbilityInfo,
|
||||||
|
/// What kind of damage the attack does
|
||||||
|
pub damage_kind: DamageKind,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)]
|
#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||||
@ -141,6 +143,7 @@ impl CharacterBehavior for Data {
|
|||||||
let damage = AttackDamage::new(
|
let damage = AttackDamage::new(
|
||||||
Damage {
|
Damage {
|
||||||
source: DamageSource::Melee,
|
source: DamageSource::Melee,
|
||||||
|
kind: self.static_data.damage_kind,
|
||||||
value: self.static_data.base_damage as f32
|
value: self.static_data.base_damage as f32
|
||||||
+ charge_frac * self.static_data.scaled_damage as f32,
|
+ charge_frac * self.static_data.scaled_damage as f32,
|
||||||
},
|
},
|
||||||
@ -291,6 +294,7 @@ impl CharacterBehavior for Data {
|
|||||||
let damage = AttackDamage::new(
|
let damage = AttackDamage::new(
|
||||||
Damage {
|
Damage {
|
||||||
source: DamageSource::Melee,
|
source: DamageSource::Melee,
|
||||||
|
kind: self.static_data.damage_kind,
|
||||||
value: self.static_data.base_damage as f32
|
value: self.static_data.base_damage as f32
|
||||||
+ charge_frac * self.static_data.scaled_damage as f32,
|
+ charge_frac * self.static_data.scaled_damage as f32,
|
||||||
},
|
},
|
||||||
|
@ -5,7 +5,7 @@ use crate::{
|
|||||||
behavior::{CharacterBehavior, JoinData},
|
behavior::{CharacterBehavior, JoinData},
|
||||||
utils::{StageSection, *},
|
utils::{StageSection, *},
|
||||||
},
|
},
|
||||||
Damage, DamageSource, GroupTarget, Knockback, KnockbackDir,
|
Damage, DamageKind, DamageSource, GroupTarget, Knockback, KnockbackDir,
|
||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
@ -37,6 +37,8 @@ pub struct StaticData {
|
|||||||
pub vertical_leap_strength: f32,
|
pub vertical_leap_strength: f32,
|
||||||
/// What key is used to press ability
|
/// What key is used to press ability
|
||||||
pub ability_info: AbilityInfo,
|
pub ability_info: AbilityInfo,
|
||||||
|
/// What kind of damage the attack does
|
||||||
|
pub damage_kind: DamageKind,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)]
|
#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||||
@ -157,6 +159,7 @@ impl CharacterBehavior for Data {
|
|||||||
let damage = AttackDamage::new(
|
let damage = AttackDamage::new(
|
||||||
Damage {
|
Damage {
|
||||||
source: DamageSource::Melee,
|
source: DamageSource::Melee,
|
||||||
|
kind: self.static_data.damage_kind,
|
||||||
value: self.static_data.base_damage as f32,
|
value: self.static_data.base_damage as f32,
|
||||||
},
|
},
|
||||||
Some(GroupTarget::OutOfGroup),
|
Some(GroupTarget::OutOfGroup),
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
combat::{
|
combat::{
|
||||||
Attack, AttackDamage, AttackEffect, CombatEffect, CombatRequirement, Damage, DamageSource,
|
Attack, AttackDamage, AttackEffect, CombatEffect, CombatRequirement, Damage, DamageKind,
|
||||||
GroupTarget, Knockback,
|
DamageSource, GroupTarget, Knockback,
|
||||||
},
|
},
|
||||||
comp::{shockwave, CharacterState, StateUpdate},
|
comp::{shockwave, CharacterState, StateUpdate},
|
||||||
event::ServerEvent,
|
event::ServerEvent,
|
||||||
@ -42,6 +42,8 @@ pub struct StaticData {
|
|||||||
pub move_efficiency: f32,
|
pub move_efficiency: f32,
|
||||||
/// What key is used to press ability
|
/// What key is used to press ability
|
||||||
pub ability_info: AbilityInfo,
|
pub ability_info: AbilityInfo,
|
||||||
|
/// What kind of damage the attack does
|
||||||
|
pub damage_kind: DamageKind,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)]
|
#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||||
@ -88,6 +90,7 @@ impl CharacterBehavior for Data {
|
|||||||
let damage = AttackDamage::new(
|
let damage = AttackDamage::new(
|
||||||
Damage {
|
Damage {
|
||||||
source: DamageSource::Shockwave,
|
source: DamageSource::Shockwave,
|
||||||
|
kind: self.static_data.damage_kind,
|
||||||
value: self.static_data.damage as f32,
|
value: self.static_data.damage as f32,
|
||||||
},
|
},
|
||||||
Some(GroupTarget::OutOfGroup),
|
Some(GroupTarget::OutOfGroup),
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
combat::{
|
combat::{
|
||||||
Attack, AttackDamage, AttackEffect, CombatBuff, CombatEffect, CombatRequirement, Damage,
|
Attack, AttackDamage, AttackEffect, CombatBuff, CombatEffect, CombatRequirement, Damage,
|
||||||
DamageSource, GroupTarget, Knockback,
|
DamageKind, DamageSource, GroupTarget, Knockback,
|
||||||
},
|
},
|
||||||
comp::{tool::ToolKind, CharacterState, EnergyChange, EnergySource, Melee, StateUpdate},
|
comp::{tool::ToolKind, CharacterState, EnergyChange, EnergySource, Melee, StateUpdate},
|
||||||
consts::GRAVITY,
|
consts::GRAVITY,
|
||||||
@ -51,6 +51,8 @@ pub struct StaticData {
|
|||||||
pub ability_info: AbilityInfo,
|
pub ability_info: AbilityInfo,
|
||||||
/// Used to specify the melee attack to the frontend
|
/// Used to specify the melee attack to the frontend
|
||||||
pub specifier: Option<FrontendSpecifier>,
|
pub specifier: Option<FrontendSpecifier>,
|
||||||
|
/// What kind of damage the attack does
|
||||||
|
pub damage_kind: DamageKind,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)]
|
#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||||
@ -124,6 +126,7 @@ impl CharacterBehavior for Data {
|
|||||||
let mut damage = AttackDamage::new(
|
let mut damage = AttackDamage::new(
|
||||||
Damage {
|
Damage {
|
||||||
source: DamageSource::Melee,
|
source: DamageSource::Melee,
|
||||||
|
kind: self.static_data.damage_kind,
|
||||||
value: self.static_data.base_damage as f32,
|
value: self.static_data.base_damage as f32,
|
||||||
},
|
},
|
||||||
self.static_data.target,
|
self.static_data.target,
|
||||||
|
@ -77,8 +77,11 @@ impl<'a> System<'a> for Sys {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let damage_reduction =
|
let damage_reduction = Damage::compute_damage_reduction(
|
||||||
Damage::compute_damage_reduction(read_data.inventories.get(entity), Some(&stat));
|
read_data.inventories.get(entity),
|
||||||
|
Some(&stat),
|
||||||
|
None,
|
||||||
|
);
|
||||||
if (damage_reduction - 1.0).abs() < f32::EPSILON {
|
if (damage_reduction - 1.0).abs() < f32::EPSILON {
|
||||||
for (id, buff) in buff_comp.buffs.iter() {
|
for (id, buff) in buff_comp.buffs.iter() {
|
||||||
if !buff.kind.is_buff() {
|
if !buff.kind.is_buff() {
|
||||||
|
@ -29,7 +29,7 @@ use common::{
|
|||||||
terrain::{Block, BlockKind, SpriteKind, TerrainChunkSize},
|
terrain::{Block, BlockKind, SpriteKind, TerrainChunkSize},
|
||||||
uid::Uid,
|
uid::Uid,
|
||||||
vol::RectVolSize,
|
vol::RectVolSize,
|
||||||
Damage, DamageSource, Explosion, LoadoutBuilder, RadiusEffect,
|
Damage, DamageKind, DamageSource, Explosion, LoadoutBuilder, RadiusEffect,
|
||||||
};
|
};
|
||||||
use common_net::{
|
use common_net::{
|
||||||
msg::{DisconnectReason, Notification, PlayerListUpdate, ServerGeneral},
|
msg::{DisconnectReason, Notification, PlayerListUpdate, ServerGeneral},
|
||||||
@ -1671,6 +1671,7 @@ fn handle_explosion(
|
|||||||
effects: vec![
|
effects: vec![
|
||||||
RadiusEffect::Entity(Effect::Damage(Damage {
|
RadiusEffect::Entity(Effect::Damage(Damage {
|
||||||
source: DamageSource::Explosion,
|
source: DamageSource::Explosion,
|
||||||
|
kind: DamageKind::Energy,
|
||||||
value: 100.0 * power,
|
value: 100.0 * power,
|
||||||
})),
|
})),
|
||||||
RadiusEffect::TerrainDestruction(power),
|
RadiusEffect::TerrainDestruction(power),
|
||||||
|
@ -26,7 +26,7 @@ use common::{
|
|||||||
uid::{Uid, UidAllocator},
|
uid::{Uid, UidAllocator},
|
||||||
util::Dir,
|
util::Dir,
|
||||||
vol::ReadVol,
|
vol::ReadVol,
|
||||||
Damage, DamageSource, Explosion, GroupTarget, RadiusEffect,
|
Damage, DamageKind, DamageSource, Explosion, GroupTarget, RadiusEffect,
|
||||||
};
|
};
|
||||||
use common_net::{msg::ServerGeneral, sync::WorldSyncExt};
|
use common_net::{msg::ServerGeneral, sync::WorldSyncExt};
|
||||||
use common_state::BlockChange;
|
use common_state::BlockChange;
|
||||||
@ -491,10 +491,14 @@ pub fn handle_land_on_ground(server: &Server, entity: EcsEntity, vel: Vec3<f32>)
|
|||||||
if let Some(mut health) = state.ecs().write_storage::<comp::Health>().get_mut(entity) {
|
if let Some(mut health) = state.ecs().write_storage::<comp::Health>().get_mut(entity) {
|
||||||
let damage = Damage {
|
let damage = Damage {
|
||||||
source: DamageSource::Falling,
|
source: DamageSource::Falling,
|
||||||
|
kind: DamageKind::Crushing,
|
||||||
value: falldmg,
|
value: falldmg,
|
||||||
};
|
};
|
||||||
let damage_reduction =
|
let damage_reduction = Damage::compute_damage_reduction(
|
||||||
Damage::compute_damage_reduction(inventories.get(entity), stats.get(entity));
|
inventories.get(entity),
|
||||||
|
stats.get(entity),
|
||||||
|
Some(DamageKind::Crushing),
|
||||||
|
);
|
||||||
let change = damage.calculate_health_change(damage_reduction, None, false, 0.0, 1.0);
|
let change = damage.calculate_health_change(damage_reduction, None, false, 0.0, 1.0);
|
||||||
health.change_by(change);
|
health.change_by(change);
|
||||||
}
|
}
|
||||||
|
@ -125,6 +125,7 @@ impl StateExt for State {
|
|||||||
combat::Damage::compute_damage_reduction(
|
combat::Damage::compute_damage_reduction(
|
||||||
inventories.get(entity),
|
inventories.get(entity),
|
||||||
stats.get(entity),
|
stats.get(entity),
|
||||||
|
Some(damage.kind),
|
||||||
),
|
),
|
||||||
source,
|
source,
|
||||||
false,
|
false,
|
||||||
|
@ -3,7 +3,7 @@ use common::{
|
|||||||
effect::Effect,
|
effect::Effect,
|
||||||
event::{EventBus, ServerEvent},
|
event::{EventBus, ServerEvent},
|
||||||
resources::DeltaTime,
|
resources::DeltaTime,
|
||||||
Damage, DamageSource, Explosion, RadiusEffect,
|
Damage, DamageKind, DamageSource, Explosion, RadiusEffect,
|
||||||
};
|
};
|
||||||
use common_ecs::{Job, Origin, Phase, System};
|
use common_ecs::{Job, Origin, Phase, System};
|
||||||
use specs::{Entities, Join, Read, ReadStorage, WriteStorage};
|
use specs::{Entities, Join, Read, ReadStorage, WriteStorage};
|
||||||
@ -56,6 +56,7 @@ impl<'a> System<'a> for Sys {
|
|||||||
effects: vec![
|
effects: vec![
|
||||||
RadiusEffect::Entity(Effect::Damage(Damage {
|
RadiusEffect::Entity(Effect::Damage(Damage {
|
||||||
source: DamageSource::Explosion,
|
source: DamageSource::Explosion,
|
||||||
|
kind: DamageKind::Energy,
|
||||||
value: 400.0,
|
value: 400.0,
|
||||||
})),
|
})),
|
||||||
RadiusEffect::Entity(Effect::PoiseChange(PoiseChange {
|
RadiusEffect::Entity(Effect::PoiseChange(PoiseChange {
|
||||||
@ -150,6 +151,7 @@ impl<'a> System<'a> for Sys {
|
|||||||
effects: vec![
|
effects: vec![
|
||||||
RadiusEffect::Entity(Effect::Damage(Damage {
|
RadiusEffect::Entity(Effect::Damage(Damage {
|
||||||
source: DamageSource::Explosion,
|
source: DamageSource::Explosion,
|
||||||
|
kind: DamageKind::Energy,
|
||||||
value: 50.0,
|
value: 50.0,
|
||||||
})),
|
})),
|
||||||
RadiusEffect::Entity(Effect::PoiseChange(PoiseChange {
|
RadiusEffect::Entity(Effect::PoiseChange(PoiseChange {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use super::*;
|
use super::*;
|
||||||
use crate::audio::sfx::SfxEvent;
|
use crate::audio::sfx::SfxEvent;
|
||||||
use common::{
|
use common::{
|
||||||
|
combat::DamageKind,
|
||||||
comp::{
|
comp::{
|
||||||
inventory::loadout_builder::LoadoutBuilder, item::tool::ToolKind, CharacterAbilityType,
|
inventory::loadout_builder::LoadoutBuilder, item::tool::ToolKind, CharacterAbilityType,
|
||||||
CharacterState, InputKind, Item,
|
CharacterState, InputKind, Item,
|
||||||
@ -80,6 +81,7 @@ fn maps_basic_melee() {
|
|||||||
max_angle: 1.0,
|
max_angle: 1.0,
|
||||||
ability_info: empty_ability_info(),
|
ability_info: empty_ability_info(),
|
||||||
damage_effect: None,
|
damage_effect: None,
|
||||||
|
damage_kind: DamageKind::Slashing,
|
||||||
},
|
},
|
||||||
timer: Duration::default(),
|
timer: Duration::default(),
|
||||||
stage_section: states::utils::StageSection::Buildup,
|
stage_section: states::utils::StageSection::Buildup,
|
||||||
@ -125,6 +127,7 @@ fn matches_ability_stage() {
|
|||||||
base_swing_duration: Duration::from_millis(200),
|
base_swing_duration: Duration::from_millis(200),
|
||||||
base_recover_duration: Duration::from_millis(400),
|
base_recover_duration: Duration::from_millis(400),
|
||||||
forward_movement: 0.5,
|
forward_movement: 0.5,
|
||||||
|
damage_kind: DamageKind::Slashing,
|
||||||
}],
|
}],
|
||||||
initial_energy_gain: 0.0,
|
initial_energy_gain: 0.0,
|
||||||
max_energy_gain: 100.0,
|
max_energy_gain: 100.0,
|
||||||
@ -183,6 +186,7 @@ fn ignores_different_ability_stage() {
|
|||||||
base_swing_duration: Duration::from_millis(200),
|
base_swing_duration: Duration::from_millis(200),
|
||||||
base_recover_duration: Duration::from_millis(400),
|
base_recover_duration: Duration::from_millis(400),
|
||||||
forward_movement: 0.5,
|
forward_movement: 0.5,
|
||||||
|
damage_kind: DamageKind::Slashing,
|
||||||
}],
|
}],
|
||||||
initial_energy_gain: 0.0,
|
initial_energy_gain: 0.0,
|
||||||
max_energy_gain: 100.0,
|
max_energy_gain: 100.0,
|
||||||
|
@ -785,7 +785,8 @@ impl<'a> Widget for Bag<'a> {
|
|||||||
});
|
});
|
||||||
let protection_txt = format!(
|
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
|
as i32
|
||||||
);
|
);
|
||||||
let health_txt = format!("{}", (self.health.maximum() as f32 / 10.0) as usize);
|
let health_txt = format!("{}", (self.health.maximum() as f32 / 10.0) as usize);
|
||||||
|
Loading…
Reference in New Issue
Block a user