调整防御塔减伤比例,子弹只能对生物造成爆头伤害

This commit is contained in:
Atsuihsio 2025-02-14 01:27:22 +08:00
parent ac0f77fbc5
commit 899a1ddd1f
2 changed files with 10 additions and 13 deletions

View file

@ -2,9 +2,8 @@ package com.atsuishio.superbwarfare.entity.projectile;
import com.atsuishio.superbwarfare.ModUtils; import com.atsuishio.superbwarfare.ModUtils;
import com.atsuishio.superbwarfare.block.BarbedWireBlock; import com.atsuishio.superbwarfare.block.BarbedWireBlock;
import com.atsuishio.superbwarfare.entity.*; import com.atsuishio.superbwarfare.entity.ICustomKnockback;
import com.atsuishio.superbwarfare.entity.vehicle.DroneEntity; import com.atsuishio.superbwarfare.entity.TargetEntity;
import com.atsuishio.superbwarfare.entity.vehicle.IArmedVehicleEntity;
import com.atsuishio.superbwarfare.init.*; import com.atsuishio.superbwarfare.init.*;
import com.atsuishio.superbwarfare.item.Transcript; import com.atsuishio.superbwarfare.item.Transcript;
import com.atsuishio.superbwarfare.network.message.ClientIndicatorMessage; import com.atsuishio.superbwarfare.network.message.ClientIndicatorMessage;
@ -217,12 +216,10 @@ public class ProjectileEntity extends Projectile implements IEntityAdditionalSpa
boolean legShot = false; boolean legShot = false;
float eyeHeight = entity.getEyeHeight(); float eyeHeight = entity.getEyeHeight();
float bodyHeight = entity.getBbHeight(); float bodyHeight = entity.getBbHeight();
if ((eyeHeight - 0.35) < hitBoxPos.y && hitBoxPos.y < (eyeHeight + 0.4) && if ((eyeHeight - 0.35) < hitBoxPos.y && hitBoxPos.y < (eyeHeight + 0.4) && entity instanceof LivingEntity) {
!(entity instanceof C4Entity || entity instanceof ClaymoreEntity || entity instanceof MortarEntity || entity instanceof IArmedVehicleEntity || entity instanceof DroneEntity)) {
headshot = true; headshot = true;
} }
if (hitBoxPos.y < (0.33 * bodyHeight) && !(entity instanceof C4Entity || entity instanceof ClaymoreEntity || entity instanceof MortarEntity || if (hitBoxPos.y < (0.33 * bodyHeight) && entity instanceof LivingEntity) {
entity instanceof IArmedVehicleEntity || entity instanceof DroneEntity)) {
legShot = true; legShot = true;
} }

View file

@ -144,7 +144,7 @@ public class LaserTowerEntity extends EnergyVehicleEntity implements GeoEntity,
public boolean hurt(DamageSource source, float amount) { public boolean hurt(DamageSource source, float amount) {
super.hurt(source, amount); super.hurt(source, amount);
if (this.level() instanceof ServerLevel serverLevel) { if (this.level() instanceof ServerLevel serverLevel) {
sendParticle(serverLevel, ModParticleTypes.FIRE_STAR.get(), this.getX(), this.getY() + 2.5, this.getZ(), 4, 0.2, 0.2, 0.2, 0.2, false); sendParticle(serverLevel, ModParticleTypes.FIRE_STAR.get(), this.getX(), this.getY() + 0.8, this.getZ(), 4, 0.1, 0.1, 0.1, 0.2, false);
} }
if (source.is(DamageTypes.ARROW)) { if (source.is(DamageTypes.ARROW)) {
@ -191,17 +191,17 @@ public class LaserTowerEntity extends EnergyVehicleEntity implements GeoEntity,
amount *= 0.6f; amount *= 0.6f;
} }
if (source.is(ModTags.DamageTypes.PROJECTILE)) { if (source.is(ModTags.DamageTypes.PROJECTILE)) {
amount *= 0.08f;
}
if (source.is(ModTags.DamageTypes.PROJECTILE_ABSOLUTE)) {
amount *= 0.5f; amount *= 0.5f;
} }
if (source.is(ModTags.DamageTypes.PROJECTILE_ABSOLUTE)) {
amount *= 0.8f;
}
if (source.is(ModDamageTypes.VEHICLE_STRIKE)) { if (source.is(ModDamageTypes.VEHICLE_STRIKE)) {
amount *= 5f; amount *= 2f;
} }
this.level().playSound(null, this.getOnPos(), ModSounds.HIT.get(), SoundSource.PLAYERS, 1, 1); this.level().playSound(null, this.getOnPos(), ModSounds.HIT.get(), SoundSource.PLAYERS, 1, 1);
this.hurt(Math.max(amount - 2, 0), source.getEntity(), false); this.hurt(Math.max(amount - 1, 0), source.getEntity(), true);
return true; return true;
} }