@@ -68,21 +68,21 @@ public static AttributeSupplier.Builder createAttributes() {
6868 private int crashAttackCooldown = 0 ;
6969 private int stateDuration = 0 ; // 当前状态持续时间
7070 private boolean crashAttackReady = false ; //一个状态,大招冷却结束但未释放
71- private int crashPortalOpeningTime = Config . CRASH_PORTAL_OPENING_TIME ;
71+ private int crashPortalOpeningTime = 1 ;
7272 private final List <LivingEntity > recentAttackers = new ArrayList <>(); // 最近攻击者列表
7373 private final Map <LivingEntity , Integer > lastAttackTimeMap = new HashMap <>(); // 记录攻击时间
7474 private Vec3 crashPortalPosition = null ;
7575
7676 // ========== 可配置参数 ==========
7777 private static final class Config {
7878 // 攻击参数
79- public static final int NORMAL_ATTACK_COOLDOWN = 60 ; // 基础攻击间隔(3秒 )
79+ public static final int NORMAL_ATTACK_COOLDOWN = 30 ; // 基础攻击间隔(1.5秒 )
8080 public static final int CRASH_ATTACK_COOLDOWN = 600 ; // 大招攻击间隔(30秒)
8181 public static final int CRASH_PORTAL_OPENING_TIME = 100 ;
8282 public static final float TARGETED_ATTACK_RADIUS = 50.0F ; // 锁定半径(针对玩家,脱离后解除锁定)
8383
8484 // 目标锁定参数
85- public static final int TARGET_LOCK_DURATION = 400 ; // 锁定目标持续时间(20秒 )
85+ public static final int TARGET_LOCK_DURATION = 600 ; // 锁定目标持续时间(30秒 )
8686 public static final int RECENT_ATTACKER_MEMORY = 200 ; // 记住攻击者的时间(10秒)
8787 public static final float PLAYER_TARGET_PRIORITY = 10.0F ; // 玩家目标优先级权重
8888
@@ -237,7 +237,6 @@ private boolean canAttackTarget(LivingEntity entity) {
237237 return !(entity instanceof GrantUsLove );
238238 }
239239
240-
241240 @ Override
242241 public void tick () {
243242 super .tick ();
@@ -250,7 +249,6 @@ public void tick() {
250249 if (!this .crashAttackReady ) {//无大招时
251250 if (crashAttackCooldown <= 0 ) {
252251 crashAttackCooldown = Config .CRASH_ATTACK_COOLDOWN ;
253- // this.teleportTo(this.getX(), this.getY() + 30.0F, this.getZ());
254252 this .crashAttackReady = true ;
255253 } else {
256254 crashAttackCooldown --;
@@ -264,10 +262,13 @@ public void tick() {
264262 } else if (this .crashPortalOpeningTime > 0 ) {
265263 if (this .crashPortalOpeningTime == Config .CRASH_PORTAL_OPENING_TIME ) {//砸击开始时,锁定传送位置
266264 this .crashPortalPosition = Objects .requireNonNullElse (this .primaryTarget , this ).position ()
267- .add (0 , 20 , 0 );
265+ .add (0 , 15 , 0 );
268266 this .createPortal ();
269267 } else if (this .crashPortalOpeningTime == 1 ) {
270- this .absMoveTo (crashPortalPosition .x , crashPortalPosition .y , crashPortalPosition .z );
268+ if (this .crashPortalPosition == null ){
269+ crashPortalPosition = this .position ().add (0 , 20 , 0 );
270+ }
271+ this .setPos (crashPortalPosition .x , crashPortalPosition .y , crashPortalPosition .z );
271272 }
272273 this .crashPortalOpeningTime --;
273274 } else if (this .isOnGround ()) {//砸到地上时伤害
@@ -337,7 +338,7 @@ private void updatePrimaryTarget() {
337338 float bestScore = -1 ;
338339
339340 for (LivingEntity attacker : recentAttackers ) {
340- if (!attacker .isAlive ()) continue ;
341+ if (!attacker .isAlive () || ! this . canAttackTarget ( attacker ) ) continue ;
341342
342343 float score = this .calculateTargetScore (attacker );
343344
@@ -504,7 +505,7 @@ public GrantUsLoveRenderer(EntityRendererProvider.Context context) {
504505 @ Override
505506 public void render (GrantUsLove entity , float entityYaw , float partialTick , PoseStack poseStack , MultiBufferSource bufferSource , int packedLight ) {
506507 poseStack .pushPose ();
507- float scale = 0.3f ;
508+ float scale = 0.4f ;
508509 poseStack .scale (scale , scale , scale );
509510 super .render (entity , entityYaw , partialTick , poseStack , bufferSource , packedLight );
510511 poseStack .popPose ();
0 commit comments