LejobuildYT commited on
Commit
0d9858e
·
verified ·
1 Parent(s): 81e5b38

🐳 04/03 - 15:45 - now implement that you can prestige after you hit your first 10% of investors. it gives a slight boost, but if you have only 10% investors you get a smaller boost, but with 100% you

Browse files
Files changed (2) hide show
  1. index.html +34 -9
  2. script.js +145 -2
index.html CHANGED
@@ -91,6 +91,10 @@
91
  <i data-lucide="users" class="w-4 h-4"></i>
92
  <span class="text-sm">Investors: <span class="mono" id="investors-display">0.0%</span></span>
93
  </div>
 
 
 
 
94
  <button onclick="game.toggleSettings()" class="bg-emerald-600 hover:bg-emerald-700 px-3 py-1 rounded text-sm font-medium transition flex items-center gap-2">
95
  <i data-lucide="settings" class="w-4 h-4"></i>
96
  Settings
@@ -374,15 +378,36 @@
374
  </button>
375
  </div>
376
  <div class="p-6 space-y-4">
377
- <button onclick="game.saveGame()" class="w-full bg-blue-500 hover:bg-blue-600 text-white py-2 rounded font-semibold transition">
378
- Save Game
379
- </button>
380
- <button onclick="game.loadGame()" class="w-full bg-green-500 hover:bg-green-600 text-white py-2 rounded font-semibold transition">
381
- Load Game
382
- </button>
383
- <button onclick="game.resetGame()" class="w-full bg-red-500 hover:bg-red-600 text-white py-2 rounded font-semibold transition">
384
- Reset Game
385
- </button>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
386
  <div class="pt-4 border-t border-gray-200">
387
  <p class="text-sm text-gray-600">Game auto-saves every 30 seconds</p>
388
  </div>
 
91
  <i data-lucide="users" class="w-4 h-4"></i>
92
  <span class="text-sm">Investors: <span class="mono" id="investors-display">0.0%</span></span>
93
  </div>
94
+ <div class="flex items-center gap-2 text-emerald-100 bg-emerald-600 bg-opacity-50 px-3 py-1 rounded">
95
+ <i data-lucide="sparkles" class="w-4 h-4"></i>
96
+ <span class="text-sm">Boost: <span class="mono font-bold" id="prestige-display">1.00x</span></span>
97
+ </div>
98
  <button onclick="game.toggleSettings()" class="bg-emerald-600 hover:bg-emerald-700 px-3 py-1 rounded text-sm font-medium transition flex items-center gap-2">
99
  <i data-lucide="settings" class="w-4 h-4"></i>
100
  Settings
 
378
  </button>
379
  </div>
380
  <div class="p-6 space-y-4">
381
+ <!-- Prestige Section -->
382
+ <div id="prestige-section" class="bg-gradient-to-r from-purple-500 to-pink-500 rounded-lg p-4 text-white mb-4">
383
+ <h3 class="font-bold text-lg mb-2 flex items-center gap-2">
384
+ <i data-lucide="sparkles" class="w-5 h-5"></i>
385
+ Prestige System
386
+ </h3>
387
+ <p class="text-sm opacity-90 mb-3">Reset your progress for a permanent income boost based on your investor percentage!</p>
388
+ <div class="text-xs mb-3 bg-white bg-opacity-20 rounded p-2">
389
+ <div>Current Multiplier: <span class="font-bold" id="current-prestige-multiplier">1.00x</span></div>
390
+ <div>Total Prestiges: <span class="font-bold" id="total-prestiges">0</span></div>
391
+ </div>
392
+ <button onclick="if(game.canPrestige()) game.prestige()" id="prestige-btn" class="w-full bg-white text-purple-600 hover:bg-gray-100 py-3 rounded font-bold transition shadow-lg">
393
+ <div class="flex flex-col items-center">
394
+ <span class="font-bold">PRESTIGE LOCKED</span>
395
+ <span class="text-xs opacity-75">Need 10% investors</span>
396
+ </div>
397
+ </button>
398
+ </div>
399
+
400
+ <div class="border-t border-gray-200 pt-4 space-y-2">
401
+ <button onclick="game.saveGame()" class="w-full bg-blue-500 hover:bg-blue-600 text-white py-2 rounded font-semibold transition">
402
+ Save Game
403
+ </button>
404
+ <button onclick="game.loadGame()" class="w-full bg-green-500 hover:bg-green-600 text-white py-2 rounded font-semibold transition">
405
+ Load Game
406
+ </button>
407
+ <button onclick="game.resetGame()" class="w-full bg-red-500 hover:bg-red-600 text-white py-2 rounded font-semibold transition">
408
+ Reset Game
409
+ </button>
410
+ </div>
411
  <div class="pt-4 border-t border-gray-200">
