修改蝴蝶雷的效果

This commit is contained in:
17146 2025-05-30 17:51:49 +08:00 committed by Light_Quanta
parent dd1c72bd6e
commit e69cd6a265
No known key found for this signature in database
GPG key ID: 11A39A1B8C890959

View file

@ -22,6 +22,7 @@ import net.minecraft.world.entity.*;
import net.minecraft.world.entity.decoration.HangingEntity; import net.minecraft.world.entity.decoration.HangingEntity;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.entity.projectile.ThrownPotion; import net.minecraft.world.entity.projectile.ThrownPotion;
import net.minecraft.world.item.ArmorItem;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Explosion; import net.minecraft.world.level.Explosion;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
@ -204,8 +205,28 @@ public class Blu43Entity extends Entity implements GeoEntity, OwnableEntity {
if (entity != null) { if (entity != null) {
trigger = true; trigger = true;
if (!entity.level().isClientSide() && entity instanceof LivingEntity living) { if (!entity.level().isClientSide() && entity instanceof LivingEntity living) {
living.addEffect(new MobEffectInstance(MobEffects.MOVEMENT_SLOWDOWN, 200, 3, false, false), this.getOwner()); int baseAmplifier = 3;
living.addEffect(new MobEffectInstance(MobEffects.WEAKNESS, 200, 3, false, false), this.getOwner()); 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()); living.addEffect(new MobEffectInstance(MobEffects.BLINDNESS, 30, 0, false, false), this.getOwner());
} }
break; break;
@ -215,7 +236,6 @@ public class Blu43Entity extends Entity implements GeoEntity, OwnableEntity {
if (trigger) { if (trigger) {
triggerExplode(); triggerExplode();
} }
} }
} }