You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
1016 B
34 lines
1016 B
|
3 weeks ago
|
/**
|
||
|
|
* 按波次收紧战斗同屏表现预算(中后期怪物/飘字/特效密度上升)。
|
||
|
|
*/
|
||
|
|
export class BattlePresentationBudget {
|
||
|
|
private static _wave = 1;
|
||
|
|
|
||
|
|
/** 同步当前波次(Combat 波次,从 1 起) */
|
||
|
|
static setWave(waveNum: number): void {
|
||
|
|
this._wave = Math.max(1, Math.floor(Number(waveNum) || 1));
|
||
|
|
}
|
||
|
|
|
||
|
|
/** 表现强度系数:10 波前 1,25 波及以后约 0.4 */
|
||
|
|
static get intensityScale(): number {
|
||
|
|
const w = this._wave;
|
||
|
|
if (w <= 10) return 1;
|
||
|
|
if (w >= 25) return 0.4;
|
||
|
|
return 1 - (w - 10) * (0.6 / 15);
|
||
|
|
}
|
||
|
|
|
||
|
|
/** 15 波后 ECS 分片 tick,减轻 CPU */
|
||
|
|
static get combatTickSlice(): number {
|
||
|
|
return this._wave >= 15 ? 2 : 1;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 按波次缩放同屏数量上限。
|
||
|
|
* @param base 档位基础上限
|
||
|
|
* @param min 缩放后下限
|
||
|
|
*/
|
||
|
|
static scaleCount(base: number, min: number): number {
|
||
|
|
return Math.max(min, Math.floor(base * this.intensityScale));
|
||
|
|
}
|
||
|
|
}
|