Sfoglia il codice sorgente

More work on victim options. Human-only is back

tags/v0.7.0
Fen Dweller 7 anni fa
parent
commit
f541f916b3
5 ha cambiato i file con 69 aggiunte e 27 eliminazioni
  1. +4
    -1
      .jshintrc
  2. +22
    -9
      game.js
  3. +0
    -4
      recursive-desc.js
  4. +37
    -11
      recursive-macro.js
  5. +6
    -2
      stroll.html

+ 4
- 1
.jshintrc Vedi File

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

+ 22
- 9
game.js Vedi File

@@ -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();



+ 0
- 4
recursive-desc.js Vedi File

@@ -587,10 +587,6 @@ function defaultDumpSock(container, macro, verbose) {
}
}





// EATING

rules["eat"].push({


+ 37
- 11
recursive-macro.js Vedi File

@@ -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<type.length; i++) {
if (type[i][0] == thing) {
type.splice(i,1);
--i;
}
}
}
}
}

// adds thing to parent
function contents_insert(parent,thing,min,max,label) {
let owner = contents[parent];
if (label == undefined)
owner.push([thing,min,max]);
else
owner.push([thing,min,max,label]);
}

function initContents(name,count) {
let result = {};
let type = contents[name];

for (let i=0; i<type.length; i++) {
let amount = distribution(type[i][1],type[i][2],count);
if (amount > 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");


+ 6
- 2
stroll.html Vedi File

@@ -83,7 +83,7 @@
</div>
<div id="log-area">
<div id="log">
<div>Welcome to Stroll 0.5.18</div>
<div>Welcome to Stroll 0.5.19</div>
<div><b>This game features 18+ content</b></div>
<div><a href="https://chemicalcrux.org/stroll">Changelog</a></div>
<div><a href="https://t.me/joinchat/BSXHzUZmSqc-CXB1khkuYw">Telegram discussion group</a></div>
@@ -168,7 +168,7 @@
</div>
</div>
<div class="character-build">
<p>Welcome to Stroll 0.5.18</p>
<p>Welcome to Stroll 0.5.19</p>
<p><b>This game features 18+ content</b></p>
<p><a href="https://chemicalcrux.org/stroll">Changelog</a></p>
<p><a href="https://t.me/joinchat/BSXHzUZmSqc-CXB1khkuYw">Telegram discussion group</a></p>
@@ -293,6 +293,10 @@
<div class="custom-category">
<div class="custom-header-static">Victims</div>
<div>
<li>
<label for="victimsHuman">Human prey (instead of anthros)</label>
<input type="checkbox" name="victimsHuman" id="victimsHuman" />
</li>
<li>
<label for="military">Military</label>
<input type="checkbox" name="victimsMilitary" id="victimsMilitary" />


Loading…
Annulla
Salva