ls:: Prairie in Horodisk

This commit is contained in:
Zeno Rogue 2023-10-05 13:53:24 +02:00
parent 0ab6974cd9
commit 1c0bf5def3
3 changed files with 56 additions and 24 deletions

View File

@ -366,11 +366,12 @@ void celldrawer::setcolors() {
#if CAP_FIELD
case laPrairie:
if(prairie::isriver(c)) {
fcol = flip_dark(c->LHU.fi.rval, 0x402000, 0x503000);
fcol = flip_dark(prairie::get_val(c), 0x402000, 0x503000);
}
else {
fcol = 0x004000 + 0x001000 * c->LHU.fi.walldist;
fcol += 0x10000 * (255 - 511 / (1 + max((int) c->LHU.fi.flowerdist, 1)));
if(ls::hv_structure()) fcol = prairie::nearriver(c) ? 0x40FF00 : 0x40D000;
// fcol += 0x1 * (511 / (1 + max((int) c->LHU.fi.walldist2, 1)));
}
break;

View File

@ -3182,49 +3182,63 @@ EX namespace prairie {
#define RLOW (sphere?(PURE?7:6):PURE?4:2)
#define RHIGH (sphere?(PURE?8:9):PURE?11:13)
EX int get_val(cell *c) {
if(ls::hv_structure()) {
int a = celldistAlt(c);
if(a >= 2) a = 2;
a = gmod(18 - a, 20);
return a;
}
return c->LHU.fi.rval;
}
EX bool no_worms(cell *c) {
if(c->land != laPrairie) return false;
int rv = c->LHU.fi.rval;
int rv = get_val(c);
return rv > RLOW+1 && rv < RHIGH-1;
}
EX bool isriver(cell *c) {
return c->land == laPrairie && c->LHU.fi.rval <= RHIGH && c->LHU.fi.rval >= RLOW;
int rv = get_val(c);
return c->land == laPrairie && rv <= RHIGH && rv >= RLOW;
}
bool mainriver(cell *c) {
return c->LHU.fi.rval <= 8 && c->LHU.fi.rval >= 7;
int rv = get_val(c);
return rv <= 8 && rv >= 7;
}
EX bool nearriver(cell *c) {
return c->LHU.fi.rval == RHIGH+1 || c->LHU.fi.rval == RLOW-1;
int rv = get_val(c);
return rv == RHIGH+1 || rv == RLOW-1;
}
cell *enter;
bool opposite(cell *c) {
return (c->LHU.fi.rval ^ enter->LHU.fi.rval) & 8;
return (get_val(c) ^ get_val(enter)) & 8;
}
bool isleft(cell *c) {
return c->LHU.fi.rval & 8;
return get_val(c) & 8;
}
int towerleft(cell *c) {
return c->LHU.fi.rval;
return get_val(c);
}
int towerright(cell *c) {
return 15^c->LHU.fi.rval;
return 15^get_val(c);
}
EX cell *next(cell *c, int pv IS(1)) {
for(int i=0; i<c->type; i++) {
cell *c1 = createMov(c, i);
cell *c2 = createMov(c, (i+pv+c->type)%c->type);
if(c1 && c1->LHU.fi.rval == c->LHU.fi.rval)
if(c2 && c2->LHU.fi.rval == c->LHU.fi.rval+1)
int rv = get_val(c);
if(c1 && get_val(c1) == rv)
if(c2 && get_val(c2) == rv+1)
if(isNeighbor(c1,c2))
return c1;
}
@ -3328,20 +3342,37 @@ EX namespace prairie {
return true;
}
EX void generateTreasure_here(cell *c) {
int hr = hrand(100);
if(hr == 0 && items[itGreenGrass] >= 10 && !inv::on) {
c->item = itOrbBull;
// orbs.push_back(c);
}
else if(hr < 1+PRIZEMUL) {
placePrizeOrb(c);
// if(c->item) orbs.push_back(c);
}
else if(!ls::hv_structure())
tchoices.push_back(c);
}
EX void generateTreasure(cell *c) {
// if(nearriver(c) && op
if(enter && nearriver(c) && opposite(c) && thisriver(c)) {
int hr = hrand(100);
if(hr == 0 && items[itGreenGrass] >= 10 && !inv::on) {
c->item = itOrbBull;
// orbs.push_back(c);
if(ls::hv_structure()) {
if(get_val(c) == RHIGH + 1) {
int cd = celldist(c);
int min_cd = cd;
cell *c1;
c1 = c; for(int a=0; a<3; a++) { forCellEx(c2, c1) setdist(c2, 9, nullptr); c1 = next(c1); if(!c1) return; min_cd = min(min_cd, celldist(c1)); }
c1 = c; for(int a=0; a<3; a++) { forCellEx(c2, c1) setdist(c2, 9, nullptr); c1 = prev(c1); if(!c1) return; min_cd = min(min_cd, celldist(c1)); }
if(min_cd >= cd-1) forCellEx(c1, c) if(isriver(c1) && celldist(c1) < cd)
c->item = itGreenGrass;
}
else if(hr < 1+PRIZEMUL) {
placePrizeOrb(c);
// if(c->item) orbs.push_back(c);
}
else tchoices.push_back(c);
}
if(get_val(c) == 18 && hrand(100) < 50) c->item = itOrbSafety;
if(get_val(c) == 17) generateTreasure_here(c);
return;
}
if(enter && nearriver(c) && opposite(c) && thisriver(c)) generateTreasure_here(c);
}
EX void treasures() {

View File

@ -877,8 +877,8 @@ EX land_validity_t& land_validity(eLand l) {
if(l == laMirrorOld && !shmup::on) return not_implemented;
}
if(ls::hv_structure() && among(l, laPrairie, laDungeon, laEndorian, laBrownian, laPrincessQuest)) return not_in_hv;
if(ls::voronoi_structure() && among(l, laCamelot, laWhirlpool, laClearing)) return not_in_hv;
if(ls::hv_structure() && among(l, laDungeon, laEndorian, laBrownian, laPrincessQuest)) return not_in_hv;
if(ls::voronoi_structure() && among(l, laPrairie, laCamelot, laWhirlpool, laClearing)) return not_in_hv;
if(ls::horodisk_structure() && l != laCrossroads && isCrossroads(l)) return not_in_hv;
if(l == laBrownian) {