Selaa lähdekoodia

Further rewrote how victims are picked to guarantee something gets picked, but everything else is more random

tags/v0.7.3
Fen Dweller 7 vuotta sitten
vanhempi
commit
4c59e30deb
1 muutettua tiedostoa jossa 16 lisäystä ja 6 poistoa
  1. +16
    -6
      recursive-macro.js

+ 16
- 6
recursive-macro.js Näytä tiedosto

@@ -306,17 +306,27 @@ function fill_area(area, weights, variance=0.15)
// for small amounts, actually do the randomness

// the first few ones get a much better shot
while (loopvar > 0) {
if (loopvar <= clusters[candidate.name] && loopvar == 1 && Math.random() < cluster_chances[candidate.name])
count += 1;

// if we have nothing at all, it's even better!

if (limit > 0 && result.length == 0) {
++count;
++loopvar;
}

while (loopvar < limit) {
if (loopvar <= clusters[candidate.name] && loopvar == 0 && Math.random() < cluster_chances[candidate.name]) {
++count;
}
else if (loopvar <= clusters[candidate.name]) {
if (Math.random() < candidate.weight ? 1 : 0 || Math.random() < 0.75 * cluster_chances[candidate.name]) {
count += 1;
++count;
}
}
else
else {
count += Math.random() < candidate.weight ? 1 : 0;
--loopvar;
}
++loopvar;
}

if (limit < max) {


Loading…
Peruuta
Tallenna