From 1a485d0ede26debe77677899036afb4c1594f3e1 Mon Sep 17 00:00:00 2001 From: Svornost <11434-svornost@users.noreply.gitgud.io> Date: Sat, 12 Jun 2021 17:32:29 -0700 Subject: [PATCH] Clamp PC skill increases. --- src/endWeek/economics/persBusiness.js | 6 ++++++ src/js/utilsPC.js | 10 +++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/endWeek/economics/persBusiness.js b/src/endWeek/economics/persBusiness.js index 0665171a46c..7adcd0e5f95 100644 --- a/src/endWeek/economics/persBusiness.js +++ b/src/endWeek/economics/persBusiness.js @@ -568,6 +568,7 @@ App.EndWeek.personalBusiness = function() { } else { if (V.PC.skill.trading >= 100) { V.personalAttention = "sex"; + V.PC.skill.trading = 100; r.push(`You are now a <span class="green">master venture capitalist.</span>`); } else { r.push(`You have made progress towards mastering venture capitalism.`); @@ -603,6 +604,7 @@ App.EndWeek.personalBusiness = function() { } else { if (V.PC.skill.warfare >= 100) { V.personalAttention = "sex"; + V.PC.skill.warfare = 100; r.push(`You are now a <span class="green">master mercenary.</span>`); } else { r.push(`You have made progress towards mastering mercenary work.`); @@ -638,6 +640,7 @@ App.EndWeek.personalBusiness = function() { } else { if (V.PC.skill.slaving >= 100) { V.personalAttention = "sex"; + V.PC.skill.slaving = 100; r.push(`You are now a <span class="green">master slaver.</span>`); } else { r.push(`You have made progress towards mastering slaving.`); @@ -673,6 +676,7 @@ App.EndWeek.personalBusiness = function() { } else { if (V.PC.skill.engineering >= 100) { V.personalAttention = "sex"; + V.PC.skill.engineering = 100; r.push(`You are now a <span class="green">master arcology engineer.</span>`); } else { r.push(`You have made progress towards mastering arcology engineering.`); @@ -708,6 +712,7 @@ App.EndWeek.personalBusiness = function() { } else { if (V.PC.skill.medicine >= 100) { V.personalAttention = "sex"; + V.PC.skill.medicine = 100; r.push(`You are now a <span class="green">master slave surgeon.</span>`); } else { r.push(`You have made progress towards mastering slave surgery.`); @@ -743,6 +748,7 @@ App.EndWeek.personalBusiness = function() { } else { if (V.PC.skill.hacking >= 100) { V.personalAttention = "sex"; + V.PC.skill.hacking = 100; r.push(`You are now a <span class="green">master hacker.</span>`); } else { r.push(`You have made progress towards mastering hacking and data manipulation.`); diff --git a/src/js/utilsPC.js b/src/js/utilsPC.js index c79196d031f..857ed5e7929 100644 --- a/src/js/utilsPC.js +++ b/src/js/utilsPC.js @@ -604,17 +604,17 @@ globalThis.IncreasePCSkills = function(input, increase = 1) { } const player = V.PC; const oldSkill = player.skill[input]; - player.skill[input] += increase; + player.skill[input] = Math.clamp(player.skill[input] + increase, -100, 100); let t = ``; if (oldSkill < 10 && player.skill[input] >= 10) { - t += `<span class="green"> \nYou have gained basic knowledge in ${input}.</span>`; + t += ` <span class="green">You have gained basic knowledge in ${input}.</span>`; } else if (oldSkill < 30 && player.skill[input] >= 30) { - t += `<span class="green"> \nYou have gained some knowledge in ${input}.</span>`; + t += ` <span class="green">You have gained some knowledge in ${input}.</span>`; } else if (oldSkill < 60 && player.skill[input] >= 60) { - t += `<span class="green"> \nYou have become an expert in ${input}.</span>`; + t += ` <span class="green">You have become an expert in ${input}.</span>`; } else if (oldSkill < 100 && player.skill[input] >= 100) { - t += `<span class="green"> \nYou have mastered ${input}.</span>`; + t += ` <span class="green">You have mastered ${input}.</span>`; } return t; }; -- GitLab