export class Seasons { constructor(game) { this.game = game; this.current = 'autumn'; this.dayInSeason = 0; this.daysPerSeason = 7; this.seasonIndex = 2; // autumn this.lastDay = 0; } update() { if (this.game.gameDay !== this.lastDay) { this.lastDay = this.game.gameDay; this.dayInSeason++; if (this.dayInSeason > this.daysPerSeason) { const prevSeason = this.current; this.dayInSeason = 1; this.seasonIndex = (this.seasonIndex + 1) % 4; this.current = Seasons.SEASONS[this.seasonIndex]; this.game.notify(`Наступила ${this.getName()}! ${this.getIcon()}`, 'good'); // Пережили зиму if (prevSeason === 'winter') { this.game.questSystem.onEvent('survive_winter'); } } } } // Модификатор базовой температуры getTemperatureModifier() { switch (this.current) { case 'winter': return -15; case 'spring': return -2; case 'summer': return 10; case 'autumn': return -5; default: return 0; } } // Множитель потери тепла getWarmthDrain() { switch (this.current) { case 'winter': return 1.5; case 'spring': return 0.8; case 'summer': return 0.3; case 'autumn': return 1.0; default: return 1; } } // Множитель потери голода getHungerDrain() { switch (this.current) { case 'winter': return 1.3; case 'summer': return 0.8; default: return 1; } } // Веса погодных типов для каждого сезона getWeatherWeights() { switch (this.current) { case 'winter': return { clear: 1, rain: 1, snow: 5, fog: 3 }; case 'spring': return { clear: 3, rain: 4, snow: 0, fog: 2 }; case 'summer': return { clear: 5, rain: 2, snow: 0, fog: 1 }; case 'autumn': return { clear: 2, rain: 4, snow: 1, fog: 3 }; default: return { clear: 3, rain: 2, snow: 1, fog: 1 }; } } getName() { return Seasons.NAMES[this.current]; } getIcon() { return Seasons.ICONS[this.current]; } getDaysLeft() { return this.daysPerSeason - this.dayInSeason; } getSaveData() { return { current: this.current, dayInSeason: this.dayInSeason, seasonIndex: this.seasonIndex, lastDay: this.lastDay }; } loadSaveData(data) { if (data) { this.current = data.current || 'autumn'; this.dayInSeason = data.dayInSeason || 0; this.seasonIndex = data.seasonIndex || 2; this.lastDay = data.lastDay || 0; } } reset() { this.current = 'autumn'; this.dayInSeason = 0; this.seasonIndex = 2; this.lastDay = 0; } } Seasons.SEASONS = ['spring', 'summer', 'autumn', 'winter']; Seasons.NAMES = { spring: 'Весна', summer: 'Лето', autumn: 'Осень', winter: 'Зима' }; Seasons.ICONS = { spring: '🌱', summer: '☀️', autumn: '🍂', winter: '❄️' };