Переглянути джерело

Added military/micros/macros

tags/v0.7.0
Fen Dweller 7 роки тому
джерело
коміт
fe8ace6734
3 змінених файлів з 144 додано та 49 видалено
  1. +27
    -45
      game.js
  2. +117
    -3
      recursive-macro.js
  3. +0
    -1
      stroll.html

+ 27
- 45
game.js Переглянути файл

@@ -952,7 +952,7 @@ function get_living_prey(sum) {
let total = 0;
for (let key in sum) {
if (sum.hasOwnProperty(key)) {
if (key == "Person" || key == "Cow")
if (key == "Micro" || key == "Macro" || key == "Person" || key == "Cow")
total += sum[key];
}
}
@@ -1123,50 +1123,32 @@ function getPrey(region, area, sameSize = false)
};
}
else {
switch(region)
{
case "rural": weights = {
"Person": 0.005,
"House": 0.001,
"Barn": 0.001,
"Cow": 0.02,
}; break;
case "suburb": weights = {
"Person": 0.03,
"House": 0.15,
"Car": 0.05,
"Bus": 0.02,
"Train": 0.02,
"Town": 0.00001,
"City": 0.00005,
"Continent": 0.0005,
"Planet": 0.0001
}; break;
case "city": weights = {
"Person": 0.05,
"House": 0.1,
"Car": 0.07,
"Bus": 0.02,
"Parking Garage": 0.003,
"Small Skyscraper": 0.05,
"Town": 0.00001,
"City": 0.00005,
"Continent": 0.0005,
"Planet": 0.0001
}; break;
case "downtown": weights = {
"Person": 0.1,
"Car": 0.1,
"Bus": 0.05,
"Tram": 0.01,
"Parking Garage": 0.005,
"Small Skyscraper": 0.4,
"Large Skyscraper": 0.1,
"Town": 0.00001,
"City": 0.00005,
"Continent": 0.0005,
"Planet": 0.0001
}; break;
weights = {
"Person": 0.05,
"House": 0.1,
"Car": 0.07,
"Bus": 0.02,
"Parking Garage": 0.003,
"Small Skyscraper": 0.05,
"Town": 0.00001,
"City": 0.00005,
"Continent": 0.0005,
"Planet": 0.0001
};

if (macro.victimsMilitary) {
weights["Soldier"] = 0.01;
weights["Tank"] = 0.0005;
weights["Artillery"] = 0.0001;
weights["Helicopter"] = 0.00005;
}

if (macro.victimsMicros) {
weights["Micro"] = 1;
}

if (macro.victimsMacros) {
weights["Macro"] = 0.0001;
}
}
var prey = fill_area(area,weights);


+ 117
- 3
recursive-macro.js Переглянути файл

@@ -22,7 +22,13 @@ var things =
"Planet": Planet,
"Star": Star,
"Solar System": SolarSystem,
"Galaxy": Galaxy
"Galaxy": Galaxy,
"Soldier": Soldier,
"Tank": Tank,
"Artillery": Artillery,
"Helicopter": Helicopter,
"Micro": Micro,
"Macro": Macro,
};

var areas =
@@ -47,6 +53,12 @@ var areas =
"Star": 3e18,
"Solar System": 3e21,
"Galaxy": 2e42,
"Soldier": 1,
"Tank": 10,
"Artillery": 12,
"Helicopter": 8,
"Micro": 0.05,
"Macro": 100,
};

var masses =
@@ -70,7 +82,13 @@ var masses =
"Planet": 5.972e24,
"Star": 1e40,
"Solar System": 1,
"Galaxy": 1
"Galaxy": 1,
"Soldier": 80,
"Tank": 5000,
"Artillery": 7000,
"Helicopter": 1500,
"Micro": 0.01,
"Macro": 80000,
};

var clusters =
@@ -94,7 +112,13 @@ var clusters =
"Planet": 1,
"Star": 1,
"Solar System": 1,
"Galaxy": 1
"Galaxy": 1,
"Soldier": 0,
"Tank": 0,
"Artillery": 0,
"Helicopter": 0,
"Micro": 10,
"Macro": 0,
};

// general logic: each step fills in a fraction of the remaining space
@@ -971,3 +995,93 @@ function Galaxy(count = 1) {
}
};
}

function Soldier(count = 1) {
this.name = "Soldier";

copy_defaults(this,new DefaultEntity());
this.count = count;
this.contents = {};

this.describe = function(verbose = true) {
return (this.count == 1 ? "a soldier" : this.count + " soldiers");
};
}

function Tank(count = 1) {
this.name = "Tank";

copy_defaults(this,new DefaultEntity());
this.count = count;
this.contents = {};

this.addContent("Soldier",3,5,count);

this.describe = function(verbose = true) {
if (verbose) {
return (this.count == 1 ? "a tank" : this.count + " tanks") + " with " + describe_all(this.contents, verbose) + " trapped inside.";
} else {
return (this.count == 1 ? "a tank" : this.count + " tanks");
}
};
}

function Artillery(count = 1) {
this.name = "Artillery";

copy_defaults(this,new DefaultEntity());
this.count = count;
this.contents = {};

this.addContent("Soldier",4,6,count);

this.describe = function(verbose = true) {
if (verbose) {
return (this.count == 1 ? "an artillery unit" : this.count + " artillery units") + " with " + describe_all(this.contents, verbose) + " trapped inside.";
} else {
return (this.count == 1 ? "an artillery unit" : this.count + " artillery units");
}
};
}

function Helicopter(count = 1) {
this.name = "Helicopter";

copy_defaults(this,new DefaultEntity());
this.count = count;
this.contents = {};

this.addContent("Soldier",4,16,count);

this.describe = function(verbose = true) {
if (verbose) {
return (this.count == 1 ? "a helicopter" : this.count + " helicopters") + " with " + describe_all(this.contents, verbose) + " riding inside.";
} else {
return (this.count == 1 ? "a helicopter" : this.count + " helicopters");
}
};
}

function Micro(count = 1) {
this.name = "Micro";

copy_defaults(this,new DefaultEntity());
this.count = count;
this.contents = {};

this.describe = function(verbose = true) {
return (this.count == 1 ? "a micro" : this.count + " micros");
};
}

function Macro(count = 1) {
this.name = "Macro";

copy_defaults(this,new DefaultEntity());
this.count = count;
this.contents = {};

this.describe = function(verbose = true) {
return (this.count == 1 ? "a smaller macro" : this.count + " smaller macros");
};
}

+ 0
- 1
stroll.html Переглянути файл

@@ -63,7 +63,6 @@
<button class="stat-button" id="button-look">Look Around</button>
<button class="stat-button" id="button-arousal">Arousal On</button>
<button class="stat-button" id="button-stroll">Status: Standing</button>
<button class="stat-button" id="button-location">Location: Suburb</button>
<button class="stat-button" id="button-numbers">Numbers: Full</button>
<button class="stat-button" id="button-units">Units: Metric</button>
<button class="stat-button" id="button-verbose">Verbose Text</button>


Завантаження…
Відмінити
Зберегти