Browse Source

Add some news items based on belongings

This also introduces fields for your name and species, but they cannot be
configured just yet
tags/v0.0.7
Fen Dweller 5 years ago
parent
commit
e565bbb980
No known key found for this signature in database GPG Key ID: E80B35A6F11C3656
3 changed files with 58 additions and 0 deletions
  1. +43
    -0
      constants.js
  2. +5
    -0
      gorge.js
  3. +10
    -0
      util.js

+ 43
- 0
constants.js View File

@@ -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",


+ 5
- 0
gorge.js View File

@@ -2,6 +2,11 @@

const belongings = {};

const macroDesc = {
name: "Fen",
species: "crux"
}

const ownedUpgrades = {};
const remainingUpgrades = [];
let showOwnedUpgrades = false;


+ 10
- 0
util.js View File

@@ -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)
}

Loading…
Cancel
Save