Merge branch 'ubruntu/use-stealth-stat' into 'master'

Use stealth stat on armors

See merge request veloren/veloren!2947
This commit is contained in:
Samuel Keiffer 2021-10-24 05:31:49 +00:00
commit 5c99ca2a52
95 changed files with 141 additions and 118 deletions

View File

@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added a filter search function for crafting menu, use "input:_____" to search for recipe inputs
- Added catalan (Catalonia) language translation
- Sneaking with weapons drawn
- Stealth stat values on (some) armors
### Changed

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 3.3,
energy_reward: 0.034,
crit_power: 0.0,
stealth: 0.0,
stealth: 0.034,
),
)),
quality: High,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 3.3,
energy_reward: 0.034,
crit_power: 0.0,
stealth: 0.0,
stealth: 0.034,
),
)),
quality: High,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 19.8,
energy_reward: 0.2,
crit_power: 0.0,
stealth: 0.0,
stealth: 0.2,
),
)),
quality: High,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 6.6,
energy_reward: 0.067,
crit_power: 0.0,
stealth: 0.0,
stealth: 0.067,
),
)),
quality: High,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 6.6,
energy_reward: 0.067,
crit_power: 0.0,
stealth: 0.0,
stealth: 0.067,
),
)),
quality: High,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 13.2,
energy_reward: 0.134,
crit_power: 0.0,
stealth: 0.0,
stealth: 0.134,
),
)),
quality: High,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 13.2,
energy_reward: 0.134,
crit_power: 0.0,
stealth: 0.0,
stealth: 0.134,
),
)),
quality: High,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 0.8,
energy_reward: 0.009,
crit_power: 0.0,
stealth: 0.0,
stealth: 0.009,
),
)),
quality: Low,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 0.8,
energy_reward: 0.009,
crit_power: 0.0,
stealth: 0.0,
stealth: 0.009,
),
)),
quality: Low,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 5.0,
energy_reward: 0.051,
crit_power: 0.0,
stealth: 0.0,
stealth: 0.051,
),
)),
quality: Low,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 1.7,
energy_reward: 0.017,
crit_power: 0.0,
stealth: 0.0,
stealth: 0.017,
),
)),
quality: Low,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 1.7,
energy_reward: 0.017,
crit_power: 0.0,
stealth: 0.0,
stealth: 0.017,
),
)),
quality: Low,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 3.3,
energy_reward: 0.034,
crit_power: 0.0,
stealth: 0.0,
stealth: 0.034,
),
)),
quality: Low,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 3.3,
energy_reward: 0.034,
crit_power: 0.0,
stealth: 0.0,
stealth: 0.034,
),
)),
quality: Low,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 4.1,
energy_reward: 0.042,
crit_power: 0.0,
stealth: 0.0,
stealth: 0.042,
),
)),
quality: Epic,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 4.1,
energy_reward: 0.042,
crit_power: 0.0,
stealth: 0.0,
stealth: 0.042,
),
)),
quality: Epic,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 24.8,
energy_reward: 0.252,
crit_power: 0.0,
stealth: 0.0,
stealth: 0.252,
),
)),
quality: Epic,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 8.3,
energy_reward: 0.084,
crit_power: 0.0,
stealth: 0.0,
stealth: 0.084,
),
)),
quality: Epic,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 8.3,
energy_reward: 0.084,
crit_power: 0.0,
stealth: 0.0,
stealth: 0.084,
),
)),
quality: Epic,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 16.5,
energy_reward: 0.168,
crit_power: 0.0,
stealth: 0.0,
stealth: 0.168,
),
)),
quality: Epic,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 16.5,
energy_reward: 0.168,
crit_power: 0.0,
stealth: 0.0,
stealth: 0.168,
),
)),
quality: Epic,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 2.5,
energy_reward: 0.025,
crit_power: 0.0,
stealth: 0.0,
stealth: 0.025,
),
)),
quality: Moderate,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 2.5,
energy_reward: 0.025,
crit_power: 0.0,
stealth: 0.0,
stealth: 0.025,
),
)),
quality: Moderate,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 14.9,
energy_reward: 0.15,
crit_power: 0.0,
stealth: 0.0,
stealth: 0.15,
),
)),
quality: Moderate,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 5.0,
energy_reward: 0.05,
crit_power: 0.0,
stealth: 0.0,
stealth: 0.05,
),
)),
quality: Moderate,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 5.0,
energy_reward: 0.05,
crit_power: 0.0,
stealth: 0.0,
stealth: 0.05,
),
)),
quality: Moderate,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 9.9,
energy_reward: 0.1,
crit_power: 0.0,
stealth: 0.0,
stealth: 0.1,
),
)),
quality: Moderate,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 9.9,
energy_reward: 0.1,
crit_power: 0.0,
stealth: 0.0,
stealth: 0.1,
),
)),
quality: Moderate,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 5.0,
energy_reward: 0.05,
crit_power: 0.0,
stealth: 0.0,
stealth: 0.05,
),
)),
quality: Legendary,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 5.0,
energy_reward: 0.05,
crit_power: 0.0,
stealth: 0.0,
stealth: 0.05,
),
)),
quality: Legendary,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 30.0,
energy_reward: 0.3,
crit_power: 0.0,
stealth: 0.0,
stealth: 0.3,
),
)),
quality: Legendary,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 10.0,
energy_reward: 0.1,
crit_power: 0.0,
stealth: 0.0,
stealth: 0.1,
),
)),
quality: Legendary,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 10.0,
energy_reward: 0.1,
crit_power: 0.0,
stealth: 0.0,
stealth: 0.1,
),
)),
quality: Legendary,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 20.0,
energy_reward: 0.2,
crit_power: 0.0,
stealth: 0.0,
stealth: 0.2,
),
)),
quality: Legendary,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 20.0,
energy_reward: 0.2,
crit_power: 0.0,
stealth: 0.0,
stealth: 0.2,
),
)),
quality: Legendary,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 1.7,
energy_reward: 0.017,
crit_power: 0.0,
stealth: 0.0,
stealth: 0.017,
),
)),
quality: Common,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 1.7,
energy_reward: 0.017,
crit_power: 0.0,
stealth: 0.0,
stealth: 0.017,
),
)),
quality: Common,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 9.9,
energy_reward: 0.099,
crit_power: 0.0,
stealth: 0.0,
stealth: 0.099,
),
)),
quality: Common,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 3.3,
energy_reward: 0.033,
crit_power: 0.0,
stealth: 0.0,
stealth: 0.033,
),
)),
quality: Common,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 3.3,
energy_reward: 0.033,
crit_power: 0.0,
stealth: 0.0,
stealth: 0.033,
),
)),
quality: Common,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 6.6,
energy_reward: 0.066,
crit_power: 0.0,
stealth: 0.0,
stealth: 0.066,
),
)),
quality: Common,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 6.6,
energy_reward: 0.066,
crit_power: 0.0,
stealth: 0.0,
stealth: 0.066,
),
)),
quality: Common,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 2.0,
energy_reward: 0.025,
crit_power: 0.02,
stealth: 0.0,
stealth: 0.02,
),
)),
quality: Epic,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 13.5,
energy_reward: 0.135,
crit_power: 0.125,
stealth: 0.0,
stealth: 0.125,
),
)),
quality: Epic,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 4.5,
energy_reward: 0.045,
crit_power: 0.04,
stealth: 0.0,
stealth: 0.04,
),
)),
quality: Epic,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 4.5,
energy_reward: 0.045,
crit_power: 0.04,
stealth: 0.0,
stealth: 0.04,
),
)),
quality: Epic,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 9.0,
energy_reward: 0.1,
crit_power: 0.08,
stealth: 0.0,
stealth: 0.08,
),
)),
quality: Epic,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 9.0,
energy_reward: 0.1,
crit_power: 0.08,
stealth: 0.0,
stealth: 0.08,
),
)),
quality: Epic,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 0,
energy_reward: 0.0,
crit_power: 0.067,
stealth: 0.0,
stealth: 0.067,
),
)),
quality: High,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 0,
energy_reward: 0.0,
crit_power: 0.067,
stealth: 0.0,
stealth: 0.067,
),
)),
quality: High,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 0,
energy_reward: 0.0,
crit_power: 0.399,
stealth: 0.0,
stealth: 0.399,
),
)),
quality: High,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 0,
energy_reward: 0.0,
crit_power: 0.133,
stealth: 0.0,
stealth: 0.133,
),
)),
quality: High,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 0,
energy_reward: 0.0,
crit_power: 0.133,
stealth: 0.0,
stealth: 0.133,
),
)),
quality: High,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 0,
energy_reward: 0.0,
crit_power: 0.266,
stealth: 0.0,
stealth: 0.266,
),
)),
quality: High,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 0,
energy_reward: 0.0,
crit_power: 0.266,
stealth: 0.0,
stealth: 0.266,
),
)),
quality: High,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 0,
energy_reward: 0.0,
crit_power: 0.1,
stealth: 0.0,
stealth: 0.1,
),
)),
quality: Legendary,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 0,
energy_reward: 0.0,
crit_power: 0.1,
stealth: 0.0,
stealth: 0.1,
),
)),
quality: Legendary,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 0,
energy_reward: 0.0,
crit_power: 0.6,
stealth: 0.0,
stealth: 0.6,
),
)),
quality: Legendary,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 0,
energy_reward: 0.0,
crit_power: 0.2,
stealth: 0.0,
stealth: 0.2,
),
)),
quality: Legendary,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 0,
energy_reward: 0.0,
crit_power: 0.2,
stealth: 0.0,
stealth: 0.2,
),
)),
quality: Legendary,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 0,
energy_reward: 0.0,
crit_power: 0.4,
stealth: 0.0,
stealth: 0.4,
),
)),
quality: Legendary,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 0,
energy_reward: 0.0,
crit_power: 0.4,
stealth: 0.0,
stealth: 0.4,
),
)),
quality: Legendary,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 0,
energy_reward: 0.0,
crit_power: 0.034,
stealth: 0.0,
stealth: 0.034,
),
)),
quality: Common,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 0,
energy_reward: 0.0,
crit_power: 0.034,
stealth: 0.0,
stealth: 0.034,
),
)),
quality: Common,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 0,
energy_reward: 0.0,
crit_power: 0.201,
stealth: 0.0,
stealth: 0.034,
),
)),
quality: Common,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 0,
energy_reward: 0.0,
crit_power: 0.067,
stealth: 0.0,
stealth: 0.067,
),
)),
quality: Common,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 0,
energy_reward: 0.0,
crit_power: 0.067,
stealth: 0.0,
stealth: 0.067,
),
)),
quality: Common,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 0,
energy_reward: 0.0,
crit_power: 0.134,
stealth: 0.0,
stealth: 0.134,
),
)),
quality: Common,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 0,
energy_reward: 0.0,
crit_power: 0.134,
stealth: 0.0,
stealth: 0.134,
),
)),
quality: Common,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 0,
energy_reward: 0.0,
crit_power: 0.084,
stealth: 0.0,
stealth: 0.084,
),
)),
quality: Epic,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 0,
energy_reward: 0.0,
crit_power: 0.084,
stealth: 0.0,
stealth: 0.084,
),
)),
quality: Epic,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 0,
energy_reward: 0.0,
crit_power: 0.501,
stealth: 0.0,
stealth: 0.501,
),
)),
quality: Epic,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 0,
energy_reward: 0.0,
crit_power: 0.167,
stealth: 0.0,
stealth: 0.167,
),
)),
quality: Epic,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 0,
energy_reward: 0.0,
crit_power: 0.167,
stealth: 0.0,
stealth: 0.167,
),
)),
quality: Epic,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 0,
energy_reward: 0.0,
crit_power: 0.334,
stealth: 0.0,
stealth: 0.334,
),
)),
quality: Epic,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 0,
energy_reward: 0.0,
crit_power: 0.334,
stealth: 0.0,
stealth: 0.334,
),
)),
quality: Epic,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 0,
energy_reward: 0.0,
crit_power: 0.017,
stealth: 0.0,
stealth: 0.017,
),
)),
quality: Low,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 0,
energy_reward: 0.0,
crit_power: 0.017,
stealth: 0.0,
stealth: 0.017,
),
)),
quality: Low,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 0,
energy_reward: 0.0,
crit_power: 0.099,
stealth: 0.0,
stealth: 0.099,
),
)),
quality: Low,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 0,
energy_reward: 0.0,
crit_power: 0.033,
stealth: 0.0,
stealth: 0.033,
),
)),
quality: Low,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 0,
energy_reward: 0.0,
crit_power: 0.033,
stealth: 0.0,
stealth: 0.033,
),
)),
quality: Low,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 0,
energy_reward: 0.0,
crit_power: 0.066,
stealth: 0.0,
stealth: 0.066,
),
)),
quality: Low,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 0,
energy_reward: 0.0,
crit_power: 0.066,
stealth: 0.0,
stealth: 0.066,
),
)),
quality: Low,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 0,
energy_reward: 0.0,
crit_power: 0.05,
stealth: 0.0,
stealth: 0.05,
),
)),
quality: Moderate,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 0,
energy_reward: 0.0,
crit_power: 0.05,
stealth: 0.0,
stealth: 0.05,
),
)),
quality: Moderate,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 0,
energy_reward: 0.0,
crit_power: 0.3,
stealth: 0.0,
stealth: 0.3,
),
)),
quality: Moderate,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 0,
energy_reward: 0.0,
crit_power: 0.1,
stealth: 0.0,
stealth: 0.1,
),
)),
quality: Moderate,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 0,
energy_reward: 0.0,
crit_power: 0.1,
stealth: 0.0,
stealth: 0.1,
),
)),
quality: Moderate,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 0,
energy_reward: 0.0,
crit_power: 0.2,
stealth: 0.0,
stealth: 0.2,
),
)),
quality: Moderate,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 0,
energy_reward: 0.0,
crit_power: 0.2,
stealth: 0.0,
stealth: 0.2,
),
)),
quality: Moderate,

