Merge origin/card0614 into card0614

合并远程药水限时强化系统与本地驻场光环配置,保留双方
BuffSet 新增条目(7111-7113 战前强攻 + 7010-7019
玩家计时性强化)。
This commit is contained in:
pan
2026-07-24 10:26:04 +08:00
18 changed files with 9520 additions and 5356 deletions

View File

@@ -1,7 +1,6 @@
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { HeroDisVal, HeroInfo, HSkillInfo, HType, SkillTriggerType } from "../common/config/heroSet";
import { mLogger } from "../common/Logger";
import { Timer } from "db://oops-framework/core/common/timer/Timer";
import { FacSet, FightSet } from "../common/config/GameSet";
import { FieldSkillSet, FieldSkillType, SkillOverrides } from "../common/config/SkillSet";
import { smc } from "../common/SingletonModuleComp";
@@ -9,6 +8,11 @@ import { Attrs } from "../common/config/HeroAttrs";
import { FieldSkillHelper } from "./FieldSkillHelper";
import { BuffComp } from "./BuffComp";
import { BuffList, ModOp } from "../common/config/BuffSet";
import { buffManager } from "./BuffManager";
/** 控制类 buff 配置 id对应 BuffList */
const BUFF_ID_FROST = 7003;
const BUFF_ID_STUN = 7004;
@ecs.register('HeroAttrs')
export class HeroAttrsComp extends ecs.Comp {
public debugMode: boolean = false;
@@ -66,9 +70,6 @@ export class HeroAttrsComp extends ecs.Comp {
invincible_time: number = 0;// 无敌时间
frost_end_time: number = 0;
stun_end_time: number = 0;
boom: boolean = false; // 自爆怪
// ==================== 脏标签标记 ====================
@@ -108,8 +109,6 @@ export class HeroAttrsComp extends ecs.Comp {
* 从 HeroInfo 读取初始配置,建立属性系统
*/
initAttrs() {
this.frost_end_time = 0;
this.stun_end_time = 0;
}
/*******************基础属性管理********************/
@@ -169,14 +168,16 @@ export class HeroAttrsComp extends ecs.Comp {
}
/** 施加冰冻:委托 buffManager 写入 BuffCompduration = FROST_TIME * time */
toFrost(time: number = 1) {
const frostTime = FightSet.FROST_TIME * time;
this.frost_end_time = Math.max(this.frost_end_time, frostTime);
if (!this.ent) return;
buffManager.applyBuff(this.ent, BUFF_ID_FROST, 0, 0, { duration: FightSet.FROST_TIME * time });
}
/** 施加击晕:委托 buffManager 写入 BuffComp并清零技能 CD */
toStun(time: number = 1) {
const stunTime = FightSet.STUN_TIME * time;
this.stun_end_time = Math.max(this.stun_end_time, stunTime);
if (!this.ent) return;
buffManager.applyBuff(this.ent, BUFF_ID_STUN, 0, 0, { duration: FightSet.STUN_TIME * time });
// 击晕时 CD 清零
for (const key in this.skills) {
@@ -217,11 +218,13 @@ export class HeroAttrsComp extends ecs.Comp {
skill.ccd = Math.min(actualCd, skill.ccd + dt);
}
}
/** 是否处于冰冻状态(统一走 BuffComp 判定) */
isFrost(): boolean {
return this.frost_end_time > 0
return !!this.ent && buffManager.hasControl(this.ent, 'frost');
}
/** 是否处于击晕状态(统一走 BuffComp 判定) */
isStun(): boolean {
return this.stun_end_time > 0
return !!this.ent && buffManager.hasControl(this.ent, 'stun');
}
getSkillLevel(skillId: number): number {
if (!skillId) return 0;
@@ -350,14 +353,17 @@ export class HeroAttrsComp extends ecs.Comp {
if (!cfg || !cfg.modifiers) return;
// 每层独立贡献,模拟叠层放大效果
for (let i = 0; i < layers.length; i++) {
const layerVal = layers[i].value_override; // 药水卡覆写值优先
for (const mod of cfg.modifiers) {
if (mod.attr !== attr) continue;
const value = layerVal !== undefined ? layerVal : mod.value;
mLogger.log(this.debugMode, "HeroAttrs", `aggregateTimedMods 命中: ${this.hero_name} buff=${cfg.name} attr=${attr} op=${mod.op} value=${value} remaining=${layers[i].remaining.toFixed(1)}`);
if (mod.op === ModOp.Flat) {
result.flatSum += mod.value;
result.flatSum += value;
} else {
// PercentAdd 与 PercentMul 暂统一按加法百分比聚合;
// PercentMul 真正的独立乘区尚未启用TODO: 启用时需改造为多乘区连乘
result.pctSum += mod.value;
result.pctSum += value;
}
}
}
@@ -372,7 +378,11 @@ export class HeroAttrsComp extends ecs.Comp {
public getFinalAp(): number {
const runtimeAp = this.getRuntimeAp(this.ap);
const mods = this.aggregateTimedMods(Attrs.ap);
return (runtimeAp + mods.flatSum) * (1 + mods.pctSum / 100);
const final = (runtimeAp + mods.flatSum) * (1 + mods.pctSum / 100);
if (this.debugMode && (mods.flatSum !== 0 || mods.pctSum !== 0)) {
mLogger.log(this.debugMode, "HeroAttrs", `getFinalAp: ${this.hero_name} base=${this.ap} runtime=${runtimeAp.toFixed(1)} flat=${mods.flatSum} pct=${mods.pctSum} final=${final.toFixed(1)}`);
}
return final;
}
/**
@@ -471,7 +481,9 @@ export class HeroAttrsComp extends ecs.Comp {
const skill = this.skills[skillId];
if (!skill) return 0;
if (skill.cd <= 0) return 0;
const speedBonus = this.getRuntimeAttackSpeedBonus();
// 攻速 = 驻场加成 + 计时性 buff 修饰speed 属性的 flat/pct 均按攻速百分点处理)
const timedMods = this.aggregateTimedMods(Attrs.speed);
const speedBonus = this.getRuntimeAttackSpeedBonus() + timedMods.flatSum + timedMods.pctSum;
if (speedBonus <= 0) return skill.cd;
const speedRate = 1 + speedBonus / 100;
return Math.max(HeroAttrsComp.minAttackCd, skill.cd / speedRate);
@@ -549,9 +561,6 @@ export class HeroAttrsComp extends ecs.Comp {
this.wfuny = 0;
this.boom = false;
this.frost_end_time = 0;
this.stun_end_time = 0;
// 重置技能距离缓存
this.maxSkillDistance = 0;
this.minSkillDistance = 0;
@@ -580,32 +589,5 @@ export class HeroAttrsComp extends ecs.Comp {
}
}
@ecs.register('HeroBuffSystem')
export class HeroBuffSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate {
private timer = new Timer(0.1)
filter(): ecs.IMatcher {
return ecs.allOf(HeroAttrsComp);
}
update(e: ecs.Entity): void {
if (this.timer.update(this.dt)) {
const attrsComp = e.get(HeroAttrsComp);
if (attrsComp.frost_end_time > 0) {
attrsComp.frost_end_time -= 0.1;
if (attrsComp.frost_end_time <= 0) {
attrsComp.frost_end_time = 0;
}
}
if (attrsComp.stun_end_time > 0) {
attrsComp.stun_end_time -= 0.1;
if (attrsComp.stun_end_time <= 0) {
attrsComp.stun_end_time = 0;
}
}
}
void e;
}
}