From 728e57547a476666fca7c76cb2f6ec0fe1b7cc70 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Wed, 16 May 2018 10:52:23 +0200 Subject: [PATCH] Randomized version of Land of Storms, for other hyperbolic geometries --- landgen.cpp | 31 ++++++++++++++++++++++++++++++- landlock.cpp | 6 +++--- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/landgen.cpp b/landgen.cpp index e48ca5bb..8f2ed7a9 100644 --- a/landgen.cpp +++ b/landgen.cpp @@ -1141,7 +1141,8 @@ void giantLandSwitch(cell *c, int d, cell *from) { } break; - case laStorms: + case laStorms: { + bool randstorm = hyperbolic_not37 || gp::on || quotient == 2; if(d == 9) { if(torus) { @@ -1194,6 +1195,7 @@ void giantLandSwitch(cell *c, int d, cell *from) { } } } + else if(randstorm) ; else if(nonbitrunc) { int i = zebra40(c); if((i == 5 || i == 8) && hrand(100) < 20) c->wall = hrand(2) ? waCharged : waGrounded; @@ -1219,6 +1221,32 @@ void giantLandSwitch(cell *c, int d, cell *from) { if(c->mov[i] && c->mov[i]->land != laStorms && c->mov[i]->land != laNone) c->wall = waNone; } + if(d == 8 && randstorm) { + c->landparam = hrand(1000000); + } + if(d == 7 && randstorm) { + forCellEx(c2, c) if(c2->landparam < c->landparam) setdist(c2, 7, c); + bool bad = false; + forCellEx(c2, c) if(c2->land != laStorms) bad = true; + if(!bad) { + int wallsnow = 0; + int slp = 0; + forCellEx(c2, c) { + if(c2->wall) wallsnow++; + if(c2->landparam == 1) slp++; + } + if(wallsnow == 0) { + if(hrand(100) < 10) + c->wall = pick(waCharged, waGrounded, waSandstone, waSandstone); + else c->landparam = 1; + } + else if(wallsnow == 1 && slp == 0) { + c->wall = waSandstone; + } + else if(slp == 1 && wallsnow == 0) + c->landparam = 1; + } + } ONEMPTY { if(hrand(7500) < 25 + (items[itFulgurite] + yendor::hardness())) c->monst = (hrand(5) ? moMetalBeast : moMetalBeast2), @@ -1228,6 +1256,7 @@ void giantLandSwitch(cell *c, int d, cell *from) { } } break; + } case laGraveyard: if(d == 9) { diff --git a/landlock.cpp b/landlock.cpp index 63e28476..716df452 100644 --- a/landlock.cpp +++ b/landlock.cpp @@ -1100,7 +1100,7 @@ land_validity_t& land_validity(eLand l) { // does not agree with the pattern if(l == laStorms && quotient == 2) - return pattern_incompatibility; + return pattern_not_implemented_random; // pattern not implemented if(l == laStorms && S7 == 8) @@ -1117,7 +1117,7 @@ land_validity_t& land_validity(eLand l) { if(among(l, laMirror, laMirrorOld) && gp::on) return dont_work; - if(l == laWhirlwind && hyperbolic_non37) + if(l == laWhirlwind && hyperbolic_not37) return pattern_incompatibility; // available only in non-standard geometries @@ -1291,7 +1291,7 @@ land_validity_t& land_validity(eLand l) { return not_enough_space; if(l == laStorms && hyperbolic_not37) - return pattern_incompatibility; + return pattern_not_implemented_random; if(l == laTrollheim && !stdeuc && !bounded) return some1;