Merge branch 'zesterer/small-fixes' into 'master'

Made enemies sometimes roll

See merge request veloren/veloren!398
This commit is contained in:
Joshua Barretto
2019-08-03 12:37:42 +00:00

View File

@ -69,14 +69,10 @@ 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 < 1.5 {
// Get more distance
controller.move_dir =
Vec2::<f32>::from(target_pos.0 - pos.0).normalized() * -0.96;
} else if dist < 4.0 {
// Fight and slowly move closer
controller.move_dir =
Vec2::<f32>::from(target_pos.0 - pos.0).normalized() * 0.1;
Vec2::<f32>::from(target_pos.0 - pos.0).normalized() * 0.5;
if rand::random::<f32>() < 0.1 {
controller.attack = true;
@ -86,6 +82,10 @@ impl<'a> System<'a> for Sys {
} else if dist < SIGHT_DIST {
controller.move_dir =
Vec2::<f32>::from(target_pos.0 - pos.0).normalized() * 0.96;
if rand::random::<f32>() < 0.02 {
controller.roll = true;
}
} else {
choose_new = true;
}