dodelani dnevnik
This commit is contained in:
32
src/systems/BlueprintSystem.js
Normal file
32
src/systems/BlueprintSystem.js
Normal file
@@ -0,0 +1,32 @@
|
||||
class BlueprintSystem {
|
||||
constructor(scene) {
|
||||
this.scene = scene;
|
||||
this.knownRecipes = ['axe', 'pickaxe', 'hoe']; // Default known
|
||||
this.blueprintsFound = []; // Items found but not learned? Or just list
|
||||
console.log('📜 BlueprintSystem: Initialized');
|
||||
}
|
||||
|
||||
// Called when digging/mining
|
||||
tryDropBlueprint() {
|
||||
if (Math.random() < 0.05) { // 5% chance
|
||||
const newBp = 'blueprint_barn'; // Randomize this
|
||||
console.log('✨ BLUEPRINT FOUND:', newBp);
|
||||
return newBp;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
learnBlueprint(id) {
|
||||
if (!this.knownRecipes.includes(id)) {
|
||||
this.knownRecipes.push(id);
|
||||
console.log('🧠 Learned Recipe:', id);
|
||||
// TODO: Add to Crafting Menu
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
hasRecipe(id) {
|
||||
return this.knownRecipes.includes(id);
|
||||
}
|
||||
}
|
||||
27
src/systems/ExpansionSystem.js
Normal file
27
src/systems/ExpansionSystem.js
Normal file
@@ -0,0 +1,27 @@
|
||||
class ExpansionSystem {
|
||||
constructor(scene) {
|
||||
this.scene = scene;
|
||||
this.unlockedZones = ['FARM_START']; // List of IDs
|
||||
this.islandsDiscovered = [];
|
||||
console.log('🌍 ExpansionSystem: Initialized');
|
||||
}
|
||||
|
||||
// Preveri, če je igralec v dovoljeni coni
|
||||
checkAccess(x, y) {
|
||||
// TODO: Map coordinates to Zone ID
|
||||
return true;
|
||||
}
|
||||
|
||||
unlockZone(zoneId) {
|
||||
if (!this.unlockedZones.includes(zoneId)) {
|
||||
this.unlockedZones.push(zoneId);
|
||||
console.log('🔓 Zone Unlocked:', zoneId);
|
||||
// TODO: Remove fog/barrier
|
||||
}
|
||||
}
|
||||
|
||||
travelToIsland(islandId) {
|
||||
console.log('🚤 Traveling to:', islandId);
|
||||
// TODO: Load island map / scene
|
||||
}
|
||||
}
|
||||
44
src/systems/LegacySystem.js
Normal file
44
src/systems/LegacySystem.js
Normal file
@@ -0,0 +1,44 @@
|
||||
class LegacySystem {
|
||||
constructor(scene) {
|
||||
this.scene = scene;
|
||||
this.worldAge = 0; // Days passed
|
||||
this.generation = 1;
|
||||
this.currentAge = 18; // Protagonist age
|
||||
|
||||
this.family = {
|
||||
partner: null,
|
||||
children: []
|
||||
};
|
||||
|
||||
console.log('⏳ LegacySystem: Initialized (Gen ' + this.generation + ')');
|
||||
}
|
||||
|
||||
// Call daily
|
||||
advanceDay() {
|
||||
this.worldAge++;
|
||||
// Age Logic
|
||||
if (this.worldAge % 365 === 0) {
|
||||
this.currentAge++;
|
||||
console.log('🎂 Birthday! Now age:', this.currentAge);
|
||||
}
|
||||
}
|
||||
|
||||
marry(npcId) {
|
||||
this.family.partner = npcId;
|
||||
console.log('💍 Married to:', npcId);
|
||||
}
|
||||
|
||||
haveChild(name) {
|
||||
if (this.family.children.length < 2) {
|
||||
this.family.children.push({ name: name, age: 0 });
|
||||
console.log('👶 New Child:', name);
|
||||
}
|
||||
}
|
||||
|
||||
dieAndInherit(heirIndex) {
|
||||
console.log('⚰️ Character Died. Passing legacy...');
|
||||
this.generation++;
|
||||
this.currentAge = 18; // Reset age for heir
|
||||
// TODO: Transfer inventory and stats
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,8 @@ class StatsSystem {
|
||||
this.currentLevel = 1;
|
||||
this.currentXP = 0;
|
||||
this.xpToNextLevel = XP_REQUIRED_BASE;
|
||||
this.score = 0; // GLOBAL SCORE (Za Legacy)
|
||||
this.totalPlaytime = 0; // Skupni čas igranja (sekunde)
|
||||
|
||||
// Stats
|
||||
this.health = 100;
|
||||
@@ -39,6 +41,7 @@ class StatsSystem {
|
||||
|
||||
update(delta) {
|
||||
const seconds = delta / 1000;
|
||||
this.totalPlaytime += seconds; // Track playtime
|
||||
|
||||
// Decay
|
||||
if (this.hunger > 0) {
|
||||
@@ -94,9 +97,21 @@ class StatsSystem {
|
||||
this.thirst = Math.min(this.thirst, this.maxThirst);
|
||||
}
|
||||
|
||||
// SCORE & DEATH LOGIC
|
||||
addScore(points) {
|
||||
this.score += points;
|
||||
// console.log(`⭐ Score +${points} (Total: ${this.score})`);
|
||||
}
|
||||
|
||||
die() {
|
||||
console.log('💀 Player died!');
|
||||
|
||||
// SCORE PENALTY (Legacy Cost)
|
||||
// Igralec NE izgubi farme, ampak izgubi del Dediščine (Točk).
|
||||
const penalty = Math.floor(this.score * 0.25); // Izguba 25% točk
|
||||
this.score = Math.max(0, this.score - penalty);
|
||||
console.log(`📉 Dediščina Oškodovana: -${penalty} Točk (Novo stanje: ${this.score})`);
|
||||
|
||||
// Trigger Player Animation
|
||||
if (this.scene.player) {
|
||||
this.scene.player.dieAnimation();
|
||||
@@ -111,16 +126,26 @@ class StatsSystem {
|
||||
|
||||
const bg = uiScene.add.rectangle(width / 2, height / 2, width, height, 0x000000, 0.8);
|
||||
|
||||
const txt = uiScene.add.text(width / 2, height / 2, 'YOU DIED', {
|
||||
const txt = uiScene.add.text(width / 2, height / 2 - 50, 'YOU DIED', {
|
||||
fontSize: '64px', color: '#ff0000', fontStyle: 'bold'
|
||||
}).setOrigin(0.5);
|
||||
|
||||
const sub = uiScene.add.text(width / 2, height / 2 + 20, `Legacy Lost: -${penalty} Score pts`, {
|
||||
fontSize: '24px', color: '#ffffff'
|
||||
}).setOrigin(0.5);
|
||||
|
||||
const sub2 = uiScene.add.text(width / 2, height / 2 + 60, '(Farm Preserved)', {
|
||||
fontSize: '18px', color: '#aaaaaa', fontStyle: 'italic'
|
||||
}).setOrigin(0.5);
|
||||
|
||||
// Wait and Respawn
|
||||
uiScene.time.delayedCall(3000, () => {
|
||||
if (bg) bg.destroy();
|
||||
if (txt) txt.destroy();
|
||||
if (sub) sub.destroy();
|
||||
if (sub2) sub2.destroy();
|
||||
|
||||
// Reset Stats
|
||||
// Reset Stats (but keep Score penalty)
|
||||
this.health = 100;
|
||||
this.hunger = 100;
|
||||
this.thirst = 100;
|
||||
|
||||
39
src/systems/ZombieWorkerSystem.js
Normal file
39
src/systems/ZombieWorkerSystem.js
Normal file
@@ -0,0 +1,39 @@
|
||||
class ZombieWorkerSystem {
|
||||
constructor(scene) {
|
||||
this.scene = scene;
|
||||
this.workers = []; // Array of tames zombies
|
||||
this.graves = []; // Array of grave locations
|
||||
console.log('🧟 ZombieWorkerSystem: Initialized');
|
||||
}
|
||||
|
||||
// Dodaj zombija med delavce
|
||||
addWorker(zombieEntity) {
|
||||
this.workers.push({
|
||||
entity: zombieEntity,
|
||||
task: 'IDLE', // FARM, MINE, GUARD, REST
|
||||
energy: 100, // Decay meter
|
||||
xp: 0
|
||||
});
|
||||
console.log('🧟 New Worker Assigned!');
|
||||
}
|
||||
|
||||
// Dodelitev naloge
|
||||
assignTask(workerIndex, taskType, location) {
|
||||
if (this.workers[workerIndex]) {
|
||||
this.workers[workerIndex].task = taskType;
|
||||
this.workers[workerIndex].targetLocation = location;
|
||||
}
|
||||
}
|
||||
|
||||
update(time, delta) {
|
||||
// Logic for worker AI, decay, and farming automation
|
||||
this.workers.forEach(worker => {
|
||||
if (worker.energy > 0) {
|
||||
worker.energy -= 0.01; // Decay over time
|
||||
// TODO: Execute Task Logic
|
||||
} else {
|
||||
// TODO: Rot / Die logic
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user