From 809da4ca8d7d6dea28bfd948219623c174a7793c Mon Sep 17 00:00:00 2001 From: 17146 <1714673995@qq.com> Date: Sat, 10 May 2025 23:13:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0dps=E5=8F=91=E7=94=B5?= =?UTF-8?q?=E6=9C=BA=E5=92=8Cbeast=E7=9A=84=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../superbwarfare/entity/DPSGeneratorEntity.java | 11 +++++++++++ .../entity/projectile/ProjectileEntity.java | 10 +++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/DPSGeneratorEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/DPSGeneratorEntity.java index c1615e4c0..e081a3531 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/DPSGeneratorEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/DPSGeneratorEntity.java @@ -345,4 +345,15 @@ public class DPSGeneratorEntity extends LivingEntity implements GeoEntity { public int getMaxTransfer() { return getMaxEnergy() / 2; } + + public void beastCharge() { + this.entityData.set(LEVEL, 7); + this.getEnergy().ifPresent(cap -> { + if (cap instanceof SyncedEntityEnergyStorage storage) { + storage.setCapacity(this.getMaxEnergy()); + storage.setMaxExtract(this.getMaxTransfer()); + storage.setEnergy(this.getMaxEnergy()); + } + }); + } } diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/ProjectileEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/ProjectileEntity.java index 60cd29511..3921d613e 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/ProjectileEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/ProjectileEntity.java @@ -4,6 +4,7 @@ import com.atsuishio.superbwarfare.block.BarbedWireBlock; import com.atsuishio.superbwarfare.component.ModDataComponents; import com.atsuishio.superbwarfare.config.server.MiscConfig; import com.atsuishio.superbwarfare.config.server.ProjectileConfig; +import com.atsuishio.superbwarfare.entity.DPSGeneratorEntity; import com.atsuishio.superbwarfare.entity.ICustomKnockback; import com.atsuishio.superbwarfare.entity.TargetEntity; import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity; @@ -132,6 +133,8 @@ public class ProjectileEntity extends Projectile implements IEntityWithComplexSp if (entity.equals(this.shooter.getVehicle())) continue; if (entity instanceof TargetEntity && entity.getEntityData().get(TargetEntity.DOWN_TIME) > 0) continue; + if (entity instanceof DPSGeneratorEntity && entity.getEntityData().get(DPSGeneratorEntity.DOWN_TIME) > 0) + continue; EntityResult result = this.getHitResult(entity, startVec, endVec); if (result == null) continue; @@ -270,7 +273,8 @@ public class ProjectileEntity extends Projectile implements IEntityWithComplexSp if (!this.beast) { this.bypassArmorRate -= 0.2F; if (this.bypassArmorRate < 0.8F) { - if (result != null && !(((EntityHitResult) result).getEntity() instanceof TargetEntity target && target.getEntityData().get(TargetEntity.DOWN_TIME) > 0)) { + if (result != null && !(((EntityHitResult) result).getEntity() instanceof TargetEntity target && target.getEntityData().get(TargetEntity.DOWN_TIME) > 0) + && !(((EntityHitResult) result).getEntity() instanceof DPSGeneratorEntity dpsGeneratorEntity && dpsGeneratorEntity.getEntityData().get(DPSGeneratorEntity.DOWN_TIME) > 0)) { break; } } @@ -483,6 +487,10 @@ public class ProjectileEntity extends Projectile implements IEntityWithComplexSp if (beast && entity instanceof LivingEntity living) { if (living.isDeadOrDying()) return; if (living instanceof TargetEntity) return; + if (living instanceof DPSGeneratorEntity dpsGeneratorEntity) { + dpsGeneratorEntity.beastCharge(); + return; + } if (this.shooter instanceof ServerPlayer player) { PacketDistributor.sendToPlayer(player, new ClientIndicatorMessage(0, 5));