refactor(config): 移除废弃的SkillUpList并简化技能数值计算
删除了全局的SkillUpList常量,移除所有对该列表的依赖,将技能成长数值统一改为从SkillConfig和SkillOverrides中获取,简化了代码逻辑,移除了冗余的数值叠加步骤。
This commit is contained in:
@@ -2,7 +2,7 @@ import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ec
|
||||
import { Vec3, Prefab, instantiate, tween, Node } from "cc";
|
||||
import { HeroAttrsComp } from "./HeroAttrsComp";
|
||||
import { HeroViewComp } from "./HeroViewComp";
|
||||
import { DTType, RType, SkillConfig, SkillKind, SkillSet, SkillUpList, TGroup, SkillOverrides, mergeSkillParams } from "../common/config/SkillSet";
|
||||
import { DTType, RType, SkillConfig, SkillKind, SkillSet, TGroup, SkillOverrides, mergeSkillParams } from "../common/config/SkillSet";
|
||||
import { Skill } from "../skill/Skill";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { HeroDisVal, HeroInfo, HType } from "../common/config/heroSet";
|
||||
@@ -90,9 +90,8 @@ export class SCastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
|
||||
targetEids = this.collectFriendlyTargetEids(FacSet.HERO, undefined, true); // 获取所有英雄阵营的目标
|
||||
}
|
||||
|
||||
const sUp = SkillUpList[s_uuid] ? SkillUpList[s_uuid] : SkillUpList[1001];
|
||||
// 优先读 overrides.num(技能卡差异化多发),兜底 SkillUpList.num,限制在 [0, 2]
|
||||
const cNum = Math.min(2, Math.max(0, Math.floor(overrides?.num ?? sUp.num ?? 0)));
|
||||
// 多发次数由 overrides.num 提供(技能卡差异化多发),限制在 [0, 2]
|
||||
const cNum = Math.min(2, Math.max(0, Math.floor(overrides?.num ?? 0)));
|
||||
const castTimes = 1 + cNum;
|
||||
|
||||
// 构造一个模拟的 HeroAttrsComp 用于数值计算,只包含基础卡牌伤害计算所需的属性
|
||||
@@ -274,9 +273,8 @@ export class SCastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
|
||||
}
|
||||
}
|
||||
|
||||
const sUp = SkillUpList[s_uuid] ? SkillUpList[s_uuid] : SkillUpList[1001];
|
||||
// 优先读 overrides.num(技能卡差异化多发),兜底 SkillUpList.num,限制在 [0, 2]
|
||||
const cNum = Math.min(2, Math.max(0, Math.floor(overrides?.num ?? sUp.num ?? 0)));
|
||||
// 多发次数由 overrides.num 提供(技能卡差异化多发),限制在 [0, 2]
|
||||
const cNum = Math.min(2, Math.max(0, Math.floor(overrides?.num ?? 0)));
|
||||
const castTimes = 1 + cNum;
|
||||
let val = ""
|
||||
if (castTimes > 1) {
|
||||
@@ -345,9 +343,8 @@ export class SCastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
|
||||
const skillLv = castPlan.skillLv;
|
||||
const overrides = castPlan.overrides;
|
||||
let config = SkillSet[s_uuid];
|
||||
const sUp = SkillUpList[s_uuid] ? SkillUpList[s_uuid] : SkillUpList[1001];
|
||||
// 优先读 overrides.num(技能卡差异化多发),兜底 SkillUpList.num,限制在 [0, 2]
|
||||
const cNum = Math.min(2, Math.max(0, Math.floor(overrides?.num ?? sUp.num ?? 0)));
|
||||
// 多发次数由 overrides.num 提供(技能卡差异化多发),限制在 [0, 2]
|
||||
const cNum = Math.min(2, Math.max(0, Math.floor(overrides?.num ?? 0)));
|
||||
if (!config) return;
|
||||
|
||||
config = mergeSkillParams(config, overrides);
|
||||
@@ -448,19 +445,19 @@ 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, isCardSkill: boolean = false) {
|
||||
const kind = config.kind ?? SkillKind.Support;
|
||||
const sUp = SkillUpList[_s_uuid] ?? SkillUpList[1001];
|
||||
const sAp = config.ap + sUp.ap * _skillLv;
|
||||
const sHit = config.hit_count + sUp.hit_count * _skillLv;
|
||||
// 技能成长数值已由 SkillConfig/SkillOverrides 提供,无需再叠加 SkillUpList
|
||||
const sAp = config.ap;
|
||||
const sHit = config.hit_count;
|
||||
const applyTargets = kind === SkillKind.Heal
|
||||
? this.pickHealTargetsByMostMissingHp(targets, sHit)
|
||||
: this.pickRandomFriendlyTargets(targets, sHit);
|
||||
|
||||
for (const target of applyTargets) {
|
||||
this.applyActualFriendlyEffect(target, kind, sAp, _cAttrsComp, config, sUp, _skillLv);
|
||||
this.applyActualFriendlyEffect(target, kind, sAp, _cAttrsComp, config, _skillLv);
|
||||
}
|
||||
}
|
||||
|
||||
private applyActualFriendlyEffect(target: HeroViewComp, kind: SkillKind, sAp: number, _cAttrsComp: HeroAttrsComp, config: SkillConfig, sUp: any, _skillLv: number = 1) {
|
||||
private applyActualFriendlyEffect(target: HeroViewComp, kind: SkillKind, sAp: number, _cAttrsComp: HeroAttrsComp, config: SkillConfig, _skillLv: number = 1) {
|
||||
if (!target.ent) return;
|
||||
const model = target.ent.get(HeroAttrsComp);
|
||||
if (!model || model.is_dead) return;
|
||||
@@ -482,8 +479,7 @@ export class SCastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
|
||||
const addShield = Math.max(0, Math.floor(sAp));
|
||||
model.add_shield(addShield);
|
||||
} else if (kind === SkillKind.Gold) {
|
||||
const baseGold = config.gold ?? config.ap;
|
||||
const addGold = baseGold + (sUp.ap * _skillLv);
|
||||
const addGold = config.gold ?? config.ap;
|
||||
if (addGold > 0) {
|
||||
MissionEconomy.addCoin(addGold);
|
||||
}
|
||||
@@ -507,16 +503,8 @@ export class SCastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
|
||||
return;
|
||||
}
|
||||
|
||||
const baseValue = config.ap;
|
||||
let upgradeValue = 0;
|
||||
|
||||
// 根据 buff 类型选择对应的升级加成
|
||||
if (config.buff_type === Attrs.ap) upgradeValue = sUp.buff_ap || 0;
|
||||
else if (config.buff_type === Attrs.hp_max) upgradeValue = sUp.buff_hp || 0;
|
||||
else if (config.buff_type === Attrs.critical) upgradeValue = sUp.crt || 0;
|
||||
// 如果后续有冰冻、击晕等,在这里加上对应的 sUp 字段即可,如 sUp.frz / sUp.stun
|
||||
|
||||
const totalBuffValue = baseValue + upgradeValue;
|
||||
// 永久 buff 的数值直接取 config.ap(已由 SkillConfig/SkillOverrides 提供最终值)
|
||||
const totalBuffValue = config.ap;
|
||||
|
||||
switch (config.buff_type) {
|
||||
case Attrs.ap:
|
||||
|
||||
Reference in New Issue
Block a user