farma updejt

This commit is contained in:
2025-12-08 01:39:39 +01:00
parent 9c61c3b56d
commit e49f567831
12 changed files with 596 additions and 99 deletions

View File

@@ -1,7 +1,18 @@
// ========================================================
// KONSTANTE IN IGRALČEVI PODATKI
// ========================================================
const XP_REQUIRED_BASE = 100; // Osnovni XP, potrebni za LVL 2
const XP_GROWTH_FACTOR = 1.5; // Za vsak LVL potrebujete 1.5x več XP
class StatsSystem {
constructor(scene) {
this.scene = scene;
// Leveling System
this.currentLevel = 1;
this.currentXP = 0;
this.xpToNextLevel = XP_REQUIRED_BASE;
// Stats
this.health = 100;
this.maxHealth = 100;
@@ -130,6 +141,18 @@ class StatsSystem {
if (uiScene.hungerBar) uiScene.setBarValue(uiScene.hungerBar, this.hunger);
if (uiScene.thirstBar) uiScene.setBarValue(uiScene.thirstBar, this.thirst);
}
this.updateLevelUI();
}
updateLevelUI() {
const xpPercent = (this.currentXP / this.xpToNextLevel) * 100;
const levelText = `LV: ${this.currentLevel}`;
// Uporaba Antigravity Engine UI klicev, kot zahtevano
if (window.Antigravity && window.Antigravity.UI) {
window.Antigravity.UI.setText(this.scene, 'LevelDisplay', levelText);
window.Antigravity.UI.setBarValue(this.scene, 'XPBar', xpPercent);
}
}
// Friendship System
@@ -149,4 +172,49 @@ class StatsSystem {
this.friendship[npcType] = amount;
}
}
// ========================================================
// LEVELING SYSTEM
// ========================================================
addXP(amount) {
this.currentXP += amount;
// 1. Preverimo, ali je igralec pripravljen za Level Up
while (this.currentXP >= this.xpToNextLevel) {
this.levelUp();
}
this.updateUI();
}
levelUp() {
// Povečamo Level
this.currentLevel++;
// Izračunamo nov XP prag
this.xpToNextLevel = Math.floor(this.xpToNextLevel * XP_GROWTH_FACTOR);
// Preostanek XP prenesemo v nov Level
this.currentXP = this.currentXP - (this.xpToNextLevel / XP_GROWTH_FACTOR);
// Bonus Stats
this.maxHealth += 10;
this.health = this.maxHealth;
this.maxHunger += 5;
this.maxThirst += 5;
this.hunger = this.maxHunger;
this.thirst = this.maxThirst;
// Vizualni učinek / Prikaz sporočila
console.log(`🎉 LEVEL UP! Dosežen level ${this.currentLevel}!`);
if (window.Antigravity && window.Antigravity.UI) {
window.Antigravity.UI.showMessage(
this.scene,
`LEVEL UP! Dosežen level ${this.currentLevel}!`,
'#FFD700'
);
}
}
}