diff --git a/constants.js b/constants.js index c5af33d..21b7c44 100644 --- a/constants.js +++ b/constants.js @@ -1207,9 +1207,26 @@ function createNewsFoodRate() { } function createNewsBuildingCount() { + Object.entries(newsBuildingCountText).forEach(([key, sets]) => { + for (let [i, set] of sets.entries()) { + const conditions = []; + conditions.push(state => state.belongings[key].count >= newsBuildingCountCutoffs[i]); + + news.push({ + condition: state => conditions.every(cond => cond(state)), + lines: set + }) + } + }); } +const newsBuildingCountCutoffs = [ + 1, + 25, + 50, + 100 +] const newsFoodRateText = [ [ state => "Your neighbors are complaining about the noise", @@ -1224,6 +1241,32 @@ const newsFoodRateText = [ ] ] +const newsBuildingCountText = { + micro: [ + [ + state => "Micro-only diet: fad or fact? Our experts weigh in." + ], + [ + state => "\"I don't have a problem,\" says macro eating " + showBuilding("micro") + " per second", + state => "\"Isn't it weird how macros eat so many micros?\" asked confused citizen. \"Like, doesn't that mean they're double micros?\"" + ], + [ + state => "Local macro celebrated for cleaning up the \"unending tide\" of micros" + ], + [ + state => "That's a lot of micros." + ] + ], + anthro: [ + [ + state => "\"Nobody liked those guys anyway\" - few people concerned about " + macroDesc.name + "'s newly-acquired taste for people" + ], + [ + state => "#FeedThe" + capitalize(macroDesc.species) + " is trending on Twitter." + ] + ], +} + const powerups = { "instant-food": { name: "Free Food", diff --git a/gorge.js b/gorge.js index 5819230..17448a6 100644 --- a/gorge.js +++ b/gorge.js @@ -2,6 +2,11 @@ const belongings = {}; +const macroDesc = { + name: "Fen", + species: "crux" +} + const ownedUpgrades = {}; const remainingUpgrades = []; let showOwnedUpgrades = false; diff --git a/util.js b/util.js index be32c59..c7f426f 100644 --- a/util.js +++ b/util.js @@ -39,3 +39,13 @@ function deepFreeze(object) { return Object.freeze(object); } + +function showBuilding(key) { + let count = belongings[key].count; + let name = count == 1 ? buildings[key].name : buildings[key].plural; + return count + " " + name.toLowerCase() +} + +function capitalize(string) { + return string[0].toUpperCase() + string.slice(1) +}