improved the 'full game' in weird CR4

This commit is contained in:
Zeno Rogue 2018-04-11 23:37:28 +02:00
parent 77258cdb02
commit 854c1dd3d2
6 changed files with 53 additions and 39 deletions

View File

@ -726,7 +726,7 @@ void buildCrossroads2(cell *c) {
}
}
bool buildBarrierNowall(cell *c, eLand l2, bool force) {
bool buildBarrierNowall(cell *c, eLand l2, int forced_dir) {
if(c->land == laNone) {
printf("barrier nowall! [%p]\n", c);
@ -742,19 +742,18 @@ bool buildBarrierNowall(cell *c, eLand l2, bool force) {
for(int j=0; j<c->type; j++) swap(ds[j], ds[hrand(j+1)]);
for(int i=0; i<c->type; i++) {
int d = (S3>3 && nonbitrunc) ? (2+(i&1)) : ds[i];
int d = forced_dir != NODIR ? forced_dir : (S3>3 && nonbitrunc) ? (2+(i&1)) : ds[i];
/* if(warpv && gp::on) {
d = hrand(c->type); */
if(warpv && c->mov[d] && c->mov[d]->mpdist < c->mpdist) continue;
/* }
else
d = (S3>3 && !warpv) ? (2+(i&1)) : dtab[i]; */
if(force) d=1;
cellwalker cw(c, d);
eLand ws = warpv ? laWarpCoast : laNone;
if(force || (checkBarriersNowall(cw, 0, -1, ws, ws) && checkBarriersNowall(cw, 0, 1, ws, ws))) {
if(forced_dir != NODIR || (checkBarriersNowall(cw, 0, -1, ws, ws) && checkBarriersNowall(cw, 0, 1, ws, ws))) {
eLand l1 = c->land;
checkBarriersNowall(cw, 0, -1, l1, l2);
checkBarriersNowall(cw, 0, 1, l1, l2);

View File

@ -312,7 +312,8 @@ cell *buildAnotherEquidistant(cell *c, int radius) {
cellwalker cw(c, (gdir+3) % c->type);
vector<cell*> coastpath;
while(size(coastpath) < radius || cw.c->type != 7) {
while(size(coastpath) < radius || (cw.c->type != 7 && !weirdhyperbolic)) {
// this leads to bugs for some reason!
if(cw.c->land == laCrossroads2) {
#ifdef AUTOPLAY
@ -321,6 +322,7 @@ cell *buildAnotherEquidistant(cell *c, int radius) {
return NULL;
}
if(cw.c->bardir != NODIR) return NULL;
if(cw.c->landparam && cw.c->landparam < radius) return NULL;
/* forCellEx(c2, cw.c) if(c2->bardir != NODIR) {
generatingEquidistant = false;
@ -350,7 +352,6 @@ cell *buildAnotherEquidistant(cell *c, int radius) {
setdist(coastpath[i], BARLEV-1, coastpath[i-1]);
if(i < size(coastpath) - 5) {
coastpath[i]->bardir = NOBARRIERS;
// coastpath[i]->item = itSapphire;
// forCellEx(c2, coastpath[i]) c2->bardir = NOBARRIERS;
}
}
@ -371,12 +372,15 @@ cell *buildAnotherEquidistant(cell *c, int radius) {
if(c2->land != c->land) return NULL;
// else if(ctof(c) && hrand(10000) < 20 && !isCrossroads(c->land) && gold() >= 200)
if(pseudohept(c2) && gold() >= R200 && hrand(10) < 2 && buildBarrierNowall(c2, laCrossroads4, true)) {
if(weirdhyperbolic && specialland == laCrossroads4 && buildBarrierNowall(c2, getNewLand(laOcean))) {
nowall = true;
}
else if(pseudohept(c2) && gold() >= R200 && hrand(10) < 2 && buildBarrierNowall(c2, laCrossroads4, 1)) {
nowall = true;
// raiseBuggyGeneration(c2, "check");
// return;
}
else buildBarrier(c2, bd);
else if(!weirdhyperbolic) buildBarrier(c2, bd);
//printf("building barrier II\n");
if(hasbardir(c2)) extendBarrier(c2);
@ -417,7 +421,7 @@ int coastval(cell *c, eLand base) {
}
else {
if(c->land == laOceanWall || c->land == laCaribbean || c->land == laWhirlpool ||
c->land == laLivefjord || c->land == laWarpSea || c->land == laKraken)
c->land == laLivefjord || c->land == laWarpSea || c->land == laKraken || c->land == laDocks)
return 30;
if(c->land != laOcean && !isGravityLand(c->land) && c->land != laHaunted) {
return 0;
@ -595,10 +599,17 @@ void buildEquidistant(cell *c) {
}
}
if(c->landparam > 30 && b == laOcean && !generatingEquidistant && hrand(10) < 5 && !weirdhyperbolic)
bool chance = true;
if(weirdhyperbolic) {
chance = false;
if(specialland == laCrossroads4)
chance = hrand(100) < 10;
}
if(c->landparam > 30 && b == laOcean && !generatingEquidistant && hrand(10) < 5 && chance)
buildAnotherEquidistant(c);
if(c->landparam > HAUNTED_RADIUS+5 && b == laGraveyard && !generatingEquidistant && hrand(100) < (nonbitrunc?25:5) && items[itBone] >= 10 && !weirdhyperbolic)
if(c->landparam > HAUNTED_RADIUS+5 && b == laGraveyard && !generatingEquidistant && hrand(100) < (nonbitrunc?25:5) && items[itBone] >= 10 && chance)
buildAnotherEquidistant(c);
}
@ -960,37 +971,39 @@ bool horo_ok() {
// (they work in ALL hyperbolic geometries currently!)
return hyperbolic;
}
bool gp_wall_test() {
if(gp::on) return hrand(gp::dist_3()) == 0;
return true;
}
void buildBigStuff(cell *c, cell *from) {
if(sphere || quotient) return;
bool deepOcean = false;
if(!weirdhyperbolic) {
if(c->land == laOcean) {
if(!from) deepOcean = true;
else for(int i=0; i<from->type; i++) {
cell *c2 = from->mov[i];
if(c2 && c2->land == laOcean && c2->landparam > 30) {
deepOcean = true;
}
if(c2) forCellEx(c3, c2) if(c3 && c3->land == laOcean && c3->landparam > 30)
deepOcean = true;
if(c->land == laOcean) {
if(!from) deepOcean = true;
else for(int i=0; i<from->type; i++) {
cell *c2 = from->mov[i];
if(c2 && c2->land == laOcean && c2->landparam > 30) {
deepOcean = true;
}
if(c2) forCellEx(c3, c2) if(c3 && c3->land == laOcean && c3->landparam > 30)
deepOcean = true;
}
if(c->land == laGraveyard) {
if(!from) deepOcean = true;
else for(int i=0; i<from->type; i++) {
cell *c2 = from->mov[i];
if(c2 && c2->landparam > HAUNTED_RADIUS+5)
deepOcean = true;
}
}
if(c->land == laGraveyard) {
if(!from) deepOcean = true;
else for(int i=0; i<from->type; i++) {
cell *c2 = from->mov[i];
if(c2 && c2->landparam > HAUNTED_RADIUS+5)
deepOcean = true;
}
}
if(generatingEquidistant) deepOcean = false;
if(weirdhyperbolic && c->land == laOcean) deepOcean = c->landparam >= 30;
// if(weirdhyperbolic && c->land == laOcean) deepOcean = c->landparam >= 30;
// buildgreatwalls
@ -1026,7 +1039,7 @@ void buildBigStuff(cell *c, cell *from) {
buildBarrierNowall(c, laCrossroads4) ;
}
else if(weirdhyperbolic && specialland == laCrossroads4 && /*pseudohept(c) &&*/ hrand(I10000/4) < wallchance(c, deepOcean)) {
else if(weirdhyperbolic && specialland == laCrossroads4 && /*pseudohept(c) &&*/ hrand(I10000 /4) < wallchance(c, deepOcean) && gp_wall_test()) {
buildBarrierNowall(c, getNewLand(c->land));
}

View File

@ -2267,7 +2267,7 @@ const eLand NOWALLSEP_USED = laWhirlpool;
bool hasbardir(cell *c);
bool buildBarrierNowall(cell *c, eLand l2, bool force = false);
bool buildBarrierNowall(cell *c, eLand l2, int forced_dir = NODIR);
bool checkBarriersBack(cellwalker bb, int q=5, bool cross = false);
bool checkBarriersFront(cellwalker bb, int q=5, bool cross = false);

View File

@ -1568,7 +1568,7 @@ void giantLandSwitch(cell *c, int d, cell *from) {
if(hrand(1000) < 150 && celldist(c) >= 3 && !pseudohept(c))
c->wall = waSmallTree;
int q = 0;
if(!nonbitrunc && !chaosmode) for(int i=0; i<c->type; i++)
if(!nonbitrunc && !chaosmode && !weirdhyperbolic) for(int i=0; i<c->type; i++)
if(c->mov[i] && !isWarped(c->mov[i]->land) && c->mov[i]->land != laCrossroads4)
q++;
if(q == 1) c->wall = waWarpGate;
@ -1746,8 +1746,10 @@ void giantLandSwitch(cell *c, int d, cell *from) {
if(c->landparam % TEMPLE_EACH == 0 && c->landparam <= 24) {
int q = 0;
forCellEx(c2, c)
if(c2->landparam % TEMPLE_EACH == 0 && !ishept(c2)) q++;
if(c2->landparam % TEMPLE_EACH == 0 && !pseudohept(c2)) q++;
placecolumn = q == 2;
if(placecolumn && weirdhyperbolic && nonbitrunc && hrand(100) >= 50)
placecolumn = false;
if(placecolumn) {
placecolumn = false;
cell *c2 = c;

View File

@ -339,7 +339,7 @@ eLand landof(eItem it) {
bool isSealand(eLand l) {
return l == laOcean || l == laCaribbean || l == laWhirlpool || l == laLivefjord ||
l == laOceanWall || l == laWarpSea || l == laKraken;
l == laOceanWall || l == laWarpSea || l == laKraken || l == laDocks;
}
bool isCoastal(eLand l) {
@ -717,7 +717,7 @@ hookset<eLand(eLand)> *hooks_nextland;
eLand getNewLand(eLand old) {
if(old == laMirror && !chaosmode && hrand(10) >= (tactic::on ? 0 : markOrb(itOrbLuck) ? 5 : 2)) return laMirrored;
if(old == laTerracotta && !chaosmode && hrand(5) >= (tactic::on ? 0 : markOrb(itOrbLuck) ? 2 : 1)) return laTerracotta;
if(old == laTerracotta && !chaosmode && hrand(5) >= (tactic::on ? 0 : markOrb(itOrbLuck) ? 2 : 1) && !weirdhyperbolic) return laTerracotta;
eLand l = callhandlers(laNone, hooks_nextland, old);
if(l) return l;
@ -757,7 +757,7 @@ eLand getNewLand(eLand old) {
if(old == laEFire && lchance(old)) return hrand(2) ? laEEarth : laEAir;
if(tactic::on && !(tactic::trailer && old == specialland)) return specialland;
if(weirdhyperbolic && specialland != old) return specialland;
if(weirdhyperbolic && specialland != old && specialland != laCrossroads4) return specialland;
if(yendor::on && (yendor::clev().flags & YF_WALLS)) {
if(old != yendor::clev().l) return yendor::clev().l;

View File

@ -101,7 +101,7 @@ void initgame() {
if(firstland == laHauntedWall) firstland = laGraveyard;
if(firstland == laMercuryRiver) firstland = laTerracotta;
if(firstland == laMountain && !tactic::on) firstland = laJungle;
if((isGravityLand(firstland) && !isCyclic(firstland)) || firstland == laOcean)
if((isGravityLand(firstland) && !isCyclic(firstland)) || (firstland == laOcean && !safety))
firstland = weirdhyperbolic ? laCrossroads4 : laCrossroads;
cwt.c = currentmap->gamestart(); cwt.spin = 0; cwt.mirrored = false;