70 lines
2.3 KiB
JavaScript
70 lines
2.3 KiB
JavaScript
/**
|
|
* Galaxy Strike Online — Season System (GDD §20.3)
|
|
* 90-day seasons with themed content, seasonal leaderboards, and exclusive rewards.
|
|
* Season 1: "Dawn of the Void"
|
|
*/
|
|
|
|
const SEASONS = {
|
|
1: {
|
|
id: 1,
|
|
name: 'Dawn of the Void',
|
|
theme: 'void_cult',
|
|
icon: '🌑',
|
|
color: '#78909c',
|
|
description: 'The Void Cult stirs. Ancient relics emerge from uncharted sectors. Are you ready?',
|
|
durationDays: 90,
|
|
rewards: {
|
|
top1: { title: 'Void Champion', skin: 'void_champion_skin', credits: 50000 },
|
|
top10: { title: 'Void Knight', skin: 'void_knight_skin', credits: 20000 },
|
|
top100:{ title: 'Void Initiate', skin: null, credits: 5000 },
|
|
participation: { title: 'Season 1 Veteran', credits: 1000 },
|
|
},
|
|
bonuses: {
|
|
darkMatterBonus: 0.25, // +25% dark matter production
|
|
voidCultRepBonus: 0.5, // +50% Void Cult reputation gain
|
|
},
|
|
startDate: new Date('2026-01-01'),
|
|
endDate: new Date('2026-04-01'),
|
|
}
|
|
};
|
|
|
|
const CURRENT_SEASON_ID = 1;
|
|
|
|
class SeasonSystem {
|
|
constructor() {
|
|
this.currentSeason = SEASONS[CURRENT_SEASON_ID];
|
|
}
|
|
|
|
getCurrentSeason() {
|
|
const now = new Date();
|
|
const s = this.currentSeason;
|
|
if (!s) return { active: false };
|
|
const daysLeft = Math.max(0, Math.ceil((s.endDate - now) / 86400000));
|
|
const daysTotal = Math.ceil((s.endDate - s.startDate) / 86400000);
|
|
const daysDone = Math.max(0, Math.ceil((now - s.startDate) / 86400000));
|
|
return {
|
|
active: now >= s.startDate && now <= s.endDate,
|
|
season: { ...s, daysLeft, daysTotal, daysDone, progress: Math.round(daysDone/daysTotal*100) },
|
|
};
|
|
}
|
|
|
|
getSeasonBonuses() {
|
|
return this.currentSeason?.bonuses || {};
|
|
}
|
|
|
|
recordSeasonActivity(playerData, activityType, score = 1) {
|
|
if (!playerData.seasonProgress) playerData.seasonProgress = {};
|
|
playerData.seasonProgress[CURRENT_SEASON_ID] = playerData.seasonProgress[CURRENT_SEASON_ID] || { score: 0, activities: {} };
|
|
const sp = playerData.seasonProgress[CURRENT_SEASON_ID];
|
|
sp.score += score;
|
|
sp.activities[activityType] = (sp.activities[activityType] || 0) + 1;
|
|
return sp.score;
|
|
}
|
|
|
|
getSeasonScore(playerData) {
|
|
return playerData.seasonProgress?.[CURRENT_SEASON_ID]?.score || 0;
|
|
}
|
|
}
|
|
|
|
module.exports = { SeasonSystem, SEASONS };
|