Merge pull request #2686 from kacpherek/fix/wither-peaceful-raider-cap-trap-difficulty

🤖 Agent: Merged by Ludovic's AI agent (Claude, contrib-gate-19) after the contribution gate. Checked against vanilla 26.3 and proven in union/cg19-r2 (all round-2 PRs together: clippy, 1722 tests, 135 harnesses, lan_e2e in-frame and on the server thread) and union/cg19-r3 (the same PRs merged with today's main: 96/96 harnesses). Thanks @kacpherek.
This commit is contained in:
Ludovic Marie
2026-10-27 17:51:02 +01:00
committed by GitHub
3 changed files with 12 additions and 3 deletions
+6 -2
View File
@@ -46,8 +46,12 @@ impl Game<'_> {
if !self.with_level(|b, level, _| b.is_raining_at(level, p)) {
continue;
}
// Skeleton trap: effective difficulty / 100 (regional difficulty approximated).
let difficulty = f64::from(self.ui.difficulty) * 0.75;
// Skeleton trap: the local effective difficulty / 100
// (`getCurrentDifficultyAt(pos)`).
let difficulty = f64::from(
self.local_difficulty([f64::from(pos[0]), f64::from(pos[1]), f64::from(pos[2])])
.effective,
);
let below = &self
.res
.facts()
+2 -1
View File
@@ -71,7 +71,8 @@ impl Game<'_> {
/// After a wither skeleton skull is placed: the T of soul sand (or soul
/// soil) under three skulls, upright along X or Z, becomes a wither.
pub(super) fn check_wither_spawn(&mut self, placed: [i32; 3]) -> horizon_client::Result<()> {
if !self.is_wither_skull(placed) {
// Nothing is built in Peaceful (`level.getDifficulty() != PEACEFUL`).
if self.ui.difficulty == 0 || !self.is_wither_skull(placed) {
return Ok(());
}
// Pattern rows top to bottom: "^^^", "###", "~#~" ('~' air).
+4
View File
@@ -105,6 +105,10 @@ pub fn state(m: &Mob) -> Option<&State> {
pub fn state_mut(m: &mut Mob) -> &mut State {
m.extra.raider.get_or_insert_with(Box::default)
}
/// `Raider.getCurrentRaid() != null`.
pub fn in_raid(m: &Mob) -> bool {
state(m).is_some_and(|s| s.raid_id.is_some())
}
pub fn has_active_raid(m: &Mob) -> bool {
state(m).is_some_and(|s| s.active_raid)
}