Adding sanity checking to Node Empowering effect. Fixes #107

This commit is contained in:
MysteriousAges committed 2015-10-04 14:29:44 -07:00
1 parent eacb9f2609
commit 3fde6fb08c
2 files changed
+3 -2

No files matched your search

@@ -32,7 +32,7 @@ public class AlleleEffectEmpowering extends AlleleEffect {
int xCoord = housing.getXCoord();
int yCoord = housing.getYCoord();
int zCoord = housing.getZCoord();
int range = (int)Math.ceil(genome.getTerritory()[0] * housing.getTerritoryModifier(genome, 1f));
int range = (int)Math.max(Math.ceil(genome.getTerritory()[0] * housing.getTerritoryModifier(genome, 1f)), 1);
List<Chunk> chunks = BlockUtil.getChunksInSearchRange(world, xCoord, zCoord, range);
if (NodeHelper.growNodeInRange(chunks, world, xCoord, yCoord, zCoord, range)) {
@@ -102,7 +102,8 @@ public class NodeHelper {
if (node != null) {
++attemptedNodes;
AspectList aspectsBase = node.getAspectsBase();
if (world.rand.nextInt(aspectsBase.visSize()) < 120) {
int randBase = Math.max(aspectsBase.visSize(), 1);
if (world.rand.nextInt(randBase) < 120) {
Aspect aspectToAdd;
int rollAttempts = 0;
do {