mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Remove redundant if-statement
This commit is contained in:
parent
4aab1eea43
commit
1cb7a083e7
@ -43,8 +43,7 @@ impl<'a> AgentData<'a> {
|
||||
Path::Full,
|
||||
None,
|
||||
);
|
||||
if attack_data.dist_sqrd < MAX_PATH_DIST.powi(2)
|
||||
&& self.body.map(|b| b.is_humanoid()).unwrap_or(false)
|
||||
if self.body.map(|b| b.is_humanoid()).unwrap_or(false)
|
||||
&& attack_data.dist_sqrd < 16.0f32.powi(2)
|
||||
&& rng.gen::<f32>() < 0.02
|
||||
{
|
||||
@ -250,25 +249,24 @@ impl<'a> AgentData<'a> {
|
||||
Path::Separate,
|
||||
None,
|
||||
);
|
||||
if attack_data.dist_sqrd < MAX_PATH_DIST.powi(2) {
|
||||
if attack_data.dist_sqrd < 32.0f32.powi(2)
|
||||
&& has_leap()
|
||||
&& has_energy(50.0)
|
||||
&& can_see_tgt(
|
||||
&read_data.terrain,
|
||||
self.pos,
|
||||
tgt_data.pos,
|
||||
attack_data.dist_sqrd,
|
||||
)
|
||||
{
|
||||
use_leap(controller);
|
||||
}
|
||||
if self.body.map(|b| b.is_humanoid()).unwrap_or(false)
|
||||
&& attack_data.dist_sqrd < 16.0f32.powi(2)
|
||||
&& rng.gen::<f32>() < 0.02
|
||||
{
|
||||
controller.push_basic_input(InputKind::Roll);
|
||||
}
|
||||
|
||||
if attack_data.dist_sqrd < 32.0f32.powi(2)
|
||||
&& has_leap()
|
||||
&& has_energy(50.0)
|
||||
&& can_see_tgt(
|
||||
&read_data.terrain,
|
||||
self.pos,
|
||||
tgt_data.pos,
|
||||
attack_data.dist_sqrd,
|
||||
)
|
||||
{
|
||||
use_leap(controller);
|
||||
}
|
||||
if self.body.map(|b| b.is_humanoid()).unwrap_or(false)
|
||||
&& attack_data.dist_sqrd < 16.0f32.powi(2)
|
||||
&& rng.gen::<f32>() < 0.02
|
||||
{
|
||||
controller.push_basic_input(InputKind::Roll);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -318,25 +316,23 @@ impl<'a> AgentData<'a> {
|
||||
None,
|
||||
);
|
||||
|
||||
if attack_data.dist_sqrd < MAX_PATH_DIST.powi(2) {
|
||||
if attack_data.dist_sqrd < 32.0f32.powi(2)
|
||||
&& has_leap()
|
||||
&& has_energy(50.0)
|
||||
&& can_see_tgt(
|
||||
&read_data.terrain,
|
||||
self.pos,
|
||||
tgt_data.pos,
|
||||
attack_data.dist_sqrd,
|
||||
)
|
||||
{
|
||||
use_leap(controller);
|
||||
}
|
||||
if self.body.map(|b| b.is_humanoid()).unwrap_or(false)
|
||||
&& attack_data.dist_sqrd < 16.0f32.powi(2)
|
||||
&& rng.gen::<f32>() < 0.02
|
||||
{
|
||||
controller.push_basic_input(InputKind::Roll);
|
||||
}
|
||||
if attack_data.dist_sqrd < 32.0f32.powi(2)
|
||||
&& has_leap()
|
||||
&& has_energy(50.0)
|
||||
&& can_see_tgt(
|
||||
&read_data.terrain,
|
||||
self.pos,
|
||||
tgt_data.pos,
|
||||
attack_data.dist_sqrd,
|
||||
)
|
||||
{
|
||||
use_leap(controller);
|
||||
}
|
||||
if self.body.map(|b| b.is_humanoid()).unwrap_or(false)
|
||||
&& attack_data.dist_sqrd < 16.0f32.powi(2)
|
||||
&& rng.gen::<f32>() < 0.02
|
||||
{
|
||||
controller.push_basic_input(InputKind::Roll);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user