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

457 lines
25 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* ANA'S CLUE SYSTEM
* Manages the 50 collectible clues left by Ana across the world.
*
* Features:
* - 50 Collectibles: 15 Messages, 12 Photos, 23 Personal Items
* - Story Integration: Each clue reveals plot and lore
* - Emotional Cutscenes: Kai's reactions and Twin Bond activations
* - Progressive Discovery: Clues unlock as player explores biomes
* - Collection UI: Track progress, view discovered clues
*/
class AnaClueSystem {
constructor(scene) {
this.scene = scene;
// Clue categories
this.categories = {
messages: [], // 15 handwritten messages
photos: [], // 12 photographs
items: [] // 23 personal items
};
// All 50 clues
this.allClues = this.initializeClues();
// Discovered clues
this.discovered = new Set();
// Story progression
this.storyUnlocks = {
5: 'act1_context', // First 5 clues unlock Act 1 context
10: 'troll_king_reveal', // Giant Troll King reveal
15: 'twin_bond_boost', // Twin Bond strengthens
25: 'act2_context', // Act 2 context unlocked
35: 'final_location_hint', // Hint to Ana's location
50: 'true_ending_unlock' // True ending unlocked
};
// Clue locations (biome-specific)
this.clueLocations = new Map();
console.log('💜 Ana\'s Clue System initialized!');
console.log(`📊 Total Clues: ${this.allClues.length}`);
}
/**
* Initialize all 50 clues
*/
initializeClues() {
const clues = [];
// 15 MESSAGES
const messages = [
{ id: 'msg_01', type: 'message', title: 'First Note', biome: 'forest', content: 'Kai, if you find this... I\'m sorry. They took me. Stay safe. -Ana' },
{ id: 'msg_02', type: 'message', title: 'Hidden Trail', biome: 'wasteland', content: 'Following them west. Trail of red flowers marks my path.' },
{ id: 'msg_03', type: 'message', title: 'The Creatures', biome: 'swamp', content: 'The zombies... they\'re not mindless. I saw intelligence in their eyes.' },
{ id: 'msg_04', type: 'message', title: 'The King', biome: 'mountains', content: 'The Giant Troll King. That\'s who leads them. I heard his name.' },
{ id: 'msg_05', type: 'message', title: 'Hope Valley', biome: 'hope_valley', content: 'Hope Valley was beautiful once. We could rebuild it together.' },
{ id: 'msg_06', type: 'message', title: 'Twin Bond', biome: 'crystal_caves', content: 'I can feel you searching for me. Our bond is strong, Kai.' },
{ id: 'msg_07', type: 'message', title: 'The Portals', biome: 'portal_ruins', content: 'Ancient portals everywhere. If we repair them, we could travel instantly.' },
{ id: 'msg_08', type: 'message', title: 'Laboratory Notes', biome: 'laboratory', content: 'Found a lab. Research on "domestication" of the infected. Disturbing.' },
{ id: 'msg_09', type: 'message', title: 'The Cure', biome: 'medical_facility', content: 'There might be a cure. Research was close before the fall.' },
{ id: 'msg_10', type: 'message', title: 'Family Dreams', biome: 'abandoned_house', content: 'I dream of a family, Kai. Children playing in safe fields.' },
{ id: 'msg_11', type: 'message', title: 'The Atlanteans', biome: 'atlantis', content: 'Underwater ruins! Advanced civilization. Atlantis was REAL!' },
{ id: 'msg_12', type: 'message', title: 'Chernobyl Warning', biome: 'chernobyl', content: 'Radiation zone ahead. Be careful if you follow me here.' },
{ id: 'msg_13', type: 'message', title: 'Amazon Expedition', biome: 'amazon', content: 'The jungle is dense but alive. So much biodiversity!' },
{ id: 'msg_14', type: 'message', title: 'Final Warning', biome: 'dark_fortress', content: 'Don\'t come for me, Kai. Too dangerous. Save yourself!' },
{ id: 'msg_15', type: 'message', title: 'True Feelings', biome: 'final_castle', content: 'I know you won\'t listen. You never do. I love you, brother.' }
];
// 12 PHOTOS
const photos = [
{ id: 'photo_01', type: 'photo', title: 'Family Portrait', biome: 'forest', description: 'Photo of Kai and Ana as children, smiling.' },
{ id: 'photo_02', type: 'photo', title: 'Attack Night', biome: 'wasteland', description: 'Blurry photo of Giant Troll King during the attack.' },
{ id: 'photo_03', type: 'photo', title: 'Hope Valley (Before)', biome: 'hope_valley', description: 'Beautiful town before the apocalypse.' },
{ id: 'photo_04', type: 'photo', title: 'First Zombie', biome: 'swamp', description: 'Photo of a Level 1 zombie, looking confused.' },
{ id: 'photo_05', type: 'photo', title: 'Portal Network Map', biome: 'portal_ruins', description: 'Hand-drawn map showing portal locations.' },
{ id: 'photo_06', type: 'photo', title: 'Laboratory Interior', biome: 'laboratory', description: 'High-tech lab equipment, still functional.' },
{ id: 'photo_07', type: 'photo', title: 'Ana\'s Journal', biome: 'mountains', description: 'Close-up of Ana\'s handwriting.' },
{ id: 'photo_08', type: 'photo', title: 'Atlantean Artifact', biome: 'atlantis', description: 'Glowing crystal technology from Atlantis.' },
{ id: 'photo_09', type: 'photo', title: 'Reactor Core', biome: 'chernobyl', description: 'Damaged reactor, eerie green glow.' },
{ id: 'photo_10', type: 'photo', title: 'Jungle Temple', biome: 'amazon', description: 'Ancient temple overgrown with vines.' },
{ id: 'photo_11', type: 'photo', title: 'The Captor', biome: 'dark_fortress', description: 'Shadowy figure—Ana\'s captor.' },
{ id: 'photo_12', type: 'photo', title: 'Final Message', biome: 'final_castle', description: 'Ana holding a "Find Me" sign, tears in eyes.' }
];
// 23 PERSONAL ITEMS
const items = [
{ id: 'item_01', type: 'item', title: 'Ana\'s Bracelet', biome: 'forest', description: 'Silver bracelet with twin symbols.' },
{ id: 'item_02', type: 'item', title: 'Torn Dress Piece', biome: 'wasteland', description: 'Fragment of Ana\'s favorite dress.' },
{ id: 'item_03', type: 'item', title: 'Hairpin', biome: 'swamp', description: 'Ana\'s decorative hairpin, muddy but intact.' },
{ id: 'item_04', type: 'item', title: 'Pocket Watch', biome: 'mountains', description: 'Father\'s pocket watch, Ana always carried it.' },
{ id: 'item_05', type: 'item', title: 'Compass', biome: 'hope_valley', description: 'Engraved compass: "To Ana, find your way home."' },
{ id: 'item_06', type: 'item', title: 'Childhood Toy', biome: 'abandoned_house', description: 'Small stuffed rabbit from childhood.' },
{ id: 'item_07', type: 'item', title: 'Music Box', biome: 'crystal_caves', description: 'Delicate music box, plays Ana\'s favorite song.' },
{ id: 'item_08', type: 'item', title: 'Sketchbook', biome: 'portal_ruins', description: 'Ana\'s art sketchbook, filled with drawings.' },
{ id: 'item_09', type: 'item', title: 'Necklace', biome: 'laboratory', description: 'Mother\'s necklace, Ana\'s most treasured item.' },
{ id: 'item_10', type: 'item', title: 'Diary Page', biome: 'medical_facility', description: 'Torn diary page describing her fears.' },
{ id: 'item_11', type: 'item', title: 'Herb Pouch', biome: 'forest', description: 'Pouch of medicinal herbs Ana collected.' },
{ id: 'item_12', type: 'item', title: 'Glove (Left)', biome: 'wasteland', description: 'One of Ana\'s gloves, left behind.' },
{ id: 'item_13', type: 'item', title: 'Glove (Right)', biome: 'dark_fortress', description: 'The matching right glove.' },
{ id: 'item_14', type: 'item', title: 'Lucky Coin', biome: 'atlantis', description: 'Old coin Ana considered lucky.' },
{ id: 'item_15', type: 'item', title: 'Ribbon', biome: 'chernobyl', description: 'Purple ribbon from Ana\'s hair.' },
{ id: 'item_16', type: 'item', title: 'Boot Buckle', biome: 'amazon', description: 'Buckle from Ana\'s boot, broken off.' },
{ id: 'item_17', type: 'item', title: 'Locket', biome: 'mountains', description: 'Heart-shaped locket with Kai\'s photo inside.' },
{ id: 'item_18', type: 'item', title: 'Handkerchief', biome: 'swamp', description: 'Embroidered handkerchief, Ana\'s initials.' },
{ id: 'item_19', type: 'item', title: 'Map Fragment', biome: 'portal_ruins', description: 'Piece of a larger map, Ana\'s notes.' },
{ id: 'item_20', type: 'item', title: 'Flower Press', biome: 'hope_valley', description: 'Ana pressed flowers in this book.' },
{ id: 'item_21', type: 'item', title: 'Candle Stub', biome: 'crystal_caves', description: 'Half-burned candle, Ana used for light.' },
{ id: 'item_22', type: 'item', title: 'Broken Mirror', biome: 'laboratory', description: 'Shattered hand mirror, Ana\'s reflection.' },
{ id: 'item_23', type: 'item', title: 'Final Letter', biome: 'final_castle', description: 'Sealed letter: "Open only when you find me."' }
];
// Combine all clues
clues.push(...messages, ...photos, ...items);
// Store by category
this.categories.messages = messages;
this.categories.photos = photos;
this.categories.items = items;
return clues;
}
/**
* Place clues in the world
*/
placeCluesInWorld() {
this.allClues.forEach(clue => {
// Determine position based on biome (placeholder logic)
const position = this.getBiomePosition(clue.biome);
this.clueLocations.set(clue.id, position);
// Spawn clue object in world (visual representation)
if (this.scene.interactionSystem) {
this.scene.interactionSystem.spawnClue(position.x, position.y, clue);
}
});
console.log(`📍 Placed ${this.allClues.length} clues across the world!`);
}
/**
* Get position for a biome (placeholder)
*/
getBiomePosition(biome) {
// In real implementation, would use biome system
const biomePositions = {
forest: { x: 1000, y: 1000 },
wasteland: { x: 3000, y: 1500 },
swamp: { x: 2000, y: 3000 },
mountains: { x: 4000, y: 500 },
hope_valley: { x: 500, y: 500 },
crystal_caves: { x: 3500, y: 2500 },
portal_ruins: { x: 2500, y: 2000 },
laboratory: { x: 3200, y: 1800 },
medical_facility: { x: 2800, y: 2200 },
abandoned_house: { x: 1500, y: 1200 },
atlantis: { x: 5000, y: 4000 },
chernobyl: { x: 5500, y: 2000 },
amazon: { x: 4500, y: 3500 },
dark_fortress: { x: 6000, y: 1000 },
final_castle: { x: 7000, y: 500 }
};
return biomePositions[biome] || { x: 0, y: 0 };
}
/**
* Discover a clue
*/
discoverClue(clueId) {
if (this.discovered.has(clueId)) {
console.log(' Clue already discovered!');
return false;
}
const clue = this.allClues.find(c => c.id === clueId);
if (!clue) {
console.log(`❌ Clue not found: ${clueId}`);
return false;
}
this.discovered.add(clueId);
console.log(`💜 DISCOVERED: ${clue.title} (${this.discovered.size}/50)`);
// Play discovery cutscene
this.playDiscoveryCutscene(clue);
// Check story progression
this.checkStoryUnlocks();
// Trigger Twin Bond reaction
if (this.scene.twinBondSystem) {
this.scene.twinBondSystem.triggerClueReaction(clue);
}
return true;
}
/**
* Play emotional discovery cutscene
*/
playDiscoveryCutscene(clue) {
console.log(`🎬 CUTSCENE: Discovering "${clue.title}"`);
// Emotional reaction based on clue type
let kaiReaction = '';
switch (clue.type) {
case 'message':
kaiReaction = this.getMessageReaction(clue);
break;
case 'photo':
kaiReaction = this.getPhotoReaction(clue);
break;
case 'item':
kaiReaction = this.getItemReaction(clue);
break;
}
// Show cutscene UI
this.scene.events.emit('show-cutscene', {
type: 'clue_discovery',
clue: clue,
reaction: kaiReaction,
bondActivation: this.discovered.size % 5 === 0 // Twin Bond activates every 5 clues
});
// Play emotional music
if (this.scene.soundManager) {
this.scene.soundManager.playEmotionalTheme();
}
console.log(`💭 Kai: "${kaiReaction}"`);
}
/**
* Get Kai's reaction to a message
*/
getMessageReaction(clue) {
const reactions = {
msg_01: "*Picks up note with shaking hands*\nAna... your handwriting...\n*Traces fingers over words*\nYou were scared. I can feel it in how you wrote.\nBut you still thought of me. 'Stay safe'...\n\nNo, Ana. I won't stay safe.\nI'll find you. No matter how dangerous.\nTwin promise. 💜",
msg_02: "Red flowers... Ana's favorite!\n*Looks around, spots red flowers growing*\nShe left me a trail. Even captured, she thought ahead.\n\nThat's my sister. Always thinking.\nI'm following, Ana. Right behind you.",
msg_03: "Intelligence? She's right.\nMy zombie workers... they understand orders, learn tasks.\n\nAna saw it too. Even while captured.\nHer curiosity never stopped.\n\nMaybe... maybe zombies and humans can coexist.\nIf we survive this.",
msg_04: "*Clenches fists*\nThe Troll King. The one who took you.\n\nNow I know his name.\nNow I know my enemy.\n\nDr. Krnić may have created you, beast...\nBut I will DESTROY you.",
msg_05: "*Tears up*\n'Together'... Ana still believes we'll be together again.\n\nYes. We'll rebuild Hope Valley.\nYou, me, and whoever else survives.\nWe'll make it beautiful again.\n\nA home. Our home.",
msg_06: "*Gasps*\nYou can feel me?!\nANA! I'm here! I'm searching!\n*Closes eyes, concentrates*\n\nTwin bond... please work...\n*Faint purple glow*\n\nAna... I felt something. Just for a moment.\nYou're alive. I KNOW you're alive!",
msg_07: "Portals! Of course!\nAna, you genius!\nIf I repair these, I can search the world faster!\n\nI'll fix them all. Every single one.\nFor you.",
msg_08: "Domestication... that's what I'm doing.\nMy zombie workers are 'domesticated'.\n\nBut Ana found this disturbing?\nIs what I'm doing... wrong?\n\nNo. I'm helping them. Giving them purpose.\nThat's different from Dr. Krnić's experiments.",
msg_09: "A CURE?!\nAna... if there's a cure...\nWe could save EVERYONE!\n\nThe infected could become human again!\nMama, Dad... they could--\n\nNo. Too late for them.\nBut not too late for others.\n\nI'll find it, Ana. For you.",
msg_10: "*Sits down, holds note to chest*\nA family... children...\n\nAna, you're thinking about the future.\nEven in captivity, you dream of life.\n\nWe'll have that future. I swear it.\nYou'll see children play in safe fields.\nOur children. Our future.",
msg_11: "*Laughs through tears*\nOnly you, Ana. Only you would get excited about Atlantis.\nWhile captured. While in danger.\n\nYour curiosity, your wonder... it never dies.\nThat's what I love about you.\n\nI'll explore these ruins for you. Find every secret.",
msg_12: "Chernobyl... you went to the reactor?!\nAna, that's suicide!\n\nBut you left me a warning. Even there.\nYou knew I'd follow.\n\nRadiation won't stop me. Nothing will.\nI'm coming, Ana. Hold on.",
msg_13: "Biodiversity... scientist words even now.\n\nAna, you never stop learning.\nNever stop appreciating nature.\n\nWhen this is over, I'll take you on a real expedition.\nNo danger. Just discovery.\nTwin explorers. Together.",
msg_14: "*Crumples note, then smooths it out*\nSave MYSELF?!\nYou think I'd give up on you?!\n\nAna, I'd walk through hell for you.\nAlone if I had to.\n\nThis 'danger' you warn about?\nBRING IT ON.",
msg_15: "*Breaks down crying*\n'I love you, brother'...\n\nI love you too, Ana. So much.\n\nYou're right. I won't listen.\nI never do when it comes to you.\n\nI'm at the castle. I'm coming in.\nWait for me. Please."
};
return reactions[clue.id] || "Ana... another piece of you found.";
}
/**
* Get Kai's reaction to a photo
*/
getPhotoReaction(clue) {
const reactions = {
photo_01: "*Stares at photo for long time*\nMom... Dad... Ana... me...\nWe were so happy.\n\nI'll make us happy again, Ana.\nDifferent, but happy.\nNew family. New memories.\n\nBut I'll never forget this.",
photo_02: "*Photo of Giant Troll, blurry*\nThere you are, monster.\nThe thing that destroyed everything.\n\nAna got a photo even while running.\nBrave. So brave.\n\nI'm coming for you, Troll.",
photo_03: "It WAS beautiful...\nGreen fields, happy people, clean buildings.\n\nWe can make it like this again.\nWith your help, Ana.\nTogether we'll rebuild paradise.",
photo_04: "A Level 1 zombie... looking confused.\nAna saw them as... beings. Not monsters.\n\nShe was always more empathetic than me.\nMaybe that's why she left this trail.\nShe knew I'd need to see them differently.",
photo_05: "Ana drew a MAP for me!\nAll 18 portals marked!\n\nShe knew I'd need to travel fast.\nThought of everything.\n\nThank you, sister. This helps SO much.",
photo_06: "Dr. Krnić's lab... still functional.\nHigh-tech equipment Ana photographed.\n\nIf I find this place... I could finish her research.\nFind the cure.\nSave everyone.",
photo_07: "*Close-up of handwriting*\nHer journal... during captivity.\n\nShe kept writing. Kept documenting.\nScientist to the end.\n\nI need to find this journal. All of it.",
photo_08: "Atlantean technology... glowing crystals!\nThis could power everything!\n\nAna, you found the future.\nAncient tech to save the modern world.\n\nI'll bring it back. For everyone.",
photo_09: "*Chernobyl reactor, green glow*\nThat's where Dr. Krnić is.\nFinal facility.\n\nAna went there. Survived radiation.\nIf she can... so can I.",
photo_10: "Ancient temple in Amazon...\nAna always loved archaeology.\n\nI'll explore it. For you.\nFind whatever secrets you wanted to discover.",
photo_11: "*Shadowy figure in photo*\nThis is him. Dr. Krnić.\nThe monster who started everything.\n\nYour face is blurry, coward.\nBut I'll see you clearly...\nRight before I END you.",
photo_12: "*Ana holding 'FIND ME' sign, tears in eyes*\n\n*Kai collapses to knees, sobbing*\n\nI SEE YOU, ANA! I SEE YOU!\nI'M COMING! I SWEAR I'M COMING!\n\nHold on! Please! Just hold on!"
};
return reactions[clue.id] || "Another memory of you...";
}
/**
* Get Kai's reaction to an item
*/
getItemReaction(clue) {
const reactions = {
item_01: "*Silver twin bracelet*\nI have the matching one...\n*Holds both bracelets together*\nTwins. Always twins.\nSoon we'll wear these together again.",
item_02: "*Torn dress piece*\nFragment of Ana's favorite dress...\n*Holds it gently*\nYou loved this dress. Wore it on special days.\nI'll keep this safe for you.",
item_03: "*Muddy hairpin*\nAna's decorative hairpin...\n*Cleans mud off carefully*\nYou always wore this. Even while farming.\nIt's coming home with me.",
item_04: "*Father's pocket watch*\nDad's watch... Ana always carried it.\n*Opens it - shows family photo inside*\nYou kept us close. All of us.\nI understand, Ana.",
item_05: "*Engraved compass*\n'To Ana, find your way home'...\n*Compass points north*\nI'll use this to find YOU, Ana.\nThen we both go home. Together.",
item_06: "*Small stuffed rabbit*\nYour childhood toy!\n*Hugs it*\nWe got this when we were 5.\nYou never let it go.\nI won't either.",
item_07: "*Delicate music box*\n*Opens it - plays Ana's favorite song*\n*Sits and listens, tears flowing*\nThis song... you hummed it every night.\nI hear you, Ana. I hear you.",
item_08: "*Ana's art sketchbook*\n*Flips through pages*\nYour drawings... so beautiful.\nEven in danger, you created beauty.\nThat's who you are.",
item_09: "*Falls to knees*\nMama's necklace... Ana kept it through everything.\nProtected it.\n\n*Kisses necklace*\nMama... I'm protecting Ana now.\nLike you asked.",
item_10: "*Torn diary page*\n*Reads*\n'I'm scared. But I won't give up hope.'\n*Clutches page*\nI won't give up either, Ana. Never.",
item_17: "*Opens locket - sees his own photo*\n\n*Tears streaming*\nYou carried ME with you...\nWhile I searched for you...\nYou had me the whole time.\n\nTwin bond. Forever.",
item_23: "*Sealed envelope: 'Open when you find me'*\n\n*Hands trembling*\nNot yet. I'm not opening this yet.\nI'll open it when I SEE you.\nFace to face.\n\nSoon, Ana. Soon."
};
return reactions[clue.id] || `${clue.title}... you were here.`;
}
/**
* Check if story unlocks should trigger
*/
checkStoryUnlocks() {
const count = this.discovered.size;
Object.keys(this.storyUnlocks).forEach(threshold => {
const unlockId = this.storyUnlocks[threshold];
if (count >= parseInt(threshold)) {
this.unlockStoryEvent(unlockId, parseInt(threshold));
}
});
}
/**
* Unlock story event
*/
unlockStoryEvent(eventId, clueCount) {
console.log(`🎭 STORY UNLOCK: ${eventId} (${clueCount} clues)`);
const events = {
act1_context: {
title: 'Act 1 Revealed',
message: 'The attack, the kidnapping... the full picture emerges.',
reward: 'Twin Bond Level +1'
},
troll_king_reveal: {
title: 'Giant Troll King\'s Identity',
message: 'The true nature of the captor revealed.',
reward: 'Boss Location Marked'
},
twin_bond_boost: {
title: 'Twin Bond Strengthens',
message: 'Your psychic connection with Ana intensifies!',
reward: 'Twin Bond abilities enhanced'
},
act2_context: {
title: 'Act 2 Begins',
message: 'Ana\'s journey takes unexpected turns...',
reward: 'New locations unlocked'
},
final_location_hint: {
title: 'Ana\'s Location',
message: 'You sense where she is... the final castle.',
reward: 'Final Castle location revealed'
},
true_ending_unlock: {
title: 'ALL CLUES FOUND!',
message: 'Every piece of Ana discovered. True Ending available!',
reward: 'True Ending unlocked'
}
};
const event = events[eventId];
if (event) {
this.scene.events.emit('story-unlock', event);
if (this.scene.soundManager) {
this.scene.soundManager.playDramatic();
}
}
}
/**
* Get collection progress
*/
getProgress() {
return {
total: this.allClues.length,
discovered: this.discovered.size,
percentage: Math.round((this.discovered.size / this.allClues.length) * 100),
messages: this.getTypeProgress('message'),
photos: this.getTypeProgress('photo'),
items: this.getTypeProgress('item')
};
}
/**
* Get progress by type
*/
getTypeProgress(type) {
const typeClues = this.allClues.filter(c => c.type === type);
const discovered = typeClues.filter(c => this.discovered.has(c.id)).length;
return {
total: typeClues.length,
discovered: discovered,
percentage: Math.round((discovered / typeClues.length) * 100)
};
}
/**
* Show collection UI
*/
showCollectionUI() {
const progress = this.getProgress();
console.log('💜 ANA\'S CLUES COLLECTION');
console.log(`Total: ${progress.discovered}/${progress.total} (${progress.percentage}%)`);
console.log('─────────────────────────────────');
console.log(`📝 Messages: ${progress.messages.discovered}/${progress.messages.total} (${progress.messages.percentage}%)`);
console.log(`📷 Photos: ${progress.photos.discovered}/${progress.photos.total} (${progress.photos.percentage}%)`);
console.log(`💎 Items: ${progress.items.discovered}/${progress.items.total} (${progress.items.percentage}%)`);
// Emit UI event
this.scene.events.emit('show-clue-collection', {
progress: progress,
clues: this.allClues,
discovered: Array.from(this.discovered)
});
}
}