// 事件配置(資料驅動) export const EVENT_CONFIG = [ // Good 事件 { id: 'lucky_find', type: 'good', weight: 0.3, condition: (state) => state.happiness > 50 && state.luck > 10, effects: [ { type: 'modifyStats', payload: { happiness: +10, luck: +5 } }, { type: 'addBuff', payload: { id: 'fortune', name: '福運加持', durationTicks: 5, percent: { luck: 0.2 } } }, { type: 'logMessage', payload: '寵物撿到符咒!好運來了~' } ] }, { id: 'find_treat', type: 'good', weight: 0.25, condition: (state) => state.hunger < 80, effects: [ { type: 'modifyStats', payload: { hunger: +15, happiness: +5 } }, { type: 'logMessage', payload: '寵物發現了美味的點心!' } ] }, { id: 'playful_moment', type: 'good', weight: 0.2, condition: (state) => !state.isSleeping && state.happiness < 90, effects: [ { type: 'modifyStats', payload: { happiness: +12, dex: +1 } }, { type: 'logMessage', payload: '寵物玩得很開心,敏捷度提升了!' } ] }, { id: 'deity_blessing', type: 'good', weight: 0.15, condition: (state) => { const currentDeity = state.currentDeityId return state.deityFavors[currentDeity] > 30 }, effects: [ { type: 'modifyStats', payload: { health: +10, happiness: +8 } }, { type: 'addBuff', payload: { id: 'blessing', name: '神明祝福', durationTicks: 10, percent: { health: 0.1 } } }, { type: 'logMessage', payload: '感受到神明的祝福,寵物精神煥發!' } ] }, { id: 'rare_treasure', type: 'rare', weight: 0.1, condition: (state) => state.luck > 20 && Math.random() > 0.7, effects: [ { type: 'modifyStats', payload: { luck: +10, str: +2, int: +2, dex: +2 } }, { type: 'addBuff', payload: { id: 'treasure_luck', name: '寶物運', durationTicks: 15, percent: { dropRate: 0.3 } } }, { type: 'logMessage', payload: '✨ 發現稀有寶物!運勢大爆發!' } ] }, // Bad 事件 { id: 'over_eat', type: 'bad', weight: 0.4, condition: (state) => state.weight > 600 && state.hunger < 20, effects: [ { type: 'modifyStats', payload: { health: -15, weight: +20 } }, { type: 'addBuff', payload: { id: 'hungry_penalty', name: '飢餓懲罰', durationTicks: 3, flat: { hungerDecay: 0.1 } } }, { type: 'logMessage', payload: '寵物偷吃太多,胃痛了!' } ] }, { id: 'catch_cold', type: 'bad', weight: 0.3, condition: (state) => state.health < 70 && !state.isSick, effects: [ { type: 'modifyStats', payload: { health: -10, happiness: -5 } }, { type: 'addBuff', payload: { id: 'sick', name: '生病', durationTicks: 5, flat: { healthDecay: 0.05 } } }, { type: 'modifyStats', payload: { isSick: true } }, { type: 'logMessage', payload: '寵物感冒了,需要好好休息...' } ] }, { id: 'accident', type: 'bad', weight: 0.2, condition: (state) => state.dex < 30 && Math.random() > 0.5, effects: [ { type: 'modifyStats', payload: { health: -8, happiness: -10 } }, { type: 'logMessage', payload: '寵物不小心摔了一跤,受傷了...' } ] }, { id: 'lonely', type: 'bad', weight: 0.1, condition: (state) => state.happiness < 30 && state.hunger > 50, effects: [ { type: 'modifyStats', payload: { happiness: -15 } }, { type: 'logMessage', payload: '寵物感到孤單,心情低落...' } ] }, // Weird 事件 { id: 'stare_wall', type: 'weird', weight: 0.3, condition: (state) => state.isSleeping === false && Math.random() > 0.7, effects: [ { type: 'modifyStats', payload: { happiness: -5 } }, { type: 'logMessage', payload: '寵物盯著牆壁發呆... 怪怪的。' } ] }, { id: 'sudden_sleep', type: 'weird', weight: 0.25, condition: (state) => !state.isSleeping && state.happiness < 50, effects: [ { type: 'modifyStats', payload: { isSleeping: true } }, { type: 'modifyStats', payload: { health: +5 } }, { type: 'logMessage', payload: '寵物突然睡著了... 可能是太累了?' } ] }, { id: 'mysterious_glow', type: 'weird', weight: 0.2, condition: (state) => state.luck > 15 && Math.random() > 0.6, effects: [ { type: 'modifyStats', payload: { luck: +3, int: +1 } }, { type: 'logMessage', payload: '寵物身上發出神秘的光芒... 智力提升了?' } ] }, { id: 'random_dance', type: 'weird', weight: 0.15, condition: (state) => state.happiness > 60 && !state.isSleeping, effects: [ { type: 'modifyStats', payload: { happiness: +8, dex: +1 } }, { type: 'logMessage', payload: '寵物突然開始跳舞!看起來很開心~' } ] }, { id: 'philosophy_moment', type: 'weird', weight: 0.1, condition: (state) => state.int > 20 && Math.random() > 0.7, effects: [ { type: 'modifyStats', payload: { int: +2, happiness: +5 } }, { type: 'logMessage', payload: '寵物似乎在思考人生... 智力提升了!' } ] } ]