计算技能延迟 时间
This commit is contained in:
@@ -8,4 +8,6 @@
|
||||
- 为固定位置类型技能添加了动画结束(endType.animationEnd)支持
|
||||
- 实现了动画播放完成后的技能销毁逻辑
|
||||
- 修改了直线技能的结束条件,改为到达目标点时销毁
|
||||
- 移除了不必要的屏幕边界检测
|
||||
- 移除了不必要的屏幕边界检测
|
||||
- 优化了技能伤害延迟计算逻辑
|
||||
- 为抛物线类型技能添加了基于距离和速度的动态延迟计算
|
||||
@@ -6,6 +6,8 @@
|
||||
- 优化了技能销毁逻辑
|
||||
- 优化了直线技能的结束条件判断
|
||||
- 确保技能行为符合设计意图
|
||||
- 实现了抛物线技能的动态伤害延迟计算
|
||||
- 保持了其他类型技能的默认延迟时间
|
||||
|
||||
## 下一步工作建议
|
||||
- 测试 EndAnmCom 组件在不同类型技能上的表现
|
||||
@@ -13,4 +15,7 @@
|
||||
- 确认屏幕尺寸配置是否正确
|
||||
- 测试直线技能在不同方向上的边界检测
|
||||
- 测试直线技能到达目标点时的销毁效果
|
||||
- 验证不同距离和速度下的技能表现
|
||||
- 验证不同距离和速度下的技能表现
|
||||
- 测试抛物线技能在不同距离下的伤害延迟表现
|
||||
- 验证伤害时机是否与技能动画同步
|
||||
- 考虑是否需要为其他类型技能添加自定义延迟计算
|
||||
@@ -31,6 +31,7 @@ import { oops } from "db://oops-framework/core/Oops";
|
||||
import { GameEvent } from "../common/config/GameEvent";
|
||||
import { Skill } from "../skills/Skill";
|
||||
import { SkillCom } from "../skills/SkillCom";
|
||||
import { AnimType } from "../common/config/SkillSet";
|
||||
|
||||
|
||||
/** 技能系统 */
|
||||
@@ -261,17 +262,26 @@ export class HeroSkillSystem extends ecs.ComblockSystem implements ecs.ISystemUp
|
||||
|
||||
private calculateDamage(caster: ecs.Entity, target: ecs.Entity, config: typeof SkillSet[keyof typeof SkillSet]) {
|
||||
const result = {
|
||||
value :0, // 确保最小伤害为1
|
||||
isCrit : false,
|
||||
isDodged : false,
|
||||
delay : 0.3,
|
||||
ignoreDefense : false,
|
||||
canCrit : true,
|
||||
value: 0,
|
||||
isCrit: false,
|
||||
isDodged: false,
|
||||
delay: 0.3, // 默认延迟
|
||||
ignoreDefense: false,
|
||||
canCrit: true,
|
||||
}
|
||||
|
||||
const targetView =target.get(HeroViewComp);
|
||||
const sourceView =caster.get(HeroViewComp);
|
||||
let final = sourceView.ap*config.ap/100;
|
||||
|
||||
// 计算延迟时间
|
||||
if (config.AnimType === AnimType.parabolic) {
|
||||
const sourcePos = caster.get(HeroViewComp).node.position;
|
||||
const targetPos = target.get(HeroViewComp).node.position;
|
||||
// 计算距离除以速度得到时间
|
||||
const distance = Math.abs(targetPos.x - sourcePos.x);
|
||||
result.delay = distance / config.speed;
|
||||
}
|
||||
|
||||
const targetView = target.get(HeroViewComp);
|
||||
const sourceView = caster.get(HeroViewComp);
|
||||
let final = sourceView.ap * config.ap / 100;
|
||||
|
||||
// 伤害浮动(±10%)
|
||||
const damageFloat = 0.9 + Math.random() * 0.2; // 0.9~1.1
|
||||
|
||||
Reference in New Issue
Block a user