feat: 实现药水卡限时强化功能,支持自定义数值覆写
1. 新增Buff数值覆写机制,支持药水卡自定义buff效果数值 2. 重构属性计算逻辑,支持读取药水卡传递的覆写值 3. 新增多组限时强化Buff与药水卡配置 4. 优化UI数值显示,实时展示最终属性值 5. 新增多维度调试日志方便排查问题
This commit is contained in:
@@ -28,6 +28,7 @@ import { SBox } from "./SBox";
|
||||
import { oops } from "db://oops-framework/core/Oops";
|
||||
import { GameEvent } from "../common/config/GameEvent";
|
||||
import { BoxSet } from "../common/config/GameSet";
|
||||
import { SkillOverrides } from "../common/config/SkillSet";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
/** 技能槽位数据结构 */
|
||||
@@ -73,6 +74,7 @@ export class MissSkillsComp extends CCComp {
|
||||
/** 注册事件监听 */
|
||||
onLoad() {
|
||||
oops.message.on(GameEvent.UseSkillCard, this.onUseSkillCard, this);
|
||||
oops.message.on(GameEvent.UseItemCard, this.onUseSkillCard, this);
|
||||
oops.message.on(GameEvent.RemoveSkillBox, this.onRemoveSkillBox, this);
|
||||
}
|
||||
|
||||
@@ -80,6 +82,7 @@ export class MissSkillsComp extends CCComp {
|
||||
onDestroy() {
|
||||
super.onDestroy();
|
||||
oops.message.off(GameEvent.UseSkillCard, this.onUseSkillCard, this);
|
||||
oops.message.off(GameEvent.UseItemCard, this.onUseSkillCard, this);
|
||||
oops.message.off(GameEvent.RemoveSkillBox, this.onRemoveSkillBox, this);
|
||||
}
|
||||
|
||||
@@ -138,10 +141,12 @@ export class MissSkillsComp extends CCComp {
|
||||
*/
|
||||
private onUseSkillCard(event: string, args: any) {
|
||||
const payload = args ?? event;
|
||||
const uuid = Number(payload?.uuid ?? 0);
|
||||
// 卡 uuid 仅用于查配置;真正施法用技能 id(payload.skill),缺省时退回 uuid(兼容技能卡直接用技能 id 的场景)
|
||||
const skillUuid = Number(payload?.skill ?? payload?.uuid ?? 0);
|
||||
const card_lv = Math.max(1, Math.floor(Number(payload?.card_lv ?? 1)));
|
||||
if (!uuid) return;
|
||||
this.addSkill(uuid, card_lv);
|
||||
if (!skillUuid) return;
|
||||
// 药水/技能卡的 overrides(含 buff_value)需透传到技能实体
|
||||
this.addSkill(skillUuid, card_lv, payload?.overrides);
|
||||
}
|
||||
|
||||
start() {
|
||||
@@ -157,7 +162,7 @@ export class MissSkillsComp extends CCComp {
|
||||
* @param uuid 技能 UUID
|
||||
* @param card_lv 技能卡等级
|
||||
*/
|
||||
addSkill(uuid: number, card_lv: number) {
|
||||
addSkill(uuid: number, card_lv: number, overrides?: SkillOverrides) {
|
||||
if (!this.skill_box) {
|
||||
mLogger.error(this.debugMode, "MissSkillsComp", "skill_box prefab not set");
|
||||
return;
|
||||
@@ -174,7 +179,7 @@ export class MissSkillsComp extends CCComp {
|
||||
// 使用 ECS 实体创建技能节点
|
||||
let sbox = ecs.getEntity<SBox>(SBox);
|
||||
let pos = new Vec3(this.slots[emptyIndex].x, this.slots[emptyIndex].y, 0);
|
||||
let node = sbox.load(uuid, card_lv, pos, this.skill_box);
|
||||
let node = sbox.load(uuid, card_lv, pos, this.skill_box, overrides);
|
||||
|
||||
this.slots[emptyIndex].used = true;
|
||||
this.slots[emptyIndex].node = node;
|
||||
|
||||
Reference in New Issue
Block a user