Files
novafarma/EMERGENCY_SYSTEMS_RECOVERY/GrokCharacterSystem.js
2026-01-16 02:43:46 +01:00

869 lines
24 KiB
JavaScript

/**
* GrokCharacterSystem.js
* ======================
* KRVAVA ŽETEV - Grok Character (The Developer / Pink Alpha)
*
* CHARACTER DESIGN:
* - Skin: Light green (unique color - not human!)
* - Hair: PINK dreadlocks (iconic!)
* - Outfit: Oversized hoodie (2 sizes too big) + baggy pants
* - Shoes: Hot pink Converse
* - Piercings: Septum, eyebrows, lips, 15+ earrings, 25mm tunnels
*
* PERSONALITY:
* - ADHD genius developer
* - Always vaping (Rainbow RGB mod)
* - Zen master with massive gong
* - Quick movements when hyperfocused
* - Oversized comfort style
*
* COMPANION:
* - Susi: Hot dog hunting dog (always by his side)
*
* Features:
* - Massive gong (1m diameter!)
* - Rainbow RGB vape mod
* - Morning meditation rituals
* - Combat buffs
* - Smoke screen abilities
* - ADHD focus modes
* - Susi interactions
*
* @author NovaFarma Team
* @date 2025-12-25
*/
export default class GrokCharacterSystem {
constructor(scene, grokSprite) {
this.scene = scene;
this.grok = grokSprite;
// Grok state
this.isVaping = true; // Always vaping!
this.lastGongTime = 0;
this.gongCooldown = 300000; // 5 minutes
this.meditationTime = 6; // 6 AM daily
// ADHD mechanics
this.isFocused = false; // "Oversized Focus" mode
this.focusTimer = 0;
this.hyperfocusSpeed = 2.0; // Speed multiplier when focused
this.currentTopic = 'coding'; // What Grok is focused on
// Visual elements
this.gong = null;
this.vapeDevice = null;
this.smokeParticles = [];
this.hoodie = null; // Oversized hoodie sprite
this.dreadlocks = null; // Pink dreadlocks
this.piercings = []; // Visual piercing elements
// Susi companion
this.susi = null; // Susi the hot dog hunter
this.susiState = 'following'; // following, hunting, eating
// Buffs
this.activeBuffs = new Map();
// Character colors
this.skinColor = 0x90EE90; // Light green
this.dreadlockColor = 0xFF69B4; // Hot pink
this.hoodieColor = 0x2F4F4F; // Dark slate gray (wide hoodie)
console.log('🧘 GrokCharacterSystem initialized');
console.log('👕 Oversized hoodie: ON');
console.log('💚 Skin: Light green');
console.log('💕 Dreadlocks: HOT PINK');
console.log('🐕 Susi companion: Ready!');
// Setup visuals
this.setupGrokVisuals();
this.createSusi();
this.startVapingAnimation();
}
/**
* 13.1 - Setup Grok's visual elements
*/
setupGrokVisuals() {
if (!this.grok) return;
// Create massive gong (1m diameter = 100 pixels!)
this.gong = this.scene.add.circle(
this.grok.x - 50,
this.grok.y,
50, // Radius 50px = 100px diameter
0xDAA520 // Golden color
);
this.gong.setStrokeStyle(5, 0x8B4513); // Brown stroke
this.gong.setDepth(this.grok.depth - 1);
// Add gong details (concentric circles)
for (let i = 1; i <= 3; i++) {
const ring = this.scene.add.circle(
this.grok.x - 50,
this.grok.y,
50 - (i * 10),
null
);
ring.setStrokeStyle(2, 0x8B4513);
ring.setDepth(this.grok.depth - 1);
}
// Create RGB vape mod
this.vapeDevice = this.scene.add.rectangle(
this.grok.x + 20,
this.grok.y + 10,
15, // Width
30, // Height
0xFF1493 // Deep pink
);
this.vapeDevice.setDepth(this.grok.depth + 1);
// Add RGB LED effect
this.scene.tweens.add({
targets: this.vapeDevice,
fillColor: { from: 0xFF1493, to: 0x00CED1 }, // Pink → Cyan
duration: 2000,
yoyo: true,
repeat: -1
});
console.log('✅ Grok visuals setup complete');
}
/**
* 13.2 - Morning Meditation Gong
*/
triggerMorningMeditation() {
console.log('🧘 *BOOONG!* Morning meditation begins...');
// Play gong animation
this.playGongAnimation();
// Buff all nearby allies
this.applyMeditationBuff();
// Show message
this.showNotification({
title: 'Morning Meditation',
text: '🥁 BOOONG! Grok\'s gong brings peace to all.',
icon: '🧘'
});
}
/**
* 13.2 - Gong strike (combat buff)
*/
strikeGong() {
const now = Date.now();
if (now - this.lastGongTime < this.gongCooldown) {
const remaining = Math.ceil((this.gongCooldown - (now - this.lastGongTime)) / 1000);
console.log(`⏰ Gong on cooldown for ${remaining}s`);
return false;
}
console.log('🥁 *BOOOOONG!!!*');
this.lastGongTime = now;
// Visual effect
this.playGongAnimation();
// Sound wave radius
this.createSoundWaveEffect();
// Combat buffs
this.applyGongCombatBuff();
// Stun enemies
this.stunNearbyEnemies();
return true;
}
/**
* 13.2 - Gong animation
*/
playGongAnimation() {
if (!this.gong) return;
// Vibrate gong
this.scene.tweens.add({
targets: this.gong,
scaleX: 1.2,
scaleY: 1.2,
alpha: 0.5,
duration: 100,
yoyo: true,
repeat: 5
});
// Screen shake
this.scene.cameras.main.shake(500, 0.01);
// Flash
this.scene.cameras.main.flash(200, 255, 215, 0); // Gold flash
}
/**
* 13.2 - Sound wave effect
*/
createSoundWaveEffect() {
if (!this.gong) return;
// Create expanding circles (sound waves)
for (let i = 0; i < 3; i++) {
setTimeout(() => {
const wave = this.scene.add.circle(
this.gong.x,
this.gong.y,
10,
0xFFD700,
0.5
);
this.scene.tweens.add({
targets: wave,
radius: 480, // 10 blocks
alpha: 0,
duration: 1000,
onComplete: () => wave.destroy()
});
}, i * 200);
}
}
/**
* 13.2 - Apply gong combat buff
*/
applyGongCombatBuff() {
const buffDuration = 30000; // 30 seconds
const buffData = {
name: 'Gong Resonance',
damage: 1.2, // +20% damage
defense: 1.1, // +10% defense
expiresAt: Date.now() + buffDuration
};
// Apply to player
if (this.scene.player) {
this.activeBuffs.set('player', buffData);
console.log('⚔️ Player buffed: +20% damage, +10% defense (30s)');
}
// Apply to nearby allies
this.buffNearbyAllies(buffData);
this.showNotification({
title: 'Gong Resonance!',
text: '🥁 +20% Damage, +10% Defense for 30s!',
icon: '⚔️'
});
}
/**
* 13.2 - Buff nearby allies
*/
buffNearbyAllies(buffData) {
// TODO: Get all allies within 10 blocks
// For now, just log
console.log('🤝 Allies buffed!');
}
/**
* 13.2 - Apply meditation buff
*/
applyMeditationBuff() {
const buffData = {
name: 'Morning Meditation',
healthRegen: 5, // +5 HP/sec
staminaRegen: 10, // +10 stamina/sec
duration: 60000 // 1 minute
};
// TODO: Apply to all players/allies in area
console.log('🧘 Meditation buff active: +5 HP/sec, +10 stamina/sec');
}
/**
* 13.2 - Stun nearby enemies
*/
stunNearbyEnemies() {
const stunRadius = 480; // 10 blocks (48px per tile)
// TODO: Get all enemies within radius and stun them
console.log(`💫 Enemies within ${stunRadius}px stunned for 3 seconds!`);
}
/**
* 13.3 - Vaping animation (always active!)
*/
startVapingAnimation() {
// Constant vaping
setInterval(() => {
this.exhaleVapeSmoke();
}, 3000); // Every 3 seconds
}
/**
* 13.3 - Exhale vape smoke
*/
exhaleVapeSmoke() {
if (!this.vapeDevice) return;
// Create pink smoke particles
const smokeCount = 10;
for (let i = 0; i < smokeCount; i++) {
setTimeout(() => {
this.createSmokeParticle();
}, i * 50);
}
// Random smoke trick
if (Math.random() < 0.2) { // 20% chance
this.performSmokeTrick();
}
}
/**
* 13.3 - Create smoke particle
*/
createSmokeParticle() {
if (!this.grok) return;
const smoke = this.scene.add.circle(
this.grok.x + 20,
this.grok.y - 10,
5 + Math.random() * 5,
0xFF1493, // Deep pink
0.7
);
// Smoke rises and fades
this.scene.tweens.add({
targets: smoke,
y: smoke.y - 50 - Math.random() * 50,
x: smoke.x + (Math.random() - 0.5) * 30,
alpha: 0,
radius: 20,
duration: 2000 + Math.random() * 1000,
onComplete: () => smoke.destroy()
});
this.smokeParticles.push(smoke);
}
/**
* 13.3 - Smoke tricks
*/
performSmokeTrick() {
const tricks = ['rings', 'dragon', 'tornado'];
const trick = Phaser.Utils.Array.GetRandom(tricks);
switch (trick) {
case 'rings':
this.createSmokeRings();
break;
case 'dragon':
this.createSmokeDragon();
break;
case 'tornado':
this.createSmokeTornado();
break;
}
console.log(`💨 Grok did a ${trick} smoke trick!`);
}
/**
* 13.3 - Create smoke rings
*/
createSmokeRings() {
if (!this.grok) return;
for (let i = 0; i < 3; i++) {
setTimeout(() => {
const ring = this.scene.add.circle(
this.grok.x + 30,
this.grok.y - 20,
10,
null
);
ring.setStrokeStyle(3, 0xFF1493, 0.8);
this.scene.tweens.add({
targets: ring,
x: ring.x + 100,
radius: 20,
alpha: 0,
duration: 1500,
onComplete: () => ring.destroy()
});
}, i * 300);
}
}
/**
* 13.3 - Create smoke dragon
*/
createSmokeDragon() {
if (!this.grok) return;
// Create flowing smoke path (dragon shape!)
const points = [];
for (let i = 0; i < 20; i++) {
points.push({
x: this.grok.x + 30 + i * 10,
y: this.grok.y - 20 + Math.sin(i * 0.5) * 20
});
}
points.forEach((point, index) => {
setTimeout(() => {
const smoke = this.scene.add.circle(
point.x,
point.y,
8,
0xFF1493,
0.6
);
this.scene.tweens.add({
targets: smoke,
alpha: 0,
duration: 1000,
onComplete: () => smoke.destroy()
});
}, index * 50);
});
}
/**
* 13.3 - Create smoke tornado
*/
createSmokeTornado() {
if (!this.grok) return;
// Spiral smoke upward
for (let i = 0; i < 30; i++) {
setTimeout(() => {
const angle = (i * 20) * Math.PI / 180;
const radius = 20 + i;
const smoke = this.scene.add.circle(
this.grok.x + 30 + Math.cos(angle) * radius,
this.grok.y - 20 - i * 3,
5,
0xFF1493,
0.7
);
this.scene.tweens.add({
targets: smoke,
alpha: 0,
duration: 2000,
onComplete: () => smoke.destroy()
});
}, i * 30);
}
}
/**
* 13.3 - Combat smoke screen
*/
deploySmokeScreen() {
console.log('💨 Deploying combat smoke screen!');
// Create large pink smoke cloud
const smokescreenRadius = 240; // 5 blocks
for (let i = 0; i < 50; i++) {
setTimeout(() => {
const angle = Math.random() * Math.PI * 2;
const distance = Math.random() * smokescreenRadius;
const smoke = this.scene.add.circle(
this.grok.x + Math.cos(angle) * distance,
this.grok.y + Math.sin(angle) * distance,
10 + Math.random() * 10,
0xFF1493,
0.8
);
this.scene.tweens.add({
targets: smoke,
alpha: 0,
radius: 30,
duration: 5000,
onComplete: () => smoke.destroy()
});
}, i * 50);
}
// Confuse enemies
this.confuseNearbyEnemies();
this.showNotification({
title: 'Smoke Screen!',
text: '💨 Enemies confused! Grok vanishes into pink smoke!',
icon: '😵'
});
}
/**
* 13.3 - Confuse enemies
*/
confuseNearbyEnemies() {
// TODO: Apply confusion effect to enemies
console.log('😵 Enemies confused!');
}
/**
* 13.4 - Get Grok dialogue
*/
getRandomGrokDialogue() {
const dialogues = [
"The gong speaks to those who listen... *BOOONG!*",
"Life is like vape smoke... fleeting and pink. *exhales*",
"Why fight when you can meditate? *hits vape*",
"The universe is just a massive gong, friend. *BOOONG!*",
"*BOOOONG!* Inner peace achieved.",
"This vape? It's pink because life is beautiful. *exhales rainbow smoke*",
"My gong has defeated more enemies than any sword. *taps gong*",
"Violence is temporary. Zen is eternal. *vapes peacefully*",
"Watch this smoke trick! *creates dragon*",
"The gong's vibration aligns the chakras. Science!",
"*BOOONG!* That's me saying hello.",
"Pink smoke = happy thoughts. Simple. *exhales*"
];
return Phaser.Utils.Array.GetRandom(dialogues);
}
/**
* Update system
*/
update(time, delta) {
// Check for morning meditation time
const currentHour = this.scene.timeSystem?.getCurrentHour() || 0;
if (currentHour === this.meditationTime) {
const lastMeditation = localStorage.getItem('grok_last_meditation');
const today = new Date().toDateString();
if (lastMeditation !== today) {
this.triggerMorningMeditation();
localStorage.setItem('grok_last_meditation', today);
}
}
// Update buff timers
this.updateBuffs();
// Clean up old smoke particles
this.cleanupSmokeParticles();
}
/**
* Update active buffs
*/
updateBuffs() {
const now = Date.now();
this.activeBuffs.forEach((buff, target) => {
if (buff.expiresAt && buff.expiresAt < now) {
this.activeBuffs.delete(target);
console.log(`✨ Buff "${buff.name}" expired for ${target}`);
}
});
}
/**
* Cleanup old smoke particles
*/
cleanupSmokeParticles() {
this.smokeParticles = this.smokeParticles.filter(smoke => {
if (!smoke || smoke.alpha <= 0) {
if (smoke) smoke.destroy();
return false;
}
return true;
});
}
/**
* Helper: Show notification
*/
showNotification(notification) {
console.log(`📢 ${notification.icon} ${notification.title}: ${notification.text}`);
const ui = this.scene.scene.get('UIScene');
if (ui && ui.showNotification) {
ui.showNotification(notification);
}
}
/**
* Create Susi companion (Hot Dog Hunter)
*/
createSusi() {
if (!this.grok) return;
// Create Susi (dachshund-style hot dog hunter!)
this.susi = this.scene.add.ellipse(
this.grok.x + 30,
this.grok.y + 20,
40, // Width (long dog!)
20, // Height
0x8B4513 // Brown color
);
this.susi.setDepth(this.grok.depth);
// Add spots
const spot1 = this.scene.add.circle(
this.susi.x - 10,
this.susi.y,
4,
0x654321 // Darker spot
);
spot1.setDepth(this.grok.depth + 1);
// Susi's nose (always sniffing for hot dogs!)
const nose = this.scene.add.circle(
this.susi.x + 20,
this.susi.y,
3,
0x000000 // Black nose
);
nose.setDepth(this.grok.depth + 2);
// Tail (wagging animation!)
const tail = this.scene.add.line(
this.susi.x - 20,
this.susi.y - 5,
0, 0,
-10, -5,
0x8B4513,
1
);
tail.setLineWidth(3);
tail.setDepth(this.grok.depth);
// Tail wag animation
this.scene.tweens.add({
targets: tail,
angle: { from: -15, to: 15 },
duration: 300,
yoyo: true,
repeat: -1
});
console.log('🐕 Susi created! Hot dog hunter ready!');
// Susi behavior
this.startSusiBehavior();
}
/**
* Susi's AI behavior
*/
startSusiBehavior() {
// Susi follows Grok
setInterval(() => {
if (!this.susi || !this.grok) return;
// Follow Grok at distance
const targetX = this.grok.x + 30;
const targetY = this.grok.y + 20;
// Smooth follow
this.susi.x += (targetX - this.susi.x) * 0.1;
this.susi.y += (targetY - this.susi.y) * 0.1;
// Random hot dog hunting
if (Math.random() < 0.01) { // 1% chance per frame
this.susiHuntHotDog();
}
}, 100);
}
/**
* Susi hunts for hot dogs!
*/
susiHuntHotDog() {
if (!this.susi) return;
console.log('🌭 Susi spotted a potential hot dog!');
this.susiState = 'hunting';
// Susi runs to random location
const randomX = this.susi.x + (Math.random() - 0.5) * 100;
const randomY = this.susi.y + (Math.random() - 0.5) * 100;
this.scene.tweens.add({
targets: this.susi,
x: randomX,
y: randomY,
duration: 1000,
ease: 'Quad.InOut',
onComplete: () => {
// Found hot dog!
this.susiState = 'eating';
console.log('🌭 Susi found a hot dog! *nom nom*');
// Eating animation (wiggle)
this.scene.tweens.add({
targets: this.susi,
angle: { from: -5, to: 5 },
duration: 200,
yoyo: true,
repeat: 5,
onComplete: () => {
this.susiState = 'following';
this.susi.setAngle(0);
}
});
}
});
}
/**
* ADHD Focus Mode - Grok hides in hoodie to focus
*/
enterFocusMode(topic = 'coding') {
if (this.isFocused) {
console.log('⚠️ Already in focus mode!');
return false;
}
console.log(`🧠 Grok enters ADHD FOCUS MODE! Topic: ${topic}`);
console.log('👕 *Hides in oversized hoodie*');
this.isFocused = true;
this.currentTopic = topic;
this.focusTimer = 0;
// Visual: Grok shrinks into hoodie
if (this.grok) {
this.scene.tweens.add({
targets: this.grok,
scale: 0.7, // Gets smaller (hiding in hoodie)
alpha: 0.8,
duration: 500
});
}
// Can't be interrupted unless you have vape juice!
this.showNotification({
title: 'Focus Mode Active!',
text: `🧠 Grok is focusing on ${topic}. Don't interrupt! (Unless you have vape juice)`,
icon: '👕'
});
return true;
}
/**
* Exit ADHD focus mode
*/
exitFocusMode() {
if (!this.isFocused) return;
console.log('🧠 Focus mode complete!');
this.isFocused = false;
// Visual: Grok emerges from hoodie
if (this.grok) {
this.scene.tweens.add({
targets: this.grok,
scale: 1.0,
alpha: 1.0,
duration: 500
});
}
this.showNotification({
title: 'Focus Complete!',
text: `${this.currentTopic} finished! Grok emerges victorious!`,
icon: '🎉'
});
}
/**
* ADHD Hyperfocus Movement
*/
moveWithHyperfocus(direction) {
if (!this.isFocused) {
console.log('⚠️ Not in focus mode!');
return;
}
// When hyperfocused, Grok moves SUPER fast!
const baseSpeed = 5;
const speed = baseSpeed * this.hyperfocusSpeed; // 2x speed!
console.log(`⚡ HYPERFOCUS SPEED! Moving ${direction} at ${speed} px/frame!`);
// Move Grok super fast
// (Integration with movement system would go here)
}
/**
* Get Grok's quest dialogues
*/
getGrokQuests() {
return [
{
id: 'hoodie_rescue',
title: 'Hoodie v nevarnosti',
dialogue: "Dude, moj najljubši hoodie se je zataknil za eno tistih piranha rastlin v coni 4. Brez njega se ne morem fokusirati, preveč me zebe v roke! Greš ponj?",
objective: 'Premagaj gigantsko mesojedko in reši Gronkov široki pulover',
rewards: {
gold: 500,
xp: 1000,
item: 'grok_friendship +10'
}
},
{
id: 'vape_mixology',
title: 'Zamenjava tekočine (Vape Mixology)',
dialogue: "Bro, poskušam zmešati nov okus 'Baggy Cloud', ampak Susi mi je prevrnila epruveto, ker je mislila, da so notri hrenovke. Rabim tri mutirane jagode iz Dino Valleyja!",
objective: 'Najdi 3 mutirane jagode v Dino Valley biome',
rewards: {
gold: 300,
xp: 750,
item: 'baggy_cloud_vape_juice'
}
},
{
id: 'adhd_code',
title: 'ADHD koda na hlačah',
dialogue: "Ej, si vedel, da sem si na nogo (na hlače) napisal pomembno kodo za tvoj novi rudnik, pa sem jo zdaj ponesreči umazal z blatom? Susi, pomagaj mi polizati to blato... ah, ne, Kai, ti boš moral najti čistilo!",
objective: 'Najdi čistilo v opuščenem laboratoriju',
rewards: {
gold: 400,
xp: 850,
unlock: 'advanced_mine_code'
}
}
];
}
/**
* Helper: Show notification
*/
showNotification(notification) {
console.log(`📢 ${notification.icon} ${notification.title}: ${notification.text}`);
const ui = this.scene.scene.get('UIScene');
if (ui && ui.showNotification) {
ui.showNotification(notification);
}
}
/**
* Get active buff for target
*/
getActiveBuff(target) {
return this.activeBuffs.get(target);
}
}