Merge branch 'sam/fix-dash' into 'master'

Dash now ticks damage based off distance rather than duration.

See merge request veloren/veloren!1715
This commit is contained in:
Samuel Keiffer 2021-01-23 04:42:56 +00:00
commit 97f0413307
3 changed files with 8 additions and 10 deletions

View File

@ -1162,7 +1162,7 @@ impl From<(&CharacterAbility, AbilityKey)> for CharacterState {
},
auto_charge: false,
timer: Duration::default(),
refresh_timer: Duration::default(),
refresh_distance: 0.0,
stage_section: StageSection::Buildup,
exhausted: false,
}),

View File

@ -54,8 +54,8 @@ pub struct Data {
pub auto_charge: bool,
/// Timer for each stage
pub timer: Duration,
/// Timer used to limit how often another attack will be applied
pub refresh_timer: Duration,
/// Distance used to limit how often another attack will be applied
pub refresh_distance: f32,
/// What section the character stage is in
pub stage_section: StageSection,
/// Whether the state should attempt attacking again
@ -149,16 +149,14 @@ impl CharacterBehavior for Data {
exhausted: true,
..*self
})
} else if self.refresh_timer < Duration::from_millis(50) {
} else if self.refresh_distance < self.static_data.range * 0.5 {
update.character = CharacterState::DashMelee(Data {
timer: self
.timer
.checked_add(Duration::from_secs_f32(data.dt.0))
.unwrap_or_default(),
refresh_timer: self
.refresh_timer
.checked_add(Duration::from_secs_f32(data.dt.0))
.unwrap_or_default(),
refresh_distance: self.refresh_distance
+ data.dt.0 * data.vel.0.magnitude(),
..*self
})
} else {
@ -167,7 +165,7 @@ impl CharacterBehavior for Data {
.timer
.checked_add(Duration::from_secs_f32(data.dt.0))
.unwrap_or_default(),
refresh_timer: Duration::default(),
refresh_distance: 0.0,
exhausted: false,
..*self
})

View File

@ -890,7 +890,7 @@ impl<'a> System<'a> for Sys {
}
},
Tactic::StoneGolemBoss => {
if dist_sqrd < (MIN_ATTACK_DIST * scale).powi(2) {
if dist_sqrd < (MIN_ATTACK_DIST * scale * 2.0).powi(2) { // 2.0 is temporary correction factor to allow them to melee with their large hitbox
inputs.move_dir = Vec2::zero();
inputs.primary.set_state(true);
} else if dist_sqrd < MAX_CHASE_DIST.powi(2)