Add officeSpace building and enhance ResourceDisplay progress calculation

This commit is contained in:
billy 2025-03-30 04:04:09 -04:00
parent 301c955058
commit d3ed7bd5d6
3 changed files with 93 additions and 67 deletions

View File

@ -18,7 +18,7 @@ import {
import theme from './theme' import theme from './theme'
import { useEffect } from 'react' import { useEffect } from 'react'
type BuildingId = 'mouseFarms' | 'keyboardFactories' | 'monitorDisplays' | 'serverRooms' | 'dataCenters' | type BuildingId = 'mouseFarms' | 'keyboardFactories' | 'monitorDisplays' | 'officeSpace' | 'serverRooms' | 'dataCenters' |
'dataCities' | 'dataCountries' | 'dataContinents' | 'dataWorlds' | 'dataMoons' | 'dataCities' | 'dataCountries' | 'dataContinents' | 'dataWorlds' | 'dataMoons' |
'dataSolarSystems' | 'dataGalaxies' | 'dataUniverses' | 'dataGods' 'dataSolarSystems' | 'dataGalaxies' | 'dataUniverses' | 'dataGods'

View File

@ -10,7 +10,16 @@ export function ResourceDisplay() {
// Calculate progress to next level // Calculate progress to next level
const currentLevelPPS = Math.pow(10, playerLevel - 1) const currentLevelPPS = Math.pow(10, playerLevel - 1)
const nextLevelPPS = Math.pow(10, playerLevel) const nextLevelPPS = Math.pow(10, playerLevel)
const progress = ((pointsPerSecond - currentLevelPPS) / (nextLevelPPS - currentLevelPPS)) * 100
// Handle progress calculation properly
let progress = 0;
if (playerLevel === 1) {
// For level 1, show progress from 0 to 10 PPS
progress = Math.min(Math.max((pointsPerSecond / nextLevelPPS) * 100, 0), 100);
} else {
// For levels > 1, show progress from currentLevelPPS to nextLevelPPS
progress = Math.min(Math.max(((pointsPerSecond - currentLevelPPS) / (nextLevelPPS - currentLevelPPS)) * 100, 0), 100);
}
return ( return (
<Box <Box
@ -49,6 +58,9 @@ export function ResourceDisplay() {
borderRadius="full" borderRadius="full"
bg="gray.700" bg="gray.700"
/> />
<Text fontSize="xs" color="gray.500" mt={1} textAlign="center">
{pointsPerSecond.toFixed(1)}/{nextLevelPPS} PPS
</Text>
</Box> </Box>
</VStack> </VStack>
</Box> </Box>

View File

@ -21,6 +21,7 @@ interface GameState {
mouseFarms: number mouseFarms: number
keyboardFactories: number keyboardFactories: number
monitorDisplays: number monitorDisplays: number
officeSpace: number
serverRooms: number serverRooms: number
dataCenters: number dataCenters: number
dataCities: number dataCities: number
@ -37,6 +38,7 @@ interface GameState {
mouseFarmsLevel: number mouseFarmsLevel: number
keyboardFactoriesLevel: number keyboardFactoriesLevel: number
monitorDisplaysLevel: number monitorDisplaysLevel: number
officeSpaceLevel: number
serverRoomsLevel: number serverRoomsLevel: number
dataCentersLevel: number dataCentersLevel: number
dataCitiesLevel: number dataCitiesLevel: number
@ -86,6 +88,7 @@ const initialState = {
mouseFarms: 0, mouseFarms: 0,
keyboardFactories: 0, keyboardFactories: 0,
monitorDisplays: 0, monitorDisplays: 0,
officeSpace: 0,
serverRooms: 0, serverRooms: 0,
dataCenters: 0, dataCenters: 0,
dataCities: 0, dataCities: 0,
@ -100,6 +103,7 @@ const initialState = {
mouseFarmsLevel: 1, mouseFarmsLevel: 1,
keyboardFactoriesLevel: 1, keyboardFactoriesLevel: 1,
monitorDisplaysLevel: 1, monitorDisplaysLevel: 1,
officeSpaceLevel: 1,
serverRoomsLevel: 1, serverRoomsLevel: 1,
dataCentersLevel: 1, dataCentersLevel: 1,
dataCitiesLevel: 1, dataCitiesLevel: 1,
@ -123,17 +127,18 @@ const PRODUCTION_RATES = {
mouseFarms: { points: 0.1 }, mouseFarms: { points: 0.1 },
keyboardFactories: { points: 0.2 }, keyboardFactories: { points: 0.2 },
monitorDisplays: { points: 0.2 }, monitorDisplays: { points: 0.2 },
serverRooms: { points: 1 }, officeSpace: { points: 1 },
dataCenters: { points: 5 }, serverRooms: { points: 5 },
dataCities: { points: 25 }, dataCenters: { points: 25 },
dataCountries: { points: 100 }, dataCities: { points: 100 },
dataContinents: { points: 500 }, dataCountries: { points: 500 },
dataWorlds: { points: 2500 }, dataContinents: { points: 2500 },
dataMoons: { points: 10000 }, dataWorlds: { points: 10000 },
dataSolarSystems: { points: 50000 }, dataMoons: { points: 50000 },
dataGalaxies: { points: 250000 }, dataSolarSystems: { points: 250000 },
dataUniverses: { points: 1000000 }, dataGalaxies: { points: 1000000 },
dataGods: { points: 5000000 }, dataUniverses: { points: 5000000 },
dataGods: { points: 25000000 },
} }
// Building costs // Building costs
@ -141,17 +146,18 @@ const BUILDING_COSTS = {
mouseFarms: 10, mouseFarms: 10,
keyboardFactories: 50, keyboardFactories: 50,
monitorDisplays: 100, monitorDisplays: 100,
serverRooms: 500, officeSpace: 500,
dataCenters: 1000, serverRooms: 1000,
dataCities: 5000, dataCenters: 5000,
dataCountries: 25000, dataCities: 25000,
dataContinents: 100000, dataCountries: 100000,
dataWorlds: 500000, dataContinents: 500000,
dataMoons: 2000000, dataWorlds: 2000000,
dataSolarSystems: 10000000, dataMoons: 10000000,
dataGalaxies: 50000000, dataSolarSystems: 50000000,
dataUniverses: 200000000, dataGalaxies: 200000000,
dataGods: 1000000000, dataUniverses: 1000000000,
dataGods: 5000000000,
} }
// Building level requirements // Building level requirements
@ -159,17 +165,18 @@ const BUILDING_LEVEL_REQUIREMENTS = {
mouseFarms: 1, mouseFarms: 1,
keyboardFactories: 1, keyboardFactories: 1,
monitorDisplays: 1, monitorDisplays: 1,
officeSpace: 1,
serverRooms: 1, serverRooms: 1,
dataCenters: 1, dataCenters: 5,
dataCities: 5, dataCities: 10,
dataCountries: 10, dataCountries: 20,
dataContinents: 20, dataContinents: 30,
dataWorlds: 30, dataWorlds: 40,
dataMoons: 40, dataMoons: 50,
dataSolarSystems: 50, dataSolarSystems: 60,
dataGalaxies: 60, dataGalaxies: 70,
dataUniverses: 70, dataUniverses: 80,
dataGods: 80, dataGods: 90,
} }
// Special multiplier purchases // Special multiplier purchases
@ -375,81 +382,88 @@ export const BUILDING_INFO: Record<string, Omit<BuildingInfo, 'id'>> = {
description: 'High-resolution displays that generate points. A balanced production facility.', description: 'High-resolution displays that generate points. A balanced production facility.',
production: { points: 0.2 } production: { points: 0.2 }
}, },
serverRooms: { officeSpace: {
cost: 500, cost: 500,
levelRequirement: 1, levelRequirement: 1,
title: 'Server Room', title: 'Office Space',
description: 'A powerful facility that generates significant amounts of points. Requires proper cooling.', description: 'A productive workspace filled with computers. Generates a significant amount of points.',
production: { points: 1 } production: { points: 1 }
}, },
dataCenters: { serverRooms: {
cost: 1000, cost: 1000,
levelRequirement: 1, levelRequirement: 1,
title: 'Data Center', title: 'Server Room',
description: 'The ultimate production facility. Generates massive amounts of points but requires significant investment.', description: 'A powerful facility that generates substantial amounts of points. Requires proper cooling.',
production: { points: 5 } production: { points: 5 }
}, },
dataCities: { dataCenters: {
cost: 5000, cost: 5000,
levelRequirement: 5, levelRequirement: 5,
title: 'Data City', title: 'Data Center',
description: 'A massive network of data centers spanning an entire city. Requires level 5 to unlock.', description: 'The ultimate production facility. Generates massive amounts of points but requires significant investment.',
production: { points: 25 } production: { points: 25 }
}, },
dataCountries: { dataCities: {
cost: 25000, cost: 25000,
levelRequirement: 10, levelRequirement: 10,
title: 'Data Country', title: 'Data City',
description: 'A country-wide network of data cities. Requires level 10 to unlock.', description: 'A massive network of data centers spanning an entire city. Requires level 10 to unlock.',
production: { points: 100 } production: { points: 100 }
}, },
dataContinents: { dataCountries: {
cost: 100000, cost: 100000,
levelRequirement: 20, levelRequirement: 20,
title: 'Data Continent', title: 'Data Country',
description: 'A continent-spanning network of data countries. Requires level 20 to unlock.', description: 'A country-wide network of data cities. Requires level 20 to unlock.',
production: { points: 500 } production: { points: 500 }
}, },
dataWorlds: { dataContinents: {
cost: 500000, cost: 500000,
levelRequirement: 30, levelRequirement: 30,
title: 'Data World', title: 'Data Continent',
description: 'A world-wide network of data continents. Requires level 30 to unlock.', description: 'A continent-spanning network of data countries. Requires level 30 to unlock.',
production: { points: 2500 } production: { points: 2500 }
}, },
dataMoons: { dataWorlds: {
cost: 2000000, cost: 2000000,
levelRequirement: 40, levelRequirement: 40,
title: 'Data Moon', title: 'Data World',
description: 'A moon-sized data processing facility. Requires level 40 to unlock.', description: 'A world-wide network of data continents. Requires level 40 to unlock.',
production: { points: 10000 } production: { points: 10000 }
}, },
dataSolarSystems: { dataMoons: {
cost: 10000000, cost: 10000000,
levelRequirement: 50, levelRequirement: 50,
title: 'Data Solar System', title: 'Data Moon',
description: 'A solar system-wide network of data moons. Requires level 50 to unlock.', description: 'A moon-sized data processing facility. Requires level 50 to unlock.',
production: { points: 50000 } production: { points: 50000 }
}, },
dataGalaxies: { dataSolarSystems: {
cost: 50000000, cost: 50000000,
levelRequirement: 60, levelRequirement: 60,
title: 'Data Galaxy', title: 'Data Solar System',
description: 'A galaxy-spanning network of data solar systems. Requires level 60 to unlock.', description: 'A solar system-wide network of data moons. Requires level 60 to unlock.',
production: { points: 250000 } production: { points: 250000 }
}, },
dataUniverses: { dataGalaxies: {
cost: 200000000, cost: 200000000,
levelRequirement: 70, levelRequirement: 70,
title: 'Data Universe', title: 'Data Galaxy',
description: 'A universe-wide network of data galaxies. Requires level 70 to unlock.', description: 'A galaxy-spanning network of data solar systems. Requires level 70 to unlock.',
production: { points: 1000000 } production: { points: 1000000 }
}, },
dataGods: { dataUniverses: {
cost: 1000000000, cost: 1000000000,
levelRequirement: 80, levelRequirement: 80,
title: 'Data God', title: 'Data Universe',
description: 'The ultimate data processing entity. Requires level 80 to unlock.', description: 'A universe-wide network of data galaxies. Requires level 80 to unlock.',
production: { points: 5000000 } production: { points: 5000000 }
},
dataGods: {
cost: 5000000000,
levelRequirement: 90,
title: 'Data God',
description: 'The ultimate data processing entity. Requires level 90 to unlock.',
production: { points: 25000000 }
} }
} }