Skip to content

Commit

Permalink
Support disabling poison traps and condenser towers
Browse files Browse the repository at this point in the history
  • Loading branch information
DataBeaver committed Apr 16, 2019
1 parent 53b541f commit 9bc00d4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion spirelayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,11 @@ void Layout::mutate(MutateMode mode, unsigned count, Random &random, unsigned cy
base = (random()%locality)*5;
}

unsigned traps_count = (upgrades.lightning>0 ? 7 : 5);
unsigned traps_count = 7;
if(!upgrades.lightning)
traps_count -= 2;
if(!upgrades.poison)
traps_count -= 2;
for(unsigned i=0; i<count; ++i)
{
unsigned op = 0; // REPLACE_ONLY
Expand All @@ -698,6 +702,8 @@ void Layout::mutate(MutateMode mode, unsigned count, Random &random, unsigned cy
op = random()%8;

unsigned t = 1+random()%traps_count;
if(!upgrades.poison && t>=3)
t += (t-1)/2;
if(!upgrades.lightning && t>=4)
++t;
char trap = traps[t];
Expand Down

0 comments on commit 9bc00d4

Please sign in to comment.