3 Commits

Author SHA1 Message Date
panw
b9f7a66fae feat(英雄): 重构复活机制为动态配置
将固定的复活次数属性改为从英雄配置中动态计算。移除 `revive_count` 静态属性,新增 `revive` 数组用于存储复活配置(包含基础次数和等级成长),并添加 `revived_count` 记录已复活次数。在 `Hero` 和 `Monster` 的初始化中同步此属性,并在战斗系统中根据配置和英雄等级计算最大可复活次数。
2026-04-23 09:41:50 +08:00
panw
0676412a5a refactor(英雄): 移除复活时间相关逻辑
- 从 HeroAttrs 枚举中删除 revive_time 属性
- 移除 HeroAtkSystem 中的 scheduleRevive 调用
- 清理 HeroAttrsComp 中与复活时间相关的字段和重置逻辑
- 简化 HeroViewComp 的 alive 方法并删除 scheduleRevive 方法
2026-04-23 09:40:36 +08:00
panw
8ab0cc3971 feat(hero): 为英雄系统添加复活机制
- 在 HeroAttrsComp 中增加 `is_revived` 字段以追踪已复活次数
- 修改 HeroViewComp 的 `scheduleRevive` 方法,使其能播放复活技能的准备动画并立即触发复活
- 在 heroInfo 接口中新增 `revive` 配置项,用于定义英雄的复活技能
- 在 SkillSet 中添加新的复活技能配置(uuid: 6501)
- 新增 hero-roster.md 的元数据配置文件
2026-04-23 09:09:49 +08:00
9 changed files with 42 additions and 26 deletions

View File

@@ -26,8 +26,6 @@ export enum Attrs {
// ==================== 特殊效果属性 ====================
freeze_chance = "freeze_chance", // 冰冻概率
revive_count = "revive_count", // 复活次数
revive_time = "revive_time", // 复活时间
invincible_time = "invincible_time",// 无敌时间
puncture = "puncture", // 穿刺次数
wfuny = "wfuny", // 风怒

View File

@@ -296,6 +296,11 @@ export const SkillSet: Record<number, SkillConfig> = {
DTType:DTType.single,kind:SkillKind.Support,ap:0,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,buffs:[{buff:Attrs.ap,value:2},{buff:Attrs.hp_max,value:10}],info:"随机3个友方+2攻击,+10最大生命值",
},
6501:{
uuid:6501,name:"复活",sp_name:"buff_wind",icon:"1255",TGroup:TGroup.Self,readyAnm:"ap_up",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,buffs:[],info:"立即复活获得50%生命",
}
};

View File

@@ -0,0 +1,11 @@
{
"ver": "1.0.1",
"importer": "text",
"imported": true,
"uuid": "c86bee35-69d7-43a9-ab1a-967c1e4f08a8",
"files": [
".json"
],
"subMetas": {},
"userData": {}
}

View File

@@ -70,6 +70,7 @@ export interface heroInfo {
field?:number[]; // 驻场技能uuid列表英雄在场时对全局生效
atking?:{s_uuid:number, t_num:number}[]; // 普通攻击后触发的技能配置s_uuid: 技能id, t_num: 触发所需的普攻次数
atked?:{s_uuid:number, t_num:number}[]; // 受击后触发的技能配置s_uuid: 技能id, t_num: 触发所需的受击次数
revive?:{s_uuid:number,r_num:number,upr:number}[]
// dis: number; // 攻击距离(像素)
speed: number; // 移动速度(像素/秒)
skills: Record<number, HSkillInfo> ; // 携带技能ID列表

View File

@@ -116,6 +116,7 @@ export class Hero extends ecs.Entity {
model.fend = hero.fend;
model.atking = hero.atking;
model.atked = hero.atked;
model.revive = hero.revive;
// 基础属性按等级倍率初始化
// 使用指数增长公式等级2时为原来的3倍等级3时为原来的9倍 (若需线性增长可改为 hero.ap * (1 + (model.lv - 1) * (FightSet.H_HERO_POW - 1)))

View File

@@ -188,16 +188,25 @@ export class HeroAtkSystem extends ecs.ComblockSystem implements ecs.ISystemUpd
// 检查死亡
if (TAttrsComp.hp <= 0) {
// 复活机制:如果玩家属性内的复活属性值>=1 则执行复活,原地50%血量复活
if (TAttrsComp.revive_count >= 1) {
TAttrsComp.revive_count--;
let canRevive = false;
let maxReviveCount = 0;
if (TAttrsComp.revive && TAttrsComp.revive.length > 0) {
const reviveConf = TAttrsComp.revive[0];
maxReviveCount = reviveConf.r_num + Math.floor((TAttrsComp.lv - 1) * reviveConf.upr);
if (TAttrsComp.revived_count < maxReviveCount) {
canRevive = true;
}
}
if (canRevive) {
TAttrsComp.revived_count++;
TAttrsComp.is_reviving = true; // 标记为正在复活
// 触发死亡动画(假死)
if (targetView) {
targetView.do_dead();
// 延迟1秒复活
targetView.scheduleRevive(1.0);
}
mLogger.log(this.debugMode, 'HeroAtkSystem', ` Hero waiting to revive! Lives left: ${TAttrsComp.revive_count}`);
mLogger.log(this.debugMode, 'HeroAtkSystem', ` Hero waiting to revive! Lives revived: ${TAttrsComp.revived_count}/${maxReviveCount}`);
return reDate;
}

View File

@@ -34,6 +34,7 @@ export class HeroAttrsComp extends ecs.Comp {
fend?: number[];
atking?: {s_uuid: number, t_num: number}[];
atked?: {s_uuid: number, t_num: number}[];
revive?: {s_uuid: number, r_num: number, upr: number}[];
// ==================== 特殊属性 ====================
critical: number = 0; // 暴击率
@@ -41,8 +42,7 @@ export class HeroAttrsComp extends ecs.Comp {
puncture: number = 0; // 穿刺次数
wfuny: number = 0; // 风怒
revive_count: number = 0; // 复活次数
revive_time: number = 0; // 复活时间
revived_count: number = 0; // 复活次数
invincible_time: number = 0;// 无敌时间
@@ -245,10 +245,10 @@ export class HeroAttrsComp extends ecs.Comp {
this.fend = undefined;
this.atking = undefined;
this.atked = undefined;
this.revive = undefined;
this.critical = 0;
this.freeze_chance = 0;
this.revive_count = 0;
this.revive_time = 0;
this.revived_count = 0;
this.invincible_time = 0;
this.puncture = 0;
this.wfuny = 0;

View File

@@ -389,27 +389,17 @@ export class HeroViewComp extends CCComp {
alive(){
// 重置复活标记 - 必须最先重置否则status_change会被拦截
this.model.is_reviving = false;
this.model.is_dead=false
this.model.is_count_dead=false
this.deadCD = 0;
this.as.do_buff();
this.status_change("idle");
this.top_node.active=true
this.setTopBarOpacity(false);
this.lastBarUpdateTime=0
// this.status_change("idle");
// this.top_node.active=true
// this.setTopBarOpacity(false);
// this.lastBarUpdateTime=0
}
/**
* 调度复活逻辑
* @param delay 延迟时间(秒)
*/
scheduleRevive(delay: number) {
this.scheduleOnce(() => {
this.alive();
}, delay);
}
/**
* 死亡视图表现

View File

@@ -174,6 +174,7 @@ export class Monster extends ecs.Entity {
model.fend = hero.fend;
model.atking = hero.atking;
model.atked = hero.atked;
model.revive = hero.revive;
// 标记是否 Boss非 Boss 默认记作杂兵
model.is_boss =is_boss