1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-09-27 13:48:15 +00:00

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) { if(c->land == laNone) {
printf("barrier nowall! [%p]\n", c); 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 j=0; j<c->type; j++) swap(ds[j], ds[hrand(j+1)]);
for(int i=0; i<c->type; i++) { 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) { /* if(warpv && gp::on) {
d = hrand(c->type); */ d = hrand(c->type); */
if(warpv && c->mov[d] && c->mov[d]->mpdist < c->mpdist) continue; if(warpv && c->mov[d] && c->mov[d]->mpdist < c->mpdist) continue;
/* } /* }
else else
d = (S3>3 && !warpv) ? (2+(i&1)) : dtab[i]; */ d = (S3>3 && !warpv) ? (2+(i&1)) : dtab[i]; */
if(force) d=1;
cellwalker cw(c, d); cellwalker cw(c, d);
eLand ws = warpv ? laWarpCoast : laNone; 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; eLand l1 = c->land;
checkBarriersNowall(cw, 0, -1, l1, l2); checkBarriersNowall(cw, 0, -1, l1, l2);
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); cellwalker cw(c, (gdir+3) % c->type);
vector<cell*> coastpath; 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! // this leads to bugs for some reason!
if(cw.c->land == laCrossroads2) { if(cw.c->land == laCrossroads2) {
#ifdef AUTOPLAY #ifdef AUTOPLAY
@ -321,6 +322,7 @@ cell *buildAnotherEquidistant(cell *c, int radius) {
return NULL; return NULL;
} }
if(cw.c->bardir != NODIR) 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) { /* forCellEx(c2, cw.c) if(c2->bardir != NODIR) {
generatingEquidistant = false; generatingEquidistant = false;
@ -350,7 +352,6 @@ cell *buildAnotherEquidistant(cell *c, int radius) {
setdist(coastpath[i], BARLEV-1, coastpath[i-1]); setdist(coastpath[i], BARLEV-1, coastpath[i-1]);
if(i < size(coastpath) - 5) { if(i < size(coastpath) - 5) {
coastpath[i]->bardir = NOBARRIERS; coastpath[i]->bardir = NOBARRIERS;
// coastpath[i]->item = itSapphire;
// forCellEx(c2, coastpath[i]) c2->bardir = NOBARRIERS; // forCellEx(c2, coastpath[i]) c2->bardir = NOBARRIERS;
} }
} }
@ -371,12 +372,15 @@ cell *buildAnotherEquidistant(cell *c, int radius) {
if(c2->land != c->land) return NULL; if(c2->land != c->land) return NULL;
// else if(ctof(c) && hrand(10000) < 20 && !isCrossroads(c->land) && gold() >= 200) // 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; nowall = true;
// raiseBuggyGeneration(c2, "check"); // raiseBuggyGeneration(c2, "check");
// return; // return;
} }
else buildBarrier(c2, bd); else if(!weirdhyperbolic) buildBarrier(c2, bd);
//printf("building barrier II\n"); //printf("building barrier II\n");
if(hasbardir(c2)) extendBarrier(c2); if(hasbardir(c2)) extendBarrier(c2);
@ -417,7 +421,7 @@ int coastval(cell *c, eLand base) {
} }
else { else {
if(c->land == laOceanWall || c->land == laCaribbean || c->land == laWhirlpool || 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; return 30;
if(c->land != laOcean && !isGravityLand(c->land) && c->land != laHaunted) { if(c->land != laOcean && !isGravityLand(c->land) && c->land != laHaunted) {
return 0; 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); 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); buildAnotherEquidistant(c);
} }
@ -960,37 +971,39 @@ bool horo_ok() {
// (they work in ALL hyperbolic geometries currently!) // (they work in ALL hyperbolic geometries currently!)
return hyperbolic; return hyperbolic;
} }
bool gp_wall_test() {
if(gp::on) return hrand(gp::dist_3()) == 0;
return true;
}
void buildBigStuff(cell *c, cell *from) { void buildBigStuff(cell *c, cell *from) {
if(sphere || quotient) return; if(sphere || quotient) return;
bool deepOcean = false; bool deepOcean = false;
if(!weirdhyperbolic) { if(c->land == laOcean) {
if(!from) deepOcean = true;
if(c->land == laOcean) { else for(int i=0; i<from->type; i++) {
if(!from) deepOcean = true; cell *c2 = from->mov[i];
else for(int i=0; i<from->type; i++) { if(c2 && c2->land == laOcean && c2->landparam > 30) {
cell *c2 = from->mov[i]; deepOcean = true;
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(c2) forCellEx(c3, c2) if(c3 && c3->land == laOcean && c3->landparam > 30)
deepOcean = true;
} }
}
if(c->land == laGraveyard) {
if(!from) deepOcean = true; if(c->land == laGraveyard) {
else for(int i=0; i<from->type; i++) { if(!from) deepOcean = true;
cell *c2 = from->mov[i]; else for(int i=0; i<from->type; i++) {
if(c2 && c2->landparam > HAUNTED_RADIUS+5) cell *c2 = from->mov[i];
deepOcean = true; if(c2 && c2->landparam > HAUNTED_RADIUS+5)
} deepOcean = true;
} }
} }
if(generatingEquidistant) deepOcean = false; if(generatingEquidistant) deepOcean = false;
if(weirdhyperbolic && c->land == laOcean) deepOcean = c->landparam >= 30; // if(weirdhyperbolic && c->land == laOcean) deepOcean = c->landparam >= 30;
// buildgreatwalls // buildgreatwalls
@ -1026,7 +1039,7 @@ void buildBigStuff(cell *c, cell *from) {
buildBarrierNowall(c, laCrossroads4) ; 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)); buildBarrierNowall(c, getNewLand(c->land));
} }

View File

@ -2267,7 +2267,7 @@ const eLand NOWALLSEP_USED = laWhirlpool;
bool hasbardir(cell *c); 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 checkBarriersBack(cellwalker bb, int q=5, bool cross = false);
bool checkBarriersFront(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)) if(hrand(1000) < 150 && celldist(c) >= 3 && !pseudohept(c))
c->wall = waSmallTree; c->wall = waSmallTree;
int q = 0; 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) if(c->mov[i] && !isWarped(c->mov[i]->land) && c->mov[i]->land != laCrossroads4)
q++; q++;
if(q == 1) c->wall = waWarpGate; 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) { if(c->landparam % TEMPLE_EACH == 0 && c->landparam <= 24) {
int q = 0; int q = 0;
forCellEx(c2, c) forCellEx(c2, c)
if(c2->landparam % TEMPLE_EACH == 0 && !ishept(c2)) q++; if(c2->landparam % TEMPLE_EACH == 0 && !pseudohept(c2)) q++;
placecolumn = q == 2; placecolumn = q == 2;
if(placecolumn && weirdhyperbolic && nonbitrunc && hrand(100) >= 50)
placecolumn = false;
if(placecolumn) { if(placecolumn) {
placecolumn = false; placecolumn = false;
cell *c2 = c; cell *c2 = c;

View File

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

View File

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