[#12659] Bug修复:限制闪电距离
变更摘要
修复了闪电可以击中超出预期距离目标的问题。通过在寻找最远单位时增加距离限制,确保闪电的延伸距离被正确截断。
状态 Open · 目标 master ← dummydummydummydummy
文件 1 · 代码变化 +1 / -1
类型 Bug修复
主要变更
修改了
Lightning.java中查找最远单位的条件判断。增加了对最远单位与起点距离的检查,要求距离小于
length * 1.5f。限制了闪电在实体间跳跃或延伸的最大距离。
影响范围
闪电实体逻辑
战斗距离判定
可能影响
修复闪电攻击距离过远的问题
限制闪电相关武器或能力的实际射程
以上影响分析根据 PR 描述及代码修改推断,不代表维护者正式结论。
重点文件
core/src/mindustry/entities/Lightning.java
修改 · +1 / -1
修改了
createLightningInternal方法中查找最远单位的逻辑。在判断
furthest不为空的条件中,增加了距离限制furthest.dst(x, y) < length * 1.5f。
作者说明
b160.5 时
修复前
<img width="249" height="755" alt="image" src="https://github.com/user-attachments/assets/f35831af-03f2-4e10-83d7-9e92ba3a2197" /> <img width="1203" height="574" alt="image" src="https://github.com/user-attachments/assets/7596d157-d163-4dce-88f7-7420e257202a" />
修复后
<img width="324" height="598" alt="image" src="https://github.com/user-attachments/assets/59f9cade-a84f-4b23-aca6-60fce257437c" />
如果你的 pull request 不是翻译或服务器列表相关的,请阅读以下要求列表并勾选每个复选框:
我已阅读贡献指南。
我已确保我的代码可以编译(如果适用)。
我已确保此 PR 中的任何新功能都能在游戏中正常运行(如果适用)。
GitHub 原文
b160.5 when
Before
<img width="249" height="755" alt="image" src="https://github.com/user-attachments/assets/f35831af-03f2-4e10-83d7-9e92ba3a2197" /> <img width="1203" height="574" alt="image" src="https://github.com/user-attachments/assets/7596d157-d163-4dce-88f7-7420e257202a" />
After
<img width="324" height="598" alt="image" src="https://github.com/user-attachments/assets/59f9cade-a84f-4b23-aca6-60fce257437c" />
If your pull request is not translation or serverlist-related, read the list of requirements below and check each box:
I have read the contribution guidelines.
I have ensured that my code compiles, if applicable.
I have ensured that any new features in this PR function correctly in-game, if applicable.
由 MDT GitHub 同步机器人自动同步。中文翻译、摘要及代码影响分析由 AI 生成,仅供参考。