天堂2单机论坛

 找回密码
 立即注册
查看: 172|回复: 3

修正L2j長久以來技能動畫中斷的問題,特別是Boss技能動畫

[复制链接]
  • TA的每日心情
    无聊
    2026-1-24 08:33
  • 签到天数: 3 天

    [LV.2]偶尔看看I

    3

    主题

    13

    帖子

    46

    积分

    新手上路

    Rank: 1

    积分
    46
    发表于 2026-1-24 11:03:19 | 显示全部楼层 |阅读模式

    l2j長久以來都有Boss技能動畫在最後一兩秒中斷的問題, 增加技能 cooltime 並不能解決這個問題.


    https://drive.google.com/file/d/ ... view?usp=drive_link
    下載並放到資料夾 libs/



    可按以下自行編譯

    1. --- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/actor/Creature.java
    2. +++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/actor/Creature.java
    3. @@ -671,7 +671,7 @@ public abstract class Creature extends WorldObject
    4.                          final WorldObject target = ((intention == Intention.ATTACK) || (intention == Intention.FOLLOW)) ? _target : null;
    5.                          if (target != null)
    6.                          {
    7. -                                if (target != this)
    8. +                                if ((target != this) && !isOnGeodataPath(move))
    9.                                  {
    10.                                          broadcastPacket(new MoveToPawn(this, target, getAI().getClientMovingToPawnOffset()));
    11.                                  }
    12. @@ -1943,18 +1943,24 @@ public abstract class Creature extends WorldObject
    13.                  
    14.                  // Get the Base Casting Time of the Skills.
    15.                  int skillTime = (skill.getHitTime() + skill.getCoolTime());
    16. +                int animationTime = skill.getHitTime(); // Use only hitTime for animation
    17. +                int hitTime = skill.getHitTime(); // Calculate hitTime separately for damage timing
    18.                  if (!skill.isChanneling() || (skill.getChannelingSkillId() == 0))
    19.                  {
    20.                          // Calculate the Casting Time of the "Non-Static" Skills (with caster PAtk/MAtkSpd).
    21.                          if (!skill.isStatic())
    22.                          {
    23.                                  skillTime = Formulas.calcAtkSpd(this, skill, skillTime);
    24. +                                animationTime = Formulas.calcAtkSpd(this, skill, animationTime);
    25. +                                hitTime = Formulas.calcAtkSpd(this, skill, hitTime);
    26.                          }
    27.                         
    28.                          // Calculate the Casting Time of Magic Skills (reduced in 40% if using SPS/BSPS)
    29.                          if (skill.isMagic() && (isChargedShot(ShotType.SPIRITSHOTS) || isChargedShot(ShotType.BLESSED_SPIRITSHOTS)))
    30.                          {
    31.                                  skillTime = (int) (0.6 * skillTime);
    32. +                                animationTime = (int) (0.6 * animationTime);
    33. +                                hitTime = (int) (0.6 * hitTime);
    34.                          }
    35.                  }
    36.                  
    37. @@ -1970,6 +1976,9 @@ public abstract class Creature extends WorldObject
    38.                          skillTime = 500;
    39.                  }
    40.                  
    41. +                // Calculate coolTime after all adjustments
    42. +                int coolTime = skillTime - hitTime;
    43. +               
    44.                  // queue herbs and potions
    45.                  if (_isCastingSimultaneouslyNow && simultaneously)
    46.                  {
    47. @@ -2100,7 +2109,7 @@ public abstract class Creature extends WorldObject
    48.                  {
    49.                          // Send a Server->Client packet MagicSkillUser with target, displayId, level, skillTime, reuseDelay
    50.                          // to the Creature AND to all Player in the _KnownPlayers of the Creature
    51. -                        broadcastSkillPacket(new MagicSkillUse(this, target, skill.getDisplayId(), skill.getDisplayLevel(), skillTime, reuseDelay), target);
    52. +                        broadcastSkillPacket(new MagicSkillUse(this, target, skill.getDisplayId(), skill.getDisplayLevel(), animationTime, reuseDelay), target);
    53.                          broadcastSkillPacket(new MagicSkillLaunched(this, skill.getDisplayId(), skill.getDisplayLevel(), targets), targets);
    54.                  }
    55.                  
    56. @@ -2140,6 +2149,7 @@ public abstract class Creature extends WorldObject
    57.                  }
    58.                  
    59.                  final MagicUseTask mut = new MagicUseTask(this, targets, skill, skillTime, simultaneously);
    60. +                mut.setCoolTime(coolTime);
    61.                  
    62.                  // launch the magic in skillTime milliseconds
    63.                  if (skillTime > 0)
    64. @@ -2164,9 +2174,9 @@ public abstract class Creature extends WorldObject
    65.                                          _skillCast2 = null;
    66.                                  }
    67.                                  
    68. -                                // Create a task MagicUseTask to launch the MagicSkill at the end of the casting time (skillTime)
    69. +                                // Create a task MagicUseTask to launch the MagicSkill at hitTime (for damage) instead of skillTime
    70.                                  // For client animation reasons (party buffs especially) 400 ms before!
    71. -                                _skillCast2 = ThreadPool.schedule(mut, Math.max(0, skillTime - 400));
    72. +                                _skillCast2 = ThreadPool.schedule(mut, Math.max(0, hitTime - 400));
    73.                          }
    74.                          else
    75.                          {
    76. @@ -2177,9 +2187,9 @@ public abstract class Creature extends WorldObject
    77.                                          _skillCast = null;
    78.                                  }
    79.                                  
    80. -                                // Create a task MagicUseTask to launch the MagicSkill at the end of the casting time (skillTime)
    81. +                                // Create a task MagicUseTask to launch the MagicSkill at hitTime (for damage) instead of skillTime
    82.                                  // For client animation reasons (party buffs especially) 400 ms before!
    83. -                                _skillCast = ThreadPool.schedule(mut, Math.max(0, skillTime - 400));
    84. +                                _skillCast = ThreadPool.schedule(mut, Math.max(0, hitTime - 400));
    85.                          }
    86.                  }
    87.                  else
    88. @@ -6061,13 +6071,34 @@ public abstract class Creature extends WorldObject
    89.                          LOGGER.log(Level.WARNING, "", e);
    90.                  }
    91.                  
    92. +                // Clear casting state immediately after damage if creature is dead
    93. +                // This allows death processing to proceed normally
    94. +                if (isAlikeDead())
    95. +                {
    96. +                        if (!mut.isSimultaneous())
    97. +                        {
    98. +                                _skillCast = null;
    99. +                                _castInterruptTime = 0;
    100. +                                setCastingNow(false);
    101. +                        }
    102. +                        else
    103. +                        {
    104. +                                _skillCast2 = null;
    105. +                                setCastingSimultaneouslyNow(false);
    106. +                        }
    107. +                        // Don't schedule finalizer if dead, death processing will handle cleanup
    108. +                        return;
    109. +                }
    110. +               
    111.                  if (mut.getSkillTime() > 0)
    112.                  {
    113.                          mut.setCount(mut.getCount() + 1);
    114.                  }
    115.                  
    116.                  mut.setPhase(3);
    117. -                if (mut.getSkillTime() == 0)
    118. +                // Schedule finalizer at the end of skillTime (after coolTime from hitTime)
    119. +                int finalizerDelay = mut.getCoolTime();
    120. +                if (finalizerDelay <= 0)
    121.                  {
    122.                          onMagicFinalizer(mut);
    123.                  }
    124. @@ -6075,11 +6106,11 @@ public abstract class Creature extends WorldObject
    125.                  {
    126.                          if (mut.isSimultaneous())
    127.                          {
    128. -                                _skillCast2 = ThreadPool.schedule(mut, 0);
    129. +                                _skillCast2 = ThreadPool.schedule(mut, finalizerDelay);
    130.                          }
    131.                          else
    132.                          {
    133. -                                _skillCast = ThreadPool.schedule(mut, 0);
    134. +                                _skillCast = ThreadPool.schedule(mut, finalizerDelay);
    135.                          }
    136.                  }
    137.          }
    138. @@ -6094,7 +6125,7 @@ public abstract class Creature extends WorldObject
    139.                          return;
    140.                  }
    141.                  
    142. -                // Cleanup
    143. +                // Cleanup - ensure casting state is cleared even if creature is dead
    144.                  _skillCast = null;
    145.                  _castInterruptTime = 0;
    复制代码


    回复

    使用道具 举报

  • TA的每日心情
    开心
    2024-6-7 00:11
  • 签到天数: 441 天

    [LV.9]以坛为家II

    56

    主题

    1177

    帖子

    2万

    积分

    VIP会员

    Rank: 8Rank: 8

    积分
    24829
    发表于 2026-1-24 12:44:31 | 显示全部楼层
    感谢楼主无私分享技术教学,期待楼主有更多的作品分享。
    回复

    使用道具 举报

  • TA的每日心情
    开心
    昨天 07:58
  • 签到天数: 1051 天

    [LV.10]以坛为家III

    1

    主题

    1125

    帖子

    5657

    积分

    论坛元老

    Rank: 8Rank: 8

    积分
    5657
    发表于 2026-1-24 19:00:14 | 显示全部楼层
    感谢楼主无私分享  ,楼主大佬牛批
    回复

    使用道具 举报

  • TA的每日心情

    4 天前
  • 签到天数: 252 天

    [LV.8]以坛为家I

    3

    主题

    277

    帖子

    1331

    积分

    金牌会员

    Rank: 6Rank: 6

    积分
    1331
    发表于 2026-1-24 21:02:01 | 显示全部楼层
    感谢楼主无私分享  ,楼主大佬牛批
    回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    QQ|Archiver|手机版|监狱|天堂2单机论坛 ( 粤ICP备20030366号 )

    GMT+8, 2026-2-1 02:09 , Processed in 0.053287 second(s), 21 queries .

    Powered by Discuz! X3.4

    © 2001-2023 Discuz! Team.

    快速回复 返回顶部 返回列表