feat: purchase workers with currency, increase instrument speed, prices go up with each purchase

This commit is contained in:
John McCardle 2022-01-09 12:52:17 -05:00
parent 79f00ed080
commit 25a9c70663
2 changed files with 28 additions and 9 deletions

View File

@ -5,17 +5,19 @@
:key="index"
class="flex flex-col mb-4 p-4 rounded border"
:class="`border-${$store.getters.activeTab.darkColor}`"
@click="$store.commit('purchaseWorker', index)"
>
<span class="text-center font-bold pb-2 text-xl">
{{ process.workerCount }} {{ process.worker }}s
{{ process.workerCount }} {{ process.worker
}}<template v-if="process.workerCount != 1">s</template>
</span>
<span class="text-left font-semibold">
Each <b>{{ process.worker }}</b> makes your
<b>{{ process.device }}s</b> produce <b>{{ process.produces }}</b> at an
increased rate.
<b>{{ process.device }}s</b> produce <b>spare time</b> at an increased
rate.
</span>
<span class="text-center text-md pt-2"
>Cost for next {{ process.worker }}: 4
>Cost for next {{ process.worker }}: {{ process.nextWorkerCost }}
{{ process.buyWorkersWith }}</span
>
</div>

View File

@ -60,30 +60,36 @@ export const state = () => ({
instrument: 'Star Chart',
worker: 'Shaman',
deviceCount: new Decimal(0),
workerCount: 1,
workerCount: 0,
completion: 0,
workerRate: 8.0, // amount added to "completion" (100=full bar) per worker
reward: 10, // currency added when the bar is completed
workerRate: 6.0, // amount added to "completion" (100=full bar) per worker
reward: 8, // currency added when the bar is completed
nextWorkerCost: 15, // currency cost of next worker
nextWorkerFactor: 1.4, // worker cost *= this factor after each purchase
unlockThreshold: { tech: null, currency: 0 },
},
{
instrument: 'Stone Calendar',
worker: 'Stonecarver',
deviceCount: new Decimal(0),
workerCount: 1,
workerCount: 0,
completion: 0,
workerRate: 4.0,
reward: 35,
nextWorkerCost: 60,
nextWorkerFactor: 1.6,
unlockThreshold: { tech: null, currency: 10000 },
},
{
instrument: 'Astrolabes',
worker: 'Mathematician',
deviceCount: new Decimal(0),
workerCount: 1,
workerCount: 0,
completion: 0,
workerRate: 1.5,
reward: 80,
nextWorkerCost: 90,
nextWorkerFactor: 1.8,
unlockThreshold: { tech: 0, currency: new Decimal(10e5) },
},
],
@ -166,4 +172,15 @@ export const mutations = {
completeMission: (state, missionIndex) => {
state.missions[missionIndex].complete = true
},
purchaseWorker: (state, processIndex) => {
const p = state.processes[processIndex]
if (p.nextWorkerCost > state.currency) return
state.currency = Decimal.subtract(state.currency, p.nextWorkerCost)
Vue.set(state.processes[processIndex], 'workerCount', p.workerCount + 1)
Vue.set(
state.processes[processIndex],
'nextWorkerCost',
Math.floor(p.nextWorkerCost * p.nextWorkerFactor)
)
},
}