412
  <p class="text-sm text-gray-600">Game auto-saves every 30 seconds</p>
413
  </div>
script.js CHANGED
@@ -7,6 +7,11 @@ class ComputerEvolution {
7
  this.soundEnabled = true;
8
  this.lastSave = Date.now();
9
 
 
 
 
 
 
10
  // Hardware
11
  this.hardware = {
12
  hdd: {
@@ -105,7 +110,96 @@ class ComputerEvolution {
105
  // Apply OS multiplier
106
  const osMultiplier = this.osLevels[this.currentOS].multiplier;
107
 
108
- return baseIncome * cpuMultiplier * osMultiplier;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
109
  }
110
 
111
  calculateUsage() {
@@ -241,6 +335,51 @@ class ComputerEvolution {
241
  document.getElementById('income-display').textContent = this.formatMoney(this.calculateIncome());
242
  document.getElementById('investors-display').textContent = this.investors.toFixed(1) + '%';
243
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
244
  // HDD
245
  const maxStorage = this.hardware.hdd.capacity * this.hardware.hdd.quantity;
246
  const usage = this.calculateUsage();
@@ -432,7 +571,9 @@ class ComputerEvolution {
432
  hardware: this.hardware,
433
  currentOS: this.currentOS,
434
  installedApps: this.installedApps,
435
- availableApps: this.availableApps.map(app => ({ id: app.id, installed: app.installed }))
 
 
436
  };
437
  localStorage.setItem('computerEvolutionSave', JSON.stringify(data));
438
  this.showToast('Game Saved', 'Your progress has been saved!');
@@ -455,6 +596,8 @@ class ComputerEvolution {
455
  if (app) app.installed = savedApp.installed;
456
  });
457
  }
 
 
458
  this.showToast('Game Loaded', 'Welcome back!');
459
  } catch (e) {
460
  console.error('Failed to load save:', e);
 
7
  this.soundEnabled = true;
8
  this.lastSave = Date.now();
9
 
10
+ // Prestige system
11
+ this.prestigeMultiplier = 1;
12
+ this.totalPrestiges = 0;
13
+ this.prestigeThreshold = 10; // Minimum 10% investors to prestige
14
+
15
  // Hardware
16
  this.hardware = {
17
  hdd: {
 
110
  // Apply OS multiplier
111
  const osMultiplier = this.osLevels[this.currentOS].multiplier;
112
 
113
+ // Apply Prestige multiplier
114
+ // Formula: 1 + (investors% / 100) * 0.5 at 10%, up to 1 + (100/100) * 2 = 3x at 100%
115
+ // But we use the stored prestigeMultiplier which is calculated at prestige time
116
+
117
+ return baseIncome * cpuMultiplier * osMultiplier * this.prestigeMultiplier;
118
+ }
119
+
120
+ calculatePrestigeBoost() {
121
+ // Calculate potential boost based on current investors
122
+ // At 10%: 1.1x boost (10% increase)
123
+ // At 50%: 1.5x boost (50% increase)
124
+ // At 100%: 2.5x boost (150% increase)
125
+ if (this.investors < this.prestigeThreshold) return 0;
126
+
127
+ // Formula: 1 + (investors / 100) * 1.5
128
+ // 10% = 1.15x, 100% = 2.5x
129
+ const boost = 1 + (this.investors / 100) * 1.5;
130
+ return boost;
131
+ }
132
+
133
+ canPrestige() {
134
+ return this.investors >= this.prestigeThreshold;
135
+ }
136
+
137
+ prestige() {
138
+ if (!this.canPrestige()) {
139
+ this.showToast('Cannot Prestige', `You need at least ${this.prestigeThreshold}% investors!`);
140
+ return;
141
+ }
142
+
143
+ const boost = this.calculatePrestigeBoost();
144
+ const oldMultiplier = this.prestigeMultiplier;
145
+ this.prestigeMultiplier *= boost;
146
+ this.totalPrestiges++;
147
+
148
+ // Reset game progress
149
+ this.money = 50;
150
+ this.totalEarned = 0;
151
+ this.investors = 0;
152
+
153
+ // Reset hardware
154
+ this.hardware = {
155
+ hdd: {
156
+ quantity: 1,
157
+ capacity: 12,
158
+ used: 0,
159
+ baseCost: { quantity: 2.5, capacity: 1.9 },
160
+ costMultiplier: 1.5
161
+ },
162
+ cpu: {
163
+ cores: 1,
164
+ speed: 38.7,
165
+ used: 0,
166
+ baseCost: { cores: 50, speed: 23 },
167
+ costMultiplier: 1.6
168
+ },
169
+ ram: {
170
+ quantity: 1,
171
+ capacity: 31.3,
172
+ used: 0,
173
+ baseCost: { quantity: 50, capacity: 23 },
174
+ costMultiplier: 1.5
175
+ },
176
+ motherboard: {
177
+ level: 1,
178
+ maxOS: 2,
179
+ baseCost: 11.5,
180
+ costMultiplier: 2.5
181
+ }
182
+ };
183
+
184
+ // Reset OS
185
+ this.currentOS = 1;
186
+
187
+ // Reset apps
188
+ this.installedApps = ['terminal'];
189
+ this.availableApps.forEach(app => {
190
+ app.installed = app.id === 'terminal';
191
+ });
192
+
193
+ // Close modal if open
194
+ this.toggleSettings();
195
+
196
+ this.showToast('Prestige Complete!',
197
+ `Boost: ${boost.toFixed(2)}x\nTotal Multiplier: ${oldMultiplier.toFixed(2)}x → ${this.prestigeMultiplier.toFixed(2)}x`,
198
+ 5000);
199
+
200
+ this.updateUI();
201
+ this.renderApps();
202
+ this.saveGame();
203
  }
204
 
205
  calculateUsage() {
 
335
  document.getElementById('income-display').textContent = this.formatMoney(this.calculateIncome());
336
  document.getElementById('investors-display').textContent = this.investors.toFixed(1) + '%';
337
 
338
+ // Update prestige display
339
+ const prestigeDisplay = document.getElementById('prestige-display');
340
+ const prestigeBtn = document.getElementById('prestige-btn');
341
+ const currentMultiplierEl = document.getElementById('current-prestige-multiplier');
342
+ const totalPrestigesEl = document.getElementById('total-prestiges');
343
+
344
+ if (prestigeDisplay) {
345
+ prestigeDisplay.textContent = this.prestigeMultiplier.toFixed(2) + 'x';
346
+ }
347
+
348
+ if (currentMultiplierEl) {
349
+ currentMultiplierEl.textContent = this.prestigeMultiplier.toFixed(2) + 'x';
350
+ }
351
+
352
+ if (totalPrestigesEl) {
353
+ totalPrestigesEl.textContent = this.totalPrestiges;
354
+ }
355
+
356
+ // Update prestige button state
357
+ if (prestigeBtn) {
358
+ if (this.canPrestige()) {
359
+ const potentialBoost = this.calculatePrestigeBoost();
360
+ const potentialMultiplier = this.prestigeMultiplier * potentialBoost;
361
+
362
+ prestigeBtn.innerHTML = `
363
+ <div class="flex flex-col items-center">
364
+ <span class="font-bold">PRESTIGE NOW</span>
365
+ <span class="text-xs opacity-90">+${potentialBoost.toFixed(2)}x boost (${this.investors.toFixed(1)}% investors)</span>
366
+ <span class="text-xs opacity-75">New total: ${potentialMultiplier.toFixed(2)}x</span>
367
+ </div>
368
+ `;
369
+ prestigeBtn.classList.remove('opacity-50', 'cursor-not-allowed');
370
+ prestigeBtn.classList.add('animate-pulse');
371
+ } else {
372
+ prestigeBtn.innerHTML = `
373
+ <div class="flex flex-col items-center">
374
+ <span class="font-bold">PRESTIGE LOCKED</span>
375
+ <span class="text-xs opacity-75">Need ${this.prestigeThreshold}% investors (${(this.prestigeThreshold - this.investors).toFixed(1)}% more)</span>
376
+ </div>
377
+ `;
378
+ prestigeBtn.classList.add('opacity-50', 'cursor-not-allowed');
379
+ prestigeBtn.classList.remove('animate-pulse');
380
+ }
381
+ }
382
+
383
  // HDD
384
  const maxStorage = this.hardware.hdd.capacity * this.hardware.hdd.quantity;
385
  const usage = this.calculateUsage();
 
571
  hardware: this.hardware,
572
  currentOS: this.currentOS,
573
  installedApps: this.installedApps,
574
+ availableApps: this.availableApps.map(app => ({ id: app.id, installed: app.installed })),
575
+ prestigeMultiplier: this.prestigeMultiplier,
576
+ totalPrestiges: this.totalPrestiges
577
  };
578
  localStorage.setItem('computerEvolutionSave', JSON.stringify(data));
579
  this.showToast('Game Saved', 'Your progress has been saved!');
 
596
  if (app) app.installed = savedApp.installed;
597
  });
598
  }
599
+ if (data.prestigeMultiplier) this.prestigeMultiplier = data.prestigeMultiplier;
600
+ if (data.totalPrestiges) this.totalPrestiges = data.totalPrestiges;
601
  this.showToast('Game Loaded', 'Welcome back!');
602
  } catch (e) {
603
  console.error('Failed to load save:', e);