🏗️💎 MASTER SYSTEM ARCHITECTURE - 100% COMPLETE!
✅ ALL 6 SYSTEMS IMPLEMENTED (1,830 lines): 1️⃣ GAMEPAD CONTROLLER (200 lines) ✅ - Xbox/PS controller support - Left stick → Longboard movement - Buttons: A (interact), X (vape), Y (whistle), B (menu) - Haptic feedback: collision, zombie, vape rumble - Auto-detect connection 2️⃣ VIP MANAGER (250 lines) ✅ - First 20 buyers → Gronk exclusive - Purchase order tracking - Founder badge system - Streamer access keys - Steam/Itch API stubs ready 3️⃣ GRONK STATS (180 lines) ✅ - Level 1-10 progression - XP from vape usage (+10 each) - Stats scale per level: - Cloud size: +15% - Duration: +0.5s - Shield: +20 HP - Speed: +5% - Cooldown: -0.5s 4️⃣ SUSI COMPANION (350 lines) ✅ - Follow Kai (50px distance) - Whistle response (Y button) - Memory tracking AI - Bark animations + sounds - State machine: follow/track/sit/sleep 5️⃣ SAVE/LOAD + AGING (400 lines) ✅ - Complete save structure - Auto-save every 5 min - Export/import saves - Aging engine 9 stages (14-60 years) - Memory-based progression - Sprite auto-switch 6️⃣ NOIR CITY ATMOSPHERE (450 lines) ✅ - Stray cats (3-5) - run from longboard - Stray dogs (2-3) - bark from shadows - Ambient sounds (city, wind, distant) - Dust particles, blowing trash - Flickering streetlights 📊 TECHNICAL: - All systems use singleton pattern - LocalStorage persistence - Event-driven architecture - Phaser 3 compatible - 16:9 centered layout 🎮 INTEGRATION READY: - Full GameScene integration guide - All imports prepared - Event listeners documented - Usage examples provided PROJECT IS NOW 'BETONIRAN' (CONCRETE-SOLID)! 🏗️ Files: - src/systems/GamepadController.js - src/systems/VIPManager.js - src/systems/GronkStats.js - src/systems/SusiCompanion.js - src/systems/SaveLoadSystem.js - src/systems/NoirCitySystem.js - MASTER_SYSTEM_ARCHITECTURE_COMPLETE.md
This commit is contained in:
186
src/systems/GronkStats.js
Normal file
186
src/systems/GronkStats.js
Normal file
@@ -0,0 +1,186 @@
|
||||
/**
|
||||
* GRONK STATS SYSTEM
|
||||
* Level-up progression for Gronk companion
|
||||
* Powers increase with vape usage
|
||||
*/
|
||||
|
||||
class GronkStats {
|
||||
constructor() {
|
||||
this.level = 1;
|
||||
this.xp = 0;
|
||||
this.vapeUsageCount = 0;
|
||||
|
||||
// Gronk abilities
|
||||
this.stats = {
|
||||
vapeCloudSize: 1.0, // Multiplier for cloud area
|
||||
vapeCloudDuration: 3000, // ms
|
||||
shieldStrength: 100, // HP absorbed
|
||||
speedBoost: 1.2, // 20% speed boost baseline
|
||||
cooldown: 10000 // 10s between vapes
|
||||
};
|
||||
|
||||
this.maxLevel = 10;
|
||||
this.load();
|
||||
}
|
||||
|
||||
/**
|
||||
* GAIN XP FROM VAPE USAGE
|
||||
*/
|
||||
useVape() {
|
||||
this.vapeUsageCount++;
|
||||
this.addXP(10); // 10 XP per vape use
|
||||
|
||||
console.log(`💨 Gronk vape used! (${this.vapeUsageCount} total)`);
|
||||
this.save();
|
||||
}
|
||||
|
||||
/**
|
||||
* ADD XP AND CHECK FOR LEVEL UP
|
||||
*/
|
||||
addXP(amount) {
|
||||
this.xp += amount;
|
||||
|
||||
const xpNeeded = this.getXPForNextLevel();
|
||||
if (this.xp >= xpNeeded && this.level < this.maxLevel) {
|
||||
this.levelUp();
|
||||
}
|
||||
|
||||
this.save();
|
||||
}
|
||||
|
||||
/**
|
||||
* LEVEL UP GRONK
|
||||
*/
|
||||
levelUp() {
|
||||
this.level++;
|
||||
this.xp = 0;
|
||||
|
||||
// Increase all stats
|
||||
this.stats.vapeCloudSize += 0.15; // +15% cloud size per level
|
||||
this.stats.vapeCloudDuration += 500; // +0.5s per level
|
||||
this.stats.shieldStrength += 20; // +20 HP per level
|
||||
this.stats.speedBoost += 0.05; // +5% speed per level
|
||||
this.stats.cooldown = Math.max(5000, this.stats.cooldown - 500); // -0.5s cooldown
|
||||
|
||||
console.log('⬆️ GRONK LEVELED UP to ' + this.level + '!');
|
||||
console.log(' Stats:', this.stats);
|
||||
|
||||
// Emit level up event
|
||||
const event = new CustomEvent('gronk-levelup', {
|
||||
detail: {
|
||||
level: this.level,
|
||||
stats: this.stats
|
||||
}
|
||||
});
|
||||
window.dispatchEvent(event);
|
||||
|
||||
this.save();
|
||||
}
|
||||
|
||||
/**
|
||||
* GET XP NEEDED FOR NEXT LEVEL
|
||||
*/
|
||||
getXPForNextLevel() {
|
||||
// Exponential XP curve
|
||||
return Math.floor(100 * Math.pow(1.5, this.level - 1));
|
||||
}
|
||||
|
||||
/**
|
||||
* GET CURRENT PROGRESS TO NEXT LEVEL
|
||||
*/
|
||||
getLevelProgress() {
|
||||
const needed = this.getXPForNextLevel();
|
||||
return {
|
||||
current: this.xp,
|
||||
needed: needed,
|
||||
percentage: Math.min(100, (this.xp / needed) * 100)
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* GET ALL STATS
|
||||
*/
|
||||
getStats() {
|
||||
return {
|
||||
level: this.level,
|
||||
xp: this.xp,
|
||||
vapeUsageCount: this.vapeUsageCount,
|
||||
...this.stats,
|
||||
nextLevel: this.getLevelProgress()
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* CHECK IF VAPE IS READY (not on cooldown)
|
||||
*/
|
||||
isVapeReady(lastUseTime) {
|
||||
const now = Date.now();
|
||||
return (now - lastUseTime) >= this.stats.cooldown;
|
||||
}
|
||||
|
||||
/**
|
||||
* GET VAPE COOLDOWN REMAINING
|
||||
*/
|
||||
getVapeCooldownRemaining(lastUseTime) {
|
||||
const now = Date.now();
|
||||
const elapsed = now - lastUseTime;
|
||||
return Math.max(0, this.stats.cooldown - elapsed);
|
||||
}
|
||||
|
||||
/**
|
||||
* SAVE TO LOCALSTORAGE
|
||||
*/
|
||||
save() {
|
||||
const data = {
|
||||
level: this.level,
|
||||
xp: this.xp,
|
||||
vapeUsageCount: this.vapeUsageCount,
|
||||
stats: this.stats,
|
||||
lastSaved: new Date().toISOString()
|
||||
};
|
||||
|
||||
localStorage.setItem('gronk_stats', JSON.stringify(data));
|
||||
}
|
||||
|
||||
/**
|
||||
* LOAD FROM LOCALSTORAGE
|
||||
*/
|
||||
load() {
|
||||
const stored = localStorage.getItem('gronk_stats');
|
||||
if (!stored) return;
|
||||
|
||||
try {
|
||||
const data = JSON.parse(stored);
|
||||
this.level = data.level || 1;
|
||||
this.xp = data.xp || 0;
|
||||
this.vapeUsageCount = data.vapeUsageCount || 0;
|
||||
this.stats = data.stats || this.stats;
|
||||
|
||||
console.log('📊 Gronk stats loaded:', this.getStats());
|
||||
} catch (e) {
|
||||
console.warn('Failed to load Gronk stats:', e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* RESET PROGRESSION (for testing)
|
||||
*/
|
||||
reset() {
|
||||
this.level = 1;
|
||||
this.xp = 0;
|
||||
this.vapeUsageCount = 0;
|
||||
this.stats = {
|
||||
vapeCloudSize: 1.0,
|
||||
vapeCloudDuration: 3000,
|
||||
shieldStrength: 100,
|
||||
speedBoost: 1.2,
|
||||
cooldown: 10000
|
||||
};
|
||||
localStorage.removeItem('gronk_stats');
|
||||
console.log('🔄 Gronk stats reset');
|
||||
}
|
||||
}
|
||||
|
||||
// Singleton instance
|
||||
const gronkStats = new GronkStats();
|
||||
export default gronkStats;
|
||||
Reference in New Issue
Block a user