1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-24 01:00:25 +00:00

Crossroads IV in alternate hyperbolic geometries

This commit is contained in:
Zeno Rogue 2018-01-08 23:11:29 +01:00
parent a4593cd2b0
commit 51652304ad
9 changed files with 76 additions and 46 deletions

View File

@ -909,6 +909,38 @@ bool quickfind(eLand l) {
#define I2000 (INVLUCK?600:2000)
#define I10000 (INVLUCK?3000:10000)
int wallchance(cell *c, bool deepOcean) {
eLand l = c->land;
return
showoff ? (cwt.c->mpdist > 7 ? 0 : 10000) :
inmirror(c) ? 0 :
isGravityLand(l) ? 0 :
generatingEquidistant ? 0 :
l == laPrairie ? 0 :
(yendor::on && yendor::nexttostart) ? 10000 :
princess::challenge ? 0 :
isElemental(l) ? 4000 :
(yendor::on && (yendor::generating || !(yendor::clev().flags & YF_WALLS))) ? 0 :
l == laCrossroads3 ? 10000 :
l == laCrossroads ? 5000 :
l == laCrossroads2 ? 10000 :
l == laCrossroads5 ? 10000 :
l == laCrossroads4 ? (weirdhyperbolic ? 5000 : 0) :
(l == laMirror && !yendor::generating) ? 6000 :
l == laTerracotta ? 250 :
(tactic::on && !tactic::trailer) ? 0 :
l == laCaribbean ? 500 :
(l == laWarpSea || l == laWarpCoast) ? 500 :
l == laStorms ? 250 :
l == laCanvas ? 0 :
l == laHaunted ? 0 :
(l == laGraveyard && !deepOcean) ? 0 :
(l == laGraveyard && items[itBone] >= 10) ? 120 :
l == laOcean ? (deepOcean ? (nonbitrunc ? 250 : 2000) : 0) :
l == laDragon ? 120 :
50;
}
void buildBigStuff(cell *c, cell *from) {
if(sphere || quotient) return;
bool deepOcean = false;
@ -959,7 +991,8 @@ void buildBigStuff(cell *c, cell *from) {
else if(ctof(c) && c->land == laCrossroads4 && hrand(10000) < 7000 && c->land &&
buildBarrierNowall(c, getNewLand(laCrossroads4))) ;
else if(ctof(c) && hrand(I10000) < 20 && !generatingEquidistant && !yendor::on && !tactic::on && !isCrossroads(c->land) && gold() >= R200 &&
else if(ctof(c) && hrand(I10000) < 20 && !generatingEquidistant && !yendor::on && !tactic::on && !isCrossroads(c->land) &&
gold() >= R200 && !weirdhyperbolic &&
!inmirror(c) && !isSealand(c->land) && !isHaunted(c->land) && !isGravityLand(c->land) &&
(c->land != laRlyeh || rlyehComplete()) &&
c->land != laTortoise && c->land != laPrairie && c->land &&
@ -969,6 +1002,10 @@ void buildBigStuff(cell *c, cell *from) {
buildBarrierNowall(c, laCrossroads4) ;
}
else if(weirdhyperbolic && specialland == laCrossroads4 && ctof(c) && hrand(I10000/4) < wallchance(c, deepOcean)) {
buildBarrierNowall(c, getNewLand(c->land));
}
else if(weirdhyperbolic) ; // non-Nowall barriers not implemented yet in weird hyperbolic
else if(c->land == laCrossroads2 && !nonbitrunc)
@ -985,34 +1022,7 @@ void buildBigStuff(cell *c, cell *from) {
}
}
else if(ctof(c) && c->land && hrand(I10000) < (
showoff ? (cwt.c->mpdist > 7 ? 0 : 10000) :
inmirror(c) ? 0 :
isGravityLand(c->land) ? 0 :
generatingEquidistant ? 0 :
c->land == laPrairie ? 0 :
(yendor::on && yendor::nexttostart) ? 10000 :
princess::challenge ? 0 :
isElemental(c->land) ? 4000 :
(yendor::on && (yendor::generating || !(yendor::clev().flags & YF_WALLS))) ? 0 :
c->land == laCrossroads3 ? 10000 :
c->land == laCrossroads ? 5000 :
c->land == laCrossroads2 ? 10000 :
c->land == laCrossroads5 ? 10000 :
c->land == laCrossroads4 ? 0 :
(c->land == laMirror && !yendor::generating) ? 6000 :
c->land == laTerracotta ? 250 :
(tactic::on && !tactic::trailer) ? 0 :
c->land == laCaribbean ? 500 :
(c->land == laWarpSea || c->land == laWarpCoast) ? 500 :
c->land == laStorms ? 250 :
c->land == laCanvas ? 0 :
c->land == laHaunted ? 0 :
(c->land == laGraveyard && !deepOcean) ? 0 :
(c->land == laGraveyard && items[itBone] >= 10) ? 120 :
c->land == laOcean ? (deepOcean ? (nonbitrunc ? 250 : 2000) : 0) :
c->land == laDragon ? 120 :
50))
else if(ctof(c) && c->land && hrand(I10000) < wallchance(c, deepOcean))
{
int bd = 2 + hrand(2) * 3;
@ -1052,7 +1062,7 @@ void buildBigStuff(cell *c, cell *from) {
if(c->land == laOvergrown && ctof(c) &&
(quickfind(laClearing) || (hrand(I2000) < 25 &&
!randomPatternsMode && items[itMutant] >= U5 &&
isLandValid(laClearing) &&
isLandIngame(laClearing) &&
!tactic::on && !yendor::on))) {
heptagon *h = createAlternateMap(c, 2, hsA);
if(h) clearing::bpdata[h].root = NULL;

View File

@ -6153,7 +6153,7 @@ void movecost(cell* from, cell *to) {
tour::checkGoodLand(to->land);
#endif
if(to->land ==laCrossroads4 && !chaosUnlocked) {
if(to->land ==laCrossroads4 && !chaosUnlocked && !geometry) {
achievement_gain("CR4");
chaosUnlocked = true;
}

View File

@ -218,6 +218,7 @@ void showEuclideanMenu() {
for(int i=0; i<landtypes; i++)
if(hiitemsMax(treasureType(eLand(i))) >= 25) landvisited[i] = true;
landvisited[laCrossroads] = true;
landvisited[laCrossroads4] = true;
landvisited[laIce] = true;
landvisited[laHunting] = true;
landvisited[laMirrorOld] = true;
@ -422,7 +423,8 @@ void showEuclideanMenu() {
}
void runGeometryExperiments() {
specialland = getLandForList(cwt.c);
if(!geometry)
specialland = getLandForList(cwt.c);
pushScreen(showEuclideanMenu);
}

View File

@ -2283,6 +2283,7 @@ extern vector<eLand> landlist;
template<class T> void generateLandList(T t);
int isLandValid(eLand l);
bool isLandValid2(eLand l);
bool isLandIngame(eLand l);
bool inmirrororwall(eLand l);
extern bool holdmouse;

View File

@ -1536,7 +1536,7 @@ void giantLandSwitch(cell *c, int d, cell *from) {
if(d == 9 && randomPatternsMode)
setland(c, RANDPAT ? laWarpCoast : laWarpSea);
if(d == 8) {
if(d == 8 && !weirdhyperbolic) {
if(c->land == laWarpCoast) {
if(hrand(1000) < 150 && celldist(c) >= 3 && !pseudohept(c))
c->wall = waSmallTree;

View File

@ -434,7 +434,7 @@ bool landUnlocked(eLand l) {
return gold() >= R30;
case laCaribbean: case laWhirlpool:
return exploreland[0][laOcean] || items[itCoast] || items[itStatue];
return gold() >= R30;
case laRlyeh: case laDryForest: case laWineyard: case laCrossroads2:
return gold() >= R60;
@ -562,7 +562,7 @@ bool landUnlocked(eLand l) {
void countHyperstoneQuest(int& i1, int& i2) {
i1 = 0; i2 = 0;
generateLandList(isLandValid);
generateLandList(isLandIngame);
for(eLand l: landlist) if(l != laCamelot && l != laPrincessQuest) {
eItem ttype = treasureType(l);
if(ttype != itHyperstone) {
@ -693,7 +693,7 @@ eLand getNewSealand(eLand old) {
if(p == laKraken && peace::on) continue;
if(incompatible(old, p)) continue;
if(p == old) continue;
if(!isLandValid2(p)) continue;
if(!isLandIngame(p)) continue;
return p;
}
}
@ -725,7 +725,7 @@ eLand getNewLand(eLand old) {
eLand n = eLand(hrand(landtypes));
if(n == old) continue;
if(incompatible(n,old)) continue;
if(!isLandValid2(n)) continue;
if(!isLandIngame(n)) continue;
if(n == laElementalWall || isTechnicalLand(n)) continue;
if(n == laWildWest) continue;
if(isElemental(n) && hrand(100) >= 25) continue;
@ -953,7 +953,11 @@ eLand getNewLand(eLand old) {
// for(int i=0; i<20; i++) tab[cnt++] = laCrossroads;
eLand n = old;
while(incompatible(n, old) || !isLandValid2(n)) n = tab[hrand(cnt)];
while(incompatible(n, old) || !isLandIngame(n)) {
n = tab[hrand(cnt)];
if(weirdhyperbolic && specialland == laCrossroads4 && isCrossroads(n))
n = laCrossroads4;
}
return n;
}
@ -962,7 +966,7 @@ vector<eLand> land_over = {
laIce, laCaves, laDesert, laHunting, laMotion, laJungle, laAlchemist,
laCrossroads,
laMirror, laMirrorOld, laMinefield, laPalace, laPrincessQuest, laZebra, laSwitch, laReptile,
laOcean, laWarpCoast, laLivefjord, laKraken, laCaribbean, laWhirlpool, laRlyeh, laTemple,
laOcean, laDocks, laWarpCoast, laLivefjord, laKraken, laCaribbean, laWhirlpool, laRlyeh, laTemple,
laIvoryTower, laEndorian, laDungeon, laMountain,
laCrossroads2,
laDryForest, laWineyard, laDeadCaves, laGraveyard, laHaunted, laHive,
@ -976,7 +980,7 @@ vector<eLand> land_over = {
laHell, laCrossroads3, laCocytus, laPower, laCrossroads4,
laCrossroads5,
// EXTRA
laWildWest, laHalloween, laDual, laSnakeNest, laDocks, laMagnetic, laCA
laWildWest, laHalloween, laDual, laSnakeNest, laMagnetic, laCA
};
vector<eLand> landlist;
@ -999,6 +1003,14 @@ eLand getLandForList(cell *c) {
return l;
}
bool isLandIngame(eLand l) {
if(isLandValid(l) < 2)
return false;
if(l == laWildWest)
return false;
return true;
}
// check if the given land should appear in lists
int isLandValid(eLand l) {
@ -1192,7 +1204,11 @@ int isLandValid(eLand l) {
if(l == laCrossroads3 && !stdeuc && !bigsphere)
return 0;
// OK in small bounded worlds, and in Euclidean
// Crossroads IV is great in weird hyperbolic
if(l == laCrossroads4 && weirdhyperbolic)
return 3;
// OK in small bounded worlds, and in Euclidean
if(l == laCrossroads4 && !(stdeuc || smallbounded))
return 0;

View File

@ -37,7 +37,7 @@ void showOverview() {
bool pages;
generateLandList(isLandValid2);
generateLandList(isLandIngame);
if(dialog::infix != "") {
vector<eLand> filtered;
@ -702,7 +702,7 @@ void setAppropriateOverview() {
pushScreen(yendor::showMenu);
else if(peace::on)
pushScreen(peace::showMenu);
else if(geometry != gNormal && !chaosmode && !(geometry == gEuclid && isCrossroads(specialland))) {
else if(geometry != gNormal && !chaosmode && !(geometry == gEuclid && isCrossroads(specialland)) && !(weirdhyperbolic && specialland == laCrossroads4)) {
runGeometryExperiments();
}
else {

View File

@ -294,7 +294,7 @@ string contstr() {
}
eLand nextHyperstone() {
generateLandList(isLandValid);
generateLandList(isLandIngame);
for(eLand l: landlist)
if(items[treasureType(l)] < R10 && !isCrossroads(l) && l != laPrincessQuest && l != laCamelot)
return l;

View File

@ -94,7 +94,7 @@ void initgame() {
if(peace::on) firstland = specialland;
if(tactic::on && (euclid || sphere)) specialland = firstland;
if(tactic::on && geometry) specialland = firstland;
if(firstland == laNone || firstland == laBarrier)
firstland = laCrossroads;
@ -107,7 +107,7 @@ void initgame() {
if(isGravityLand(firstland) && !tactic::on) firstland = laCrossroads;
cwt.c = currentmap->gamestart(); cwt.spin = 0; cwt.mirrored = false;
cwt.c->land = geometry ? specialland : firstland;
cwt.c->land = (geometry && !safety) ? specialland : firstland;
chaosAchieved = false;
@ -824,6 +824,7 @@ void saveStats(bool emergency = false) {
fprintf(f, "cells generated: %d\n", cellcount);
if(pureHardcore()) fprintf(f, "Pure hardcore mode\n");
if(nonbitrunc) fprintf(f, "Heptagons only mode\n");
if(geometry) fprintf(f, "Geometry: %s\n", ginf[geometry].name);
if(chaosmode) fprintf(f, "Chaos mode\n");
if(shmup::on) fprintf(f, "Shoot-em up mode\n");
if(inv::on) fprintf(f, "Inventory mode\n");