Skip to content

Commit

Permalink
feat: add new fungus and milestones
Browse files Browse the repository at this point in the history
  • Loading branch information
Mees committed Nov 2, 2024
1 parent dcf1957 commit ec8ffda
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 2 deletions.
35 changes: 33 additions & 2 deletions src/stores/trainingStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,41 @@ export const useTrainingStore = defineStore({
},
// Mining
miningMilestones: [
{
levelRequired: 25,
effect: {
yield: 1.1,
},
description: 'Increases the yield of all mined resources by 10%',
},
{
levelRequired: 50,
effect: {
maxActiveResources: 2,
},
description: 'Unlocks the ability to mine 2 resources at once',
},
{
levelRequired: 60,
effect: {
yield: 1.5,
},
description: 'Increases the yield of all mined resources by 50%',
},
{
levelRequired: 75,
effect: {
maxActiveResources: 3,
},
description: 'Unlocks the ability to mine 3 resources at once',
},
{
levelRequired: 80,
effect: {
yield: 1.5,
},
description: 'Increases the yield of all mined resources by 50%',
},
{
levelRequired: 150,
effect: {
Expand Down Expand Up @@ -318,6 +339,7 @@ export const useTrainingStore = defineStore({
regenerationRate: 1,
spawnRate: 1,
defense: 1,
xpBoost: 1,
},
eatenFungus: [] as {
name: SeedNames,
Expand All @@ -328,6 +350,9 @@ export const useTrainingStore = defineStore({
combatMilestones: combatMilestones,

modifiers: {
mining: {
yield: 1,
},
army: {
attack: 1,
defense: 1,
Expand Down Expand Up @@ -462,6 +487,7 @@ export const useTrainingStore = defineStore({
regenerationRate: 1,
spawnRate: 1,
defense: 1,
xpBoost: 1,
}
},

Expand Down Expand Up @@ -639,7 +665,7 @@ export const useTrainingStore = defineStore({
if (Math.random() < this.miningDoubleChance) {
lootMultiplier = 2
}
this.resourcesCollected[resource.name] += resource.collectionMultiplier * lootMultiplier
this.resourcesCollected[resource.name] += resource.collectionMultiplier * lootMultiplier * this.modifiers.mining.yield

// Mark the resource as depleted and reset timePerAction
resource.isDepleted = true
Expand Down Expand Up @@ -794,14 +820,19 @@ export const useTrainingStore = defineStore({
if (effect === 'maxActiveResources') {
this.maxActiveResources = milestone.effect[effect]
}

if (effect === 'yield') {
this.modifiers.mining.yield *= milestone.effect[effect]
}

})
},

addXp(skill: Skill, xp: number) {
const training = this.getTrainingState(skill)
if (!training) return

const multipliedXp = xp * this.xpMultiplier
const multipliedXp = xp * this.xpMultiplier * this.farmingModifiers.xpBoost
training.xp += multipliedXp
if (training.xp >= training.xpToNextLevel) this.addLevel(skill)
},
Expand Down
11 changes: 11 additions & 0 deletions src/types/farmingSeeds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export enum SeedNames {
EnergyFungus = 'Energy Fungus',
PheromoneFungus = 'Pheromone Fungus',
DefenseFungus = 'Defense Fungus',
InsightFungus = 'Insight Fungus',
}

export const seeds: Seed[] = [
Expand Down Expand Up @@ -43,4 +44,14 @@ export const seeds: Seed[] = [
effect: {defense: 2},
duration: 60 * 60,
},
{
name: SeedNames.InsightFungus,
levelRequired: 50,
growthTime: 500 * 60,
xpPerAction: 450,
description: 'A unique fungus that enhances mental acuity, doubling experience gain from actions for 1 hour.',
effect: {xpBoost: 2},
duration: 60 * 60,
},

]
7 changes: 7 additions & 0 deletions src/views/Training/TrainingMining.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@
{{ toPercentageFormatted(trainingStore.miningDoubleChance) }}%
</span>
</div>

<div class="flex items-center">
<span class="text-lg font-semibold text-gray-800 mr-2">Yield:</span>
<span class="inline-block px-3 py-1 text-sm font-semibold text-white bg-blue-600 rounded-full">
{{ toPercentageFormatted(trainingStore.modifiers.mining.yield) }}%
</span>
</div>
</div>

<div class="grid sm:grid-cols-2 lg:grid-cols-3 grid-cols-1 gap-6">
Expand Down

0 comments on commit ec8ffda

Please sign in to comment.