Melee attacks now only hit a single target by default

This commit is contained in:
Sam 2022-02-17 13:19:17 -05:00
parent af39287331
commit 7b27b63122
23 changed files with 33 additions and 0 deletions

View File

@ -13,6 +13,7 @@ LeapMelee(
),
range: 4.5,
angle: 30.0,
multi_target: true,
),
forward_leap_strength: 20.0,
vertical_leap_strength: 8.0,

View File

@ -11,6 +11,7 @@ SpinMelee(
),
range: 3.5,
angle: 360.0,
multi_target: true,
),
energy_cost: 10.0,
is_infinite: true,

View File

@ -13,6 +13,7 @@ LeapMelee(
),
range: 4.5,
angle: 180.0,
multi_target: true,
),
forward_leap_strength: 40.0,
vertical_leap_strength: 7.5,

View File

@ -12,6 +12,7 @@ BasicMelee(
),
range: 4.0,
angle: 45.0,
multi_target: true,
),
ori_modifier: 1.0,
)

View File

@ -12,6 +12,7 @@ BasicMelee(
),
range: 4.0,
angle: 60.0,
multi_target: true,
),
ori_modifier: 1.0,
)

View File

@ -10,6 +10,7 @@ SpinMelee(
),
range: 16.0,
angle: 360.0,
multi_target: true,
),
energy_cost: 0.0,
is_infinite: true,

View File

@ -21,6 +21,7 @@ DashMelee(
strength: DamageFraction(0.3),
chance: 0.25,
))),
multi_target: true,
),
energy_drain: 0,
forward_speed: 5.0,

View File

@ -16,6 +16,7 @@ ChargedMelee(
)),
range: 5.0,
angle: 45.0,
multi_target: true,
),
charge_duration: 4.5,
swing_duration: 0.1,

View File

@ -18,6 +18,7 @@ BasicMelee(
strength: Value(0.5),
chance: 1.0,
))),
multi_target: true,
),
ori_modifier: 1.0,
)

View File

@ -16,6 +16,7 @@ ChargedMelee(
)),
range: 6.0,
angle: 90.0,
multi_target: true,
),
charge_duration: 3.2,
swing_duration: 0.7,

View File

@ -13,6 +13,7 @@ LeapMelee(
),
range: 6.75,
angle: 180.0,
multi_target: true,
),
forward_leap_strength: 45.0,
vertical_leap_strength: 10.0,

View File

@ -13,6 +13,7 @@ LeapMelee(
),
range: 4.5,
angle: 180.0,
multi_target: true,
),
forward_leap_strength: 20.0,
vertical_leap_strength: 5.0,

View File

@ -11,6 +11,7 @@ SpinMelee(
),
range: 7.5,
angle: 360.0,
multi_target: true,
),
energy_cost: 0,
is_infinite: false,

View File

@ -12,6 +12,7 @@ BasicMelee(
),
range: 5.0,
angle: 60.0,
multi_target: true,
),
ori_modifier: 1.0,
)

View File

@ -15,6 +15,7 @@ DashMelee(
)),
range: 5.0,
angle: 90.0,
multi_target: true,
),
energy_drain: 0,
forward_speed: 10.0,

View File

@ -11,6 +11,7 @@ SpinMelee(
),
range: 3.5,
angle: 360.0,
multi_target: true,
),
energy_cost: 0,
is_infinite: true,

View File

@ -12,6 +12,7 @@ BasicMelee(
),
range: 4.0,
angle: 20.0,
multi_target: true,
),
ori_modifier: 1.0,
)

View File

@ -16,6 +16,7 @@ ChargedMelee(
)),
range: 3.5,
angle: 30.0,
multi_target: true,
),
charge_duration: 1.0,
swing_duration: 0.12,

View File

@ -13,6 +13,7 @@ LeapMelee(
),
range: 4.5,
angle: 360.0,
multi_target: true,
),
forward_leap_strength: 20.0,
vertical_leap_strength: 8.0,

View File

@ -660,6 +660,7 @@ impl Default for CharacterAbility {
scaled: None,
range: 3.5,
angle: 15.0,
multi_target: false,
damage_effect: None,
},
ori_modifier: 1.0,

View File

@ -20,6 +20,7 @@ pub struct Melee {
pub max_angle: f32,
pub applied: bool,
pub hit_count: u32,
pub multi_target: bool,
pub break_block: Option<(Vec3<i32>, Option<ToolKind>)>,
}
@ -45,6 +46,8 @@ pub struct MeleeConstructor {
pub scaled: Option<MeleeConstructorKind>,
pub range: f32,
pub angle: f32,
#[serde(default)]
pub multi_target: bool,
pub damage_effect: Option<CombatEffect>,
}
@ -282,6 +285,7 @@ impl MeleeConstructor {
max_angle: self.angle.to_radians(),
applied: false,
hit_count: 0,
multi_target: self.multi_target,
break_block: None,
}
}

View File

@ -287,6 +287,9 @@ impl CharacterBehavior for Data {
max_angle: self.static_data.stage_data[stage_index].angle.to_radians(),
applied: false,
hit_count: 0,
// TODO: Evaluate if we want to leave this true. State will be removed at
// some point anyways and this does preserve behavior
multi_target: true,
break_block: data
.inputs
.break_block_pos

View File

@ -112,6 +112,12 @@ impl<'a> System<'a> for Sys {
)
.join()
{
// Unless the melee attack can hit multiple targets, stop the attack if it has
// already hit 1 target
if !melee_attack.multi_target && melee_attack.hit_count > 0 {
break;
}
let look_dir = *ori.look_dir();
// 2D versions