From f541f916b390e572cf171299bc7c8e928710d234 Mon Sep 17 00:00:00 2001 From: Fen Dweller Date: Sun, 4 Mar 2018 11:40:33 -0500 Subject: [PATCH] More work on victim options. Human-only is back --- .jshintrc | 5 ++++- game.js | 31 +++++++++++++++++++++--------- recursive-desc.js | 4 ---- recursive-macro.js | 48 +++++++++++++++++++++++++++++++++++----------- stroll.html | 8 ++++++-- 5 files changed, 69 insertions(+), 27 deletions(-) diff --git a/.jshintrc b/.jshintrc index d6f081f..bcdaddb 100644 --- a/.jshintrc +++ b/.jshintrc @@ -16,6 +16,9 @@ "number": true, "describe": true, "humanMode": true, - "describe_all": true + "describe_all": true, + "contents_insert": true, + "contents_remove": true, + "contents_replace": true } } diff --git a/game.js b/game.js index 1f5122c..b914783 100644 --- a/game.js +++ b/game.js @@ -1328,14 +1328,14 @@ function getOnePrey(biome, area, sameSize = true) } if (sameSize) - return new Container([new Person(1)]); + return new Container([new things["Person"](1)]); else return new Container(); } function getPrey(region, area, sameSize = false) { - let weights = {"Person": 1}; + let weights = {}; if (area > areas["Planet"]) { weights = { @@ -1355,7 +1355,6 @@ function getPrey(region, area, sameSize = false) } else { weights = { - "Person": 0.017, "House": 0.1, "Car": 0.07, "Bus": 0.02, @@ -1367,6 +1366,14 @@ function getPrey(region, area, sameSize = false) "Planet": 0.0001 }; + if (!macro.victimsNoPeople) { + if (macro.victimsHuman) { + weights["Human"] = 0.017; + } else { + weights["Person"] = 0.017; + } + } + if (macro.victimsMilitary) { weights["Soldier"] = 0.01; weights["Tank"] = 0.0005; @@ -3359,14 +3366,20 @@ function startGame(e) { document.getElementById("edge").style.display = "none"; } + if (macro.victimsNoPeople) { + contents_remove("Person"); + } - //let species = document.getElementById("option-species").value; - //let re = /^[a-zA-Z\- ]+$/; + if (macro.victimsHuman) { + // oh god this is bad bad bad bad bad bad BAD BAD BAD BAD BAD + things["Person"] = Human; + } - // tricksy tricksy players - //if (re.test(species)) { - // macro.species = species; - //} + if (macro.victimsMacro) { + contents_insert("Town","Macro",2,5); + contents_insert("City","Macro",5,20); + contents_insert("Continent","Macro",100,300); + } macro.init(); diff --git a/recursive-desc.js b/recursive-desc.js index 22634bd..03994f3 100644 --- a/recursive-desc.js +++ b/recursive-desc.js @@ -587,10 +587,6 @@ function defaultDumpSock(container, macro, verbose) { } } - - - - // EATING rules["eat"].push({ diff --git a/recursive-macro.js b/recursive-macro.js index c7dac00..203f267 100644 --- a/recursive-macro.js +++ b/recursive-macro.js @@ -134,7 +134,7 @@ var contents = "Car": [["Person",1,4]], "Bus": [["Person",2,30]], "Tram": [["Person",10,50]], - "Train": [["Person",1,4],["Train Car",2,10]], + "Train": [["Person",1,4,"engine"],["Train Car",2,10]], "Train Car": [["Person",10,40]], "House": [["Person",0,8],["Empty Car",0,2]], "Barn": [["Person",0,2],["Cow",30,70]], @@ -170,14 +170,44 @@ function contents_substitute(from,to) { } } +// remove all instances of thing +function contents_remove(thing) { + for (let key in contents) { + if (contents.hasOwnProperty(key)) { + let type = contents[key]; + for (let i=0; i 0) - result[type[i][0]] = new things[type[i][0]](amount); + if (amount > 0) { + // if a custom label is supplied, use it! + if (type[i].length == 4) + result[type[i][3]] = new things[type[i][0]](amount); + else + result[type[i][0]] = new things[type[i][0]](amount); + + } } return result; @@ -500,7 +530,7 @@ function Person(count = 1) { } function Human(count = 1) { - this.name = "Human"; + this.name = "Person"; copy_defaults(this,new DefaultEntity()); @@ -510,7 +540,7 @@ function Human(count = 1) { this.describeOne = function (verbose=true) { var body = random_desc(["skinny","fat","tall","short","stocky","spindly"], (verbose ? 0.6 : 0)); - var sex = random_desc(["man", "woman"], (verbose ? 1 : 0)); + var sex = random_desc(["man", "woman"], 1); return "a " + merge_desc([body,sex]); }; @@ -715,10 +745,6 @@ function Train(count = 1) { this.count = count; this.contents = initContents(this.name,this.count); - - - - this.describeOne = function(verbose=true) { var adjective = random_desc(["rusty","brand-new"], (verbose ? 0.3 : 0)); var color = random_desc(["black","tan","gray"], (verbose ? 1 : 0)); @@ -733,9 +759,9 @@ function Train(count = 1) { for (var i = 0; i < this.count; i++) { list.push(this.describeOne(verbose)); } - return merge_things(list) + " with " + this.contents["Person"].describe(false) + " in the engine and " + this.contents["Train Car"].describe() + " attached"; + return merge_things(list) + " with " + this.contents["engine"].describe(false) + " in the engine and " + this.contents["Train Car"].describe() + " attached"; } else { - return this.count + " trains with " + this.contents["Person"].describe(false) + " in the engine and " + this.contents["Train Car"].describe() + " attached"; + return this.count + " trains with " + this.contents["engine"].describe(false) + " in the engine and " + this.contents["Train Car"].describe() + " attached"; } } else { return (this.count > 1 ? this.count + " trains" : "a train"); diff --git a/stroll.html b/stroll.html index 50f88b8..c096365 100644 --- a/stroll.html +++ b/stroll.html @@ -83,7 +83,7 @@
-
Welcome to Stroll 0.5.18
+
Welcome to Stroll 0.5.19
This game features 18+ content
Changelog
Telegram discussion group
@@ -168,7 +168,7 @@
-

Welcome to Stroll 0.5.18

+

Welcome to Stroll 0.5.19

This game features 18+ content

Changelog

Telegram discussion group

@@ -293,6 +293,10 @@
Victims
+
  • + + +