Compare commits
5 Commits
18cbc1c75c
...
15c771c58c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
15c771c58c | ||
|
|
9adff47e6a | ||
|
|
5c81227169 | ||
|
|
f00b9496e2 | ||
|
|
612bcee5a1 |
@@ -7,7 +7,6 @@ import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/O
|
||||
import { GameEvent } from "./config/GameEvent";
|
||||
import { GameScoreStats } from "./config/HeroAttrs";
|
||||
import { mLogger } from "./Logger";
|
||||
import { TalentType } from "./config/TalentSet";
|
||||
import { gameDataSync } from "./GameDataSync";
|
||||
import { FightSet } from "./config/GameSet";
|
||||
|
||||
@@ -18,12 +17,6 @@ import { FightSet } from "./config/GameSet";
|
||||
export interface GameDate {
|
||||
gold: number,
|
||||
timestamp?: number, // 用于比对本地与云端数据的最新状态
|
||||
collection?: {
|
||||
talents: Record<TalentType, number>,
|
||||
player_level: number,
|
||||
player_exp: number,
|
||||
talent_points?: number,
|
||||
}
|
||||
}
|
||||
export interface CloudData {
|
||||
openid: string;
|
||||
@@ -65,30 +58,6 @@ export class SingletonModuleComp extends ecs.Comp {
|
||||
guides: any = [0, 0, 0, 0, 0]
|
||||
current_guide: number = 0
|
||||
|
||||
collection: {
|
||||
talents: Record<TalentType, number>;
|
||||
player_level: number;
|
||||
player_exp: number;
|
||||
talent_points?: number;
|
||||
} = {
|
||||
talents: {
|
||||
[TalentType.Attack]: 0,
|
||||
[TalentType.Hp]: 0,
|
||||
[TalentType.Critical]: 0,
|
||||
[TalentType.WindFury]: 0,
|
||||
[TalentType.Freeze]: 0,
|
||||
[TalentType.Puncture]: 0,
|
||||
[TalentType.DeadTrigger]: 0,
|
||||
[TalentType.Summon]: 0,
|
||||
[TalentType.BuyDiscount]: 0,
|
||||
[TalentType.RefreshDiscount]: 0,
|
||||
[TalentType.SellBonus]: 0
|
||||
}, // 存储各个天赋的等级: { talent_id: level }
|
||||
player_level: 1, // 玩家等级
|
||||
player_exp: 0, // 玩家当前经验
|
||||
talent_points: 0, // 兼容旧存档的历史字段
|
||||
};
|
||||
|
||||
vmdata: any = {
|
||||
game_over: false,
|
||||
game_pause: false,
|
||||
@@ -249,16 +218,6 @@ export class SingletonModuleComp extends ecs.Comp {
|
||||
if (data.gold !== undefined) {
|
||||
this.vmdata.gold = data.gold;
|
||||
}
|
||||
// 恢复收集记录
|
||||
if (data.collection) {
|
||||
const remoteCol = data.collection;
|
||||
if (remoteCol.talents) {
|
||||
Object.assign(this.collection.talents, remoteCol.talents);
|
||||
}
|
||||
if (typeof remoteCol.player_level === 'number') this.collection.player_level = remoteCol.player_level;
|
||||
if (typeof remoteCol.player_exp === 'number') this.collection.player_exp = remoteCol.player_exp;
|
||||
if (typeof remoteCol.talent_points === 'number') this.collection.talent_points = remoteCol.talent_points;
|
||||
}
|
||||
}
|
||||
|
||||
// 触发UI更新
|
||||
@@ -271,7 +230,6 @@ export class SingletonModuleComp extends ecs.Comp {
|
||||
getGameDate() {
|
||||
let data: GameDate = {
|
||||
gold: this.vmdata.gold,
|
||||
collection: this.collection,
|
||||
timestamp: Date.now() // 每次获取当前数据结构时都附带最新的时间戳
|
||||
};
|
||||
return data;
|
||||
|
||||
@@ -33,7 +33,7 @@ export enum SkillKind {
|
||||
|
||||
|
||||
//受伤动画名称
|
||||
export enum AtkedName {
|
||||
export enum AtkedName {
|
||||
atked = "atked",
|
||||
ice = "atked_ice",
|
||||
fire = "atked_fire",
|
||||
@@ -49,7 +49,7 @@ export enum RType {
|
||||
fixedEnd = 3, //固定终点
|
||||
}
|
||||
//EType 只负责动画什么时候结束,碰撞体什么时候消失不管,但是消失前一定要关闭碰撞体
|
||||
export enum EType {
|
||||
export enum EType {
|
||||
animationEnd = 0, //碰撞够也不消失,动画结束才消失
|
||||
timeEnd = 1, //碰撞够也不消失,时间到才消失
|
||||
collision = 2, //碰撞次数够就消失
|
||||
@@ -87,73 +87,73 @@ export enum EType {
|
||||
- speed: 移动速度
|
||||
- cost: 消耗值
|
||||
*/
|
||||
export enum DType {
|
||||
ATK= 0, // 物理
|
||||
ICE=1, // 冰元素
|
||||
FIRE=2, // 火元素
|
||||
WIND=3, // 风元素
|
||||
export enum DType {
|
||||
ATK = 0, // 物理
|
||||
ICE = 1, // 冰元素
|
||||
FIRE = 2, // 火元素
|
||||
WIND = 3, // 风元素
|
||||
}
|
||||
|
||||
export enum IType {
|
||||
export enum IType {
|
||||
Melee = 0, // 近战
|
||||
remote = 1, // 远程
|
||||
support = 2, // 辅助
|
||||
}
|
||||
export const HeroSkillList = [6001,6001,6001,6001,6001,6001]
|
||||
export const HeroSkillList = [6001, 6001, 6001, 6001, 6001, 6001]
|
||||
|
||||
// Debuff配置接口
|
||||
// (已被废弃,采用平铺字段 buff_type 和 buff_value 代替)
|
||||
|
||||
interface IReady {
|
||||
uuid:number,
|
||||
uuid: number,
|
||||
loop: boolean,
|
||||
SkillTime: number,// 技能控制存续时间时间
|
||||
ReadyTime: number,// 技能前摇时间
|
||||
RType: number, //技能运行类型 0-线性 1-贝塞尔 2-开始位置固定 3-目标位置固定
|
||||
ready_y: number,
|
||||
path:string,
|
||||
path: string,
|
||||
}
|
||||
|
||||
interface IEndAnm {
|
||||
uuid:number,
|
||||
path:string,
|
||||
loop:boolean,
|
||||
time:number,
|
||||
uuid: number,
|
||||
path: string,
|
||||
loop: boolean,
|
||||
time: number,
|
||||
}
|
||||
// 技能配置接口 - 按照6001格式排列
|
||||
export interface SkillConfig {
|
||||
uuid:number, // 技能唯一ID
|
||||
name:string, // 技能名称
|
||||
sp_name:string, // 特效名称
|
||||
icon:string, // 图标ID
|
||||
TGroup:TGroup, // 目标群体(敌方/友方/自身等)
|
||||
act:string, // 角色执行的动画
|
||||
DTType:DTType, // 伤害类型(单体/范围)
|
||||
ap:number, // 伤害/治疗技能为攻击百分比,护盾技能为免疫次数
|
||||
gold?:number, // 获取金币技能的金币值
|
||||
hit_count:number, // 可命中次数
|
||||
hitcd:number, // 持续伤害的伤害间隔(秒)
|
||||
speed:number, // 移动速度
|
||||
with:number, // 宽度(暂时无用)
|
||||
ready:number, // 前摇时间
|
||||
readyAnm:string, // 前摇动画名称
|
||||
endAnm:string, // 结束动画名称
|
||||
EAnm:number, // 结束动画ID
|
||||
DAnm:string, // 命中后动画ID
|
||||
IType:IType, // 技能类型(近战/远程/辅助)
|
||||
RType:RType, // 技能运行类型(直线/贝塞尔/固定起点/固定终点)
|
||||
EType:EType, // 结束条件(动画结束/时间结束/距离结束/碰撞/次数结束)
|
||||
bezier_start_y?:number, // 贝塞尔起始抬升高度
|
||||
bezier_mid_y?:number, // 贝塞尔中间高度增量
|
||||
bezier_arc?:number, // 贝塞尔弧度系数
|
||||
time?:number, // timeEnd 持续时间(秒)
|
||||
kind?:SkillKind, // 主效果类型
|
||||
crt?:number, // 额外暴击率
|
||||
frz?:number, // 额外冰冻概率
|
||||
bck?:number, // 额外击退概率
|
||||
buff_type?:Attrs, // Buff 类型 (单一职责)
|
||||
call_hero?:number, // 召唤技能召唤英雄id(可选)
|
||||
info:string, // 技能描述
|
||||
uuid: number, // 技能唯一ID
|
||||
name: string, // 技能名称
|
||||
sp_name: string, // 特效名称
|
||||
icon: string, // 图标ID
|
||||
TGroup: TGroup, // 目标群体(敌方/友方/自身等)
|
||||
act: string, // 角色执行的动画
|
||||
DTType: DTType, // 伤害类型(单体/范围)
|
||||
ap: number, // 伤害/治疗技能为攻击百分比,护盾技能为免疫次数
|
||||
gold?: number, // 获取金币技能的金币值
|
||||
hit_count: number, // 可命中次数
|
||||
hitcd: number, // 持续伤害的伤害间隔(秒)
|
||||
speed: number, // 移动速度
|
||||
with: number, // 宽度(暂时无用)
|
||||
ready: number, // 前摇时间
|
||||
readyAnm: string, // 前摇动画名称
|
||||
endAnm: string, // 结束动画名称
|
||||
EAnm: number, // 结束动画ID
|
||||
DAnm: string, // 命中后动画ID
|
||||
IType: IType, // 技能类型(近战/远程/辅助)
|
||||
RType: RType, // 技能运行类型(直线/贝塞尔/固定起点/固定终点)
|
||||
EType: EType, // 结束条件(动画结束/时间结束/距离结束/碰撞/次数结束)
|
||||
bezier_start_y?: number, // 贝塞尔起始抬升高度
|
||||
bezier_mid_y?: number, // 贝塞尔中间高度增量
|
||||
bezier_arc?: number, // 贝塞尔弧度系数
|
||||
time?: number, // timeEnd 持续时间(秒)
|
||||
kind?: SkillKind, // 主效果类型
|
||||
crt?: number, // 额外暴击率
|
||||
frz?: number, // 额外冰冻概率
|
||||
bck?: number, // 额外击退概率
|
||||
buff_type?: Attrs, // Buff 类型 (单一职责)
|
||||
call_hero?: number, // 召唤技能召唤英雄id(可选)
|
||||
info: string, // 技能描述
|
||||
}
|
||||
|
||||
export interface SkillOverrides {
|
||||
@@ -183,7 +183,7 @@ export function mergeSkillParams(config: SkillConfig, overrides?: SkillOverrides
|
||||
}
|
||||
|
||||
export const SkillUpList = {
|
||||
1001:{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 }
|
||||
}
|
||||
|
||||
/******
|
||||
@@ -196,162 +196,162 @@ export const SkillUpList = {
|
||||
export const SkillSet: Record<number, SkillConfig> = {
|
||||
// ========== 基础技能 ==========
|
||||
6001: {
|
||||
uuid:6001,name:"普通攻击",sp_name:"atk",icon:"1026",TGroup:TGroup.Enemy,readyAnm:"",endAnm:"",act:"atk",
|
||||
DTType:DTType.single,ap:100,hit_count:1,hitcd:0.2,speed:720,with:0,ready:0.2,EAnm:0,DAnm:"",IType:IType.Melee,
|
||||
RType:RType.linear,EType:EType.collision,info:"造成攻击力100%的伤害",
|
||||
uuid: 6001, name: "普通攻击", sp_name: "atk", icon: "1026", TGroup: TGroup.Enemy, readyAnm: "", endAnm: "", act: "atk",
|
||||
DTType: DTType.single, ap: 100, hit_count: 1, hitcd: 0.2, speed: 720, with: 0, ready: 0.2, EAnm: 0, DAnm: "", IType: IType.Melee,
|
||||
RType: RType.linear, EType: EType.collision, info: "造成攻击力100%的伤害",
|
||||
},
|
||||
6002: {
|
||||
uuid:6002,name:"光箭蓝",sp_name:"atk_c1",icon:"1126",TGroup:TGroup.Enemy,readyAnm:"",endAnm:"",act:"atk",
|
||||
DTType:DTType.single,ap:100,hit_count:1,hitcd:0.3,speed:720,with:90,ready:0.2,EAnm:0,DAnm:"",IType:IType.remote,
|
||||
RType:RType.bezier,EType:EType.collision,info:"近战普通攻击技能",
|
||||
uuid: 6002, name: "光箭蓝", sp_name: "atk_c1", icon: "1126", TGroup: TGroup.Enemy, readyAnm: "", endAnm: "", act: "atk",
|
||||
DTType: DTType.single, ap: 100, hit_count: 1, hitcd: 0.3, speed: 720, with: 90, ready: 0.2, EAnm: 0, DAnm: "", IType: IType.remote,
|
||||
RType: RType.bezier, EType: EType.collision, info: "近战普通攻击技能",
|
||||
},
|
||||
6003: {
|
||||
uuid:6003,name:"光箭红",sp_name:"atk_c2",icon:"1126",TGroup:TGroup.Enemy,readyAnm:"",endAnm:"",act:"atk",
|
||||
DTType:DTType.single,ap:100,hit_count:1,hitcd:0.3,speed:720,with:90,ready:0.2,EAnm:0,DAnm:"",IType:IType.remote,
|
||||
RType:RType.bezier,EType:EType.collision,info:"一定几率暴击",
|
||||
uuid: 6003, name: "光箭红", sp_name: "atk_c2", icon: "1126", TGroup: TGroup.Enemy, readyAnm: "", endAnm: "", act: "atk",
|
||||
DTType: DTType.single, ap: 100, hit_count: 1, hitcd: 0.3, speed: 720, with: 90, ready: 0.2, EAnm: 0, DAnm: "", IType: IType.remote,
|
||||
RType: RType.bezier, EType: EType.collision, info: "一定几率暴击",
|
||||
},
|
||||
6004: {
|
||||
uuid:6004,name:"光箭绿",sp_name:"atk_c3",icon:"1126",TGroup:TGroup.Enemy,readyAnm:"",endAnm:"",act:"atk",
|
||||
DTType:DTType.single,ap:100,hit_count:1,hitcd:0.3,speed:720,with:90,ready:0.2,EAnm:0,DAnm:"",IType:IType.remote,
|
||||
RType:RType.bezier,EType:EType.collision,info:"一定几率击退目标",
|
||||
uuid: 6004, name: "光箭绿", sp_name: "atk_c3", icon: "1126", TGroup: TGroup.Enemy, readyAnm: "", endAnm: "", act: "atk",
|
||||
DTType: DTType.single, ap: 100, hit_count: 1, hitcd: 0.3, speed: 720, with: 90, ready: 0.2, EAnm: 0, DAnm: "", IType: IType.remote,
|
||||
RType: RType.bezier, EType: EType.collision, info: "一定几率击退目标",
|
||||
},
|
||||
//怪物战士类型统一使用 6005
|
||||
6005: {
|
||||
uuid:6005,name:"光箭深红",sp_name:"atk_c4",icon:"1126",TGroup:TGroup.Enemy,readyAnm:"",endAnm:"",act:"atk",
|
||||
DTType:DTType.single,ap:100,hit_count:1,hitcd:0.3,speed:720,with:90,ready:0.2,EAnm:0,DAnm:"",IType:IType.remote,
|
||||
RType:RType.bezier,EType:EType.collision,info:"一定几率击退目标",
|
||||
uuid: 6005, name: "光箭深红", sp_name: "atk_c4", icon: "1126", TGroup: TGroup.Enemy, readyAnm: "", endAnm: "", act: "atk",
|
||||
DTType: DTType.single, ap: 100, hit_count: 1, hitcd: 0.3, speed: 720, with: 90, ready: 0.2, EAnm: 0, DAnm: "", IType: IType.remote,
|
||||
RType: RType.bezier, EType: EType.collision, info: "一定几率击退目标",
|
||||
},
|
||||
6006: {
|
||||
uuid:6006,name:"光箭灰白",sp_name:"atk_c5",icon:"1126",TGroup:TGroup.Enemy,readyAnm:"",endAnm:"",act:"atk",
|
||||
DTType:DTType.single,ap:100,hit_count:1,hitcd:0.3,speed:720,with:90,ready:0.2,EAnm:0,DAnm:"",IType:IType.remote,
|
||||
RType:RType.bezier,EType:EType.collision,info:"一定几率击退目标",
|
||||
uuid: 6006, name: "光箭灰白", sp_name: "atk_c5", icon: "1126", TGroup: TGroup.Enemy, readyAnm: "", endAnm: "", act: "atk",
|
||||
DTType: DTType.single, ap: 100, hit_count: 1, hitcd: 0.3, speed: 720, with: 90, ready: 0.2, EAnm: 0, DAnm: "", IType: IType.remote,
|
||||
RType: RType.bezier, EType: EType.collision, info: "一定几率击退目标",
|
||||
},
|
||||
6007: {
|
||||
uuid:6007,name:"水球",sp_name:"ball_water",icon:"1126",TGroup:TGroup.Enemy,readyAnm:"",endAnm:"",act:"atk",
|
||||
DTType:DTType.single,ap:100,hit_count:1,hitcd:0.3,speed:720,with:90,ready:0.2,EAnm:0,DAnm:"",IType:IType.remote,
|
||||
RType:RType.bezier,EType:EType.collision,info:"一定几率冰冻目标",
|
||||
uuid: 6007, name: "水球", sp_name: "ball_water", icon: "1126", TGroup: TGroup.Enemy, readyAnm: "", endAnm: "", act: "atk",
|
||||
DTType: DTType.single, ap: 100, hit_count: 1, hitcd: 0.3, speed: 720, with: 90, ready: 0.2, EAnm: 0, DAnm: "", IType: IType.remote,
|
||||
RType: RType.bezier, EType: EType.collision, info: "一定几率冰冻目标",
|
||||
},
|
||||
6008: {
|
||||
uuid:6008,name:"箭矢",sp_name:"arrow",icon:"1135",TGroup:TGroup.Enemy,readyAnm:"",endAnm:"",act:"atk",
|
||||
DTType:DTType.single,ap:100,hit_count:1,hitcd:0.2,speed:720,with:0,ready:0.2,EAnm:0,DAnm:"",IType:IType.remote,
|
||||
RType:RType.bezier,EType:EType.collision,bezier_start_y:20,bezier_mid_y:140,bezier_arc:1.05,info:"造成攻击力100%的伤害",
|
||||
uuid: 6008, name: "箭矢", sp_name: "arrow", icon: "1135", TGroup: TGroup.Enemy, readyAnm: "", endAnm: "", act: "atk",
|
||||
DTType: DTType.single, ap: 100, hit_count: 1, hitcd: 0.2, speed: 720, with: 0, ready: 0.2, EAnm: 0, DAnm: "", IType: IType.remote,
|
||||
RType: RType.bezier, EType: EType.collision, bezier_start_y: 20, bezier_mid_y: 140, bezier_arc: 1.05, info: "造成攻击力100%的伤害",
|
||||
},
|
||||
6009: {
|
||||
uuid:6009,name:"箭矢蓝",sp_name:"arrow_blue",icon:"1135",TGroup:TGroup.Enemy,readyAnm:"",endAnm:"",act:"atk",
|
||||
DTType:DTType.single,ap:100,hit_count:1,hitcd:0.2,speed:720,with:0,ready:0.2,EAnm:0,DAnm:"",IType:IType.remote,
|
||||
RType:RType.bezier,EType:EType.collision,bezier_start_y:20,bezier_mid_y:140,bezier_arc:1.05,info:"造成攻击力100%的伤害",
|
||||
uuid: 6009, name: "箭矢蓝", sp_name: "arrow_blue", icon: "1135", TGroup: TGroup.Enemy, readyAnm: "", endAnm: "", act: "atk",
|
||||
DTType: DTType.single, ap: 100, hit_count: 1, hitcd: 0.2, speed: 720, with: 0, ready: 0.2, EAnm: 0, DAnm: "", IType: IType.remote,
|
||||
RType: RType.bezier, EType: EType.collision, bezier_start_y: 20, bezier_mid_y: 140, bezier_arc: 1.05, info: "造成攻击力100%的伤害",
|
||||
},
|
||||
6010: {
|
||||
uuid:6010,name:"箭矢红",sp_name:"arrow_red",icon:"1135",TGroup:TGroup.Enemy,readyAnm:"",endAnm:"",act:"atk",
|
||||
DTType:DTType.single,ap:100,hit_count:1,hitcd:0.2,speed:720,with:0,ready:0.2,EAnm:0,DAnm:"",IType:IType.remote,
|
||||
RType:RType.bezier,EType:EType.collision,bezier_start_y:20,bezier_mid_y:140,bezier_arc:1.05,info:"造成攻击力100%的伤害",
|
||||
uuid: 6010, name: "箭矢红", sp_name: "arrow_red", icon: "1135", TGroup: TGroup.Enemy, readyAnm: "", endAnm: "", act: "atk",
|
||||
DTType: DTType.single, ap: 100, hit_count: 1, hitcd: 0.2, speed: 720, with: 0, ready: 0.2, EAnm: 0, DAnm: "", IType: IType.remote,
|
||||
RType: RType.bezier, EType: EType.collision, bezier_start_y: 20, bezier_mid_y: 140, bezier_arc: 1.05, info: "造成攻击力100%的伤害",
|
||||
},
|
||||
|
||||
6101: {
|
||||
uuid:6101,name:"火球",sp_name:"ball_fire",icon:"1126",TGroup:TGroup.Enemy,readyAnm:"",endAnm:"",act:"atk",
|
||||
DTType:DTType.single,frz:0,ap:100,hit_count:1,hitcd:0.3,speed:720,with:90,ready:0.2,EAnm:0,DAnm:"",IType:IType.remote,
|
||||
RType:RType.linear,EType:EType.collision,info:"造成攻击力100%的伤害,一定几率暴击,高阶技能",
|
||||
uuid: 6101, name: "火球", sp_name: "ball_fire", icon: "1126", TGroup: TGroup.Enemy, readyAnm: "", endAnm: "", act: "atk",
|
||||
DTType: DTType.single, frz: 0, ap: 100, hit_count: 1, hitcd: 0.3, speed: 720, with: 90, ready: 0.2, EAnm: 0, DAnm: "", IType: IType.remote,
|
||||
RType: RType.linear, EType: EType.collision, info: "造成攻击力100%的伤害,一定几率暴击,高阶技能",
|
||||
},
|
||||
6102: {
|
||||
uuid:6102,name:"龙卷风",sp_name:"ball_winds",icon:"1126",TGroup:TGroup.Enemy,readyAnm:"",endAnm:"",act:"atk",
|
||||
DTType:DTType.single,ap:100,hit_count:1,hitcd:0.3,speed:720,with:90,ready:0.2,EAnm:0,DAnm:"",IType:IType.remote,
|
||||
RType:RType.linear,EType:EType.collision,info:"造成攻击力100%的伤害,一定几率击退目标,高阶技能",
|
||||
uuid: 6102, name: "龙卷风", sp_name: "ball_winds", icon: "1126", TGroup: TGroup.Enemy, readyAnm: "", endAnm: "", act: "atk",
|
||||
DTType: DTType.single, ap: 100, hit_count: 1, hitcd: 0.3, speed: 720, with: 90, ready: 0.2, EAnm: 0, DAnm: "", IType: IType.remote,
|
||||
RType: RType.linear, EType: EType.collision, info: "造成攻击力100%的伤害,一定几率击退目标,高阶技能",
|
||||
},
|
||||
//怪物法师统一使用 暗影球
|
||||
6103: {
|
||||
uuid:6103,name:"暗影球",sp_name:"ball_zi",icon:"1126",TGroup:TGroup.Enemy,readyAnm:"",endAnm:"",act:"atk",
|
||||
DTType:DTType.single,ap:100,hit_count:1,hitcd:0.3,speed:720,with:90,ready:0.2,EAnm:0,DAnm:"",IType:IType.remote,
|
||||
RType:RType.linear,EType:EType.collision,info:"造成攻击力100%的伤害,一定几率上毒(后期加入),高阶技能 ",
|
||||
},
|
||||
6103: {
|
||||
uuid: 6103, name: "暗影球", sp_name: "ball_zi", icon: "1126", TGroup: TGroup.Enemy, readyAnm: "", endAnm: "", act: "atk",
|
||||
DTType: DTType.single, ap: 100, hit_count: 1, hitcd: 0.3, speed: 720, with: 90, ready: 0.2, EAnm: 0, DAnm: "", IType: IType.remote,
|
||||
RType: RType.linear, EType: EType.collision, info: "造成攻击力100%的伤害,一定几率上毒(后期加入),高阶技能 ",
|
||||
},
|
||||
6104: {
|
||||
uuid:6104,name:"穿云箭",sp_name:"arrow_big_yellow",icon:"1135",TGroup:TGroup.Enemy,readyAnm:"yellow",endAnm:"",act:"max",
|
||||
DTType:DTType.single,crt:20,ap:100,hit_count:6,hitcd:0.2,speed:720,with:0,ready:0.2,EAnm:0,DAnm:"",IType:IType.remote,
|
||||
RType:RType.linear,EType:EType.collision,info:"射出强力箭矢,最多穿透6个敌人,附带20%额外暴击率",
|
||||
uuid: 6104, name: "穿云箭", sp_name: "arrow_big_yellow", icon: "1135", TGroup: TGroup.Enemy, readyAnm: "yellow", endAnm: "", act: "max",
|
||||
DTType: DTType.single, crt: 20, ap: 100, hit_count: 6, hitcd: 0.2, speed: 720, with: 0, ready: 0.2, EAnm: 0, DAnm: "", IType: IType.remote,
|
||||
RType: RType.linear, EType: EType.collision, info: "射出强力箭矢,最多穿透6个敌人,附带20%额外暴击率",
|
||||
},
|
||||
6105: {
|
||||
uuid:6105,name:"冰刺",sp_name:"ice_up",icon:"1173",TGroup:TGroup.Enemy,readyAnm:"blues",endAnm:"",act:"max",
|
||||
DTType:DTType.range,frz:0,ap:150,hit_count:6,hitcd:0.2,speed:720,with:0,ready:0.2,EAnm:0,DAnm:"",IType:IType.remote,
|
||||
RType:RType.fixedEnd,EType:EType.animationEnd,info:"召唤冰刺攻击一排的敌人,有概率冰冻",
|
||||
uuid: 6105, name: "冰刺", sp_name: "ice_up", icon: "1173", TGroup: TGroup.Enemy, readyAnm: "blues", endAnm: "", act: "max",
|
||||
DTType: DTType.range, frz: 0, ap: 150, hit_count: 6, hitcd: 0.2, speed: 720, with: 0, ready: 0.2, EAnm: 0, DAnm: "", IType: IType.remote,
|
||||
RType: RType.fixedEnd, EType: EType.animationEnd, info: "召唤冰刺攻击一排的敌人,有概率冰冻",
|
||||
},
|
||||
6106: {
|
||||
uuid:6106,name:"冰推",sp_name:"ice_t",icon:"1173",TGroup:TGroup.Enemy,readyAnm:"blues",endAnm:"",act:"max",
|
||||
DTType:DTType.range,frz:0,ap:150,hit_count:6,hitcd:0.2,speed:720,with:0,ready:0.2,EAnm:0,DAnm:"",IType:IType.remote,
|
||||
RType:RType.fixed,EType:EType.animationEnd,info:"召唤冰墙阻挡敌人,有概率冰冻,100%击退",
|
||||
uuid: 6106, name: "冰推", sp_name: "ice_t", icon: "1173", TGroup: TGroup.Enemy, readyAnm: "blues", endAnm: "", act: "max",
|
||||
DTType: DTType.range, frz: 0, ap: 150, hit_count: 6, hitcd: 0.2, speed: 720, with: 0, ready: 0.2, EAnm: 0, DAnm: "", IType: IType.remote,
|
||||
RType: RType.fixed, EType: EType.animationEnd, info: "召唤冰墙阻挡敌人,有概率冰冻,100%击退",
|
||||
},
|
||||
6107: {
|
||||
uuid:6107,name:"陨石",sp_name:"fire_yuns",icon:"1173",TGroup:TGroup.Enemy,readyAnm:"reds",endAnm:"",act:"max",
|
||||
DTType:DTType.range,crt:20,ap:150,hit_count:6,hitcd:0.2,speed:720,with:0,ready:0.2,EAnm:0,DAnm:"",IType:IType.remote,
|
||||
RType:RType.fixedEnd,EType:EType.animationEnd,info:"召唤攻击敌人,造成攻击力150%的范围伤害,附带20%额外暴击率",
|
||||
uuid: 6107, name: "陨石", sp_name: "fire_yuns", icon: "1173", TGroup: TGroup.Enemy, readyAnm: "reds", endAnm: "", act: "max",
|
||||
DTType: DTType.range, crt: 20, ap: 150, hit_count: 6, hitcd: 0.2, speed: 720, with: 0, ready: 0.2, EAnm: 0, DAnm: "", IType: IType.remote,
|
||||
RType: RType.fixedEnd, EType: EType.animationEnd, info: "召唤攻击敌人,造成攻击力150%的范围伤害,附带20%额外暴击率",
|
||||
},
|
||||
|
||||
//============================= ====== 辅助技能 ====== ==========================
|
||||
6301:{
|
||||
uuid:6301,name:"护盾",sp_name:"buff_wind",icon:"1255",TGroup:TGroup.Self,readyAnm:"up_blue",endAnm:"",act:"atk",
|
||||
DTType:DTType.single,kind:SkillKind.Shield,ap:3,hit_count:1,hitcd:0.2,speed:720,with:0,ready:0.2,EAnm:0,DAnm:"",IType:IType.support,
|
||||
RType:RType.fixed,EType:EType.animationEnd,info:"为伙伴/自己添加护盾,可抵挡3次伤害",
|
||||
6301: {
|
||||
uuid: 6301, name: "护盾", sp_name: "buff_wind", icon: "1255", TGroup: TGroup.Self, readyAnm: "up_blue", endAnm: "", act: "atk",
|
||||
DTType: DTType.single, kind: SkillKind.Shield, ap: 3, hit_count: 1, hitcd: 0.2, speed: 720, with: 0, ready: 0.2, EAnm: 0, DAnm: "", IType: IType.support,
|
||||
RType: RType.fixed, EType: EType.animationEnd, info: "为伙伴/自己添加护盾,可抵挡3次伤害",
|
||||
},
|
||||
6302: {
|
||||
uuid:6302,name:"治疗",sp_name:"buff_wind",icon:"1292",TGroup:TGroup.Team,readyAnm:"up_green",endAnm:"",act:"atk",
|
||||
DTType:DTType.single,kind:SkillKind.Heal,ap:300,hit_count:1,hitcd:0.2,speed:720,with:0,ready:0.2,EAnm:0,DAnm:"",IType:IType.support,
|
||||
RType:RType.fixed,EType:EType.animationEnd,info:"治疗伙伴/自己",
|
||||
uuid: 6302, name: "治疗", sp_name: "buff_wind", icon: "1292", TGroup: TGroup.Team, readyAnm: "up_green", endAnm: "", act: "atk",
|
||||
DTType: DTType.single, kind: SkillKind.Heal, ap: 300, hit_count: 1, hitcd: 0.2, speed: 720, with: 0, ready: 0.2, EAnm: 0, DAnm: "", IType: IType.support,
|
||||
RType: RType.fixed, EType: EType.animationEnd, info: "治疗伙伴/自己",
|
||||
},
|
||||
6303: {
|
||||
uuid:6303,name:"获取金币",sp_name:"buff_wind",icon:"1255",TGroup:TGroup.Self,readyAnm:"up_blue",endAnm:"gold",act:"atk",
|
||||
DTType:DTType.single,kind:SkillKind.Gold,ap:0,gold:10,hit_count:1,hitcd:0.2,speed:720,with:0,ready:0.2,EAnm:0,DAnm:"",IType:IType.support,
|
||||
RType:RType.fixed,EType:EType.animationEnd,info:"增加一定数量的金币",
|
||||
uuid: 6303, name: "获取金币", sp_name: "buff_wind", icon: "1255", TGroup: TGroup.Self, readyAnm: "up_blue", endAnm: "gold", act: "atk",
|
||||
DTType: DTType.single, kind: SkillKind.Gold, ap: 0, gold: 10, hit_count: 1, hitcd: 0.2, speed: 720, with: 0, ready: 0.2, EAnm: 0, DAnm: "", IType: IType.support,
|
||||
RType: RType.fixed, EType: EType.animationEnd, info: "增加一定数量的金币",
|
||||
},
|
||||
//==========================buff 技能=====================
|
||||
6401:{
|
||||
uuid:6401,name:"攻击强化",sp_name:"buff_wind",icon:"1255",TGroup:TGroup.Team,readyAnm:"up_ap",endAnm:"",act:"atk",
|
||||
DTType:DTType.single,kind:SkillKind.Support,ap:5,hit_count:1,hitcd:0.2,speed:720,with:0,ready:0.2,EAnm:0,DAnm:"",IType:IType.support,
|
||||
RType:RType.fixed,EType:EType.animationEnd,buff_type:Attrs.ap,info:"全体友方攻击力提升5点,持续1次",
|
||||
6401: {
|
||||
uuid: 6401, name: "攻击强化", sp_name: "buff_wind", icon: "1255", TGroup: TGroup.Team, readyAnm: "up_ap", endAnm: "", act: "atk",
|
||||
DTType: DTType.single, kind: SkillKind.Support, ap: 5, hit_count: 1, hitcd: 0.2, speed: 720, with: 0, ready: 0.2, EAnm: 0, DAnm: "", IType: IType.support,
|
||||
RType: RType.fixed, EType: EType.animationEnd, buff_type: Attrs.ap, info: "全体友方攻击力提升5点,持续1次",
|
||||
},
|
||||
6402:{
|
||||
uuid:6402,name:"生命强化",sp_name:"buff_wind",icon:"1255",TGroup:TGroup.Team,readyAnm:"up_hp",endAnm:"",act:"atk",
|
||||
DTType:DTType.single,kind:SkillKind.Support,ap:20,hit_count:1,hitcd:0.2,speed:720,with:0,ready:0.2,EAnm:0,DAnm:"",IType:IType.support,
|
||||
RType:RType.fixed,EType:EType.animationEnd,buff_type:Attrs.hp_max,info:"全体友方最大生命值提升20点,持续1次",
|
||||
6402: {
|
||||
uuid: 6402, name: "生命强化", sp_name: "buff_wind", icon: "1255", TGroup: TGroup.Team, readyAnm: "up_hp", endAnm: "", act: "atk",
|
||||
DTType: DTType.single, kind: SkillKind.Support, ap: 20, hit_count: 1, hitcd: 0.2, speed: 720, with: 0, ready: 0.2, EAnm: 0, DAnm: "", IType: IType.support,
|
||||
RType: RType.fixed, EType: EType.animationEnd, buff_type: Attrs.hp_max, info: "全体友方最大生命值提升20点,持续1次",
|
||||
},
|
||||
6403:{
|
||||
uuid:6403,name:"暴击强化",sp_name:"buff_wind",icon:"1255",TGroup:TGroup.Team,readyAnm:"up_ap",endAnm:"",act:"atk",
|
||||
DTType:DTType.single,kind:SkillKind.Support,ap:1,hit_count:1,hitcd:0.2,speed:720,with:0,ready:0.2,EAnm:0,DAnm:"",IType:IType.support,
|
||||
RType:RType.fixed,EType:EType.animationEnd,buff_type:Attrs.critical,info:"全体友方暴击率提升10%,持续1次",
|
||||
6403: {
|
||||
uuid: 6403, name: "暴击强化", sp_name: "buff_wind", icon: "1255", TGroup: TGroup.Team, readyAnm: "up_ap", endAnm: "", act: "atk",
|
||||
DTType: DTType.single, kind: SkillKind.Support, ap: 1, hit_count: 1, hitcd: 0.2, speed: 720, with: 0, ready: 0.2, EAnm: 0, DAnm: "", IType: IType.support,
|
||||
RType: RType.fixed, EType: EType.animationEnd, buff_type: Attrs.critical, info: "全体友方暴击率提升10%,持续1次",
|
||||
},
|
||||
6404:{
|
||||
uuid:6404,name:"暴伤强化",sp_name:"buff_wind",icon:"1255",TGroup:TGroup.Team,readyAnm:"up_ap",endAnm:"",act:"atk",
|
||||
DTType:DTType.single,kind:SkillKind.Support,ap:1,hit_count:1,hitcd:0.2,speed:720,with:0,ready:0.2,EAnm:0,DAnm:"",IType:IType.support,
|
||||
RType:RType.fixed,EType:EType.animationEnd,buff_type:Attrs.critical_damage,info:"全体友方暴击伤害提升20%,持续1次",
|
||||
6404: {
|
||||
uuid: 6404, name: "暴伤强化", sp_name: "buff_wind", icon: "1255", TGroup: TGroup.Team, readyAnm: "up_ap", endAnm: "", act: "atk",
|
||||
DTType: DTType.single, kind: SkillKind.Support, ap: 1, hit_count: 1, hitcd: 0.2, speed: 720, with: 0, ready: 0.2, EAnm: 0, DAnm: "", IType: IType.support,
|
||||
RType: RType.fixed, EType: EType.animationEnd, buff_type: Attrs.critical_damage, info: "全体友方暴击伤害提升20%,持续1次",
|
||||
},
|
||||
6405:{
|
||||
uuid:6405,name:"冰冻强化",sp_name:"buff_wind",icon:"1255",TGroup:TGroup.Team,readyAnm:"up_blue",endAnm:"",act:"atk",
|
||||
DTType:DTType.single,kind:SkillKind.Support,ap:1,hit_count:1,hitcd:0.2,speed:720,with:0,ready:0.2,EAnm:0,DAnm:"",IType:IType.support,
|
||||
RType:RType.fixed,EType:EType.animationEnd,buff_type:Attrs.freeze_chance,info:"全体友方冰冻概率提升10%,持续1次",
|
||||
6405: {
|
||||
uuid: 6405, name: "冰冻强化", sp_name: "buff_wind", icon: "1255", TGroup: TGroup.Team, readyAnm: "up_blue", endAnm: "", act: "atk",
|
||||
DTType: DTType.single, kind: SkillKind.Support, ap: 1, hit_count: 1, hitcd: 0.2, speed: 720, with: 0, ready: 0.2, EAnm: 0, DAnm: "", IType: IType.support,
|
||||
RType: RType.fixed, EType: EType.animationEnd, buff_type: Attrs.freeze_chance, info: "全体友方冰冻概率提升10%,持续1次",
|
||||
},
|
||||
6406:{
|
||||
uuid:6406,name:"击退强化",sp_name:"buff_wind",icon:"1255",TGroup:TGroup.Team,readyAnm:"up_blue",endAnm:"",act:"atk",
|
||||
DTType:DTType.single,kind:SkillKind.Support,ap:1,hit_count:1,hitcd:0.2,speed:720,with:0,ready:0.2,EAnm:0,DAnm:"",IType:IType.support,
|
||||
RType:RType.fixed,EType:EType.animationEnd,buff_type:Attrs.knockback_chance,info:"全体友方击退概率提升10%,持续1次",
|
||||
6406: {
|
||||
uuid: 6406, name: "击退强化", sp_name: "buff_wind", icon: "1255", TGroup: TGroup.Team, readyAnm: "up_blue", endAnm: "", act: "atk",
|
||||
DTType: DTType.single, kind: SkillKind.Support, ap: 1, hit_count: 1, hitcd: 0.2, speed: 720, with: 0, ready: 0.2, EAnm: 0, DAnm: "", IType: IType.support,
|
||||
RType: RType.fixed, EType: EType.animationEnd, buff_type: Attrs.knockback_chance, info: "全体友方击退概率提升10%,持续1次",
|
||||
},
|
||||
6407:{
|
||||
uuid:6407,name:"距推强化",sp_name:"buff_wind",icon:"1255",TGroup:TGroup.Team,readyAnm:"up_blue",endAnm:"",act:"atk",
|
||||
DTType:DTType.single,kind:SkillKind.Support,ap:1,hit_count:1,hitcd:0.2,speed:720,with:0,ready:0.2,EAnm:0,DAnm:"",IType:IType.support,
|
||||
RType:RType.fixed,EType:EType.animationEnd,buff_type:Attrs.knockback_distance,info:"全体友方击退距离提升20点,持续1次",
|
||||
6407: {
|
||||
uuid: 6407, name: "距推强化", sp_name: "buff_wind", icon: "1255", TGroup: TGroup.Team, readyAnm: "up_blue", endAnm: "", act: "atk",
|
||||
DTType: DTType.single, kind: SkillKind.Support, ap: 1, hit_count: 1, hitcd: 0.2, speed: 720, with: 0, ready: 0.2, EAnm: 0, DAnm: "", IType: IType.support,
|
||||
RType: RType.fixed, EType: EType.animationEnd, buff_type: Attrs.knockback_distance, info: "全体友方击退距离提升20点,持续1次",
|
||||
},
|
||||
6408:{
|
||||
uuid:6408,name:"穿刺强化",sp_name:"buff_wind",icon:"1255",TGroup:TGroup.Team,readyAnm:"up_ap",endAnm:"",act:"atk",
|
||||
DTType:DTType.single,kind:SkillKind.Support,ap:20,hit_count:1,hitcd:0.2,speed:720,with:0,ready:0.2,EAnm:0,DAnm:"",IType:IType.support,
|
||||
RType:RType.fixed,EType:EType.animationEnd,buff_type:Attrs.puncture_chance,info:"全体友方穿透概率提升20%,持续1次",
|
||||
6408: {
|
||||
uuid: 6408, name: "穿刺强化", sp_name: "buff_wind", icon: "1255", TGroup: TGroup.Team, readyAnm: "up_ap", endAnm: "", act: "atk",
|
||||
DTType: DTType.single, kind: SkillKind.Support, ap: 20, hit_count: 1, hitcd: 0.2, speed: 720, with: 0, ready: 0.2, EAnm: 0, DAnm: "", IType: IType.support,
|
||||
RType: RType.fixed, EType: EType.animationEnd, buff_type: Attrs.puncture_chance, info: "全体友方穿透概率提升20%,持续1次",
|
||||
},
|
||||
6409:{
|
||||
uuid:6409,name:"风怒强化",sp_name:"buff_wind",icon:"1255",TGroup:TGroup.Team,readyAnm:"up_ap",endAnm:"",act:"atk",
|
||||
DTType:DTType.single,kind:SkillKind.Support,ap:1,hit_count:1,hitcd:0.2,speed:720,with:0,ready:0.2,EAnm:0,DAnm:"",IType:IType.support,
|
||||
RType:RType.fixed,EType:EType.animationEnd,buff_type:Attrs.wfuny,info:"全体友方风怒次数提升1次,持续1次",
|
||||
6409: {
|
||||
uuid: 6409, name: "风怒强化", sp_name: "buff_wind", icon: "1255", TGroup: TGroup.Team, readyAnm: "up_ap", endAnm: "", act: "atk",
|
||||
DTType: DTType.single, kind: SkillKind.Support, ap: 1, hit_count: 1, hitcd: 0.2, speed: 720, with: 0, ready: 0.2, EAnm: 0, DAnm: "", IType: IType.support,
|
||||
RType: RType.fixed, EType: EType.animationEnd, buff_type: Attrs.wfuny, info: "全体友方风怒次数提升1次,持续1次",
|
||||
},
|
||||
6501:{
|
||||
uuid:6501,name:"复活",sp_name:"buff_wind",icon:"1255",TGroup:TGroup.Self,readyAnm:"up_ap",endAnm:"",act:"atk",
|
||||
DTType:DTType.single,kind:SkillKind.Support,ap:50,hit_count:3,hitcd:0.2,speed:720,with:0,ready:0.2,EAnm:0,DAnm:"",IType:IType.support,
|
||||
RType:RType.fixed,EType:EType.animationEnd,info:"ap 代表复活的生命值百分比",
|
||||
6501: {
|
||||
uuid: 6501, name: "复活", sp_name: "buff_wind", icon: "1255", TGroup: TGroup.Self, readyAnm: "up_ap", endAnm: "", act: "atk",
|
||||
DTType: DTType.single, kind: SkillKind.Support, ap: 50, hit_count: 3, hitcd: 0.2, speed: 720, with: 0, ready: 0.2, EAnm: 0, DAnm: "", IType: IType.support,
|
||||
RType: RType.fixed, EType: EType.animationEnd, info: "ap 代表复活的生命值百分比",
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
//***************驻场技能配置***************
|
||||
export enum FieldSkillType {
|
||||
@@ -367,6 +367,13 @@ export enum FieldSkillType {
|
||||
HeroCrit = 10, // 英雄暴击加成
|
||||
HeroCritDamage = 11, // 英雄暴击伤害加成
|
||||
HeroSpeed = 12, // 英雄攻击速度加成
|
||||
// ---- 13~18 由 TalentSet 迁移而来,统一为驻场口径 ----
|
||||
// 备注:SellGold 已原生覆盖"出售返还"语义,故 TalentSet 中的 SellBonus 不再单独保留
|
||||
BuyDiscount = 13, // 购买卡牌费用减免(金币)
|
||||
RefreshDiscount = 14, // 刷新卡牌费用减免(金币)
|
||||
HeroHp = 16, // 英雄最大生命加成
|
||||
HeroWindFury = 17, // 英雄风怒概率加成
|
||||
HeroPuncture = 18, // 英雄穿刺概率加成
|
||||
}
|
||||
|
||||
export interface FieldSkillConfig {
|
||||
@@ -390,4 +397,11 @@ export const FieldSkillSet: Record<number, FieldSkillConfig> = {
|
||||
7010: { uuid: 7010, name: "暴击加成", type: FieldSkillType.HeroCrit, value: 0.1, info: "英雄暴击率+10%" },
|
||||
7011: { uuid: 7011, name: "暴伤加成", type: FieldSkillType.HeroCritDamage, value: 0.5, info: "英雄暴击伤害+50%" },
|
||||
7012: { uuid: 7012, name: "攻速加成", type: FieldSkillType.HeroSpeed, value: 0.2, info: "英雄攻击速度+20%" },
|
||||
// ---- 13~18 来自原 TalentSet,统一为驻场百分比 / 绝对值口径 ----
|
||||
// 出售返还由原生 SellGold 承担,SellBonus 不再单独配置
|
||||
7013: { uuid: 7013, name: "购买优惠", type: FieldSkillType.BuyDiscount, value: 1, info: "购买卡牌费用-1金币" },
|
||||
7014: { uuid: 7014, name: "刷新优惠", type: FieldSkillType.RefreshDiscount, value: 1, info: "刷新卡牌费用-1金币" },
|
||||
7016: { uuid: 7016, name: "生命加成", type: FieldSkillType.HeroHp, value: 0.1, info: "英雄最大生命+10%" },
|
||||
7017: { uuid: 7017, name: "风怒加成", type: FieldSkillType.HeroWindFury, value: 0.1, info: "英雄风怒概率+10%" },
|
||||
7018: { uuid: 7018, name: "穿刺加成", type: FieldSkillType.HeroPuncture, value: 0.1, info: "英雄穿刺概率+10%" },
|
||||
};
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
/**
|
||||
* @file TalentSet.ts
|
||||
* @description 天赋系统配置数据,包含经验要求、消耗、每个天赋的具体加成数值和描述。
|
||||
*/
|
||||
|
||||
export enum TalentType {
|
||||
Attack = 1, // 攻击强化
|
||||
Hp = 2, // 生命强化
|
||||
Critical = 3, // 暴击强化
|
||||
WindFury = 4, // 风怒强化
|
||||
Freeze = 5, // 冰冻强化
|
||||
Puncture = 6, // 穿刺强化
|
||||
DeadTrigger = 7,// 亡语强化
|
||||
Summon = 8, // 召唤强化
|
||||
BuyDiscount = 9,// 采购优惠
|
||||
RefreshDiscount = 10, // 刷新优惠
|
||||
SellBonus = 11 // 出售补贴
|
||||
}
|
||||
|
||||
export interface TalentInfo {
|
||||
/** 天赋 ID */
|
||||
id: number;
|
||||
/** 天赋名称 */
|
||||
name: string;
|
||||
/** 天赋图标或标识(可选) */
|
||||
icon?: string;
|
||||
/** 描述模板,使用 {value} 替换具体数值 */
|
||||
desc: string;
|
||||
/** 最大等级 */
|
||||
maxLevel: number;
|
||||
/** 每一级的加成数值,从第1级到最大级 */
|
||||
values: number[];
|
||||
/** 每一级的金币消耗数量,下标 0 表示升到 1 级 */
|
||||
costs: number[];
|
||||
}
|
||||
|
||||
export const TalentConfig = {
|
||||
// 玩家升级所需经验配置
|
||||
expRequirements: [
|
||||
{ maxLevel: 10, expPerLevel: 100 },
|
||||
{ maxLevel: 20, expPerLevel: 150 },
|
||||
{ maxLevel: 30, expPerLevel: 200 }
|
||||
],
|
||||
|
||||
// 所有天赋定义(使用数组维护)
|
||||
talents: [
|
||||
{ id: TalentType.Attack, name: "攻击", icon: "3109", desc: "+{value}%",
|
||||
maxLevel: 5, values: [3, 6, 9, 12, 15], costs: [1, 1, 2, 2, 3] },
|
||||
{ id: TalentType.Hp, name: "生命", icon: "3056", desc: "+{value}%",
|
||||
maxLevel: 5, values: [5, 10, 15, 20, 25], costs: [1, 1, 2, 2, 3] },
|
||||
{ id: TalentType.Critical, name: "暴击率", icon: "3063", desc: "+{value}%",
|
||||
maxLevel: 5, values: [2, 4, 6, 8, 10], costs: [1, 1, 2, 2, 3] },
|
||||
{ id: TalentType.WindFury, name: "风怒率", icon: "3138", desc: "+{value}%",
|
||||
maxLevel: 5, values: [2, 4, 6, 8, 10], costs: [1, 1, 2, 2, 3] },
|
||||
{ id: TalentType.Freeze, name: "冰冻率", icon: "3136", desc: "+{value}%",
|
||||
maxLevel: 5, values: [2, 4, 6, 8, 10], costs: [1, 1, 2, 2, 3] },
|
||||
{ id: TalentType.Puncture, name: "穿刺", icon: "3105", desc: "+{value}",
|
||||
maxLevel: 5, values: [0.2, 0.4, 0.6, 0.8, 1.0], costs: [1, 1, 2, 2, 3] },
|
||||
{ id: TalentType.DeadTrigger, name: "亡语触发", icon: "3062", desc: "+{value}次",
|
||||
maxLevel: 1, values: [1], costs: [25] },
|
||||
{ id: TalentType.Summon, name: "召唤触发", icon: "3054", desc: "+{value}次",
|
||||
maxLevel: 1, values: [1], costs: [25] },
|
||||
{ id: TalentType.BuyDiscount, name: "购买优惠", icon: "3020", desc: "-{value}金币",
|
||||
maxLevel: 1, values: [1], costs: [10] },
|
||||
{ id: TalentType.RefreshDiscount, name: "刷新优惠", icon: "3019", desc: "-{value}金币",
|
||||
maxLevel: 1, values: [1], costs: [10] },
|
||||
{ id: TalentType.SellBonus, name: "出售返还", icon: "3151", desc: "+{value}金币",
|
||||
maxLevel: 1, values: [1], costs: [10] }
|
||||
] as TalentInfo[]
|
||||
};
|
||||
@@ -13,7 +13,6 @@ import { Attrs} from "../common/config/HeroAttrs";
|
||||
import { MoveComp } from "./MoveComp";
|
||||
import { mLogger } from "../common/Logger";
|
||||
import { FieldSkillType } from "../common/config/SkillSet";
|
||||
import { TalentType } from "../common/config/TalentSet";
|
||||
/** 英雄实体:负责英雄节点创建、属性初始化、入场动画与销毁流程 */
|
||||
@ecs.register(`Hero`)
|
||||
|
||||
@@ -133,17 +132,10 @@ export class Hero extends ecs.Entity {
|
||||
model.base_ap = base_ap;
|
||||
model.base_hp = base_hp;
|
||||
|
||||
// 应用天赋加成
|
||||
// 英雄享受驻场百分比加成,怪物保持基础值
|
||||
if (model.fac === FacSet.HERO) {
|
||||
let apBonus = HeroAttrsComp.getTalentValue(TalentType.Attack); // 攻击强化
|
||||
let hpBonus = HeroAttrsComp.getTalentValue(TalentType.Hp); // 生命强化
|
||||
model.ap = base_ap * (1 + apBonus / 100);
|
||||
model.hp = model.hp_max = base_hp * (1 + hpBonus / 100);
|
||||
model.critical = HeroAttrsComp.getTalentValue(TalentType.Critical); // 暴击强化
|
||||
model.wfuny = HeroAttrsComp.getTalentValue(TalentType.WindFury); // 风怒强化
|
||||
model.freeze_chance = HeroAttrsComp.getTalentValue(TalentType.Freeze); // 冰冻强化
|
||||
model.puncture_chance = HeroAttrsComp.getTalentValue(TalentType.Puncture); // 穿刺强化
|
||||
// 护盾强化 和 亡语强化 在对应逻辑中应用
|
||||
model.ap = model.getRuntimeAp(base_ap);
|
||||
model.hp = model.hp_max = model.getRuntimeHp(base_hp);
|
||||
} else {
|
||||
model.ap = base_ap;
|
||||
model.hp = model.hp_max = base_hp;
|
||||
|
||||
@@ -5,7 +5,6 @@ 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";
|
||||
import { TalentConfig, TalentType } from "../common/config/TalentSet";
|
||||
import { Attrs } from "../common/config/HeroAttrs";
|
||||
import { FieldSkillHelper } from "./FieldSkillHelper";
|
||||
@ecs.register('HeroAttrs')
|
||||
@@ -226,7 +225,7 @@ export class HeroAttrsComp extends ecs.Comp {
|
||||
}
|
||||
|
||||
/** 将驻场配置值统一换算成百分比数值,兼容 0.2 和 20 两种写法。 */
|
||||
private getFieldPercentValue(type: FieldSkillType): number {
|
||||
public static getFieldPercentValue(type: FieldSkillType): number {
|
||||
const rawValue = FieldSkillHelper.getFieldSkillTotalValue(type);
|
||||
if (Math.abs(rawValue) <= HeroAttrsComp.percentRateThreshold) {
|
||||
return rawValue * 100;
|
||||
@@ -237,30 +236,49 @@ export class HeroAttrsComp extends ecs.Comp {
|
||||
/** 英雄实时暴击率 = 基础暴击率 + 驻场暴击率。 */
|
||||
public getRuntimeCritical(): number {
|
||||
if (this.fac !== FacSet.HERO) return this.critical;
|
||||
return this.critical + this.getFieldPercentValue(FieldSkillType.HeroCrit);
|
||||
return this.critical + HeroAttrsComp.getFieldPercentValue(FieldSkillType.HeroCrit);
|
||||
}
|
||||
|
||||
/** 英雄实时冰冻率 = 基础冰冻率 + 驻场冰冻率。 */
|
||||
public getRuntimeFreezeChance(): number {
|
||||
if (this.fac !== FacSet.HERO) return this.freeze_chance;
|
||||
return this.freeze_chance + this.getFieldPercentValue(FieldSkillType.HeroFrost);
|
||||
return this.freeze_chance + HeroAttrsComp.getFieldPercentValue(FieldSkillType.HeroFrost);
|
||||
}
|
||||
|
||||
/** 英雄实时穿透概率 = 基础穿透概率。 */
|
||||
/** 英雄实时风怒概率 = 基础风怒 + 驻场风怒。 */
|
||||
public getRuntimeWindFury(): number {
|
||||
if (this.fac !== FacSet.HERO) return this.wfuny;
|
||||
return this.wfuny + HeroAttrsComp.getFieldPercentValue(FieldSkillType.HeroWindFury);
|
||||
}
|
||||
|
||||
/** 英雄实时穿透概率 = 基础穿透 + 驻场穿透。 */
|
||||
public getRuntimePunctureChance(): number {
|
||||
return this.puncture_chance;
|
||||
if (this.fac !== FacSet.HERO) return this.puncture_chance;
|
||||
return this.puncture_chance + HeroAttrsComp.getFieldPercentValue(FieldSkillType.HeroPuncture);
|
||||
}
|
||||
|
||||
/** 英雄实时暴击伤害 = 基础额外暴伤 + 驻场暴伤。 */
|
||||
public getRuntimeCritDamageBonus(): number {
|
||||
if (this.fac !== FacSet.HERO) return this.crit_damage;
|
||||
return this.crit_damage + this.getFieldPercentValue(FieldSkillType.HeroCritDamage);
|
||||
return this.crit_damage + HeroAttrsComp.getFieldPercentValue(FieldSkillType.HeroCritDamage);
|
||||
}
|
||||
|
||||
/** 攻速加成通过缩短普通攻击技能 CD 生效,正值越高,攻击越快。 */
|
||||
public getRuntimeAttackSpeedBonus(): number {
|
||||
if (this.fac !== FacSet.HERO) return 0;
|
||||
return this.getFieldPercentValue(FieldSkillType.HeroSpeed);
|
||||
return HeroAttrsComp.getFieldPercentValue(FieldSkillType.HeroSpeed);
|
||||
}
|
||||
|
||||
/** 英雄实时攻击力 = 基础攻击 × (1 + 驻场攻击百分比)。 */
|
||||
public getRuntimeAp(baseAp: number): number {
|
||||
if (this.fac !== FacSet.HERO) return baseAp;
|
||||
return baseAp * (1 + HeroAttrsComp.getFieldPercentValue(FieldSkillType.HeroAtk) / 100);
|
||||
}
|
||||
|
||||
/** 英雄实时最大生命 = 基础生命 × (1 + 驻场生命百分比)。 */
|
||||
public getRuntimeHp(baseHp: number): number {
|
||||
if (this.fac !== FacSet.HERO) return baseHp;
|
||||
return baseHp * (1 + HeroAttrsComp.getFieldPercentValue(FieldSkillType.HeroHp) / 100);
|
||||
}
|
||||
|
||||
/** 根据攻速加成换算实际攻击间隔,避免直接改写配置里的基础 CD。 */
|
||||
@@ -370,18 +388,6 @@ export class HeroAttrsComp extends ecs.Comp {
|
||||
this.dirty_hp = false;
|
||||
this.dirty_shield = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** 获取指定天赋的加成数值 */
|
||||
public static getTalentValue(talentId: TalentType): number {
|
||||
if (!smc || !smc.collection || !smc.collection.talents) return 0;
|
||||
let level = smc.collection.talents[talentId] || 0;
|
||||
if (level <= 0) return 0;
|
||||
let talentInfo = TalentConfig.talents.find(t => t.id === talentId);
|
||||
if (!talentInfo || !talentInfo.values || level > talentInfo.values.length) return 0;
|
||||
return talentInfo.values[level - 1];
|
||||
}
|
||||
}
|
||||
|
||||
@ecs.register('HeroBuffSystem')
|
||||
|
||||
@@ -5,7 +5,6 @@ import { HeroAttrsComp } from "./HeroAttrsComp";
|
||||
import { HeroViewComp } from "./HeroViewComp";
|
||||
import { FacSet } from "../common/config/GameSet";
|
||||
import { FieldSkillType, SkillOverrides } from "../common/config/SkillSet";
|
||||
import { TalentType } from "../common/config/TalentSet";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { FieldSkillHelper } from "./FieldSkillHelper";
|
||||
|
||||
@@ -59,7 +58,7 @@ export class SkillTriggerHelper {
|
||||
|
||||
/**
|
||||
* 处理召唤(落地)触发技能
|
||||
* 支持受【召唤强化羁绊 (SummonCount)】和【召唤强化天赋 (TalentType.Summon)】的多次触发加成。
|
||||
* 支持受【召唤强化羁绊 (SummonCount)】的多次触发加成。
|
||||
*/
|
||||
private static handleCall(model: HeroAttrsComp, view: HeroViewComp) {
|
||||
if (!model.call || model.call.length === 0) return;
|
||||
@@ -68,7 +67,6 @@ export class SkillTriggerHelper {
|
||||
// 仅英雄享受加成,怪物始终只触发 1 次
|
||||
if (model.fac === FacSet.HERO) {
|
||||
triggerCount += FieldSkillHelper.getFieldSkillTotalValue(FieldSkillType.SummonCount);
|
||||
triggerCount += HeroAttrsComp.getTalentValue(TalentType.Summon);
|
||||
}
|
||||
triggerCount = Math.max(1, Math.floor(triggerCount)); // 确保最少触发 1 次
|
||||
|
||||
|
||||
@@ -33,7 +33,8 @@ import { smc } from "../common/SingletonModuleComp";
|
||||
|
||||
import { UIID } from "../common/config/GameUIConfig";
|
||||
import { HeroAttrsComp } from "../hero/HeroAttrsComp";
|
||||
import { TalentType } from "../common/config/TalentSet";
|
||||
import { FieldSkillType } from "../common/config/SkillSet";
|
||||
import { FieldSkillHelper } from "../hero/FieldSkillHelper";
|
||||
import { getLvColor } from "../common/config/GameSet";
|
||||
import { MissionEconomy } from "./MissionEconomy";
|
||||
|
||||
@@ -251,7 +252,8 @@ export class CardComp extends CCComp {
|
||||
|
||||
let baseCost = data.cost ?? 0;
|
||||
if (this.card_type === CardType.Hero) {
|
||||
const discount = HeroAttrsComp.getTalentValue(TalentType.BuyDiscount);
|
||||
// 驻场英雄带来的"购买优惠"折扣
|
||||
const discount = FieldSkillHelper.getFieldSkillTotalValue(FieldSkillType.BuyDiscount);
|
||||
baseCost = Math.max(0, baseCost - discount);
|
||||
}
|
||||
this.card_cost = Math.floor(baseCost);
|
||||
|
||||
@@ -25,7 +25,6 @@ import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/modu
|
||||
import { HeroInfo } from "../common/config/heroSet";
|
||||
import { HeroAttrsComp } from "../hero/HeroAttrsComp";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { TalentType } from "../common/config/TalentSet";
|
||||
import { Hero } from "../hero/Hero";
|
||||
import { FieldSkillType } from "../common/config/SkillSet";
|
||||
import { buildSkillDesc } from "../common/config/HeroSkillDesc";
|
||||
|
||||
@@ -47,7 +47,6 @@ import { HeroViewComp } from "../hero/HeroViewComp";
|
||||
import { FacSet, FightSet } from "../common/config/GameSet";
|
||||
import { MoveComp } from "../hero/MoveComp";
|
||||
import { MissionHeroComp } from "./MissionHeroComp";
|
||||
import { TalentType } from "../common/config/TalentSet";
|
||||
import { MissionEconomy } from "./MissionEconomy";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
||||
import { GameEvent } from "../common/config/GameEvent";
|
||||
import { HeroAttrsComp } from "../hero/HeroAttrsComp";
|
||||
import { FieldSkillType } from "../common/config/SkillSet";
|
||||
import { TalentType } from "../common/config/TalentSet";
|
||||
import { FightSet } from "../common/config/GameSet";
|
||||
import { FieldSkillHelper } from "../hero/FieldSkillHelper";
|
||||
|
||||
/**
|
||||
@@ -23,7 +20,7 @@ export class MissionEconomy {
|
||||
amount = Math.floor(amount);
|
||||
smc.vmdata.mission_data.coin = this.getCoin() + amount;
|
||||
smc.vmdata.scores.gold_earned += amount;
|
||||
|
||||
|
||||
// 发送 UI 更新事件,这里我们统一使用 syncOnly 通知 UI 刷新即可
|
||||
oops.message.dispatchEvent(GameEvent.CoinAdd, { delta: amount, syncOnly: true });
|
||||
}
|
||||
@@ -34,10 +31,10 @@ export class MissionEconomy {
|
||||
amount = Math.floor(amount);
|
||||
const current = this.getCoin();
|
||||
if (current < amount) return false;
|
||||
|
||||
|
||||
smc.vmdata.mission_data.coin = current - amount;
|
||||
smc.vmdata.scores.gold_spent += amount;
|
||||
|
||||
|
||||
// 发送 UI 更新事件
|
||||
oops.message.dispatchEvent(GameEvent.CoinAdd, { delta: -amount, syncOnly: true });
|
||||
return true;
|
||||
@@ -49,7 +46,8 @@ export class MissionEconomy {
|
||||
*/
|
||||
static getRefreshCost(baseCost: number = 1): number {
|
||||
let cost = baseCost;
|
||||
const discount = HeroAttrsComp.getTalentValue(TalentType.RefreshDiscount);
|
||||
// 驻场英雄带来的"刷新优惠"折扣
|
||||
const discount = FieldSkillHelper.getFieldSkillTotalValue(FieldSkillType.RefreshDiscount);
|
||||
cost = Math.max(0, cost - discount);
|
||||
return Math.floor(cost);
|
||||
}
|
||||
@@ -72,13 +70,9 @@ export class MissionEconomy {
|
||||
static getSellGold(heroLevel: number = 1): number {
|
||||
const sellByLevel: Record<number, number> = { 1: 3, 2: 10, 3: 25 };
|
||||
const baseSellGold = sellByLevel[heroLevel] || 3;
|
||||
// 驻场英雄带来的"出售金币"加成(包含原 SellBonus 语义,统一在 SellGold 中)
|
||||
const goldBoost = FieldSkillHelper.getFieldSkillTotalValue(FieldSkillType.SellGold);
|
||||
let totalSellGold = baseSellGold + goldBoost;
|
||||
// 应用天赋 SellBonus (增加数值)
|
||||
const bonusGold = HeroAttrsComp.getTalentValue(TalentType.SellBonus);
|
||||
if (bonusGold > 0) {
|
||||
totalSellGold += bonusGold;
|
||||
}
|
||||
const totalSellGold = baseSellGold + goldBoost;
|
||||
return Math.floor(totalSellGold);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,125 +1,64 @@
|
||||
/**
|
||||
* @file TalentItemComp.ts
|
||||
* @description 单个天赋项组件
|
||||
* @description 驻场技能项组件(UI 视图层)
|
||||
*
|
||||
* 职责:
|
||||
* 1. 接收 TalentsComp 下发的 FieldSkillConfig 与当前场上总加成值。
|
||||
* 2. 渲染名称 / 基础值 / 当前值 / 描述四段信息。
|
||||
* 3. 兼容旧的 `@ecs.register('TalentItem')` 资源引用。
|
||||
*
|
||||
* 依赖:
|
||||
* - SkillSet.FieldSkillConfig —— 单条驻场技能配置
|
||||
*/
|
||||
import { _decorator, Node, Label, Button, resources, SpriteAtlas, Sprite } from "cc";
|
||||
import { _decorator, Label } from "cc";
|
||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
|
||||
import { TalentInfo, TalentType } from "../common/config/TalentSet";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { FieldSkillConfig } from "../common/config/SkillSet";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
/**
|
||||
* 将驻场配置值统一格式化为可读字符串。
|
||||
* 兼容"小数"(0.1 表示 10%)与"整数百分点"(10 表示 10%)两种口径。
|
||||
*/
|
||||
function formatBuffValue(value: number): string {
|
||||
if (Math.abs(value) < 1) {
|
||||
return `${(value * 100).toFixed(0)}%`;
|
||||
}
|
||||
return value.toString();
|
||||
}
|
||||
|
||||
/** TalentItemComp —— 驻场技能项组件 */
|
||||
@ccclass('TalentItemComp')
|
||||
@ecs.register('TalentItem', false)
|
||||
export class TalentItemComp extends CCComp {
|
||||
|
||||
@property({ type: Label, tooltip: "天赋名称" })
|
||||
@property({ type: Label, tooltip: "驻场技能名称" })
|
||||
lbl_name: Label = null!;
|
||||
|
||||
@property({ type: Node, tooltip: "图标节点" })
|
||||
icon_node: Node = null!;
|
||||
@property({ type: Label, tooltip: "基础值(来自配置)" })
|
||||
lbl_base: Label = null!;
|
||||
|
||||
@property({ type: Label, tooltip: "描述" })
|
||||
lbl_desc: Label = null!;
|
||||
@property({ type: Label, tooltip: "当前场上总加成(实时聚合)" })
|
||||
lbl_current: Label = null!;
|
||||
|
||||
@property({ type: Label, tooltip: "等级进度" })
|
||||
lbl_level: Label = null!;
|
||||
|
||||
@property({ type: Label, tooltip: "升级消耗" })
|
||||
lbl_cost: Label = null!;
|
||||
|
||||
@property({ type: Button, tooltip: "升级按钮" })
|
||||
btn_upgrade: Button = null!;
|
||||
|
||||
@property({ type: Node, tooltip: "背景" })
|
||||
item_bg: Node = null!;
|
||||
|
||||
@property({ type: Node, tooltip: "图标背景" })
|
||||
icon_bg: Node = null!;
|
||||
|
||||
private _talentId: TalentType = TalentType.Attack;
|
||||
private _onClickCallback: ((talentId: TalentType, currentLevel: number) => void) | null = null;
|
||||
private _currentLevel: number = 0;
|
||||
|
||||
private _talentInfo: TalentInfo | null = null;
|
||||
|
||||
protected onLoad(): void {
|
||||
if (this.btn_upgrade && this.btn_upgrade.node) {
|
||||
this.btn_upgrade.node.on(Button.EventType.CLICK, this.onUpgradeClicked, this);
|
||||
}
|
||||
}
|
||||
@property({ type: Label, tooltip: "驻场技能描述" })
|
||||
lbl_info: Label = null!;
|
||||
|
||||
/**
|
||||
* 更新天赋项显示
|
||||
* @param talentInfo 天赋配置数据
|
||||
* @param currentLevel 当前等级
|
||||
* @param onClickCallback 点击升级按钮的回调
|
||||
* 刷新单条驻场技能展示
|
||||
* @param config FieldSkillSet 中的单条配置
|
||||
* @param currentTotal 当前场上同 type 累加值(实时聚合)
|
||||
*/
|
||||
public updateItem(talentInfo: TalentInfo, currentLevel: number, onClickCallback: (talentId: TalentType, currentLevel: number) => void) {
|
||||
this._talentInfo = talentInfo;
|
||||
this._talentId = talentInfo.id;
|
||||
this._currentLevel = currentLevel;
|
||||
this._onClickCallback = onClickCallback;
|
||||
|
||||
if (this.lbl_name) {
|
||||
this.lbl_name.string = talentInfo.name;
|
||||
}
|
||||
|
||||
// 同步尝试刷新一次图标(如果图集已经缓存过,比如重新打开界面时)
|
||||
this.refreshIcon();
|
||||
|
||||
if (this.lbl_desc) {
|
||||
let currentVal = currentLevel === 0 ? 0 : talentInfo.values[currentLevel - 1];
|
||||
this.lbl_desc.string = talentInfo.desc.replace('{value}', currentVal.toString());
|
||||
}
|
||||
|
||||
if (this.lbl_level) {
|
||||
this.lbl_level.string = `${currentLevel}/${talentInfo.maxLevel}`;
|
||||
}
|
||||
|
||||
let isMax = currentLevel >= talentInfo.maxLevel;
|
||||
let cost = isMax ? 0 : (talentInfo.costs[currentLevel] ?? 0);
|
||||
let canUpgrade = !isMax && smc.vmdata.gold >= cost;
|
||||
|
||||
if (this.lbl_cost) {
|
||||
this.lbl_cost.string = isMax ? "已满级" : `${cost}`;
|
||||
}
|
||||
|
||||
if (this.btn_upgrade) {
|
||||
this.btn_upgrade.interactable = canUpgrade;
|
||||
}
|
||||
public updateItem(config: FieldSkillConfig, currentTotal: number): void {
|
||||
if (!config) return;
|
||||
if (this.lbl_name) this.lbl_name.string = config.name ?? "";
|
||||
if (this.lbl_base) this.lbl_base.string = `基础 +${formatBuffValue(config.value)}`;
|
||||
if (this.lbl_current) this.lbl_current.string = `当前 +${formatBuffValue(currentTotal)}`;
|
||||
if (this.lbl_info) this.lbl_info.string = config.info ?? "";
|
||||
}
|
||||
|
||||
/** 单独更新图标,供父节点加载完图集后回调或自身更新时调用 */
|
||||
public refreshIcon() {
|
||||
if (!this._talentInfo || !this.icon_node || !this._talentInfo.icon) return;
|
||||
|
||||
if (smc.uiconsAtlas && smc.uiconsAtlas.spriteFrames) {
|
||||
// 确保 icon 是字符串类型,防止配置写成纯数字导致底层 getSpriteFrame 报错
|
||||
const iconStr = String(this._talentInfo.icon);
|
||||
const frame = smc.uiconsAtlas.getSpriteFrame(iconStr);
|
||||
if (frame && this.icon_node.isValid) {
|
||||
const sprite = this.icon_node.getComponent(Sprite) || this.icon_node.addComponent(Sprite);
|
||||
sprite.spriteFrame = frame;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private onUpgradeClicked() {
|
||||
if (this._onClickCallback) {
|
||||
this._onClickCallback(this._talentId, this._currentLevel);
|
||||
}
|
||||
}
|
||||
|
||||
protected onDestroy(): void {
|
||||
super.onDestroy();
|
||||
if (this.btn_upgrade && this.btn_upgrade.node && this.btn_upgrade.node.isValid) {
|
||||
this.btn_upgrade.node.off(Button.EventType.CLICK, this.onUpgradeClicked, this);
|
||||
}
|
||||
}
|
||||
|
||||
/** ECS 组件移除时销毁节点 */
|
||||
/** ECS 组件移除时销毁节点(CCComp 抽象方法实现) */
|
||||
reset() {
|
||||
this.node.destroy();
|
||||
}
|
||||
|
||||
@@ -1,268 +1,90 @@
|
||||
/**
|
||||
* @file TalentsComp.ts
|
||||
* @description 天赋系统页面组件(UI 视图层)
|
||||
* @description 驻场技能信息展示页组件(UI 视图层)
|
||||
*
|
||||
* 职责:
|
||||
* 1. 展示玩家等级、当前经验、进度条、金币。
|
||||
* 2. 展示天赋列表及每个天赋的当前等级。
|
||||
* 3. 处理天赋升级点击事件,扣除金币并保存。
|
||||
* 4. 处理重置天赋(看广告)功能。
|
||||
*
|
||||
* 关键设计:
|
||||
* - 通过 MissionHomeComp 页面切换显示,节点 active 控制显隐。
|
||||
* - onAdded(args) 接收参数时刷新界面。
|
||||
* 1. 展示当前所有 FieldSkillSet 配置项的名称、基础值、当前场上总加成。
|
||||
* 2. 通过 FieldSkillHelper 实时聚合英雄驻场数据并下发给每个 TalentItemComp。
|
||||
* 3. 兼容旧的 `@ecs.register('Talents')` 资源引用。
|
||||
*
|
||||
* 依赖:
|
||||
* - MissionHomeComp —— 通过节点 active 显隐控制页面切换
|
||||
* - smc.collection —— 玩家数据
|
||||
* - TalentConfig(TalentSet)—— 天赋配置
|
||||
* - SkillSet(FieldSkillSet / FieldSkillConfig)—— 驻场技能配置
|
||||
* - FieldSkillHelper —— 场上英雄驻场技能聚合
|
||||
* - TalentItemComp —— 单条驻场技能项视图
|
||||
*/
|
||||
import { _decorator, Node, Label, Button, ProgressBar, instantiate, Prefab } from "cc";
|
||||
import { _decorator, instantiate, Node, Prefab } from "cc";
|
||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
|
||||
import { mLogger } from "../common/Logger";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
||||
import { TalentConfig, TalentInfo, TalentType } from "../common/config/TalentSet";
|
||||
import { FieldSkillSet, FieldSkillConfig } from "../common/config/SkillSet";
|
||||
import { FieldSkillHelper } from "../hero/FieldSkillHelper";
|
||||
import { TalentItemComp } from "./TalentItemComp";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
/**
|
||||
* TalentsComp —— 天赋系统界面组件
|
||||
*
|
||||
* 职责:
|
||||
* 1. 展示玩家等级、当前经验、进度条、金币。
|
||||
* 2. 展示天赋列表及每个天赋的当前等级。
|
||||
* 3. 处理天赋升级点击事件,扣除金币并保存。
|
||||
* 4. 处理重置天赋(看广告)功能。
|
||||
*/
|
||||
/** TalentsComp —— 驻场技能信息页组件 */
|
||||
@ccclass('TalentsComp')
|
||||
@ecs.register('Talents', false)
|
||||
export class TalentsComp extends CCComp {
|
||||
|
||||
@property({ type: Node, tooltip: "标题节点" })
|
||||
title_node: Node = null!;
|
||||
|
||||
@property({ type: Label, tooltip: "玩家等级文本,例如 'Lv.12'" })
|
||||
lbl_level: Label = null!;
|
||||
|
||||
@property({ type: Label, tooltip: "经验文本,例如 '150/200'" })
|
||||
lbl_exp: Label = null!;
|
||||
|
||||
@property({ type: ProgressBar, tooltip: "经验进度条" })
|
||||
pb_exp: ProgressBar = null!;
|
||||
|
||||
@property({ type: Label, tooltip: "当前金币文本" })
|
||||
lbl_points: Label = null!;
|
||||
|
||||
@property({ type: Node, tooltip: "天赋列表容器,用于动态添加天赋项" })
|
||||
@property({ type: Node, tooltip: "驻场技能列表容器" })
|
||||
talents_content: Node = null!;
|
||||
|
||||
@property({ type: Prefab, tooltip: "" })
|
||||
@property({ type: Prefab, tooltip: "单条驻场技能项预制" })
|
||||
prefab_talent_item: Prefab = null!;
|
||||
|
||||
@property({ type: Button, tooltip: "看广告重置天赋按钮" })
|
||||
btn_reset: Button = null!;
|
||||
|
||||
@property({ type: Button, tooltip: "返回按钮" })
|
||||
btn_close: Button = null!;
|
||||
|
||||
|
||||
|
||||
/** 调试日志开关 */
|
||||
debugMode: boolean = false;
|
||||
|
||||
/** 最大玩家等级 */
|
||||
private readonly MAX_PLAYER_LEVEL = 30;
|
||||
|
||||
protected onLoad(): void {
|
||||
if (this.btn_reset && this.btn_reset.node) {
|
||||
this.btn_reset.node.on(Button.EventType.CLICK, this.onResetClicked, this);
|
||||
}
|
||||
if (this.btn_close && this.btn_close.node) {
|
||||
this.btn_close.node.on(Button.EventType.CLICK, this.onCloseClicked, this);
|
||||
}
|
||||
}
|
||||
/** 首次实例化缓存 */
|
||||
private rendered: boolean = false;
|
||||
|
||||
/** 缓存的稳定配置顺序,避免重复渲染时列表抖动 */
|
||||
private cachedConfigs: FieldSkillConfig[] = [];
|
||||
|
||||
protected onEnable(): void {
|
||||
this.refreshUI();
|
||||
}
|
||||
|
||||
/** 刷新整体界面 */
|
||||
private refreshUI() {
|
||||
this.updatePlayerInfo();
|
||||
this.updateTalentList();
|
||||
}
|
||||
|
||||
/** 更新玩家等级、经验、金币信息 */
|
||||
private updatePlayerInfo() {
|
||||
const collection = smc.collection;
|
||||
let level = collection.player_level || 1;
|
||||
let exp = collection.player_exp || 0;
|
||||
|
||||
// 限制最大等级
|
||||
if (level > this.MAX_PLAYER_LEVEL) {
|
||||
level = this.MAX_PLAYER_LEVEL;
|
||||
}
|
||||
|
||||
if (this.lbl_level) this.lbl_level.string = `Lv.${level}`;
|
||||
if (this.lbl_points) this.lbl_points.string = `金币: ${smc.vmdata.gold}`;
|
||||
|
||||
// 计算当前等级升级所需经验
|
||||
let expRequired = this.getExpRequirement(level);
|
||||
|
||||
if (level >= this.MAX_PLAYER_LEVEL) {
|
||||
if (this.lbl_exp) this.lbl_exp.string = "已满级";
|
||||
if (this.pb_exp) this.pb_exp.progress = 1;
|
||||
} else {
|
||||
if (this.lbl_exp) this.lbl_exp.string = `${exp}/${expRequired}`;
|
||||
if (this.pb_exp) this.pb_exp.progress = exp / expRequired;
|
||||
}
|
||||
}
|
||||
|
||||
/** 获取对应等级的升级所需经验 */
|
||||
private getExpRequirement(level: number): number {
|
||||
for (let config of TalentConfig.expRequirements) {
|
||||
if (level <= config.maxLevel) {
|
||||
return config.expPerLevel;
|
||||
}
|
||||
}
|
||||
return TalentConfig.expRequirements[TalentConfig.expRequirements.length - 1].expPerLevel;
|
||||
}
|
||||
|
||||
/** 动态生成或更新天赋列表 */
|
||||
private updateTalentList() {
|
||||
/** 重新拉取最新数据并刷新所有子项 */
|
||||
public refreshUI(): void {
|
||||
if (!this.talents_content || !this.prefab_talent_item) return;
|
||||
|
||||
const collection = smc.collection;
|
||||
|
||||
// 如果内容为空,则实例化预制体
|
||||
if (this.talents_content.children.length === 0) {
|
||||
TalentConfig.talents.forEach(talentInfo => {
|
||||
let itemNode = instantiate(this.prefab_talent_item);
|
||||
// 第一次:实例化所有子节点;之后只更新数据
|
||||
if (!this.rendered) {
|
||||
this.cachedConfigs = Object.values(FieldSkillSet)
|
||||
.sort((a, b) => a.uuid - b.uuid);
|
||||
this.cachedConfigs.forEach((cfg) => {
|
||||
const itemNode = instantiate(this.prefab_talent_item);
|
||||
this.talents_content.addChild(itemNode);
|
||||
let comp = itemNode.getComponent(TalentItemComp);
|
||||
const comp = itemNode.getComponent(TalentItemComp);
|
||||
if (comp) {
|
||||
comp.updateItem(talentInfo, collection.talents[talentInfo.id as TalentType], this.onUpgradeClicked.bind(this));
|
||||
comp.updateItem(cfg, 0);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// 否则直接更新现有节点
|
||||
TalentConfig.talents.forEach((talentInfo, index) => {
|
||||
let itemNode = this.talents_content.children[index];
|
||||
if (itemNode) {
|
||||
let comp = itemNode.getComponent(TalentItemComp);
|
||||
if (comp) {
|
||||
comp.updateItem(talentInfo, collection.talents[talentInfo.id as TalentType], this.onUpgradeClicked.bind(this));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/** 点击升级按钮 */
|
||||
private onUpgradeClicked(talentId: TalentType, currentLevel: number) {
|
||||
const collection = smc.collection;
|
||||
const talentInfo = TalentConfig.talents.find(t => t.id === talentId);
|
||||
if (!talentInfo) {
|
||||
oops.gui.toast("天赋配置不存在");
|
||||
return;
|
||||
this.rendered = true;
|
||||
}
|
||||
|
||||
if (currentLevel >= talentInfo.maxLevel) {
|
||||
oops.gui.toast("该天赋已满级");
|
||||
return;
|
||||
}
|
||||
|
||||
const cost = talentInfo.costs[currentLevel] ?? 0;
|
||||
|
||||
if (smc.vmdata.gold >= cost) {
|
||||
// 1. 扣除金币消耗
|
||||
smc.updateGold(-cost);
|
||||
// 2. 更新等级
|
||||
collection.talents[talentId] = currentLevel + 1;
|
||||
|
||||
// 3. 同步数据(通过 SingletonModuleComp 新增的机制,这里会触发标记脏数据并自动尝试云端同步)
|
||||
smc.updateCloudData();
|
||||
|
||||
// 4. 刷新 UI
|
||||
this.refreshUI();
|
||||
|
||||
oops.gui.toast("天赋升级成功");
|
||||
} else {
|
||||
oops.gui.toast("金币不足");
|
||||
}
|
||||
}
|
||||
|
||||
/** 点击重置按钮 */
|
||||
private onResetClicked() {
|
||||
// 看广告回调(预留)
|
||||
this.watch_ad().then(success => {
|
||||
if (success) {
|
||||
const collection = smc.collection;
|
||||
// 计算已消耗金币并返还
|
||||
let refundedGold = 0;
|
||||
for (let id in collection.talents) {
|
||||
let talentId = Number(id) as TalentType;
|
||||
let level = collection.talents[talentId];
|
||||
let talentInfo = TalentConfig.talents.find(t => t.id === talentId);
|
||||
if (talentInfo) {
|
||||
for (let i = 0; i < level; i++) {
|
||||
refundedGold += talentInfo.costs[i] ?? 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 重置天赋等级并返还金币
|
||||
for (let k in collection.talents) {
|
||||
collection.talents[k as any as TalentType] = 0;
|
||||
}
|
||||
|
||||
if (refundedGold > 0) {
|
||||
smc.updateGold(refundedGold);
|
||||
}
|
||||
|
||||
// 同步到云端
|
||||
smc.updateCloudData();
|
||||
|
||||
// 刷新界面
|
||||
this.refreshUI();
|
||||
oops.gui.toast("天赋已重置,金币已返还");
|
||||
} else {
|
||||
oops.gui.toast("广告观看失败,无法重置");
|
||||
}
|
||||
// 按相同顺序回填最新场上聚合值
|
||||
this.cachedConfigs.forEach((cfg, index) => {
|
||||
const child = this.talents_content.children[index];
|
||||
if (!child) return;
|
||||
const comp = child.getComponent(TalentItemComp);
|
||||
if (!comp) return;
|
||||
const total = FieldSkillHelper.getFieldSkillTotalValue(cfg.type);
|
||||
comp.updateItem(cfg, total);
|
||||
});
|
||||
}
|
||||
|
||||
/** 模拟看广告回调,实际项目中需要替换为真实的广告SDK调用 */
|
||||
private watch_ad(): Promise<boolean> {
|
||||
return new Promise((resolve) => {
|
||||
// 模拟广告播放延迟
|
||||
setTimeout(() => {
|
||||
resolve(true);
|
||||
}, 500);
|
||||
});
|
||||
}
|
||||
|
||||
/** 点击返回按钮 */
|
||||
private onCloseClicked() {
|
||||
this.node.active = false
|
||||
/** ECS 组件移除时销毁节点 */
|
||||
reset() {
|
||||
this.rendered = false;
|
||||
this.cachedConfigs = [];
|
||||
this.node.destroy();
|
||||
}
|
||||
|
||||
protected onDestroy(): void {
|
||||
super.onDestroy();
|
||||
mLogger.log(this.debugMode, 'TalentsComp', "释放界面");
|
||||
if (this.btn_reset && this.btn_reset.node && this.btn_reset.node.isValid) {
|
||||
this.btn_reset.node.off(Button.EventType.CLICK, this.onResetClicked, this);
|
||||
}
|
||||
if (this.btn_close && this.btn_close.node && this.btn_close.node.isValid) {
|
||||
this.btn_close.node.off(Button.EventType.CLICK, this.onCloseClicked, this);
|
||||
}
|
||||
}
|
||||
|
||||
/** ECS 组件移除时销毁节点 */
|
||||
reset() {
|
||||
this.node.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user