Implement the world wonder.

This commit is contained in:
Adrian 2024-11-13 11:53:58 +01:00
parent f8157c288c
commit 387e980f5d
7 changed files with 33 additions and 1 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 232 KiB

After

Width:  |  Height:  |  Size: 206 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 184 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 147 KiB

After

Width:  |  Height:  |  Size: 158 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 289 KiB

View File

@ -353,4 +353,35 @@ export default [
}, },
}, },
}, },
{
type: 'wonder',
name: 'World Wonder',
maxLevel: 1,
unique: true,
requiredTownhallLevel: 20,
cost: () => {
return {
wood: 42000,
stone: 42000,
iron: 42000,
food: 38000,
};
},
timeToBuild: () => 120,
behavior: {
production: (V: VillageState, self: BuildingType) => {
const prod = getEmptyResources();
prod.food = self.level * -300;
return prod;
},
triggers: {
onLevelUp: (V: VillageState, self: BuildingType) => {
if (self.level === 1) {
// Gain a lot of culture.
V.resources.culture += 18000;
}
},
},
},
},
]; ];

View File

@ -112,6 +112,7 @@ function getInitialState() {
// Create the Town hall. // Create the Town hall.
const townhall = createBuilding('townhall'); const townhall = createBuilding('townhall');
// townhall.level = 20;
state.villageTiles[0][0] = townhall.id; state.villageTiles[0][0] = townhall.id;
state.buildings.push(townhall); state.buildings.push(townhall);
@ -134,7 +135,7 @@ function getInitialState() {
} }
const newBuilding = createBuilding(type); const newBuilding = createBuilding(type);
newBuilding.tile = new Hex(x, y); newBuilding.tile = new Hex(x, y);
newBuilding.level = 20; //newBuilding.type === 'field' ? 1 : 10; newBuilding.level = 1; //20; //newBuilding.type === 'field' ? 1 : 10;
state.outsideTiles[y][x] = newBuilding.id; state.outsideTiles[y][x] = newBuilding.id;
state.buildings.push(newBuilding); state.buildings.push(newBuilding);
}); });