feat(victory): add defeat reward gate by clear time and kill ratio

Defeat rewards now require surviving 15s and killing at least one
monster. Qualified defeats grant a fixed survive reward plus a
kill-ratio-scaled bonus; unqualified defeats yield nothing.
Victory rewards remain unchanged.
This commit is contained in:
pan
2026-09-11 15:57:21 +08:00
parent a6dbda13b1
commit 5fe961846f
4 changed files with 107 additions and 21 deletions

View File

@@ -46,6 +46,7 @@ import { Timer } from "db://oops-framework/core/common/timer/Timer";
import { FieldSkillType } from "../common/config/SkillSet";
import { FieldSkillHelper } from "../hero/FieldSkillHelper";
import { spawningEngine, WAVE_DURATION, BATTLE_TIMEOUT } from "./RogueConfig";
import { MissionMonCompComp } from "./MissionMonComp";
import {
getProgressText,
} from "../common/config/StageSet";
@@ -637,6 +638,11 @@ export class MissionComp extends CCComp {
// 结算类型:小节胜利显示"下一节",末关通关显示"确认退出" + 通关标题
settle_type: this._settleType,
settle_title: this._settleTitle,
// 失败奖励判定数据:本节坚持时间 + 击杀统计(kills=已刷出-存活)
defeat_stats: {
clear_time: this.clearTime,
...this.querySectionKillStats(),
},
});
} else {
// 如果 play 已经是 false,说明是通过 fight_end 进来的
@@ -1080,6 +1086,17 @@ export class MissionComp extends CCComp {
return hasHero && smc.mission.dead_heroes.length === 0;
}
/**
* 查询本节击杀统计(转交结算弹窗做失败奖励判定)
* @returns { kills, total },查询不到 MissionMonComp 时返回 0/0
*/
private querySectionKillStats(): { kills: number; total: number } {
const entities = ecs.query(ecs.allOf(MissionMonCompComp));
const comp = entities[0]?.get(MissionMonCompComp);
if (!comp) return { kills: 0, total: 0 };
return comp.getSectionKillStats();
}
/**
* 英雄全灭检测:若场上无存活英雄且处于战斗中,预约延迟结算(等待死亡动画播完再弹窗)。
* @param heroCount 当前存活英雄数量