Introduce hit_timing for combo_melee

bonus: speeding up first swing of sword from 0.15 to 0.1 and reducing
poise damage of hammer from 25 to 20
This commit is contained in:
juliancoffee 2021-06-11 22:00:06 +03:00
parent f578c56db7
commit 62eaabfe88
35 changed files with 104 additions and 8 deletions

View File

@ -11,6 +11,7 @@ ComboMelee(
angle: 50.0,
base_buildup_duration: 0.15,
base_swing_duration: 0.075,
hit_timing: 0.6,
base_recover_duration: 0.35,
forward_movement: 0.5,
damage_kind: Slashing,
@ -26,6 +27,7 @@ ComboMelee(
angle: 30.0,
base_buildup_duration: 0.2,
base_swing_duration: 0.1,
hit_timing: 0.6,
base_recover_duration: 0.35,
forward_movement: 0.25,
damage_kind: Slashing,

View File

@ -11,6 +11,7 @@ ComboMelee(
angle: 50.0,
base_buildup_duration: 0.6,
base_swing_duration: 0.12,
hit_timing: 0.5,
base_recover_duration: 0.6,
forward_movement: 3.5,
damage_kind: Slashing,
@ -26,6 +27,7 @@ ComboMelee(
angle: 15.0,
base_buildup_duration: 0.5,
base_swing_duration: 0.15,
hit_timing: 0.5,
base_recover_duration: 1.2,
forward_movement: 4.5,
damage_kind: Slashing,

View File

@ -11,6 +11,7 @@ ComboMelee(
angle: 60.0,
base_buildup_duration: 0.4,
base_swing_duration: 0.07,
hit_timing: 0.5,
base_recover_duration: 0.4,
forward_movement: 3.0,
damage_kind: Crushing,

View File

@ -11,6 +11,7 @@ ComboMelee(
angle: 30.0,
base_buildup_duration: 0.65,
base_swing_duration: 0.07,
hit_timing: 0.5,
base_recover_duration: 0.3,
forward_movement: 2.0,
damage_kind: Crushing,
@ -26,6 +27,7 @@ ComboMelee(
angle: 30.0,
base_buildup_duration: 0.4,
base_swing_duration: 0.07,
hit_timing: 0.5,
base_recover_duration: 0.3,
forward_movement: 1.5,
damage_kind: Crushing,
@ -41,6 +43,7 @@ ComboMelee(
angle: 30.0,
base_buildup_duration: 0.4,
base_swing_duration: 0.07,
hit_timing: 0.5,
base_recover_duration: 0.3,
forward_movement: 1.5,
damage_kind: Crushing,

View File

@ -11,6 +11,7 @@ ComboMelee(
angle: 30.0,
base_buildup_duration: 0.4,
base_swing_duration: 0.1,
hit_timing: 0.5,
base_recover_duration: 0.3,
forward_movement: 2.0,
damage_kind: Slashing,
@ -26,6 +27,7 @@ ComboMelee(
angle: 30.0,
base_buildup_duration: 0.4,
base_swing_duration: 0.1,
hit_timing: 0.5,
base_recover_duration: 0.3,
forward_movement: 1.5,
damage_kind: Slashing,
@ -41,6 +43,7 @@ ComboMelee(
angle: 30.0,
base_buildup_duration: 0.65,
base_swing_duration: 0.1,
hit_timing: 0.5,
base_recover_duration: 0.3,
forward_movement: 1.5,
damage_kind: Slashing,

View File

@ -11,6 +11,7 @@ ComboMelee(
angle: 30.0,
base_buildup_duration: 0.4,
base_swing_duration: 0.1,
hit_timing: 0.5,
base_recover_duration: 0.3,
forward_movement: 2.0,
damage_kind: Slashing,
@ -26,6 +27,7 @@ ComboMelee(
angle: 30.0,
base_buildup_duration: 0.4,
base_swing_duration: 0.1,
hit_timing: 0.5,
base_recover_duration: 0.3,
forward_movement: 1.5,
damage_kind: Slashing,
@ -41,6 +43,7 @@ ComboMelee(
angle: 30.0,
base_buildup_duration: 0.65,
base_swing_duration: 0.1,
hit_timing: 0.5,
base_recover_duration: 0.3,
forward_movement: 1.5,
damage_kind: Slashing,

View File

@ -11,6 +11,7 @@ ComboMelee(
angle: 60.0,
base_buildup_duration: 0.25,
base_swing_duration: 0.07,
hit_timing: 0.5,
base_recover_duration: 0.25,
forward_movement: 0.5,
damage_kind: Crushing,

View File

@ -11,6 +11,7 @@ ComboMelee(
angle: 30.0,
base_buildup_duration: 0.2,
base_swing_duration: 0.07,
hit_timing: 0.5,
base_recover_duration: 0.2,
forward_movement: 1.0,
damage_kind: Crushing,
@ -26,6 +27,7 @@ ComboMelee(
angle: 30.0,
base_buildup_duration: 0.22,
base_swing_duration: 0.07,
hit_timing: 0.5,
base_recover_duration: 0.2,
forward_movement: 0.0,
damage_kind: Crushing,
@ -41,6 +43,7 @@ ComboMelee(
angle: 30.0,
base_buildup_duration: 0.2,
base_swing_duration: 0.07,
hit_timing: 0.5,
base_recover_duration: 0.2,
forward_movement: 1.0,
damage_kind: Crushing,

View File

@ -11,6 +11,7 @@ ComboMelee(
angle: 60.0,
base_buildup_duration: 0.4,
base_swing_duration: 0.07,
hit_timing: 0.5,
base_recover_duration: 0.4,
forward_movement: 3.0,
damage_kind: Crushing,

View File

@ -11,6 +11,7 @@ ComboMelee(
angle: 30.0,
base_buildup_duration: 0.65,
base_swing_duration: 0.07,
hit_timing: 0.5,
base_recover_duration: 0.3,
forward_movement: 2.0,
damage_kind: Crushing,
@ -26,6 +27,7 @@ ComboMelee(
angle: 30.0,
base_buildup_duration: 0.4,
base_swing_duration: 0.07,
hit_timing: 0.5,
base_recover_duration: 0.3,
forward_movement: 1.5,
damage_kind: Crushing,
@ -41,6 +43,7 @@ ComboMelee(
angle: 30.0,
base_buildup_duration: 0.4,
base_swing_duration: 0.07,
hit_timing: 0.5,
base_recover_duration: 0.3,
forward_movement: 1.5,
damage_kind: Crushing,

View File

@ -11,6 +11,7 @@ ComboMelee(
angle: 30.0,
base_buildup_duration: 0.65,
base_swing_duration: 0.1,
hit_timing: 0.5,
base_recover_duration: 0.3,
forward_movement: 2.0,
damage_kind: Crushing,
@ -26,6 +27,7 @@ ComboMelee(
angle: 30.0,
base_buildup_duration: 0.4,
base_swing_duration: 0.1,
hit_timing: 0.5,
base_recover_duration: 0.3,
forward_movement: 1.5,
damage_kind: Crushing,
@ -41,6 +43,7 @@ ComboMelee(
angle: 30.0,
base_buildup_duration: 0.4,
base_swing_duration: 0.1,
hit_timing: 0.5,
base_recover_duration: 0.3,
forward_movement: 1.5,
damage_kind: Crushing,

View File

@ -11,6 +11,7 @@ ComboMelee(
angle: 30.0,
base_buildup_duration: 0.6,
base_swing_duration: 0.1,
hit_timing: 0.5,
base_recover_duration: 0.1,
forward_movement: 1.5,
damage_kind: Crushing,
@ -26,6 +27,7 @@ ComboMelee(
angle: 30.0,
base_buildup_duration: 0.15,
base_swing_duration: 0.07,
hit_timing: 0.5,
base_recover_duration: 0.1,
forward_movement: 0.8,
damage_kind: Crushing,
@ -41,6 +43,7 @@ ComboMelee(
angle: 30.0,
base_buildup_duration: 0.2,
base_swing_duration: 0.07,
hit_timing: 0.5,
base_recover_duration: 0.1,
forward_movement: 0.8,
damage_kind: Crushing,
@ -56,6 +59,7 @@ ComboMelee(
angle: 30.0,
base_buildup_duration: 0.2,
base_swing_duration: 0.07,
hit_timing: 0.5,
base_recover_duration: 0.1,
forward_movement: 0.8,
damage_kind: Crushing,

View File

@ -11,6 +11,7 @@ ComboMelee(
angle: 60.0,
base_buildup_duration: 0.4,
base_swing_duration: 0.1,
hit_timing: 0.5,
base_recover_duration: 0.4,
forward_movement: 3.0,
damage_kind: Crushing,

View File

@ -11,6 +11,7 @@ ComboMelee(
angle: 30.0,
base_buildup_duration: 0.65,
base_swing_duration: 0.1,
hit_timing: 0.5,
base_recover_duration: 0.2,
forward_movement: 2.0,
damage_kind: Crushing,
@ -26,6 +27,7 @@ ComboMelee(
angle: 30.0,
base_buildup_duration: 0.2,
base_swing_duration: 0.1,
hit_timing: 0.5,
base_recover_duration: 0.2,
forward_movement: 1.0,
damage_kind: Crushing,
@ -41,6 +43,7 @@ ComboMelee(
angle: 30.0,
base_buildup_duration: 0.2,
base_swing_duration: 0.1,
hit_timing: 0.5,
base_recover_duration: 0.2,
forward_movement: 1.0,
damage_kind: Crushing,

View File

@ -11,6 +11,7 @@ ComboMelee(
angle: 60.0,
base_buildup_duration: 0.4,
base_swing_duration: 0.1,
hit_timing: 0.5,
base_recover_duration: 0.4,
forward_movement: 1.0,
damage_kind: Crushing,

View File

@ -11,6 +11,7 @@ ComboMelee(
angle: 30.0,
base_buildup_duration: 0.45,
base_swing_duration: 0.07,
hit_timing: 0.5,
base_recover_duration: 0.2,
forward_movement: 1.0,
damage_kind: Crushing,
@ -26,6 +27,7 @@ ComboMelee(
angle: 30.0,
base_buildup_duration: 0.4,
base_swing_duration: 0.07,
hit_timing: 0.5,
base_recover_duration: 0.2,
forward_movement: 0.0,
damage_kind: Crushing,
@ -41,6 +43,7 @@ ComboMelee(
angle: 30.0,
base_buildup_duration: 0.4,
base_swing_duration: 0.07,
hit_timing: 0.5,
base_recover_duration: 0.2,
forward_movement: 1.0,
damage_kind: Crushing,

View File

@ -11,6 +11,7 @@ ComboMelee(
angle: 30.0,
base_buildup_duration: 0.65,
base_swing_duration: 0.1,
hit_timing: 0.5,
base_recover_duration: 0.3,
forward_movement: 1.0,
damage_kind: Crushing,
@ -26,6 +27,7 @@ ComboMelee(
angle: 30.0,
base_buildup_duration: 0.4,
base_swing_duration: 0.1,
hit_timing: 0.5,
base_recover_duration: 0.3,
forward_movement: 0.5,
damage_kind: Crushing,

View File

@ -11,6 +11,7 @@ ComboMelee(
angle: 30.0,
base_buildup_duration: 0.65,
base_swing_duration: 0.1,
hit_timing: 0.5,
base_recover_duration: 0.3,
forward_movement: 1.0,
damage_kind: Crushing,
@ -26,6 +27,7 @@ ComboMelee(
angle: 30.0,
base_buildup_duration: 0.4,
base_swing_duration: 0.1,
hit_timing: 0.5,
base_recover_duration: 0.3,
forward_movement: 1.5,
damage_kind: Crushing,

View File

@ -11,6 +11,7 @@ ComboMelee(
angle: 40.0,
base_buildup_duration: 0.6,
base_swing_duration: 0.15,
hit_timing: 0.5,
base_recover_duration: 0.4,
forward_movement: 0.3,
damage_kind: Crushing,
@ -26,6 +27,7 @@ ComboMelee(
angle: 40.0,
base_buildup_duration: 0.4,
base_swing_duration: 0.15,
hit_timing: 0.5,
base_recover_duration: 0.3,
forward_movement: 0.5,
damage_kind: Crushing,
@ -41,6 +43,7 @@ ComboMelee(
angle: 40.0,
base_buildup_duration: 0.4,
base_swing_duration: 0.15,
hit_timing: 0.5,
base_recover_duration: 0.3,
forward_movement: 0.5,
damage_kind: Crushing,

View File

@ -11,6 +11,7 @@ ComboMelee(
angle: 50.0,
base_buildup_duration: 0.3,
base_swing_duration: 0.15,
hit_timing: 0.5,
base_recover_duration: 0.3,
forward_movement: 1.0,
damage_kind: Crushing,

View File

@ -11,6 +11,7 @@ ComboMelee(
angle: 60.0,
base_buildup_duration: 0.9,
base_swing_duration: 0.1,
hit_timing: 0.5,
base_recover_duration: 0.9,
forward_movement: 3.0,
damage_kind: Crushing,

View File

@ -11,6 +11,7 @@ ComboMelee(
angle: 60.0,
base_buildup_duration: 0.5,
base_swing_duration: 0.15,
hit_timing: 0.5,
base_recover_duration: 0.4,
forward_movement: 3.0,
damage_kind: Crushing,

View File

@ -11,6 +11,7 @@ ComboMelee(
angle: 30.0,
base_buildup_duration: 0.9,
base_swing_duration: 0.15,
hit_timing: 0.5,
base_recover_duration: 0.3,
forward_movement: 1.0,
damage_kind: Crushing,
@ -26,6 +27,7 @@ ComboMelee(
angle: 30.0,
base_buildup_duration: 0.5,
base_swing_duration: 0.15,
hit_timing: 0.5,
base_recover_duration: 0.15,
forward_movement: 1.0,
damage_kind: Crushing,
@ -41,6 +43,7 @@ ComboMelee(
angle: 30.0,
base_buildup_duration: 0.35,
base_swing_duration: 0.125,
hit_timing: 0.5,
base_recover_duration: 0.9,
forward_movement: 1.0,
damage_kind: Crushing,

View File

@ -11,6 +11,7 @@ ComboMelee(
angle: 15.0,
base_buildup_duration: 0.4,
base_swing_duration: 0.15,
hit_timing: 0.5,
base_recover_duration: 0.4,
forward_movement: 3.0,
damage_kind: Crushing,

View File

@ -11,6 +11,7 @@ ComboMelee(
angle: 15.0,
base_buildup_duration: 0.65,
base_swing_duration: 0.15,
hit_timing: 0.5,
base_recover_duration: 0.3,
forward_movement: 1.0,
damage_kind: Crushing,
@ -26,6 +27,7 @@ ComboMelee(
angle: 15.0,
base_buildup_duration: 0.4,
base_swing_duration: 0.15,
hit_timing: 0.5,
base_recover_duration: 0.15,
forward_movement: 1.0,
damage_kind: Crushing,
@ -41,6 +43,7 @@ ComboMelee(
angle: 15.0,
base_buildup_duration: 0.35,
base_swing_duration: 0.125,
hit_timing: 0.5,
base_recover_duration: 0.9,
forward_movement: 1.0,
damage_kind: Crushing,

View File

@ -11,6 +11,7 @@ ComboMelee(
angle: 30.0,
base_buildup_duration: 0.6,
base_swing_duration: 0.2,
hit_timing: 0.5,
base_recover_duration: 0.4,
forward_movement: 5.0,
damage_kind: Crushing,

View File

@ -3,13 +3,14 @@ ComboMelee(
stage: 1,
base_damage: 150,
damage_increase: 10,
base_poise_damage: 25,
base_poise_damage: 20,
poise_damage_increase: 0,
knockback: 5.0,
range: 4.5,
angle: 50.0,
base_buildup_duration: 0.2,
base_swing_duration: 0.1,
hit_timing: 0.5,
base_recover_duration: 0.45,
forward_movement: 0.0,
damage_kind: Crushing,

View File

@ -11,6 +11,7 @@ ComboMelee(
angle: 50.0,
base_buildup_duration: 0.6,
base_swing_duration: 0.08,
hit_timing: 0.5,
base_recover_duration: 0.6,
forward_movement: 3.5,
damage_kind: Crushing,
@ -26,6 +27,7 @@ ComboMelee(
angle: 30.0,
base_buildup_duration: 0.5,
base_swing_duration: 0.25,
hit_timing: 0.5,
base_recover_duration: 1.2,
forward_movement: 2.0,
damage_kind: Crushing,

View File

@ -11,6 +11,7 @@ ComboMelee(
angle: 15.0,
base_buildup_duration: 0.35,
base_swing_duration: 0.075,
hit_timing: 0.5,
base_recover_duration: 0.4,
forward_movement: 0.7,
damage_kind: Piercing,
@ -26,6 +27,7 @@ ComboMelee(
angle: 15.0,
base_buildup_duration: 0.5,
base_swing_duration: 0.1,
hit_timing: 0.5,
base_recover_duration: 0.5,
forward_movement: 0.7,
damage_kind: Piercing,

View File

@ -9,8 +9,9 @@ ComboMelee(
knockback: 1.0,
range: 4.0,
angle: 30.0,
base_buildup_duration: 0.15,
base_buildup_duration: 0.1,
base_swing_duration: 0.075,
hit_timing: 0.5,
base_recover_duration: 0.15,
forward_movement: 0.5,
damage_kind: Slashing,
@ -26,6 +27,7 @@ ComboMelee(
angle: 40.0,
base_buildup_duration: 0.1,
base_swing_duration: 0.1,
hit_timing: 0.5,
base_recover_duration: 0.3,
forward_movement: 0.0,
damage_kind: Slashing,
@ -41,6 +43,7 @@ ComboMelee(
angle: 10.0,
base_buildup_duration: 0.15,
base_swing_duration: 0.1,
hit_timing: 0.2,
base_recover_duration: 0.35,
forward_movement: 1.2,
damage_kind: Piercing,

View File

@ -11,6 +11,7 @@ ComboMelee(
angle: 50.0,
base_buildup_duration: 0.4,
base_swing_duration: 0.08,
hit_timing: 0.5,
base_recover_duration: 0.5,
forward_movement: 2.5,
damage_kind: Slashing,
@ -26,6 +27,7 @@ ComboMelee(
angle: 30.0,
base_buildup_duration: 0.7,
base_swing_duration: 0.1,
hit_timing: 0.5,
base_recover_duration: 0.7,
forward_movement: 2.0,
damage_kind: Slashing,

View File

@ -1383,6 +1383,7 @@ impl From<(&CharacterAbility, AbilityInfo)> for CharacterState {
ori_modifier: *ori_modifier as f32,
ability_info,
},
exhausted: false,
stage: 1,
timer: Duration::default(),
stage_section: StageSection::Buildup,

View File

@ -62,7 +62,7 @@ pub struct Data {
pub stage_section: StageSection,
/// Timer for each stage
pub timer: Duration,
/// Whether the attack fired already
/// Whether the attack executed already
pub exhausted: bool,
/// How much the attack charged by
pub charge_amount: f32,

View File

@ -33,6 +33,8 @@ pub struct Stage<T> {
/// Duration of stage spent in swing (controls animation stuff, and can also
/// be used to handle movement separately to buildup)
pub base_swing_duration: T,
/// At what fraction of the swing duration to apply the melee "hit"
pub hit_timing: f32,
/// Initial recover duration of stage (how long until character exits state)
pub base_recover_duration: T,
/// How much forward movement there is in the swing portion of the stage
@ -53,6 +55,7 @@ impl Stage<f32> {
range: self.range,
angle: self.angle,
base_buildup_duration: Duration::from_secs_f32(self.base_buildup_duration),
hit_timing: self.hit_timing,
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,
@ -112,6 +115,8 @@ pub struct Data {
/// Struct containing data that does not change over the course of the
/// character state
pub static_data: StaticData,
/// Whether the attack was executed already
pub exhausted: bool,
/// Indicates what stage the combo is in
pub stage: u32,
/// Timer for each stage
@ -155,8 +160,24 @@ impl CharacterBehavior for Data {
stage_section: StageSection::Swing,
..*self
});
}
},
StageSection::Swing => {
if self.timer.as_secs_f32()
> self.static_data.stage_data[stage_index].hit_timing
* self.static_data.stage_data[stage_index]
.base_swing_duration
.as_secs_f32()
&& !self.exhausted
{
// Swing
update.character = CharacterState::ComboMelee(Data {
static_data: self.static_data.clone(),
timer: tick_attack_or_default(data, self.timer, None),
exhausted: true,
..*self
});
// Hit attempt
let damage = self.static_data.stage_data[stage_index].base_damage
+ (self
.static_data
@ -177,6 +198,7 @@ impl CharacterBehavior for Data {
CombatEffect::Poise(poise),
)
.with_requirement(CombatRequirement::AnyDamage);
let knockback = AttackEffect::new(
Some(GroupTarget::OutOfGroup),
CombatEffect::Knockback(Knockback {
@ -185,13 +207,17 @@ impl CharacterBehavior for Data {
}),
)
.with_requirement(CombatRequirement::AnyDamage);
let energy = self.static_data.max_energy_gain.min(
self.static_data.initial_energy_gain
+ data.combo.counter() as f32 * self.static_data.energy_increase,
);
let energy = AttackEffect::new(None, CombatEffect::EnergyReward(energy))
.with_requirement(CombatRequirement::AnyDamage);
let buff = CombatEffect::Buff(CombatBuff::default_physical());
let damage = AttackDamage::new(
Damage {
source: DamageSource::Melee,
@ -201,8 +227,10 @@ impl CharacterBehavior for Data {
Some(GroupTarget::OutOfGroup),
)
.with_effect(buff);
let (crit_chance, crit_mult) =
get_crit_data(data, self.static_data.ability_info);
let attack = Attack::default()
.with_damage(damage)
.with_crit(crit_chance, crit_mult)
@ -228,10 +256,8 @@ impl CharacterBehavior for Data {
})
.filter(|(_, tool)| tool == &Some(ToolKind::Pick)),
});
}
},
StageSection::Swing => {
if self.timer < self.static_data.stage_data[stage_index].base_swing_duration {
} else if self.timer < self.static_data.stage_data[stage_index].base_swing_duration
{
handle_orientation(data, &mut update, 0.4 * self.static_data.ori_modifier);
// Forward movement

View File

@ -128,6 +128,7 @@ fn matches_ability_stage() {
angle: 30.0,
base_buildup_duration: Duration::from_millis(500),
base_swing_duration: Duration::from_millis(200),
hit_timing: 0.5,
base_recover_duration: Duration::from_millis(400),
forward_movement: 0.5,
damage_kind: DamageKind::Slashing,
@ -142,6 +143,7 @@ fn matches_ability_stage() {
ori_modifier: 1.0,
ability_info: empty_ability_info(),
},
exhausted: false,
stage: 1,
timer: Duration::default(),
stage_section: states::utils::StageSection::Swing,
@ -187,6 +189,7 @@ fn ignores_different_ability_stage() {
angle: 30.0,
base_buildup_duration: Duration::from_millis(500),
base_swing_duration: Duration::from_millis(200),
hit_timing: 0.5,
base_recover_duration: Duration::from_millis(400),
forward_movement: 0.5,
damage_kind: DamageKind::Slashing,
@ -201,6 +204,7 @@ fn ignores_different_ability_stage() {
ori_modifier: 1.0,
ability_info: empty_ability_info(),
},
exhausted: false,
stage: 1,
timer: Duration::default(),
stage_section: states::utils::StageSection::Swing,