View File

@ -9,7 +9,7 @@ ItemDef(
energy_max: 2.0,
energy_reward: 0.025,
crit_power: 0.02,
stealth: 0.0,
stealth: 0.02,
),
)),
quality: Epic,

View File

@ -994,3 +994,22 @@ pub fn compute_max_energy_mod(inventory: Option<&Inventory>) -> f32 {
.sum()
})
}
/// Computes the sneak coefficient from armor. Agent perception distances are
/// divided by the resulting f32.
#[cfg(not(target_arch = "wasm32"))]
pub fn compute_stealth_coefficient(inventory: Option<&Inventory>) -> f32 {
// Starts with a value of 2.0 when summing the stats from each armor piece, and
// defaults to a value of 2.0 if no inventory is equipped
inventory.map_or(2.0, |inv| {
inv.equipped_items()
.filter_map(|item| {
if let ItemKind::Armor(armor) = &item.kind() {
Some(armor.stealth())
} else {
None
}
})
.fold(2.0, |a, b| a + b.max(0.0))
})
}

View File

@ -43,6 +43,8 @@ pub struct Stats {
/// Crit power is summed, and then added to the default crit multiplier of
/// 1.25. Damage is multiplied by this value when an attack crits.
crit_power: f32,
/// Stealth is summed along with the base stealth bonus (2.0), and then
/// the agent's perception distance is divided by this value
stealth: f32,
}

