浏览代码

Allow for the properties of everything in a container to be modified. Shrinking now reduces mass

master
Fen Dweller 5 年前
父节点
当前提交
8481bcaa29
共有 2 个文件被更改,包括 14 次插入1 次删除
  1. +1
    -1
      game.js
  2. +13
    -0
      recursive-macro.js

+ 1
- 1
game.js 查看文件

@@ -4358,7 +4358,7 @@ function magic_shrink()
prey = getPrey(biome, macro.height * macro.height * 100, true); prey = getPrey(biome, macro.height * macro.height * 100, true);


macro.shrunkPrey = prey; macro.shrunkPrey = prey;
macro.shrunkPrey.mass /= 1000000;
macro.shrunkPrey.mod_property("mass", x => x/1e2)


let line = describe("magic-shrink", prey, macro, false, flat); let line = describe("magic-shrink", prey, macro, false, flat);
let linesummary = summarize(prey.sum(), false); let linesummary = summarize(prey.sum(), false);


+ 13
- 0
recursive-macro.js 查看文件

@@ -780,6 +780,18 @@ function defaultSumProperty(thing) {
}; };
} }


function defaultModProperty(thing) {
return function(prop, func) {
thing[prop] = func(thing[prop]);

for (var key in thing.contents) {
if (thing.contents.hasOwnProperty(key)) {
thing.contents[key].mod_property(prop, func);
}
}
};
}

function defaultAddContent(thing) { function defaultAddContent(thing) {
return function(name, min, max, count) { return function(name, min, max, count) {
if (min == max) { if (min == max) {
@@ -797,6 +809,7 @@ function DefaultEntity() {
this.area = defaultArea; this.area = defaultArea;
this.mass = defaultMass; this.mass = defaultMass;
this.sum_property = defaultSumProperty; this.sum_property = defaultSumProperty;
this.mod_property = defaultModProperty;
this.merge = defaultMerge; this.merge = defaultMerge;
this.multiply = defaultMultiply; this.multiply = defaultMultiply;
this.describeSimple = defaultDescribeSimple; this.describeSimple = defaultDescribeSimple;


正在加载...
取消
保存