From e69cd6a265427afe1f62c0a288b1bbcc01f89758 Mon Sep 17 00:00:00 2001 From: 17146 <1714673995@qq.com> Date: Fri, 30 May 2025 17:51:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=9D=B4=E8=9D=B6=E9=9B=B7?= =?UTF-8?q?=E7=9A=84=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../superbwarfare/entity/Blu43Entity.java | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/Blu43Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/Blu43Entity.java index 749ed9bd3..552855600 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/Blu43Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/Blu43Entity.java @@ -22,6 +22,7 @@ import net.minecraft.world.entity.*; import net.minecraft.world.entity.decoration.HangingEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.projectile.ThrownPotion; +import net.minecraft.world.item.ArmorItem; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Explosion; import net.minecraft.world.level.Level; @@ -204,8 +205,28 @@ public class Blu43Entity extends Entity implements GeoEntity, OwnableEntity { if (entity != null) { trigger = true; if (!entity.level().isClientSide() && entity instanceof LivingEntity living) { - living.addEffect(new MobEffectInstance(MobEffects.MOVEMENT_SLOWDOWN, 200, 3, false, false), this.getOwner()); - living.addEffect(new MobEffectInstance(MobEffects.WEAKNESS, 200, 3, false, false), this.getOwner()); + int baseAmplifier = 3; + int baseDuration = 600; + + var boot = living.getItemBySlot(EquipmentSlot.FEET); + var leggings = living.getItemBySlot(EquipmentSlot.LEGS); + if (!boot.isEmpty()) { + baseAmplifier--; + baseDuration -= 100; + if (boot.getItem() instanceof ArmorItem armorItem) { + baseDuration -= armorItem.getDefense() * 10; + } + } + if (!leggings.isEmpty()) { + baseAmplifier--; + baseDuration -= 100; + if (leggings.getItem() instanceof ArmorItem armorItem) { + baseDuration -= armorItem.getDefense() * 10; + } + } + + living.addEffect(new MobEffectInstance(MobEffects.MOVEMENT_SLOWDOWN, Math.max(baseDuration, 20), baseAmplifier, false, false), this.getOwner()); + living.addEffect(new MobEffectInstance(MobEffects.WEAKNESS, Math.max(baseDuration, 20), baseAmplifier, false, false), this.getOwner()); living.addEffect(new MobEffectInstance(MobEffects.BLINDNESS, 30, 0, false, false), this.getOwner()); } break; @@ -215,7 +236,6 @@ public class Blu43Entity extends Entity implements GeoEntity, OwnableEntity { if (trigger) { triggerExplode(); } - } }