diff --git a/assets/script/game/common/config/SkillSet.ts b/assets/script/game/common/config/SkillSet.ts index a4e9c352..8edc22de 100644 --- a/assets/script/game/common/config/SkillSet.ts +++ b/assets/script/game/common/config/SkillSet.ts @@ -150,7 +150,7 @@ export interface SkillConfig { } export const SkillUpList = { - 6001:{ap:0,hit_count:0,buff_ap:0,buff_hp:0,bck:0,frz:0,crt:0,num:0} + 1001:{ap:0,hit_count:0,buff_ap:0,buff_hp:0,bck:0,frz:0,crt:0,num:0} } /****** @@ -256,28 +256,28 @@ export const SkillSet: Record = { //============================= ====== 辅助技能 ====== ========================== 6301:{ uuid:6301,name:"魔法盾",sp_name:"buff_wind",icon:"1255",TGroup:TGroup.Self,readyAnm:"",endAnm:"",act:"atk", - DTType:DTType.single,kind:SkillKind.Shield,ap:30,hit_count:1,hitcd:0.2,speed:720,with:0,ready:0,EAnm:0,DAnm:"", - RType:RType.fixed,EType:EType.animationEnd,buffs:[],info:"获得30%最大生命值的护盾", + DTType:DTType.single,kind:SkillKind.Shield,ap:300,hit_count:1,hitcd:0.2,speed:720,with:0,ready:0,EAnm:0,DAnm:"", + RType:RType.fixed,EType:EType.animationEnd,buffs:[],info:"获得300%攻击力的护盾", }, 6302: { uuid:6302,name:"治疗",sp_name:"buff_wind",icon:"1292",TGroup:TGroup.Team,readyAnm:"",endAnm:"",act:"atk", - DTType:DTType.single,kind:SkillKind.Heal,ap:30,hit_count:1,hitcd:0.2,speed:720,with:0,ready:0,EAnm:0,DAnm:"", - RType:RType.fixed,EType:EType.animationEnd,buffs:[],info:"治疗1个友方30%最大生命值", + DTType:DTType.single,kind:SkillKind.Heal,ap:300,hit_count:1,hitcd:0.2,speed:720,with:0,ready:0,EAnm:0,DAnm:"", + RType:RType.fixed,EType:EType.animationEnd,buffs:[],info:"治疗1个友方300%攻击力的生命值", }, 6303:{ uuid:6303,name:"护盾",sp_name:"buff_wind",icon:"1255",TGroup:TGroup.Self,readyAnm:"",endAnm:"",act:"atk", - DTType:DTType.single,kind:SkillKind.Shield,ap:30,hit_count:1,hitcd:0.2,speed:720,with:0,ready:0,EAnm:0,DAnm:"", - RType:RType.fixed,EType:EType.animationEnd,buffs:[],info:"随机1个友方获得30%最大生命值的护盾", + DTType:DTType.single,kind:SkillKind.Shield,ap:300,hit_count:1,hitcd:0.2,speed:720,with:0,ready:0,EAnm:0,DAnm:"", + RType:RType.fixed,EType:EType.animationEnd,buffs:[],info:"随机1个友方获得300%攻击力的护盾", }, 6304: { uuid:6304,name:"群体治疗",sp_name:"buff_wind",icon:"1292",TGroup:TGroup.Team,readyAnm:"",endAnm:"",act:"atk", - DTType:DTType.single,kind:SkillKind.Heal,ap:20,hit_count:3,hitcd:0.2,speed:720,with:0,ready:0,EAnm:0,DAnm:"", - RType:RType.fixed,EType:EType.animationEnd,buffs:[],info:"随机3个友方,回复20%最大生命值", + DTType:DTType.single,kind:SkillKind.Heal,ap:200,hit_count:3,hitcd:0.2,speed:720,with:0,ready:0,EAnm:0,DAnm:"", + RType:RType.fixed,EType:EType.animationEnd,buffs:[],info:"随机治疗3个友方200%攻击力的生命值", }, 6305:{ uuid:6305,name:"群体护盾",sp_name:"buff_wind",icon:"1255",TGroup:TGroup.Team,readyAnm:"",endAnm:"",act:"atk", - DTType:DTType.single,kind:SkillKind.Shield,ap:20,hit_count:3,hitcd:0.2,speed:720,with:0,ready:0,EAnm:0,DAnm:"", - RType:RType.fixed,EType:EType.animationEnd,buffs:[],info:"随机3个友方获得20%最大生命值的护盾", + DTType:DTType.single,kind:SkillKind.Shield,ap:200,hit_count:3,hitcd:0.2,speed:720,with:0,ready:0,EAnm:0,DAnm:"", + RType:RType.fixed,EType:EType.animationEnd,buffs:[],info:"随机3个友方获得200%攻击力的护盾", }, //==========================buff 技能===================== 6401:{ diff --git a/assets/script/game/hero/SCastSystem.ts b/assets/script/game/hero/SCastSystem.ts index f7602e00..3eaf008a 100644 --- a/assets/script/game/hero/SCastSystem.ts +++ b/assets/script/game/hero/SCastSystem.ts @@ -110,6 +110,8 @@ export class SCastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate const s_uuid = castPlan.skillId; const skillLv = castPlan.skillLv; const config = SkillSet[s_uuid]; + const sUp=SkillUpList[s_uuid]??SkillUpList[1001] + const cNum=sUp.num if (!config) return; //播放前摇技能动画 heroView.playReady(config.readyAnm); @@ -174,14 +176,16 @@ export class SCastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate */ private applyFriendlySkillEffects(_s_uuid: number, _skillLv: number, config: SkillConfig, _heroView: HeroViewComp, _cAttrsComp: HeroAttrsComp, targets: HeroViewComp[], _targetPos: Vec3 | null) { const kind = config.kind ?? SkillKind.Support; - const sUp=SkillUpList[_skillLv] + const sUp = SkillUpList[_s_uuid] ?? SkillUpList[1001]; const sAp =config.ap+sUp.ap*_skillLv; - const sHit=config.hit_count+sUp.hit_count*_skillLv - for (const target of targets) { + const sHit=config.hit_count+sUp.hit_count*_skillLv; + const selectedTargets = this.pickRandomFriendlyTargets(targets, sHit); + const applyTargets = kind === SkillKind.Heal ? this.sortTargetsByLowestHp(selectedTargets) : selectedTargets; + for (const target of applyTargets) { if (!target.ent) continue; const model = target.ent.get(HeroAttrsComp); if (!model || model.is_dead) continue; - if (kind === SkillKind.Heal && config.ap !== 0) { + if (kind === SkillKind.Heal && sAp !== 0) { const addHp = model.add_hp(sAp*_cAttrsComp.ap); target.health(addHp); } else if (kind === SkillKind.Shield && sAp !== 0) { @@ -204,6 +208,34 @@ export class SCastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate } } + private pickRandomFriendlyTargets(targets: HeroViewComp[], hitCount: number): HeroViewComp[] { + if (!targets || targets.length === 0) return []; + const validHitCount = Math.max(1, Math.floor(hitCount)); + if (validHitCount >= targets.length) return [...targets]; + const pool = [...targets]; + const selected: HeroViewComp[] = []; + while (selected.length < validHitCount && pool.length > 0) { + const index = Math.floor(Math.random() * pool.length); + const [target] = pool.splice(index, 1); + if (!target) continue; + selected.push(target); + } + return selected; + } + + private sortTargetsByLowestHp(targets: HeroViewComp[]): HeroViewComp[] { + return [...targets].sort((a, b) => { + const aModel = a.ent?.get(HeroAttrsComp); + const bModel = b.ent?.get(HeroAttrsComp); + const aRatio = aModel && aModel.hp_max > 0 ? aModel.hp / aModel.hp_max : 1; + const bRatio = bModel && bModel.hp_max > 0 ? bModel.hp / bModel.hp_max : 1; + if (aRatio !== bRatio) return aRatio - bRatio; + const aHp = aModel?.hp ?? Number.MAX_SAFE_INTEGER; + const bHp = bModel?.hp ?? Number.MAX_SAFE_INTEGER; + return aHp - bHp; + }); + } + /** 根据目标 eid 列表解析出有效友方视图目标 */ private resolveFriendlyTargets(targetEids: number[], fac: number): HeroViewComp[] { const targets: HeroViewComp[] = []; diff --git a/assets/script/game/skill/Skill.ts b/assets/script/game/skill/Skill.ts index 8a399188..14a0c0ce 100644 --- a/assets/script/game/skill/Skill.ts +++ b/assets/script/game/skill/Skill.ts @@ -204,10 +204,10 @@ export class Skill extends ecs.Entity { sDataCom.group=caster.box_group sDataCom.casterEid=caster.ent.eid sDataCom.Attrs = {}; - const SUp=SkillUpList[s_uuid] - const sCrt = (config.crt ?? 0)+(SUp.crt??0)*skill_lv; - const sFrz = (config.frz ?? 0)+(SUp.frz??0)*skill_lv; - const sBck = (config.bck ?? 0)+(SUp.bck??0)*skill_lv; + const SUp=SkillUpList[s_uuid]??SkillUpList[1001] + const sCrt = (config.crt ?? 0)+SUp.crt*skill_lv; + const sFrz = (config.frz ?? 0)+SUp.frz*skill_lv; + const sBck = (config.bck ?? 0)+SUp.bck*skill_lv; const sAp =config.ap+SUp.ap*skill_lv; const sHit=config.hit_count+SUp.hit_count*skill_lv + cAttrsComp.puncture sDataCom.Attrs[Attrs.ap] = cAttrsComp.ap*sAp;