v0.1.12: 弹框有道(ModalShell 统一壳 + 底部独立一排 + 全按钮检修)
【弹框体系】 - ModalShell 统一壳:六弹框(事件/战报/纸笺/成员/定鼎)全部迁移 - 右上独立×(与内容分离)+ ESC 全局关闭 + 遮罩策略(详情可点、事件禁遮罩) - 事件「稍后再议」:requeueEvent 按回队列下月再弹(不消灭不误弃) - 底部独立一排 footer:明显分隔线+独立底色,与内容区分;返回重选/出战、 合上战报、翻过此页、暂不落印/落印分列其位 - 加宽:事件680/战报720/纸笺620/成员740/定鼎700;min(92vw,N) 零横滚;内容区滚动+word-break 【全按钮检修】 - 求经台 UI 入口补上(藏书阁3级/150灵石/两年冷却三条件 disabled 提示) - 冲关二次确认(成功率约X%预览)——走火可能陨落的高危操作不再是一点即发 - 丹房炼制资源不足即禁用+title;集市收藏品购买灵石不足禁用 - 外交赠礼改 40/120/300 三档 + 每档预览「关系+N」换算 【测试】923→937(requeue 语义/赠礼档位矩阵/求经四态/弹框规格带) 金钟罩零漂移(纯 UI 层),typecheck/build 通过
This commit is contained in:
@@ -32,12 +32,18 @@ export function npcRelation(w: World, npcId: string): number {
|
||||
return w.state.npcFamilies[npcId]?.relation ?? 0
|
||||
}
|
||||
|
||||
export function calcGiftGain(stones: number): number {
|
||||
return Math.max(1, Math.round(stones / 12))
|
||||
}
|
||||
|
||||
export const GIFT_TIERS = [40, 120, 300] as const
|
||||
|
||||
export function giftNpc(w: World, npcId: string, stones: number): boolean {
|
||||
const fam = w.state.family
|
||||
if (stones <= 0 || fam.stones < stones) return false
|
||||
fam.stones -= stones
|
||||
const npc = w.state.npcFamilies[npcId]
|
||||
const gain = Math.max(1, Math.round(stones / 12))
|
||||
const gain = calcGiftGain(stones)
|
||||
npc.relation = Math.min(100, npc.relation + gain)
|
||||
w.log('info', `厚礼送往${npc.name},两家关系 +${gain}。`)
|
||||
return true
|
||||
|
||||
@@ -298,6 +298,12 @@ export class World {
|
||||
this.pruneYearFlags()
|
||||
}
|
||||
|
||||
requeueEvent(eventId: string): void {
|
||||
const s = this.state
|
||||
if (!s.eventQueue.includes(eventId)) s.eventQueue.push(eventId)
|
||||
s.pendingEvent = undefined
|
||||
}
|
||||
|
||||
/** 年度清理:剔除 3 年以前的年份前缀 flag 键(防长线膨胀) */
|
||||
private pruneYearFlags(): void {
|
||||
const fam = this.state.family
|
||||
|
||||
Reference in New Issue
Block a user