Shifted hit attempt to before swing duration, instead of after.

This commit is contained in:
Sam 2020-09-11 13:29:42 -05:00
parent b79235b890
commit e54483d789
2 changed files with 14 additions and 16 deletions

View File

@ -83,7 +83,6 @@ pub enum CharacterAbility {
buildup_duration: Duration,
charge_duration: Duration,
infinite_charge: bool,
swing_duration: Duration,
recover_duration: Duration,
},
BasicBlock,
@ -331,7 +330,6 @@ impl From<&CharacterAbility> for CharacterState {
buildup_duration,
charge_duration,
infinite_charge,
swing_duration,
recover_duration,
} => CharacterState::DashMelee(dash_melee::Data {
static_data: dash_melee::StaticData {

View File

@ -105,6 +105,20 @@ impl CharacterBehavior for Data {
stage_section: StageSection::Swing,
next_stage: self.next_stage,
});
// Hit attempt
data.updater.insert(data.entity, Attacking {
base_healthchange: -((self.stage_data[stage_index].max_damage.min(
self.stage_data[stage_index].base_damage
+ self.combo / self.num_stages
* self.stage_data[stage_index].damage_increase,
)) as i32),
range: self.stage_data[stage_index].range,
max_angle: self.stage_data[stage_index].angle.to_radians(),
applied: false,
hit_count: 0,
knockback: self.stage_data[stage_index].knockback,
});
} else if self.stage_section == StageSection::Swing
&& self.timer < self.stage_data[stage_index].base_swing_duration
{
@ -134,20 +148,6 @@ impl CharacterBehavior for Data {
next_stage: self.next_stage,
});
} else if self.stage_section == StageSection::Swing {
// Hit attempt
data.updater.insert(data.entity, Attacking {
base_healthchange: -((self.stage_data[stage_index].max_damage.min(
self.stage_data[stage_index].base_damage
+ self.combo / self.num_stages
* self.stage_data[stage_index].damage_increase,
)) as i32),
range: self.stage_data[stage_index].range,
max_angle: self.stage_data[stage_index].angle.to_radians(),
applied: false,
hit_count: 0,
knockback: self.stage_data[stage_index].knockback,
});
// Transitions to recover section of stage
update.character = CharacterState::ComboMelee(Data {
stage: self.stage,