mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Made enemies sometimes roll
This commit is contained in:
parent
51fa4f3cfc
commit
5e3e87f9c5
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user