View File

@ -1,5 +1,6 @@
use crate::rtsim::{Entity as RtSimData, RtSim};
use common::{
combat,
comp::{
self,
agent::{
@ -168,7 +169,6 @@ const PARTIAL_PATH_DIST: f32 = 50.0;
const SEPARATION_DIST: f32 = 10.0;
const SEPARATION_BIAS: f32 = 0.8;
const MAX_FLEE_DIST: f32 = 20.0;
const SNEAK_COEFFICIENT: f32 = 0.25;
const AVG_FOLLOW_DIST: f32 = 6.0;
const RETARGETING_THRESHOLD_SECONDS: f64 = 10.0;
const HEALING_ITEM_THRESHOLD: f32 = 0.5;
@ -1529,16 +1529,16 @@ impl<'a> AgentData<'a> {
let max_search_dist = agent.psyche.search_dist();
let max_sight_dist = agent.psyche.sight_dist;
let max_listen_dist = agent.psyche.listen_dist;
let in_sight_dist = |e_pos: &Pos, e_char_state: Option<&CharacterState>| {
let search_dist = max_sight_dist
* if e_char_state.map_or(false, CharacterState::is_stealthy) {
// TODO: make sneak more effective based on a stat like e_stats.fitness
SNEAK_COEFFICIENT
} else {
1.0
};
e_pos.0.distance_squared(self.pos.0) < search_dist.powi(2)
};
let in_sight_dist =
|e_pos: &Pos, e_char_state: Option<&CharacterState>, inventory: &Inventory| {
let search_dist = max_sight_dist
/ if e_char_state.map_or(false, CharacterState::is_stealthy) {
combat::compute_stealth_coefficient(Some(inventory))
} else {
1.0
};
e_pos.0.distance_squared(self.pos.0) < search_dist.powi(2)
};
let within_fov = |e_pos: &Pos| {
(e_pos.0 - self.pos.0)
@ -1546,22 +1546,23 @@ impl<'a> AgentData<'a> {
.map_or(true, |v| v.dot(*controller.inputs.look_dir) > 0.15)
};
let in_listen_dist = |e_pos: &Pos, e_char_state: Option<&CharacterState>| {
let listen_dist = max_listen_dist
* if e_char_state.map_or(false, CharacterState::is_stealthy) {
// TODO: make sneak more effective based on a stat like e_stats.fitness
SNEAK_COEFFICIENT
} else {
1.0
};
// TODO implement proper sound system for agents
e_pos.0.distance_squared(self.pos.0) < listen_dist.powi(2)
};
let in_listen_dist =
|e_pos: &Pos, e_char_state: Option<&CharacterState>, inventory: &Inventory| {
let listen_dist = max_listen_dist
/ if e_char_state.map_or(false, CharacterState::is_stealthy) {
combat::compute_stealth_coefficient(Some(inventory))
} else {
1.0
};
// TODO implement proper sound system for agents
e_pos.0.distance_squared(self.pos.0) < listen_dist.powi(2)
};
let within_reach = |e_pos: &Pos, e_char_state: Option<&CharacterState>| {
(in_sight_dist(e_pos, e_char_state) && within_fov(e_pos))
|| in_listen_dist(e_pos, e_char_state)
};
let within_reach =
|e_pos: &Pos, e_char_state: Option<&CharacterState>, e_inventory: &Inventory| {
(in_sight_dist(e_pos, e_char_state, e_inventory) && within_fov(e_pos))
|| in_listen_dist(e_pos, e_char_state, e_inventory)
};
let owners_hostile = |e_alignment: Option<&Alignment>| {
try_owner_alignment(self.alignment, read_data).map_or(false, |owner_alignment| {
@ -1662,7 +1663,7 @@ impl<'a> AgentData<'a> {
Option<&Alignment>,
Option<&CharacterState>,
)| {
let can_target = within_reach(e_pos, e_char_state)
let can_target = within_reach(e_pos, e_char_state, e_inventory)
&& entity != *self.entity
&& !e_health.is_dead
&& !invulnerability_is_in_buffs(read_data.buffs.get(entity));