chaosmode variants (CLI only for now)

This commit is contained in:
Zeno Rogue 2019-05-27 07:17:39 +02:00
parent 638274504c
commit 2b1aebb9b4
9 changed files with 73 additions and 7 deletions

View File

@ -1207,6 +1207,7 @@ bool good_for_wall(cell *c) {
void buildBigStuff(cell *c, cell *from) {
if(sphere || quotient) return;
if(chaosmode > 1) return;
bool deepOcean = deep_ocean_at(c, from);
// if(weirdhyperbolic && c->land == laOcean) deepOcean = c->landparam >= 30;
@ -1606,4 +1607,14 @@ void generate_mines() {
for(int i=0; i<bounded_mine_quantity; i++) candidates[i]->wall = waMineMine;
}
vector<eLand> currentlands;
void pregen() {
currentlands.clear();
if(chaosmode > 1)
for(eLand l: land_over)
if(landUnlocked(l) && isLandIngame(l))
currentlands.push_back(l);
}
}

View File

@ -3039,6 +3039,7 @@ namespace prairie {
}
void move() {
if(chaosmode) return;
manual_celllister cl;
for(int i=0; i<isize(dcal); i++) {
cell *c = dcal[i];

View File

@ -742,6 +742,24 @@ int read_cheat_args() {
cheat();
quantum = true;
}
else if(argis("-chaos-circle")) {
PHASEFROM(2);
cheat();
stop_game();
chaosmode = 2;
}
else if(argis("-chaos-total")) {
PHASEFROM(2);
cheat();
stop_game();
chaosmode = 3;
}
else if(argis("-chaos-random")) {
PHASEFROM(2);
cheat();
stop_game();
chaosmode = 4;
}
else if(argis("-fix")) {
PHASE(1);
fixseed = true; autocheat = true;

View File

@ -4422,6 +4422,7 @@ void killThePlayerAt(eMonster m, cell *c, flagtype flags) {
}
void afterplayermoved() {
pregen();
setdist(cwt.at, 7 - getDistLimit() - genrange_bonus, NULL);
prairie::treasures();
if(generatingEquidistant) {

View File

@ -1744,7 +1744,7 @@ void generate_mines();
bool canAttack(cell *c1, eMonster m1, cell *c2, eMonster m2, flagtype flags);
extern bool chaosmode;
extern int chaosmode;
extern bool chaosUnlocked;
extern bool chaosAchieved;
bool isTechnicalLand(eLand l);
@ -5407,5 +5407,7 @@ static const int POLY_ALWAYS_IN = (1<<21); // always draw this
static const int POLY_TRIANGLES = (1<<22); // made of TRIANGLES, not TRIANGLE_FAN
static const int POLY_INTENSE = (1<<23); // extra intense colors
void pregen();
extern vector<eLand> currentlands;
}

View File

@ -27,6 +27,7 @@ void doOvergenerate() {
bool notDippingFor(eItem i) {
if(peace::on) return false;
if(chaosmode > 1) return true;
int v = items[i] - currentLocalTreasure;
if(v <= 10) return true;
if(v >= 20) return false;
@ -35,6 +36,7 @@ bool notDippingFor(eItem i) {
bool notDippingForExtra(eItem i, eItem x) {
if(peace::on) return false;
if(chaosmode > 1) return true;
int v = items[i] - min(items[x], currentLocalTreasure);
if(v <= 10) return true;
if(v >= 20) return false;
@ -2442,6 +2444,16 @@ void repairLandgen(cell *c) {
}
}
void setland_randomwalk(cell *c) {
if(c->land) return;
if(hrand(10) == 0) setland(c, currentlands[hrand(isize(currentlands))]);
else {
cell *c2 = c->cmove(hrand(c->type));
setland_randomwalk(c2);
c->land = c2->land;
}
}
void setdist(cell *c, int d, cell *from) {
if(c->mpdist <= d) return;
@ -2483,7 +2495,7 @@ void setdist(cell *c, int d, cell *from) {
if(cseek->master->emeraldval) setland(c, eLand(cseek->master->emeraldval));
}
if(!c->land && from && (WDIM == 3 || !among(from->land, laBarrier, laElementalWall, laHauntedWall, laOceanWall)) && !quotient) {
if(!c->land && from && (WDIM == 3 || !among(from->land, laBarrier, laElementalWall, laHauntedWall, laOceanWall)) && !quotient && !(chaosmode > 1)) {
if(!hasbardir(c)) setland(c, from->land);
}
if(c->land == laTemple && !tactic::on && !chaosmode) setland(c, laRlyeh);
@ -2492,6 +2504,25 @@ void setdist(cell *c, int d, cell *from) {
if(c->land == laWhirlpool && !tactic::on && !yendor::on) setland(c, laOcean);
if(c->land == laCamelot && !tactic::on) setland(c, laCrossroads);
if(c->land == laBrownian && !tactic::on && !chaosmode) setland(c, laOcean);
if(chaosmode && !c->land && isize(currentlands)) {
if(chaosmode == 3) setland(c, currentlands[hrand(isize(currentlands))]);
if(chaosmode == 2) {
if(stdeuc) {
cell *c2 = c;
while(true) {
forCellCM(c3, c2) if(cdist50(c3) < cdist50(c2)) { c2 = c3; goto again; }
break;
again: ;
}
if(!c2->land) setland(c2, currentlands[hrand(isize(currentlands))]);
c->land = c2->land;
}
else chaosmode = 4;
}
if(chaosmode == 4)
setland_randomwalk(c);
}
#if CAP_DAILY
if(!daily::on) {
@ -2499,6 +2530,7 @@ void setdist(cell *c, int d, cell *from) {
if(true) {
#endif
if(0);
else if(chaosmode > 1) ;
#if CAP_CRYSTAL
else if(geometry == gCrystal) crystal::set_land(c);
#endif

View File

@ -71,7 +71,7 @@ eLand oppositeElement(eLand l, eLand l2) {
eLand firstland = laIce, specialland = laIce;
bool chaosmode = false;
int chaosmode = 0;
bool landUnlockedRPM(eLand n) {
if(isRandland(n) == 2) return true;

View File

@ -146,6 +146,7 @@ void initgame() {
createMov(cwt.at, 0);
pregen();
setdist(cwt.at, BARLEV, NULL);
if(!use_special_land && !safety) {
@ -622,7 +623,7 @@ void applyBoxes() {
applyBoxM(moFalsePrincess);
applyBoxM(moRoseLady);
applyBoxM(moRoseBeauty);
applyBoxBool(chaosmode, "Chaos mode");
applyBoxNum(chaosmode, "Chaos mode");
applyBoxNum(multi::players, "shmup players");
if(multi::players < 1 || multi::players > MAXPLAYER)
multi::players = 1;
@ -778,7 +779,7 @@ void loadBoxHigh() {
dynamicval<int> sp1(multi::players, savebox[197]);
dynamicval<eGeometry> sp2(geometry, (eGeometry) savebox[116]);
dynamicval<bool> sp3(shmup::on, savebox[119]);
dynamicval<bool> sp4(chaosmode, savebox[196]);
dynamicval<int> sp4(chaosmode, savebox[196]);
dynamicval<eVariation> sp5(variation, (eVariation) savebox[186]);
dynamicval<int> sp7(gp::param.first, savebox[342]);
dynamicval<int> sp8(gp::param.second, savebox[343]);

View File

@ -455,7 +455,7 @@ namespace yendor {
if(phase == 1) {
won = false;
if(!easy) items[itOrbYendor] = bestscore[modecode()][challenge];
chaosmode = (clev().flags & YF_CHAOS);
chaosmode = (clev().flags & YF_CHAOS) ? 1 : 0;
specialland = clev().l;
if(clev().flags & YF_START_AL) {
specialland = laAlchemist;
@ -704,7 +704,7 @@ namespace yendor {
if(yendor::on) {
yendor::won = true;
if(!cheater) {
dynamicval<bool> c(chaosmode, false);
dynamicval<int> c(chaosmode, 0);
yendor::bestscore[modecode()][yendor::challenge] =
max(yendor::bestscore[modecode()][yendor::challenge], items[itOrbYendor]);
yendor::uploadScore();