Bee stings only poison on Normal and Hard

This commit is contained in:
Kacpherek
2026-10-26 15:08:48 +01:00
parent 8027cb4176
commit d136dda092
2 changed files with 17 additions and 6 deletions
+13 -6
View File
@@ -323,12 +323,19 @@ pub fn sting(m: &mut Mob, who: Who, cx: &mut Cx) {
match who {
Who::Player => {
cx.events.push(MobEvent::AttackPlayer(amount, from));
let seconds = if cx.w.difficulty.hard { 18 } else { 10 };
cx.events.push(MobEvent::EffectPlayer {
effect: "minecraft:poison",
ticks: seconds * 20,
amplifier: 0,
});
// Poison only on normal (10 s) and hard (18 s).
let seconds = match cx.w.difficulty.base {
2 => 10,
3 => 18,
_ => 0,
};
if seconds > 0 {
cx.events.push(MobEvent::EffectPlayer {
effect: "minecraft:poison",
ticks: seconds * 20,
amplifier: 0,
});
}
}
Who::Mob(id) => cx.events.push(MobEvent::AttackMob {
target: id,
@@ -37,6 +37,8 @@ pub struct LocalDifficulty {
pub effective: f32,
/// The world difficulty is hard.
pub hard: bool,
/// The world difficulty id, 0 peaceful to 3 hard.
pub base: u8,
}
/// `DimensionType.MOON_BRIGHTNESS_PER_PHASE`.
pub const MOON_BRIGHTNESS: [f32; 8] = [1.0, 0.75, 0.5, 0.25, 0.0, 0.25, 0.5, 0.75];
@@ -49,6 +51,7 @@ impl LocalDifficulty {
return Self {
effective: 0.0,
hard,
base,
};
}
let global = ((total as f32 - 72000.0) / 1_440_000.0).clamp(0.0, 1.0) * 0.25;
@@ -61,6 +64,7 @@ impl LocalDifficulty {
Self {
effective: f32::from(base) * (0.75 + global + local),
hard,
base,
}
}
/// `getSpecialMultiplier`.