Files
novafarma/src/systems/MainQuestAnaSystem.js

372 lines
12 KiB
JavaScript

/**
* MainQuestAnaSystem.js
* =====================
* KRVAVA ŽETEV - Main Quest: Finding Ana (Phase 42)
*
* Features:
* - Main story quest (finding lost sister)
* - 4 Acts + Finale
* - Quest journal & tracking
* - Lore entries discovery
* - Multiple endings
* - Decision system
*
* @author NovaFarma Team
* @date 2025-12-23
*/
export default class MainQuestAnaSystem {
constructor(scene) {
this.scene = scene;
// Quest state
this.currentAct = 0;
this.currentQuest = null;
this.completedQuests = new Set();
// Story decisions
this.decisions = new Map();
this.moralityScore = 0; // -100 (revenge) to +100 (cure)
// Lore entries
this.loreEntries = new Map();
this.discoveredLore = new Set();
// Quest journal
this.journal = [];
console.log('👧 MainQuestAnaSystem initialized');
// Register all quests
this.registerQuests();
// Register lore entries
this.registerLoreEntries();
}
/**
* Register all main quests
*/
registerQuests() {
// Prologue is handled by PrologueScene
// ACT 1: Searching for Clues (Already in Act1QuestData.js)
// Quests 1.1 - 1.8 are integrated
// ACT 2: Discovering the Lab
this.registerQuest('2.1', {
act: 2,
name: 'The Underground Facility',
description: 'Twin Bond led you to old military bunker. Investigate.',
objectives: [
{ id: 'find_bunker', desc: 'Locate underground bunker entrance', type: 'location' },
{ id: 'clear_entrance', desc: 'Clear zombie blockade', type: 'combat' },
{ id: 'enter_lab', desc: 'Enter Black Serpent Laboratory', type: 'location' }
],
rewards: { xp: 2000, zlatniki: 1000, bondStrength: 15 }
});
this.registerQuest('2.2', {
act: 2,
name: 'Lab Records',
description: 'Search lab computers for information about Ana.',
objectives: [
{ id: 'find_terminal', desc: 'Find working computer terminal', type: 'location' },
{ id: 'hack_system', desc: 'Hack into lab database', type: 'puzzle' },
{ id: 'read_files', desc: 'Read experiment logs', type: 'interact' }
],
rewards: { xp: 1500, lore: ['virus_origin', 'experiment_logs'] }
});
this.registerQuest('2.3', {
act: 2,
name: 'Zombie Test Subjects',
description: 'Discover horrifying truth about zombie experiments.',
objectives: [
{ id: 'find_cells', desc: 'Locate holding cells', type: 'location' },
{ id: 'read_charts', desc: 'Read patient charts', type: 'interact' },
{ id: 'find_ana_cell', desc: 'Find Ana\'s empty cell', type: 'location' }
],
rewards: { xp: 2500, bondStrength: 20, lore: ['experiment_subjects'] }
});
// ACT 3: Confronting the Truth
this.registerQuest('3.1', {
act: 3,
name: 'The Scientist',
description: 'Track down lead scientist Dr. Kovač.',
objectives: [
{ id: 'find_hideout', desc: 'Locate Dr. Kovač\'s hideout', type: 'location' },
{ id: 'confront_scientist', desc: 'Confront Dr. Kovač', type: 'dialogue' },
{ id: 'make_choice', desc: 'Kill or spare the scientist?', type: 'decision' }
],
rewards: { xp: 3000, decision: 'scientist_fate' }
});
this.registerQuest('3.2', {
act: 3,
name: 'The Final Obstacle',
description: 'Ana is held in the mountain vault. Prepare for the breach.',
objectives: [
{ id: 'gather_allies', desc: 'Recruit allies for the assault', type: 'social' },
{ id: 'craft_weapons', desc: 'Craft high-tier equipment', type: 'crafting' },
{ id: 'locate_lair', desc: 'Find the mountain fortress', type: 'location' }
],
rewards: { xp: 4000, zlatniki: 5000 }
});
this.registerQuest('3.3', {
act: 3,
name: 'The Cure Research',
description: 'Find and study cure research notes.',
objectives: [
{ id: 'find_notes', desc: 'Collect all 7 research notes', type: 'collect' },
{ id: 'study_cure', desc: 'Study cure methodology', type: 'research' },
{ id: 'make_choice', desc: 'Pursue cure or revenge?', type: 'decision' }
],
rewards: { xp: 3500, decision: 'cure_or_revenge', lore: ['cure_research'] }
});
// FINALE
this.registerQuest('finale', {
act: 4,
name: 'Confrontation',
description: 'Reach the reactor core and save Ana.',
objectives: [
{ id: 'enter_lair', desc: 'Storm the mountain fortress', type: 'location' },
{ id: 'defeat_boss', desc: 'Breach the vault defenses', type: 'boss_fight' },
{ id: 'save_ana', desc: 'Rescue Ana', type: 'cutscene' },
{ id: 'final_choice', desc: 'The ultimate decision...', type: 'decision' }
],
rewards: { xp: 10000, achievement: 'main_quest_complete' }
});
console.log('✅ Main quest chain registered');
}
/**
* Register single quest
*/
registerQuest(id, data) {
// Quests are managed by QuestSystemExpanded
// This just tracks main quest progress
console.log(`📋 Quest ${id}: ${data.name}`);
}
/**
* Register lore entries
*/
registerLoreEntries() {
this.loreEntries.set('virus_origin', {
title: 'The Outbreak',
content: `BLACK SERPENT INITIATIVE - CLASSIFIED
Project Lazarus began as a cure for death itself. Using ancient viral samples
recovered from permafrost, Dr. Helena Kovač believed she could reanimate dead
tissue while preserving consciousness.
The first trials were... promising. Deceased subjects showed signs of life.
But something went wrong. The virus mutated. Subjects became aggressive,
hungry for living flesh.
We tried to contain it. We failed.
The Outbreak began here, in this very laboratory, on October 13th, 2024.
May God forgive us.`,
location: 'Lab Computer Terminal 1'
});
this.loreEntries.set('experiment_logs', {
title: 'Subject Ana Kovač',
content: `EXPERIMENT LOG #247
Subject: Ana Kovač (Age 19, Twin Sister of Kai Kovač)
Status: SPECIAL CASE
Subject shows unprecedented resistance to viral infection. Twin Bond
phenomenon observed - psychic connection to brother remains strong even
in experimental conditions.
Dr. Kovač (mother) has requested subject be moved to special containment.
Krnić has shown interest in subject. Authorization pending.
UPDATE: Subject escaped during the facility breach. Current location unknown.
Twin Bond suggests she's alive. Brother searching for her.`,
location: 'Lab Record Room'
});
this.loreEntries.set('project_apex', {
title: 'Project Apex',
content: `PROJECT: APEX PREDATOR
Combining viral genetics (recovered from permafrost) with the Alpha Hybrid
strain has created our most powerful weapon yet.
Designation: ALPHA TROLL KING
Capabilities:
- Enhanced strength (100x human)
- Accelerated healing
- Pack leader pheromones (controls all lesser infected)
- High intelligence (strategic thinking)
WARNING: Subject is unstable. Uncontrollable by anyone but Krnić.
Recommendation: DEPLOYMENT
The new world requires a king.`,
location: 'Lab Chief Scientist Office'
});
this.loreEntries.set('cure_research', {
title: 'The Cure - Final Notes',
content: `I've done it. The cure is real.
Using Ana's unique antibodies and the original viral strain, I've synthesized
a counter-agent. It reverses the infection. Restores humanity.
But there's a catch. The cure requires Ana's living tissue. A piece of her
brain stem, specifically. The procedure would kill her.
Kai will come for his sister. When he does, he'll have a choice:
- Save Ana, doom the world to eternal infection
- Sacrifice Ana, cure humanity, lose his sister forever
I can't make this choice. Neither could any parent.
So I've hidden the cure formula. Seven pieces, scattered across the land.
Let fate decide.
- Dr. Helena Kovač`,
location: 'Hidden Lab Vault'
});
console.log(`✅ Registered ${this.loreEntries.size} lore entries`);
}
/**
* Discover lore entry
*/
discoverLore(loreId) {
const lore = this.loreEntries.get(loreId);
if (!lore) {
console.error(`Lore ${loreId} not found!`);
return false;
}
if (this.discoveredLore.has(loreId)) {
console.log(`Already discovered: ${lore.title}`);
return false;
}
this.discoveredLore.add(loreId);
console.log(`📖 LORE DISCOVERED: ${lore.title}`);
console.log(lore.content);
this.showNotification({
title: 'Lore Entry Discovered!',
text: `📖 ${lore.title}`,
icon: '📜'
});
// Add to journal
this.journal.push({
type: 'lore',
id: loreId,
title: lore.title,
date: new Date()
});
return true;
}
/**
* Make story decision
*/
makeDecision(decisionId, choice) {
this.decisions.set(decisionId, choice);
console.log(`⚖️ Decision: ${decisionId} = ${choice}`);
// Track morality
const moralityChanges = {
scientist_fate: { kill: -20, spare: +20 },
cure_or_revenge: { cure: +50, revenge: -50 },
final_choice: { save_ana: -100, sacrifice_ana: +100 }
};
const change = moralityChanges[decisionId]?.[choice] || 0;
this.moralityScore = Math.max(-100, Math.min(100, this.moralityScore + change));
console.log(` Morality: ${this.moralityScore}`);
return true;
}
/**
* Get ending based on decisions
*/
getEnding() {
const savedAna = this.decisions.get('final_choice') === 'save_ana';
const pursuesCure = this.decisions.get('cure_or_revenge') === 'cure';
const sparedScientist = this.decisions.get('scientist_fate') === 'spare';
// 4 Main Endings
if (savedAna && pursuesCure && sparedScientist) {
return {
id: 'perfect_ending',
name: 'The Hope',
description: 'You saved Ana and found another way to create the cure. Humanity has hope.',
icon: '🌟'
};
} else if (!savedAna && pursuesCure) {
return {
id: 'sacrifice_ending',
name: 'The Martyr',
description: 'You sacrificed Ana to cure humanity. The world is saved, but at what cost?',
icon: '😢'
};
} else if (savedAna && !pursuesCure) {
return {
id: 'selfish_ending',
name: 'The Bond',
description: 'You saved Ana but abandoned the cure. The world remains infected, but your sister lives.',
icon: '💔'
};
} else {
return {
id: 'dark_ending',
name: 'The Revenge',
description: 'You chose revenge over everything. Krnić is dead, but Ana and the cure are lost.',
icon: '⚔️'
};
}
}
/**
* Get quest journal
*/
getJournal() {
return this.journal;
}
/**
* Get all discovered lore
*/
getDiscoveredLore() {
return Array.from(this.discoveredLore).map(id => this.loreEntries.get(id));
}
/**
* 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);
}
}
}