phase 11 koncano
This commit is contained in:
@@ -31,6 +31,26 @@ class NPC {
|
||||
this.maxHp = 50;
|
||||
this.moveSpeed = 150; // 50% hitrejši
|
||||
this.gridMoveTime = 200; // Hitrejši premiki
|
||||
} else if (type === 'troll') {
|
||||
this.hp = 300;
|
||||
this.maxHp = 300;
|
||||
this.moveSpeed = 40; // Very Slow
|
||||
this.gridMoveTime = 800;
|
||||
this.damage = 25;
|
||||
this.aggroRange = 6;
|
||||
} else if (type === 'elf') {
|
||||
this.hp = 50;
|
||||
this.maxHp = 50;
|
||||
this.moveSpeed = 200; // Fast
|
||||
this.gridMoveTime = 150;
|
||||
this.damage = 15;
|
||||
this.aggroRange = 10;
|
||||
} else if (type.includes('cow') || type.includes('chicken')) {
|
||||
this.hp = type.includes('mutant') ? 20 : 10;
|
||||
this.maxHp = this.hp;
|
||||
this.moveSpeed = type.includes('chicken') ? 120 : 60; // Chickens faster than cows
|
||||
this.gridMoveTime = type.includes('chicken') ? 250 : 500;
|
||||
this.passive = true; // NEW FLAG
|
||||
} else {
|
||||
this.hp = 20;
|
||||
this.maxHp = 20;
|
||||
@@ -57,6 +77,18 @@ class NPC {
|
||||
let texKey = `npc_${this.type}`;
|
||||
let isAnimated = false;
|
||||
|
||||
// Sprite selection per type
|
||||
if (['npc', 'zombie', 'merchant', 'elite_zombie'].indexOf(this.type) === -1) {
|
||||
// It's likely a new type, check direct texture existence
|
||||
if (this.scene.textures.exists(this.type)) {
|
||||
texKey = this.type;
|
||||
} else {
|
||||
console.warn(`Texture for ${this.type} not found, generating fallback.`);
|
||||
// Fallback generation triggers for known types if missing?
|
||||
// We already generated them in TextureGenerator.generateAll()
|
||||
}
|
||||
}
|
||||
|
||||
// Check for animated sprites first
|
||||
if (this.type === 'zombie' && this.scene.textures.exists('zombie_walk')) {
|
||||
texKey = 'zombie_walk';
|
||||
@@ -213,7 +245,7 @@ class NPC {
|
||||
}
|
||||
|
||||
// 3. AI Logic
|
||||
if (this.type === 'zombie' && this.state !== 'TAMED' && this.state !== 'FOLLOW') {
|
||||
if (this.type !== 'merchant' && this.state !== 'TAMED' && this.state !== 'FOLLOW' && !this.passive) {
|
||||
this.handleAggressiveAI(delta);
|
||||
} else {
|
||||
this.handlePassiveAI(delta);
|
||||
@@ -384,6 +416,7 @@ class NPC {
|
||||
const terrainSystem = this.scene.terrainSystem;
|
||||
if (!terrainSystem) return true;
|
||||
if (!this.iso.isInBounds(x, y, terrainSystem.width, terrainSystem.height)) return false;
|
||||
if (!terrainSystem.tiles[y] || !terrainSystem.tiles[y][x]) return false;
|
||||
if (terrainSystem.tiles[y][x].type.name === 'water') return false;
|
||||
|
||||
const key = `${x},${y}`;
|
||||
|
||||
Reference in New Issue
Block a user