feat: purchase workers with currency, increase instrument speed, prices go up with each purchase
This commit is contained in:
parent
79f00ed080
commit
25a9c70663
|
@ -5,17 +5,19 @@
|
||||||
:key="index"
|
:key="index"
|
||||||
class="flex flex-col mb-4 p-4 rounded border"
|
class="flex flex-col mb-4 p-4 rounded border"
|
||||||
:class="`border-${$store.getters.activeTab.darkColor}`"
|
:class="`border-${$store.getters.activeTab.darkColor}`"
|
||||||
|
@click="$store.commit('purchaseWorker', index)"
|
||||||
>
|
>
|
||||||
<span class="text-center font-bold pb-2 text-xl">
|
<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>
|
||||||
<span class="text-left font-semibold">
|
<span class="text-left font-semibold">
|
||||||
Each <b>{{ process.worker }}</b> makes your
|
Each <b>{{ process.worker }}</b> makes your
|
||||||
<b>{{ process.device }}s</b> produce <b>{{ process.produces }}</b> at an
|
<b>{{ process.device }}s</b> produce <b>spare time</b> at an increased
|
||||||
increased rate.
|
rate.
|
||||||
</span>
|
</span>
|
||||||
<span class="text-center text-md pt-2"
|
<span class="text-center text-md pt-2"
|
||||||
>Cost for next {{ process.worker }}: 4
|
>Cost for next {{ process.worker }}: {{ process.nextWorkerCost }}
|
||||||
{{ process.buyWorkersWith }}</span
|
{{ process.buyWorkersWith }}</span
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -60,30 +60,36 @@ export const state = () => ({
|
||||||
instrument: 'Star Chart',
|
instrument: 'Star Chart',
|
||||||
worker: 'Shaman',
|
worker: 'Shaman',
|
||||||
deviceCount: new Decimal(0),
|
deviceCount: new Decimal(0),
|
||||||
workerCount: 1,
|
workerCount: 0,
|
||||||
completion: 0,
|
completion: 0,
|
||||||
workerRate: 8.0, // amount added to "completion" (100=full bar) per worker
|
workerRate: 6.0, // amount added to "completion" (100=full bar) per worker
|
||||||
reward: 10, // currency added when the bar is completed
|
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 },
|
unlockThreshold: { tech: null, currency: 0 },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
instrument: 'Stone Calendar',
|
instrument: 'Stone Calendar',
|
||||||
worker: 'Stonecarver',
|
worker: 'Stonecarver',
|
||||||
deviceCount: new Decimal(0),
|
deviceCount: new Decimal(0),
|
||||||
workerCount: 1,
|
workerCount: 0,
|
||||||
completion: 0,
|
completion: 0,
|
||||||
workerRate: 4.0,
|
workerRate: 4.0,
|
||||||
reward: 35,
|
reward: 35,
|
||||||
|
nextWorkerCost: 60,
|
||||||
|
nextWorkerFactor: 1.6,
|
||||||
unlockThreshold: { tech: null, currency: 10000 },
|
unlockThreshold: { tech: null, currency: 10000 },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
instrument: 'Astrolabes',
|
instrument: 'Astrolabes',
|
||||||
worker: 'Mathematician',
|
worker: 'Mathematician',
|
||||||
deviceCount: new Decimal(0),
|
deviceCount: new Decimal(0),
|
||||||
workerCount: 1,
|
workerCount: 0,
|
||||||
completion: 0,
|
completion: 0,
|
||||||
workerRate: 1.5,
|
workerRate: 1.5,
|
||||||
reward: 80,
|
reward: 80,
|
||||||
|
nextWorkerCost: 90,
|
||||||
|
nextWorkerFactor: 1.8,
|
||||||
unlockThreshold: { tech: 0, currency: new Decimal(10e5) },
|
unlockThreshold: { tech: 0, currency: new Decimal(10e5) },
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -166,4 +172,15 @@ export const mutations = {
|
||||||
completeMission: (state, missionIndex) => {
|
completeMission: (state, missionIndex) => {
|
||||||
state.missions[missionIndex].complete = true
|
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)
|
||||||
|
)
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue