feat(技能系统): 添加额外伤害和溅射伤害功能
在技能组件中新增ext_dmg和splash字段用于处理额外伤害和溅射伤害 修改技能创建和伤害计算逻辑以支持新功能
This commit is contained in:
@@ -158,7 +158,7 @@ export class HeroAtkSystem extends ecs.ComblockSystem implements ecs.ISystemUpd
|
||||
const isCrit = this.checkChance(damageEvent.Attrs[Attrs.CRITICAL]);
|
||||
if (isCrit) attackerModel?.useValueTalByAttr(Attrs.CRITICAL); // 清除施法者的暴击buff
|
||||
// 计算伤害
|
||||
let damage = this.dmgCount(damageEvent.Attrs,targetAttrs.Attrs,damageEvent.s_uuid);
|
||||
let damage = this.dmgCount(damageEvent,targetAttrs.Attrs);
|
||||
if (isCrit) {
|
||||
// 暴击伤害计算
|
||||
// 使用施法者的暴击伤害加成属性(damageEvent.Attrs 快照)
|
||||
@@ -228,16 +228,17 @@ export class HeroAtkSystem extends ecs.ComblockSystem implements ecs.ISystemUpd
|
||||
* - 所有除法和乘法计算后都进行取整操作,确保游戏中的伤害值为整数
|
||||
* - 元素伤害只应用于魔法伤害部分
|
||||
*/
|
||||
private dmgCount(CAttrs:any,TAttrs:any,s_uuid:number){
|
||||
private dmgCount(damageEvent:any,TAttrs:any){
|
||||
// 1. 获取技能配置 - 如果技能不存在,直接返回0伤害
|
||||
let sConf = SkillSet[s_uuid];
|
||||
const CAttrs=damageEvent.Attrs;
|
||||
let sConf = SkillSet[damageEvent.s_uuid];
|
||||
if (!sConf) return 0;
|
||||
|
||||
// 2. 计算原始物理伤害和魔法伤害
|
||||
// 物理伤害基础值 = 技能物理倍率 * 施法者物理攻击力 / 100
|
||||
let apBase = (sConf.ap||0)*CAttrs[Attrs.AP]/100;
|
||||
// 魔法伤害基础值 = 技能魔法倍率 * 施法者魔法攻击力 / 100
|
||||
let mapBase = (sConf.map||0)*CAttrs[Attrs.MAP]/100;
|
||||
// 物理伤害基础值 = 技能物理倍率 * (施法者物理攻击力 + 额外物理伤害) / 100
|
||||
let apBase = (sConf.ap||0)*(CAttrs[Attrs.AP]+damageEvent.ext_dmg)/100;
|
||||
// 魔法伤害基础值 = 技能魔法倍率 * (施法者魔法攻击力 + 额外魔法伤害) / 100
|
||||
let mapBase = (sConf.map||0)*(CAttrs[Attrs.MAP]+damageEvent.ext_dmg)/100;
|
||||
|
||||
// 3. 获取目标防御属性
|
||||
const def = (TAttrs[Attrs.DEF]||0); // 目标物理防御
|
||||
|
||||
@@ -161,17 +161,19 @@ export class SACastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdat
|
||||
if (hset === HSSet.atk){
|
||||
let delay = 0.3
|
||||
let ext_dmg = heroAttrs.useCountValTal(TalEffet.ATK_DMG);
|
||||
let splash = heroAttrs.useCountValTal(TalEffet.SPLASH);
|
||||
heroView.scheduleOnce(() => {
|
||||
this.createSkill(s_uuid, heroView,targets,ext_dmg);
|
||||
this.createSkill(s_uuid, heroView,targets,ext_dmg,splash);
|
||||
}, delay);
|
||||
//风怒wfuny 只针对 普通攻击起效
|
||||
if (heroAttrs.useCountTal(TalEffet.WFUNY)){
|
||||
let ext2_dmg = heroAttrs.useCountValTal(TalEffet.ATK_DMG);
|
||||
let splash2 = heroAttrs.useCountValTal(TalEffet.SPLASH);
|
||||
let delay = 0.3
|
||||
heroView.playSkillEffect(s_uuid);
|
||||
//需要再添加 风怒动画
|
||||
heroView.scheduleOnce(() => {
|
||||
this.createSkill(s_uuid, heroView,targets,ext2_dmg);
|
||||
this.createSkill(s_uuid, heroView,targets,ext2_dmg,splash2);
|
||||
},delay);
|
||||
}
|
||||
}
|
||||
@@ -212,7 +214,7 @@ export class SACastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdat
|
||||
/**
|
||||
* 创建技能实体
|
||||
*/
|
||||
private createSkill(s_uuid: number, caster: HeroViewComp,targets:Vec3[]=[],ext_dmg:number=0) {
|
||||
private createSkill(s_uuid: number, caster: HeroViewComp,targets:Vec3[]=[],ext_dmg:number=0,splash:number=0) {
|
||||
// 检查节点有效性
|
||||
if (!caster.node || !caster.node.isValid) {
|
||||
console.warn("[SACastSystem] 施法者节点无效");
|
||||
@@ -237,7 +239,7 @@ export class SACastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdat
|
||||
const targetPos = targets[0]; // 使用第一个目标位置
|
||||
// console.log(`[SACastSystem]: ${s_uuid}, 起始位置: ${startPos}, 目标位置: ${targetPos}`);
|
||||
// 加载技能实体(包括预制体、组件初始化等)
|
||||
skill.load(startPos, parent, s_uuid, targetPos, caster,ext_dmg);
|
||||
skill.load(startPos, parent, s_uuid, targetPos, caster,ext_dmg,splash);
|
||||
|
||||
}
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user