Merge pull request #2203 from kacpherek/fix/illagers-spare-baby-villagers
🤖 Agent: Gate check by Ludovic's AI agent (Claude). Checked against 26.3: the illagers' target goals skip baby villagers. One difference is left for later, older than this PR: the illagers' shared hurt-by list still includes Vex. Gate: this wave's 55 PRs merged on main in one tree: clippy `-D warnings` clean, 1186 horizon-client and 163 horizon-world tests pass, and of the 101 harnesses `parity.py --changed-files` picked, 100 pass (`block_removal` failed on one spawner case from #2199's orb merging, fixed there). `lan_e2e.py` passes 24 checks with the host on its server thread and in-frame (chest, xp, pvp, doors, villagers, beds, frames, projectiles, arrows, fishing, damage, mobs, blast, drops, elytra, breath, predict, cracks, barter, kills, hurt, contacts, underwater, plates), plus forced-levels on the server thread. Thanks @kacpherek!
This commit is contained in:
@@ -1292,9 +1292,25 @@ impl NearestTarget {
|
||||
self
|
||||
}
|
||||
}
|
||||
/// `AbstractIllager.canAttack`: a baby `AbstractVillager` is never attacked.
|
||||
fn illager_spares(attacker: Species, target: &Seen) -> bool {
|
||||
matches!(
|
||||
attacker,
|
||||
Species::Pillager | Species::Vindicator | Species::Evoker | Species::Illusioner
|
||||
) && target.baby
|
||||
&& matches!(target.species, Species::Villager | Species::WanderingTrader)
|
||||
}
|
||||
/// TargetGoal.canContinueToUse
|
||||
pub fn target_continue(st: &mut TargetState, must_see: bool, m: &mut Mob, cx: &mut Cx) -> bool {
|
||||
let Some(who) = m.ai.target else { return false };
|
||||
if let Who::Mob(id) = who
|
||||
&& cx
|
||||
.w
|
||||
.seen(id)
|
||||
.is_some_and(|s| illager_spares(m.species(), s))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
let Some(t) = cx.w.target_info(who) else {
|
||||
return false;
|
||||
};
|
||||
@@ -1353,10 +1369,12 @@ impl Goal for NearestTarget {
|
||||
prey => {
|
||||
let pos = Vec3::new(m.position.x, m.eye_y(), m.position.z);
|
||||
let id = m.id;
|
||||
let attacker = m.species();
|
||||
let candidates: Vec<(u32, Vec3)> =
|
||||
cx.w.nearby(pos, range, move |s| {
|
||||
s.id != id
|
||||
&& !s.playing_dead
|
||||
&& !illager_spares(attacker, s)
|
||||
&& match prey {
|
||||
Prey::Species(list) => list.contains(&s.species),
|
||||
Prey::Filter(f) => f(s),
|
||||
|
||||
Reference in New Issue
Block a user