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

@@ -22,7 +22,7 @@ import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/O
import { Monster } from "../hero/Mon";
import { smc } from "../common/SingletonModuleComp";
import { GameEvent } from "../common/config/GameEvent";
import { BoxSet, FightSet } from "../common/config/GameSet";
import { BoxSet, FacSet, FightSet } from "../common/config/GameSet";
import { MonType } from "../common/config/heroSet";
import { spawningEngine, GeneratedMonster, TestModeConfig } from "./RogueConfig";
import { HeroAttrsComp } from "../hero/HeroAttrsComp";
@@ -254,6 +254,25 @@ export class MissionMonCompComp extends CCComp {
return FightSet.MON_ROW_BACK_X;
}
/**
* 本节击杀统计(结算奖励消费):
* kills = 已刷出数 - 场上存活数(实时查询,不依赖 MissionComp 的 0.2s 降频同步)
* total = 本节目标怪物总数(含未刷出)
*/
public getSectionKillStats(): { kills: number; total: number } {
let alive = 0;
ecs.query(ecs.allOf(HeroAttrsComp)).forEach(entity => {
const attrs = entity.get(HeroAttrsComp);
if (attrs && !attrs.is_dead && attrs.fac === FacSet.MON) {
alive++;
}
});
return {
kills: Math.max(0, this.sectionSpawnedCount - alive),
total: this.sectionTargetCount,
};
}
/** ECS 组件移除时触发 */
reset() { }
}