Session 5: Prestige System with Stellar Essence

This commit is contained in:
2026-08-20 13:43:23 +00:00
parent f18ef5c396
commit 3ee33ee43f
7 changed files with 769 additions and 88 deletions
+54 -4
View File
@@ -14,7 +14,11 @@ const Game = {
lastSaveTime: Date.now(),
buildings: {},
upgrades: [],
achievements: []
achievements: [],
stellarEssence: 0,
prestigeCount: 0,
totalPrestigeEssence: 0,
prestigeUpgrades: []
},
// Configuration
@@ -35,6 +39,7 @@ const Game = {
Audio.init();
UI.init();
Stats.init();
PrestigeUI.init();
console.log('🌌 Cosmic Garden initialized!');
},
@@ -131,6 +136,18 @@ const Game = {
}
}
// Apply prestige multipliers
const prestigeMultiplier = PRESTIGE.getMultiplier();
power *= prestigeMultiplier;
// Apply prestige upgrades
for (const upgradeId of (this.state.prestigeUpgrades || [])) {
const upgrade = PRESTIGE_UPGRADES[upgradeId];
if (upgrade && upgrade.effect === 'clickMultiplier') {
power *= upgrade.value;
}
}
return Math.floor(power);
},
@@ -148,6 +165,18 @@ const Game = {
let production = building.baseProduction * count;
// Apply prestige multiplier
const prestigeMultiplier = PRESTIGE.getMultiplier();
production *= prestigeMultiplier;
// Apply prestige upgrades
for (const upgradeId of (this.state.prestigeUpgrades || [])) {
const upgrade = PRESTIGE_UPGRADES[upgradeId];
if (upgrade && upgrade.effect === 'productionMultiplier') {
production *= upgrade.value;
}
}
// Apply upgrade bonuses
for (const upgradeId of this.state.upgrades) {
const upgrade = UPGRADES[upgradeId];
@@ -171,7 +200,17 @@ const Game = {
getBuildingCost(buildingId) {
const building = BUILDINGS[buildingId];
const count = this.state.buildings[buildingId] || 0;
return Math.floor(building.baseCost * Math.pow(this.config.costScaling, count));
let cost = Math.floor(building.baseCost * Math.pow(this.config.costScaling, count));
// Apply prestige cost reduction
for (const upgradeId of (this.state.prestigeUpgrades || [])) {
const upgrade = PRESTIGE_UPGRADES[upgradeId];
if (upgrade && upgrade.effect === 'costReduction') {
cost *= upgrade.value;
}
}
return Math.floor(cost);
},
/**
@@ -290,7 +329,14 @@ const Game = {
const offlineTime = (Date.now() - this.state.lastSaveTime) / 1000;
if (offlineTime > 60) {
const production = this.getProductionPerSecond();
const offlineEarnings = production * offlineTime * 0.5; // 50% offline efficiency
let offlineRate = 0.5; // 50% offline efficiency
for (const upgradeId of (this.state.prestigeUpgrades || [])) {
const upgrade = PRESTIGE_UPGRADES[upgradeId];
if (upgrade && upgrade.effect === 'offlineBonus') {
offlineRate = upgrade.value;
}
}
const offlineEarnings = production * offlineTime * offlineRate;
if (offlineEarnings > 0) {
this.addStardust(offlineEarnings);
UI.showNotification(
@@ -343,7 +389,11 @@ const Game = {
lastSaveTime: Date.now(),
buildings: {},
upgrades: [],
achievements: []
achievements: [],
stellarEssence: 0,
prestigeCount: 0,
totalPrestigeEssence: 0,
prestigeUpgrades: []
};
UI.update();
UI.showNotification('Game reset!', 'warning');