feat: Add Planner citizen type with automated city expansion

This commit is contained in:
Kacper Kostka (aider)
2025-04-02 22:33:18 +02:00
parent 3e4622fa0e
commit 18ac996f65
5 changed files with 208 additions and 4 deletions

19
game.js
View File

@@ -36,6 +36,7 @@ const COST_SCHOOL = 450;
const COST_SPAWNER = 500;
const COST_TREE = 50;
const COST_SOLDIER = 250;
const COST_PLANNER = 1000;
// Terrain costs
const COST_WATER = 20;
@@ -90,14 +91,14 @@ const SCHOOL_WOOD_REQUIRED = 65;
const SCHOOL_BUILD_RATE = 0.12;
// Professions
const PROFESSIONS = ["Farmer", "Builder", "Merchant", "Doctor", "Teacher", "Soldier"];
const PROFESSIONS = ["Farmer", "Builder", "Merchant", "Doctor", "Teacher", "Soldier", "Planner"];
// Animals
const STARTING_RABBITS = 10;
const STARTING_WOLVES = 3;
const STARTING_WOLVES = 5;
const RABBIT_HUNGER_INCREMENT = 0.003;
const RABBIT_REPRO_COOLDOWN = 3000;
const RABBIT_REPRO_CHANCE = 0.0005;
const RABBIT_REPRO_COOLDOWN = 5000;
const RABBIT_REPRO_CHANCE = 0.0002;
const WOLF_SPEED = 0.7; // Faster than rabbits
/**********************************************************************
@@ -187,6 +188,16 @@ function initWorld() {
// Spawn wolves at the corners of the map
spawnWolvesAtCorners();
// Spawn additional wolves in random locations
for(let i=0; i<5; i++) {
let x, y;
do {
x = randInt(-1500,1500);
y = randInt(-1500,1500);
} while (!isValidPlacement(x, y));
animals.push(createAnimal("Wolf", x, y));
}
requestAnimationFrame(update);
}