Add buildings that improve resource production.
This commit is contained in:
parent
933796bb4a
commit
83adff2603
BIN
public/img/buildings/bakery.png
Normal file
BIN
public/img/buildings/bakery.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 177 KiB |
BIN
public/img/buildings/blacksmith.png
Normal file
BIN
public/img/buildings/blacksmith.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 196 KiB |
BIN
public/img/buildings/sawmill.png
Normal file
BIN
public/img/buildings/sawmill.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 143 KiB |
BIN
public/img/buildings/stonecutter.png
Normal file
BIN
public/img/buildings/stonecutter.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 190 KiB |
@ -24,6 +24,11 @@ function getUnitBuildingCost(level: number, initial: number) {
|
||||
}
|
||||
|
||||
|
||||
function getMultiplierBuildingCost(level: number, initial: number) {
|
||||
return initial * Math.round( (level + level * level) / 3);
|
||||
}
|
||||
|
||||
|
||||
export default [
|
||||
{
|
||||
type: 'townhall',
|
||||
@ -353,6 +358,114 @@ export default [
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'sawmill',
|
||||
name: 'Sawmill',
|
||||
maxLevel: 5,
|
||||
unique: true,
|
||||
requiredTownhallLevel: 7,
|
||||
cost: (level: number) => {
|
||||
return {
|
||||
wood: getMultiplierBuildingCost(level, 440),
|
||||
stone: getMultiplierBuildingCost(level, 610),
|
||||
iron: getMultiplierBuildingCost(level, 870),
|
||||
food: getMultiplierBuildingCost(level, 700),
|
||||
};
|
||||
},
|
||||
timeToBuild: (level: number) => getStandardTimeToBuild(level) * 3,
|
||||
behavior: {
|
||||
production: (V: VillageState, self: BuildingType) => {
|
||||
const resourceProd = V.buildings
|
||||
.filter(b => b.type === 'woodcutter')
|
||||
.map(f => f.behavior.production?.(V, f).wood)
|
||||
.reduce((acc, f) => acc + f, 0);
|
||||
const prod = getEmptyResources();
|
||||
prod.wood = resourceProd * self.level * 0.05;
|
||||
return prod;
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'stonecutter',
|
||||
name: 'Stonecutter',
|
||||
maxLevel: 5,
|
||||
unique: true,
|
||||
requiredTownhallLevel: 7,
|
||||
cost: (level: number) => {
|
||||
return {
|
||||
wood: getMultiplierBuildingCost(level, 870),
|
||||
stone: getMultiplierBuildingCost(level, 440),
|
||||
iron: getMultiplierBuildingCost(level, 610),
|
||||
food: getMultiplierBuildingCost(level, 700),
|
||||
};
|
||||
},
|
||||
timeToBuild: (level: number) => getStandardTimeToBuild(level) * 3,
|
||||
behavior: {
|
||||
production: (V: VillageState, self: BuildingType) => {
|
||||
const resourceProd = V.buildings
|
||||
.filter(b => b.type === 'pit')
|
||||
.map(f => f.behavior.production?.(V, f).stone)
|
||||
.reduce((acc, f) => acc + f, 0);
|
||||
const prod = getEmptyResources();
|
||||
prod.stone = resourceProd * self.level * 0.05;
|
||||
return prod;
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'blacksmith',
|
||||
name: 'Blacksmith',
|
||||
maxLevel: 5,
|
||||
unique: true,
|
||||
requiredTownhallLevel: 7,
|
||||
cost: (level: number) => {
|
||||
return {
|
||||
wood: getMultiplierBuildingCost(level, 610),
|
||||
stone: getMultiplierBuildingCost(level, 870),
|
||||
iron: getMultiplierBuildingCost(level, 440),
|
||||
food: getMultiplierBuildingCost(level, 700),
|
||||
};
|
||||
},
|
||||
timeToBuild: (level: number) => getStandardTimeToBuild(level) * 3,
|
||||
behavior: {
|
||||
production: (V: VillageState, self: BuildingType) => {
|
||||
const resourceProd = V.buildings
|
||||
.filter(b => b.type === 'mine')
|
||||
.map(f => f.behavior.production?.(V, f).iron)
|
||||
.reduce((acc, f) => acc + f, 0);
|
||||
const prod = getEmptyResources();
|
||||
prod.iron = resourceProd * self.level * 0.05;
|
||||
return prod;
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'bakery',
|
||||
name: 'Bakery',
|
||||
maxLevel: 5,
|
||||
unique: true,
|
||||
requiredTownhallLevel: 7,
|
||||
cost: (level: number) => {
|
||||
return {
|
||||
wood: getMultiplierBuildingCost(level, 670),
|
||||
stone: getMultiplierBuildingCost(level, 740),
|
||||
iron: getMultiplierBuildingCost(level, 670),
|
||||
food: getMultiplierBuildingCost(level, 520),
|
||||
};
|
||||
},
|
||||
timeToBuild: (level: number) => getStandardTimeToBuild(level) * 3,
|
||||
behavior: {
|
||||
production: (V: VillageState, self: BuildingType) => {
|
||||
const fields = V.buildings.filter(b => b.type === 'field');
|
||||
const fieldFoodProd = fields
|
||||
.map(f => f.behavior.production?.(V, f).food)
|
||||
.reduce((acc, f) => acc + f, 0);
|
||||
const prod = getEmptyResources();
|
||||
prod.food = fieldFoodProd * self.level * 0.05;
|
||||
return prod;
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'wonder',
|
||||
name: 'World Wonder',
|
||||
|
@ -117,7 +117,7 @@ function getInitialState() {
|
||||
state.buildings.push(townhall);
|
||||
|
||||
// Create all the resource buildings.
|
||||
const resourceBuildingTypes: Array<string> = shuffle([
|
||||
const resourceBuildingTypes = shuffle([
|
||||
'woodcutter', 'woodcutter', 'woodcutter', 'woodcutter',
|
||||
'mine', 'mine', 'mine', 'mine',
|
||||
'pit', 'pit', 'pit', 'pit',
|
||||
|
Loading…
Reference in New Issue
Block a user