mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-19 15:20:27 +00:00
fixed treasure/monster generation in randomized palaces
This commit is contained in:
parent
4b0a63120a
commit
c8b1ea8ee6
231
landgen.cpp
231
landgen.cpp
@ -180,135 +180,136 @@ void giantLandSwitch(cell *c, int d, cell *from) {
|
|||||||
else if(i < 35)
|
else if(i < 35)
|
||||||
c->wall = waOpenGate;
|
c->wall = waOpenGate;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
if(d == 9) {
|
if(d == 9) {
|
||||||
cell *c2 = gp::on ? c->master->c7 : c;
|
cell *c2 = gp::on ? c->master->c7 : c;
|
||||||
if(cdist50(c2) == 3 && polarb50(c2) == 1)
|
if(cdist50(c2) == 3 && polarb50(c2) == 1)
|
||||||
c->wall = waPalace;
|
c->wall = waPalace;
|
||||||
}
|
|
||||||
|
|
||||||
if(d == 8 && sphere) {
|
|
||||||
int gs = getHemisphere(c,0);
|
|
||||||
if(gp::on) {
|
|
||||||
int v = 1;
|
|
||||||
forCellEx(c2, c) if(getHemisphere(c2, 0) != gs)
|
|
||||||
v = 2;
|
|
||||||
if(v == 2)
|
|
||||||
c->wall = pick(waClosedGate, waOpenGate, waPalace);
|
|
||||||
else if(hrand(100) < 10)
|
|
||||||
c->wall = pick(waClosePlate, waOpenPlate, waTrapdoor);
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
if(gs == 1)
|
|
||||||
c->wall = waPalace;
|
|
||||||
if(gs == 3)
|
|
||||||
c->wall = nonbitrunc ? waOpenGate : waClosedGate;
|
|
||||||
if(gs == 4 && hrand(100) < 40)
|
|
||||||
c->wall = waClosePlate;
|
|
||||||
if(gs == 6)
|
|
||||||
c->wall = waOpenPlate;
|
|
||||||
if(gs == -3)
|
|
||||||
c->wall = pick(waClosePlate, waOpenPlate);
|
|
||||||
if(gs == -6)
|
|
||||||
c->wall = waTrapdoor;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(d == 8 && !sphere) {
|
|
||||||
|
|
||||||
// note: Princess Challenge brings back the normal Palace generation
|
if(d == 8 && sphere) {
|
||||||
bool lookingForPrincess = !euclid && c->master->alt && !princess::challenge;
|
int gs = getHemisphere(c,0);
|
||||||
|
|
||||||
bool pgate = false;
|
|
||||||
if(nonbitrunc) {
|
|
||||||
int i = fiftyval049(c->master->c7);
|
|
||||||
if(i >= 8 && i <= 14 && !polarb50(c->master->c7)) pgate = true;
|
|
||||||
if(gp::on) {
|
if(gp::on) {
|
||||||
bool good = false;
|
int v = 1;
|
||||||
forCellEx(c2, c) {
|
forCellEx(c2, c) if(getHemisphere(c2, 0) != gs)
|
||||||
int i2 = fiftyval049(c2->master->c7);
|
v = 2;
|
||||||
if((i2 < 8) && polarb50(c2->master->c7)) good = true;
|
if(v == 2)
|
||||||
}
|
c->wall = pick(waClosedGate, waOpenGate, waPalace);
|
||||||
pgate = pgate && good;
|
else if(hrand(100) < 10)
|
||||||
|
c->wall = pick(waClosePlate, waOpenPlate, waTrapdoor);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
if(gs == 1)
|
||||||
|
c->wall = waPalace;
|
||||||
|
if(gs == 3)
|
||||||
|
c->wall = nonbitrunc ? waOpenGate : waClosedGate;
|
||||||
|
if(gs == 4 && hrand(100) < 40)
|
||||||
|
c->wall = waClosePlate;
|
||||||
|
if(gs == 6)
|
||||||
|
c->wall = waOpenPlate;
|
||||||
|
if(gs == -3)
|
||||||
|
c->wall = pick(waClosePlate, waOpenPlate);
|
||||||
|
if(gs == -6)
|
||||||
|
c->wall = waTrapdoor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(d == 8 && !sphere) {
|
||||||
|
|
||||||
if(pgate) {
|
// note: Princess Challenge brings back the normal Palace generation
|
||||||
switch(princess::generating ? 0 : hrand(2)) {
|
bool lookingForPrincess = !euclid && c->master->alt && !princess::challenge;
|
||||||
case 0:
|
|
||||||
c->wall = waClosedGate;
|
bool pgate = false;
|
||||||
toggleGates(c, waClosePlate, 1);
|
if(nonbitrunc) {
|
||||||
break;
|
int i = fiftyval049(c->master->c7);
|
||||||
case 1:
|
if(i >= 8 && i <= 14 && !polarb50(c->master->c7)) pgate = true;
|
||||||
c->wall = waOpenGate;
|
if(gp::on) {
|
||||||
toggleGates(c, waOpenPlate, 1);
|
bool good = false;
|
||||||
break;
|
forCellEx(c2, c) {
|
||||||
|
int i2 = fiftyval049(c2->master->c7);
|
||||||
|
if((i2 < 8) && polarb50(c2->master->c7)) good = true;
|
||||||
|
}
|
||||||
|
pgate = pgate && good;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else if(cdist50(c) == 3 && polarb50(c) == 1 && !ishept(c)) {
|
if(pgate) {
|
||||||
if(gp::on) ;
|
switch(princess::generating ? 0 : hrand(2)) {
|
||||||
else {
|
case 0:
|
||||||
int q = 0, s = 0;
|
c->wall = waClosedGate;
|
||||||
if(!ishept(c)) for(int i=0; i<6; i++)
|
toggleGates(c, waClosePlate, 1);
|
||||||
if(cdist50(c->mov[i]) == 3 && polarb50(c->mov[i]) == 1 && !ishept(c->mov[i]))
|
break;
|
||||||
q++, s += i;
|
case 1:
|
||||||
if(q == 1 && c->mov[s]->land == laPalace) {
|
c->wall = waOpenGate;
|
||||||
switch(princess::generating ? 0 : hrand(2)) {
|
toggleGates(c, waOpenPlate, 1);
|
||||||
case 0:
|
break;
|
||||||
c->wall = waClosedGate;
|
}
|
||||||
c->mov[s]->wall = waClosedGate;
|
}
|
||||||
break;
|
else if(cdist50(c) == 3 && polarb50(c) == 1 && !ishept(c)) {
|
||||||
case 1:
|
if(gp::on) ;
|
||||||
c->wall = waOpenGate;
|
else {
|
||||||
c->mov[s]->wall = waOpenGate;
|
int q = 0, s = 0;
|
||||||
break;
|
if(!ishept(c)) for(int i=0; i<6; i++)
|
||||||
|
if(cdist50(c->mov[i]) == 3 && polarb50(c->mov[i]) == 1 && !ishept(c->mov[i]))
|
||||||
|
q++, s += i;
|
||||||
|
if(q == 1 && c->mov[s]->land == laPalace) {
|
||||||
|
switch(princess::generating ? 0 : hrand(2)) {
|
||||||
|
case 0:
|
||||||
|
c->wall = waClosedGate;
|
||||||
|
c->mov[s]->wall = waClosedGate;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
c->wall = waOpenGate;
|
||||||
|
c->mov[s]->wall = waOpenGate;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
else if(c->wall == waPalace) ;
|
||||||
else if(c->wall == waPalace) ;
|
else if((hrand(100) < (lookingForPrincess ? (nonbitrunc ? 11 : 7) : 5) && cdist50(c)) ||
|
||||||
else if((hrand(100) < (lookingForPrincess ? (nonbitrunc ? 11 : 7) : 5) && cdist50(c)) ||
|
(cdist50(c) == 0 && polarb50(c) && hrand(100) < 60)) {
|
||||||
(cdist50(c) == 0 && polarb50(c) && hrand(100) < 60)) {
|
c->wall = hrand(100) < (lookingForPrincess ? (nonbitrunc ? 25 : 30):50) ? waClosePlate : waOpenPlate;
|
||||||
c->wall = hrand(100) < (lookingForPrincess ? (nonbitrunc ? 25 : 30):50) ? waClosePlate : waOpenPlate;
|
}
|
||||||
}
|
else if(hrand(100) < (lookingForPrincess ? 3 : 5))
|
||||||
else if(hrand(100) < (lookingForPrincess ? 3 : 5))
|
c->wall = waTrapdoor;
|
||||||
c->wall = waTrapdoor;
|
|
||||||
|
if(cdist50(c) == 0 && yendor::path) {
|
||||||
if(cdist50(c) == 0 && yendor::path) {
|
cell *c2 = c->mov[hrand(c->type)];
|
||||||
cell *c2 = c->mov[hrand(c->type)];
|
if(c2->wall == waNone) c2->wall = waTrapdoor;
|
||||||
if(c2->wall == waNone) c2->wall = waTrapdoor;
|
}
|
||||||
|
|
||||||
|
if((c->wall == waClosePlate || c->wall == waTrapdoor) && peace::on) c->wall = waNone;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((c->wall == waClosePlate || c->wall == waTrapdoor) && peace::on) c->wall = waNone;
|
if(princess::generating) {
|
||||||
}
|
// no Opening Plates nearby
|
||||||
|
if(d <= 7 && c->wall == waOpenPlate && !nonbitrunc)
|
||||||
if(princess::generating) {
|
c->wall = waNone;
|
||||||
// no Opening Plates nearby
|
if(d <= 7 && c->wall == waClosePlate && nonbitrunc)
|
||||||
if(d <= 7 && c->wall == waOpenPlate && !nonbitrunc)
|
c->wall = waOpenPlate;
|
||||||
c->wall = waNone;
|
// no monsters nearby
|
||||||
if(d <= 7 && c->wall == waClosePlate && nonbitrunc)
|
if(d>0) c->monst = moNone;
|
||||||
c->wall = waOpenPlate;
|
// no Plates or Trapdoors in the Princess cell
|
||||||
// no monsters nearby
|
if(d < 3 && (c->wall == waClosePlate || c->wall == waOpenPlate || c->wall == waTrapdoor))
|
||||||
if(d>0) c->monst = moNone;
|
c->wall = waNone;
|
||||||
// no Plates or Trapdoors in the Princess cell
|
if(d > 1) c->item = itNone;
|
||||||
if(d < 3 && (c->wall == waClosePlate || c->wall == waOpenPlate || c->wall == waTrapdoor))
|
// the Princess herself
|
||||||
c->wall = waNone;
|
if(d == 0) {
|
||||||
if(d > 1) c->item = itNone;
|
c->monst = moPrincess;
|
||||||
// the Princess herself
|
c->hitpoints = palaceHP();
|
||||||
if(d == 0) {
|
c->wall = waGiantRug;
|
||||||
c->monst = moPrincess;
|
cell *c2 = NULL;
|
||||||
c->hitpoints = palaceHP();
|
for(int i=0; i<c->type; i++) {
|
||||||
c->wall = waGiantRug;
|
cellwalker cw(c, i);
|
||||||
cell *c2 = NULL;
|
cw = cw + wstep + 4 + wstep + 2 + wstep + 4 + wstep + (2 + hrand(3)) + wstep;
|
||||||
for(int i=0; i<c->type; i++) {
|
if(!c2) c2 = cw.c;
|
||||||
cellwalker cw(c, i);
|
else if(celldist(cw.c) > celldist(c2)) c2 = cw.c;
|
||||||
cw = cw + wstep + 4 + wstep + 2 + wstep + 4 + wstep + (2 + hrand(3)) + wstep;
|
cw.c->monst = moMouse;
|
||||||
if(!c2) c2 = cw.c;
|
}
|
||||||
else if(celldist(cw.c) > celldist(c2)) c2 = cw.c;
|
c2->wall = waOpenPlate;
|
||||||
cw.c->monst = moMouse;
|
|
||||||
}
|
}
|
||||||
c2->wall = waOpenPlate;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2198,7 +2199,7 @@ void giantLandSwitch(cell *c, int d, cell *from) {
|
|||||||
case laMercuryRiver:
|
case laMercuryRiver:
|
||||||
// do nothing!
|
// do nothing!
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case laDual:
|
case laDual:
|
||||||
if(d == 7) {
|
if(d == 7) {
|
||||||
if(pseudohept(c))
|
if(pseudohept(c))
|
||||||
|
Loading…
Reference in New Issue
Block a user