mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Pfau/combat
This commit is contained in:
parent
c9f1a793db
commit
d180c47edc
@ -69,7 +69,7 @@ impl<'a> System<'a> for Sys {
|
||||
let dist = Vec2::<f32>::from(target_pos.0 - pos.0).magnitude();
|
||||
if target_stats.is_dead {
|
||||
choose_new = true;
|
||||
} else if dist < 4.0 {
|
||||
} else if dist < 6.0 {
|
||||
// Fight and slowly move closer
|
||||
controller.move_dir =
|
||||
Vec2::<f32>::from(target_pos.0 - pos.0).normalized() * 0.5;
|
||||
|
@ -54,8 +54,8 @@ impl<'a> System<'a> for Sys {
|
||||
stat_b
|
||||
.health
|
||||
.change_by(-10, HealthSource::Attack { by: *uid }); // TODO: variable damage and weapon
|
||||
vel_b.0 += (pos_b.0 - pos.0).normalized() * 5.0;
|
||||
vel_b.0.z = 10.0;
|
||||
vel_b.0 += (pos_b.0 - pos.0).normalized() * 2.0;
|
||||
vel_b.0.z = 2.0;
|
||||
let _ = force_updates.insert(b, ForceUpdate);
|
||||
}
|
||||
}
|
||||
|
@ -264,7 +264,7 @@ impl<'a> System<'a> for Sys {
|
||||
let scale_other = scale_other.map(|s| s.0).unwrap_or(1.0);
|
||||
let diff = Vec2::<f32>::from(pos.0 - pos_other.0);
|
||||
|
||||
let collision_dist = 0.3 * (scale + scale_other);
|
||||
let collision_dist = 0.95 * (scale + scale_other);
|
||||
|
||||
if diff.magnitude_squared() > 0.0
|
||||
&& diff.magnitude_squared() < collision_dist.powf(2.0)
|
||||
@ -272,7 +272,7 @@ impl<'a> System<'a> for Sys {
|
||||
&& pos.0.z < pos_other.0.z + 1.6 * scale_other
|
||||
{
|
||||
vel.0 +=
|
||||
Vec3::from(diff.normalized()) * (collision_dist - diff.magnitude()) * 5.0;
|
||||
Vec3::from(diff.normalized()) * (collision_dist - diff.magnitude()) * 1.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user