1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-23 21:07:17 +00:00
hyperrogue/landlock.cpp

1614 lines
58 KiB
C++
Raw Normal View History

// Hyperbolic Rogue -- land availability
// Copyright (C) 2011-2019 Zeno Rogue, see 'hyper.cpp' for details
/** \file landlock.cpp
* \brief unlocking lands, which lands could be found beyond the wall, validity of various lands depending on the settings
*/
2017-10-08 10:10:40 +00:00
#include "hyper.h"
namespace hr {
EX bool in_full_game() {
2021-04-11 20:15:40 +00:00
if(ls::single()) return false;
return true;
}
2019-08-09 20:07:03 +00:00
EX bool nodisplay(eMonster m) {
return
m == moIvyDead ||
m == moDragonTail ||
m == moWolfMoved ||
m == moIvyNext ||
m == moIvyDead;
}
/** returns: 2 = treasure increaser, 1 = just appears, 0 = does not appear */
2019-08-09 20:07:03 +00:00
EX int isNative(eLand l, eMonster m) {
2017-10-08 10:10:40 +00:00
switch(l) {
#define LAND(a,b,c,d,e,f,g) case c:
#define NATIVE(x) return x;
#include "content.cpp"
2019-03-30 16:51:37 +00:00
case landtypes: return 0;
2017-10-08 10:10:40 +00:00
}
return false;
}
2019-08-09 19:00:52 +00:00
EX eItem treasureType(eLand l) { return linf[l].treasure; }
2019-08-09 20:07:03 +00:00
EX eItem treasureTypeUnlock(eLand l, eItem u) {
if(u != itOrbLove && l == laPrincessQuest)
return itPalace;
return treasureType(l);
}
2019-08-09 20:07:03 +00:00
EX eLand landof(eItem it) {
for(int i=0; i<landtypes; i++) if(treasureType(eLand(i)) == it) return eLand(i);
return laNone;
}
2017-10-08 10:10:40 +00:00
2019-08-09 19:00:52 +00:00
EX int landMultiplier(eLand l) {
2017-10-08 10:10:40 +00:00
if(l == laCamelot || l == laPrincessQuest) return 10;
return 1;
}
2019-08-09 19:00:52 +00:00
EX bool isCrossroads(eLand l) {
2017-10-08 10:10:40 +00:00
return l == laCrossroads || l == laCrossroads2 || l == laCrossroads3 ||
l == laCrossroads4 || l == laCrossroads5;
}
2019-08-09 19:00:52 +00:00
EX bool bearsCamelot(eLand l) {
2017-10-08 10:10:40 +00:00
return isCrossroads(l) && l != laCrossroads2 && l != laCrossroads5;
}
2019-08-09 19:00:52 +00:00
EX bool inmirror(const cellwalker& cw) {
return inmirror(cw.at->land);
2017-10-08 10:10:40 +00:00
}
2019-08-09 19:00:52 +00:00
EX eLand oppositeElement(eLand l, eLand l2) {
2017-10-08 10:10:40 +00:00
if(l == laEFire) return laEWater;
if(l == laEWater) return laEFire;
if(l == laEAir) return laEEarth;
if(l == laEEarth) return laEAir;
if(l == laMirror && l2 == laMirrored) return laMirrored2;
if(l == laMirrored2 && l2 == laMirrored) return laMirror;
return l;
}
// land unlocking
2019-08-09 21:24:33 +00:00
EX eLand firstland = laIce;
EX eLand specialland = laIce;
2017-10-08 10:10:40 +00:00
2021-04-11 20:15:40 +00:00
#if HDR
2024-04-06 16:33:29 +00:00
enum eLandStructure { lsNiceWalls, lsChaos, lsPatchedChaos, lsTotalChaos, lsChaosRW, lsWallChaos, lsSingle, lsNoWalls, lsHorodisks, lsVoronoi, lsLandscape, lsCrossWalls, lsVineWalls, lsCursedWalls, lsGUARD };
2021-04-11 20:15:40 +00:00
#endif
EX eLandStructure land_structure;
EX namespace ls {
EX bool single() { return land_structure == lsSingle; }
2024-04-06 16:33:29 +00:00
EX bool any_chaos() { return among(land_structure, lsChaos, lsPatchedChaos, lsWallChaos, lsTotalChaos, lsChaosRW, lsCrossWalls, lsVineWalls, lsCursedWalls, lsLandscape); }
2021-04-11 20:15:40 +00:00
EX bool std_chaos() { return land_structure == lsChaos; }
2024-04-06 16:33:29 +00:00
EX bool wall_chaos() { return among(land_structure, lsWallChaos, lsCrossWalls, lsVineWalls, lsCursedWalls); }
2021-04-11 20:15:40 +00:00
EX bool patched_chaos() { return land_structure == lsPatchedChaos; }
2023-09-14 09:38:39 +00:00
EX bool any_order() { return among(land_structure, lsNiceWalls, lsNoWalls, lsHorodisks, lsVoronoi); }
2021-04-11 20:15:40 +00:00
EX bool nice_walls() { return land_structure == lsNiceWalls; }
EX bool no_walls() { return land_structure == lsNoWalls; }
2023-09-14 09:38:39 +00:00
EX bool horodisk_structure() { return land_structure == lsHorodisks; }
2023-09-14 13:06:39 +00:00
EX bool voronoi_structure() { return land_structure == lsVoronoi; }
2023-09-14 09:38:39 +00:00
EX bool hv_structure() { return among(land_structure, lsHorodisks, lsVoronoi); }
2021-04-11 20:15:40 +00:00
EX bool any_nowall() { return no_walls() || std_chaos(); }
EX bool any_wall() { return nice_walls() || wall_chaos(); }
EX int chaoticity() {
if(land_structure == lsTotalChaos) return 100;
if(land_structure == lsChaosRW) return 80;
if(land_structure == lsPatchedChaos) return 60;
if(land_structure == lsChaos) return 40;
2024-03-21 19:15:45 +00:00
if(land_structure == lsLandscape) return 35;
2021-04-11 20:15:40 +00:00
if(land_structure == lsWallChaos) return 30;
if(land_structure == lsCrossWalls) return 32;
2024-04-06 16:33:29 +00:00
if(land_structure == lsCursedWalls) return 34;
2023-09-14 09:38:39 +00:00
if(land_structure == lsVoronoi) return 20;
2021-04-11 20:15:40 +00:00
if(land_structure == lsSingle) return 0;
return 10;
}
/** a multiplier to make stuff more frequent in Wall Chaos and Cross Wall Chaos: treasure */
EX int ls_mul() {
if(land_structure == lsWallChaos) return 2;
if(land_structure == lsCrossWalls) return 3;
2024-04-06 09:45:51 +00:00
if(land_structure == lsVineWalls) return 3;
2024-04-06 16:33:29 +00:00
if(land_structure == lsCursedWalls) return 3;
return 1;
}
/** a multiplier to make stuff more frequent in Wall Chaos and Cross Wall Chaos: even bigger */
EX int ls_mul_big() {
if(land_structure == lsWallChaos) return 5;
if(land_structure == lsCrossWalls) return 10;
2024-04-06 09:45:51 +00:00
if(land_structure == lsVineWalls) return 10;
2024-04-06 16:33:29 +00:00
if(land_structure == lsCursedWalls) return 10;
return 1;
}
2021-04-11 20:15:40 +00:00
EX bool tame_chaos() { return any_chaos() && chaoticity() < 35; }
EX }
EX string land_structure_name(bool which) {
switch(land_structure) {
case lsNiceWalls:
return XLAT("standard");
case lsChaos:
return XLAT("Chaos mode");
case lsPatchedChaos:
return XLAT("patched Chaos");
case lsWallChaos:
return XLAT("excessive walls");
case lsTotalChaos:
return XLAT("total chaos");
case lsChaosRW:
return XLAT("random-walk chaos");
case lsSingle:
return which ? XLAT("single land: ") + XLATN(linf[specialland].name) : XLAT("single land");
2023-09-14 09:38:39 +00:00
case lsHorodisks:
return XLAT("horodisks");
case lsVoronoi:
2023-09-14 13:06:39 +00:00
return XLAT("ideal Voronoi");
2024-03-21 19:15:45 +00:00
case lsLandscape:
return XLAT("landscape");
2021-04-11 20:15:40 +00:00
case lsNoWalls:
return XLAT("wall-less");
case lsCrossWalls:
return XLAT("excessive crossing walls");
2024-04-06 09:45:51 +00:00
case lsVineWalls:
return XLAT("regular walls");
2024-04-06 16:33:29 +00:00
case lsCursedWalls:
return XLAT("cursed walls");
2021-04-11 20:15:40 +00:00
default:
return "error structure";
}
}
EX void fix_land_structure_choice() {
if(closed_or_bounded) {
2021-04-11 20:15:40 +00:00
if(land_structure != lsTotalChaos && land_structure != lsChaosRW)
land_structure = lsSingle;
}
2024-03-21 19:15:45 +00:00
if(land_structure == lsLandscape && !geometry_supports_cdata())
land_structure = lsChaosRW;
2021-04-11 20:15:40 +00:00
if(tactic::on || princess::challenge)
land_structure = lsSingle;
if(yendor::on)
land_structure = yendor::get_land_structure();
if(!nice_walls_available() && land_structure == lsNiceWalls)
land_structure = lsNoWalls;
if(!nice_walls_available() && land_structure == lsWallChaos)
land_structure = lsChaos;
if(!nice_walls_available() && land_structure == lsCrossWalls)
land_structure = lsChaos;
2024-04-06 09:45:51 +00:00
if(land_structure == lsVineWalls && (geometry != gNormal || !BITRUNCATED))
land_structure = lsNiceWalls;
2024-04-06 16:33:29 +00:00
if(land_structure == lsCursedWalls && (geometry != gNormal || !BITRUNCATED))
land_structure = lsNiceWalls;
2023-09-14 13:06:39 +00:00
if(ls::hv_structure() && (!hyperbolic || bt::in() || quotient))
2023-09-14 09:38:39 +00:00
land_structure = lsSingle;
2021-04-11 20:15:40 +00:00
if(walls_not_implemented() && among(land_structure, lsChaos, lsNoWalls))
land_structure = lsSingle;
2023-03-23 08:29:07 +00:00
if(land_structure == lsPatchedChaos && !(stdeuc || nil || cryst || (euclid && WDIM == 3) || aperiodic))
2021-04-11 20:15:40 +00:00
land_structure = lsSingle;
if(closed_or_bounded && !among(land_structure, lsChaosRW, lsTotalChaos, lsSingle))
2021-04-11 20:15:40 +00:00
land_structure = lsSingle;
2023-03-23 08:29:07 +00:00
if(aperiodic && !among(land_structure, lsChaosRW, lsTotalChaos, lsPatchedChaos, lsSingle))
land_structure = lsPatchedChaos;
2023-03-28 20:54:46 +00:00
if((cgflags & qFRACTAL) && !among(land_structure, lsChaosRW, lsTotalChaos, lsPatchedChaos, lsSingle))
land_structure = lsPatchedChaos;
2021-04-11 20:15:40 +00:00
}
2017-10-08 10:10:40 +00:00
2019-08-09 20:07:03 +00:00
EX bool landUnlockedRPM(eLand n) {
2018-02-14 10:45:53 +00:00
if(isRandland(n) == 2) return true;
if(isRandland(n) == 1)
return (autocheat || cheater || hiitemsMax(treasureType(n)) >= 10);
return false;
}
EX int lands_for_hell() {
return casual ? 40 : 9;
}
EX int lands_for_cr3() {
return casual ? 20 : 9;
}
EX int variant_unlock_value() {
return inv::on ? 75 : 30;
}
2019-08-09 20:07:03 +00:00
EX bool landUnlocked(eLand l) {
2017-10-08 10:10:40 +00:00
if(randomPatternsMode) {
2018-02-14 10:45:53 +00:00
return landUnlockedRPM(l);
2017-10-08 10:10:40 +00:00
}
2021-04-15 15:19:59 +00:00
if(all_unlocked) {
2021-04-15 15:22:47 +00:00
if(autocheat || hiitemsMax(treasureType(l)) >= 10) return true;
2021-04-15 15:19:59 +00:00
}
back:
2021-04-11 20:15:40 +00:00
if(princess::challenge) return among(l, laPalace, laPrincessQuest);
if(ls::any_chaos() && isCrossroads(l)) {
return hyperstonesUnlocked();
}
2021-04-11 20:15:40 +00:00
2017-10-08 10:10:40 +00:00
switch(l) {
#define LAND(a,b,c,d,e,f,g) case c:
#define REQ(x) x return true;
#define REQAS(x,y) l = x; goto back;
#define GOLD(x) if(gold() < x) return false;
#define ITEMS(kind, number) if(items[kind] < number) return false;
#define NEVER if(1) return false;
#define ALWAYS ;
#define KILLS(x) if(tkills() < x) return false;
#define KILL(x, where) if(!kills[x]) return false;
#define AKILL(x, where) if(kills[x]) return true;
#define ORD(a, b) a b
#define NUMBER(val, required, description) if(val < required) return false;
#define COND(x,y) if(!(x)) return false;
#define ITEMS_TOTAL(list, z) { int total = 0; for(eItem x: list) total += items[x]; if(total < z) return false; }
#define ACCONLY(x)
#define ACCONLY2(x,y)
2020-08-20 14:12:25 +00:00
#define ACCONLY3(x,y,z)
#define ACCONLYF(x)
#define IFINGAME(land, ok, fallback) if(isLandIngame(land)) { ok } else { fallback }
#define INMODE(x) if(x) return true;
#include "content.cpp"
case landtypes: return false;
2017-10-08 10:10:40 +00:00
}
return false;
}
EX bool required_for_hyperstones(eItem ttype) {
if(ttype == itHyperstone)
return false;
if(among(ttype, itHolyGrail, itSavedPrincess))
return false;
if(euclid && among(ttype, itBabyTortoise, itHunting))
return false;
return true;
}
2024-07-27 16:40:41 +00:00
EX void count_at_level(int& i1, int& i2, int level) {
2017-10-08 10:10:40 +00:00
i1 = 0; i2 = 0;
generateLandList(isLandIngame);
for(eLand l: landlist) {
// no treasure
2024-03-14 19:27:01 +00:00
if(l == laCA) continue;
// same treasure, so count only once
if(l == laMirrorOld && isLandIngame(laMirror)) continue;
2017-11-03 18:31:42 +00:00
eItem ttype = treasureType(l);
if(!required_for_hyperstones(ttype)) continue;
2024-07-27 16:40:41 +00:00
i2++; if(items[ttype] >= level) i1++;
2017-11-03 18:31:42 +00:00
}
}
2017-10-08 10:10:40 +00:00
2024-07-27 16:40:41 +00:00
EX void countHyperstoneQuest(int& i1, int& i2) {
count_at_level(i1, i2, R10);
}
2019-08-09 20:07:03 +00:00
EX bool hyperstonesUnlocked() {
2017-10-08 10:10:40 +00:00
int i1, i2;
if(ls::single() && isCrossroads(specialland)) return true;
2017-10-08 10:10:40 +00:00
countHyperstoneQuest(i1, i2);
return i1 == i2;
}
// 2 = always available, 1 = highscore required, 0 = never available
2019-08-09 20:07:03 +00:00
EX int isRandland(eLand l) {
if(l == laIce || l == laDesert || l == laCaves || l == laWildWest || l == laDocks)
2017-10-08 10:10:40 +00:00
return 2;
2017-11-03 18:31:42 +00:00
for(eLand ll: randlands) if(l == ll) return 1;
2017-10-08 10:10:40 +00:00
return 0;
}
EX int voronoi_sea_category(eLand l) {
if(l == laRlyeh) return rlyehComplete() ? 0 : 2;
if(among(l, laOcean, laWarpCoast, laLivefjord, laDocks)) return 1;
if(among(l, laWhirlpool, laKraken, laWarpSea, laCaribbean)) return 2;
return 0;
}
EX bool voronoi_sea_incompatible(eLand l1, eLand l2) {
int c1 = voronoi_sea_category(l1);
int c2 = voronoi_sea_category(l2);
if(c1+c2 == 2 && c1 != c2) return true;
return false;
}
2019-08-09 20:07:03 +00:00
EX bool incompatible1(eLand l1, eLand l2) {
2017-10-08 10:10:40 +00:00
if(isCrossroads(l1) && isCrossroads(l2)) return true;
if(l1 == laJungle && l2 == laMotion) return true;
if(l1 == laMirrorOld && l2 == laMotion) return true;
if(l1 == laPower && l2 == laWineyard) return true;
if(l1 == laPower && l2 == laDryForest) return true;
2017-12-21 14:12:17 +00:00
if(l1 == laVolcano && l2 == laDryForest) return true;
if(l1 == laVolcano && l2 == laWineyard) return true;
2017-10-08 10:10:40 +00:00
if(l1 == laDragon && l2 == laDryForest) return true;
if(l1 == laEFire && l2 == laWineyard) return true;
if(l1 == laEFire && l2 == laDryForest) return true;
if(l1 == laGraveyard && l2 == laDryForest) return true;
2021-06-03 08:46:16 +00:00
if(l1 == laGraveyard && l2 == laDice) return true;
if(l1 == laGraveyard && l2 == laRuins) return true;
2017-10-08 10:10:40 +00:00
if(l1 == laGraveyard && l2 == laRedRock) return true;
if(l1 == laGraveyard && l2 == laEmerald) return true;
if(l1 == laDeadCaves && l2 == laEmerald) return true;
if(l1 == laDeadCaves && l2 == laCaves) return true;
if(l1 == laWarpSea && l2 == laKraken) return true;
2017-12-03 17:47:10 +00:00
if(l1 == laPrairie && l2 == laCrossroads3) return true;
if(l1 == laPrairie && l2 == laCrossroads4) return true;
if(l1 == laWet && l2 == laDesert) return true;
if(l1 == laFrog && l2 == laMotion) return true;
2022-08-25 08:41:57 +00:00
if(l1 == laBull && l2 == laTerracotta) return true;
if(l1 == laReptile && l2 == laTerracotta) return true;
if(l1 == laBull && l2 == laDeadCaves) return true;
2017-10-08 10:10:40 +00:00
if(isElemental(l1) && isElemental(l2)) return true;
return false;
}
2019-08-09 20:07:03 +00:00
EX eLand randomElementalLand() {
2017-10-08 10:10:40 +00:00
int i = hrand(4);
eLand t[4] = { laEFire, laEWater, laEAir, laEEarth };
return t[i];
}
2019-08-09 20:07:03 +00:00
EX int elementalKills() {
2017-10-08 10:10:40 +00:00
return
kills[moAirElemental] + kills[moWaterElemental] + kills[moEarthElemental] + kills[moFireElemental];
}
2019-08-09 20:07:03 +00:00
EX eLand randomElementalLandWeighted() {
2021-04-15 15:19:59 +00:00
if(all_unlocked) return pick(laEAir, laEWater, laEEarth, laEFire);
2017-10-08 10:10:40 +00:00
int i = hrand(elementalKills());
i -= kills[moAirElemental]; if(i<0) return laEAir;
i -= kills[moWaterElemental]; if(i<0) return laEWater;
i -= kills[moEarthElemental]; if(i<0) return laEEarth;
i -= kills[moFireElemental]; if(i<0) return laEFire;
printf("elemental bug\n");
return laElementalWall;
}
2019-08-09 20:07:03 +00:00
EX bool incompatible(eLand nw, eLand old) {
2017-10-08 10:10:40 +00:00
return (nw == old) || incompatible1(nw, old) || incompatible1(old, nw);
}
2019-08-09 20:07:03 +00:00
EX bool rlyehComplete() {
2021-04-11 20:15:40 +00:00
if(ls::any_chaos()) return items[itStatue] >= 1;
2017-10-08 10:10:40 +00:00
return items[itStatue] >= 10 || items[itGrimoire] >= 10;
}
bool lchance(eLand l) {
2021-04-23 18:13:10 +00:00
if(ls::single() || racing::on || ((geometry || GOLDBERG) && specialland == laElementalWall)) return true;
2021-04-11 20:15:40 +00:00
if(ls::any_chaos()) return hrand(100) < 25;
2017-10-08 10:10:40 +00:00
return hrand(100) >= 40 * kills[elementalOf(l)] / (elementalKills()+1);
}
EX eLand pickLandRPM(eLand old) {
2017-10-08 10:10:40 +00:00
while(true) {
2018-06-22 12:47:24 +00:00
eLand n = randlands[hrand(isize(randlands))];
2017-10-08 10:10:40 +00:00
if(incompatible(n, old)) continue;
2018-02-14 10:45:53 +00:00
if(landUnlockedRPM(n)) return n;
2017-10-08 10:10:40 +00:00
}
}
2019-08-09 20:07:03 +00:00
EX eLand pickluck(eLand l1, eLand l2) {
2017-10-08 10:10:40 +00:00
int t1 = items[treasureType(l1)];
int t2 = items[treasureType(l2)];
if(t1 < t2) return l1;
if(t2 < t1) return l2;
if(isCrossroads(l1)) return l1;
return l2;
}
#define LIKELY for(int u=0; u<5; u++)
#define LIKELY2 for(int u=0; u<2; u++)
2017-10-08 10:10:40 +00:00
/* bool noChaos(eLand l) {
2017-10-08 10:10:40 +00:00
if(l == laOcean || l == laTemple) return false;
return
isCrossroads(l) || isCyclic(l) || isHaunted(l) ||
l == laCaribbean || isGravityLand(l) || l == laPrincessQuest ||
l == laPrairie || l == laHalloween;
} */
2017-10-08 10:10:40 +00:00
2019-08-09 20:07:03 +00:00
EX eLand getNewSealand(eLand old) {
for(int it=0; it<100; it++) {
eLand p = pick(laOcean, pick(laCaribbean, laLivefjord, laWarpSea, laKraken, laDocks));
2017-10-08 10:10:40 +00:00
if(p == laKraken && !landUnlocked(p)) continue;
if(p == laKraken && peace::on) continue;
if(incompatible(old, p)) continue;
if(p == old) continue;
if(!isLandIngame(p)) continue;
2017-10-08 10:10:40 +00:00
return p;
}
return old;
2017-10-08 10:10:40 +00:00
}
2019-08-09 20:07:03 +00:00
EX bool createOnSea(eLand old) {
2017-10-08 10:10:40 +00:00
return
old == laWarpSea || old == laCaribbean || old == laKraken ||
(old == laLivefjord && hrand(2)) ||
(old == laDocks && hrand(2)) ||
2021-04-11 20:15:40 +00:00
(old == laOcean && (ls::any_chaos() ? hrand(2) : !generatingEquidistant));
2017-10-08 10:10:40 +00:00
}
EX hookset<eLand(eLand)> hooks_nextland;
2017-10-08 10:10:40 +00:00
2021-04-15 15:19:59 +00:00
EX bool all_unlocked = false;
2022-12-13 18:05:39 +00:00
EX vector<eLand> cheatdest_list;
EX eLand getNewLand(eLand old) {
2017-10-08 10:10:40 +00:00
2022-02-02 02:07:12 +00:00
#if CAP_LEGACY
if(legacy_racing()) {
if(old == laMirror && hrand(10) >= ((tactic::on || racing::on) ? 0 : markOrb(itOrbLuck) ? 5 : 2)) return laMirrored;
if(old == laTerracotta && hrand(5) >= ((tactic::on || racing::on) ? 0 : markOrb(itOrbLuck) ? 2 : 1) && !weirdhyperbolic) return laTerracotta;
}
#endif
2017-10-08 10:10:40 +00:00
eLand l = callhandlers(laNone, hooks_nextland, old);
if(l) return l;
if(cheatdest != old && cheatdest != laElementalWall) if(!isCyclic(cheatdest) && !isTechnicalLand(cheatdest)) return cheatdest;
2017-10-08 10:10:40 +00:00
2022-12-13 18:05:39 +00:00
if(cheatdest_list.size()) {
eLand l = cheatdest_list[0];
std::rotate(cheatdest_list.begin(), cheatdest_list.begin()+1, cheatdest_list.end());
return l;
}
2017-10-08 10:10:40 +00:00
if(old == laTortoise) return laDragon;
2021-04-11 20:15:40 +00:00
if(yendor::on && ls::any_chaos()) {
2017-10-08 10:10:40 +00:00
while(true) {
eLand n = eLand(hrand(landtypes));
if(n == old) continue;
if(incompatible(n,old)) continue;
if(!isLandIngame(n)) continue;
2017-10-08 10:10:40 +00:00
if(n == laElementalWall || isTechnicalLand(n)) continue;
if(n == laWildWest) continue;
if(isElemental(n) && hrand(100) >= 25) continue;
return n;
}
}
if(markOrb(itOrbLuck)) {
int i = items[itOrbLuck];
items[itOrbLuck] = 0;
eLand l1 = getNewLand(old);
2017-10-08 10:10:40 +00:00
for(int i=1; i<3; i++)
l1 = pickluck(l1, getNewLand(old));
2017-10-08 10:10:40 +00:00
items[itOrbLuck] = i;
return l1;
}
if(randomPatternsMode) return pickLandRPM(old);
if(old == laEEarth && lchance(old)) return hrand(2) ? laEWater : laEFire;
if(old == laEAir && lchance(old)) return hrand(2) ? laEWater : laEFire;
if(old == laEWater && lchance(old)) return hrand(2) ? laEEarth : laEAir;
if(old == laEFire && lchance(old)) return hrand(2) ? laEEarth : laEAir;
#if CAP_RACING
2018-11-23 01:58:16 +00:00
if(racing::on && old != laElementalWall) {
eLand l = old;
using racing::race_lands;
2019-08-07 18:38:40 +00:00
while(l == old) l = race_lands[hrand(16)]; // fixed at 16
2018-11-23 01:58:16 +00:00
if(l == laElementalWall) l = randomElementalLand();
if(l == laMirror) l = laCrossroads;
return l;
}
#endif
2017-10-08 10:10:40 +00:00
2020-03-27 18:57:57 +00:00
if(tactic::on) return specialland;
if(specialland != old && easy_to_find_specialland && specialland != laElementalWall) return specialland;
2017-10-08 10:10:40 +00:00
if(specialland != old && easy_specialland && specialland != laElementalWall) {
easy_specialland--;
return specialland;
}
2017-10-08 10:10:40 +00:00
if(yendor::on && (yendor::clev().flags & YF_WALLS)) {
if(old != yendor::clev().l) return yendor::clev().l;
else if(old == laOcean) return pick(laLivefjord, laCaribbean);
}
if(yendor::on && yendor::nexttostart) {
eLand l = yendor::nexttostart;
if(!(yendor::clev().flags & YF_REPEAT))
yendor::nexttostart = laNone;
return l;
}
if(old == laDragon && tortoise::seek() && hrand(100) < 50)
return laTortoise;
2021-04-11 20:15:40 +00:00
if(isWarpedType(old) && (hrand(100) < 25) && ls::std_chaos()) return eLand(old ^ laWarpCoast ^ laWarpSea);
2017-10-08 10:10:40 +00:00
if(createOnSea(old))
return getNewSealand(old);
if(old == laGraveyard && generatingEquidistant)
return laHaunted;
2021-04-15 15:33:52 +00:00
if(old == laOcean && gold() >= R60 && hrand(100) < 75 && !rlyehComplete() && !all_unlocked)
2017-10-08 10:10:40 +00:00
return laRlyeh;
2021-04-15 15:33:52 +00:00
if(old == laRlyeh && !rlyehComplete() && !all_unlocked)
2017-10-08 10:10:40 +00:00
return laOcean;
2020-02-25 11:28:24 +00:00
eLand tab[16384];
2017-10-08 10:10:40 +00:00
int cnt = 0;
// return (hrand(2)) ? laMotion : laJungle;
2020-02-25 11:28:24 +00:00
for(eLand l: {
laCrossroads, laIce, laDesert, laJungle, laMotion, laHunting, laAlchemist, laCaves,
laMinefield, laPalace, laReptile, laSwitch, laBurial, laDungeon, laRuins, laZebra,
laStorms, laWhirlwind, laOvergrown, laBlizzard, laDryForest, laWineyard, laVolcano,
laDeadCaves, laRedRock, laVariant, laHell, laCocytus, laPower,
2020-03-02 02:19:21 +00:00
laBull, laTerracotta, laRose, laGraveyard, laHive, laDragon, laTrollheim,
2021-06-03 12:24:17 +00:00
laWet, laFrog, laEclectic, laCursed, laDice,
2020-02-25 11:28:24 +00:00
laCrossroads5,
})
if(landUnlocked(l)) tab[cnt++] = l;
struct clos {
eLand l1;
eLand l2;
int f1;
int f2;
};
for(clos c: {
clos{laZebra, laMotion, 2, 2}, {laZebra, laHunting, 2, 2},
{laDragon, laReptile, 5, 5},
{laVariant, laRuins, 5, 5}, {laVariant, laEmerald, 5, 5}, {laVariant, laGraveyard, 5, 5},
{laPalace, laDungeon, 5, 0},
{laJungle, laOvergrown, 5, 5},
{laIce, laBlizzard, 5, 5}, {laCocytus, laBlizzard, 5, 5}, {laHell, laCocytus, 5, 5}, {laIce, laCocytus, 5, 5},
{laWhirlwind, laBlizzard, 5, 5},
{laAlchemist, laVolcano, 5, 5},
{laDesert, laRedRock, 5, 5},
2020-03-02 02:19:21 +00:00
{laFrog, laReptile, 2, 2}, {laFrog, laSwitch, 2, 2}, {laFrog, laZebra, 2, 2},
{laEclectic, laStorms, 3, 3}, {laEclectic, laIce, 3, 3}, {laEclectic, laPalace, 3, 3}, {laEclectic, laDeadCaves, 3, 3},
2017-11-03 22:55:20 +00:00
2020-02-25 11:28:24 +00:00
{laEFire, laDragon, 5, 5}, {laEWater, laLivefjord, 5, 5}, {laEEarth, laDeadCaves, 5, 5}, {laEAir, laWhirlwind, 5, 5},
}) {
if(old == c.l1 && landUnlocked(c.l2)) for(int i=0; i<c.f1; i++) tab[cnt++] = c.l2;
if(old == c.l2 && landUnlocked(c.l1)) for(int i=0; i<c.f2; i++) tab[cnt++] = c.l1;
}
// these lands tend to crash while generating equidistant
for(eLand l: {laIvoryTower, laEndorian, laWestWall})
if(landUnlocked(l) && !generatingEquidistant)
tab[cnt++] = l;
2017-10-08 10:10:40 +00:00
// the intermediate lands
2021-04-15 15:19:59 +00:00
if(all_unlocked || gold() >= R30) {
2017-10-08 10:10:40 +00:00
tab[cnt++] = laCrossroads;
tab[cnt++] = laMirrorOld;
tab[cnt++] = laMirror;
2017-10-08 10:10:40 +00:00
tab[cnt++] = laOcean;
tab[cnt++] = laLivefjord;
2021-04-15 15:19:59 +00:00
if(all_unlocked || kills[moVizier]) tab[cnt++] = laEmerald;
2017-10-08 10:10:40 +00:00
tab[cnt++] = laWarpCoast;
if(euclid) tab[cnt++] = laWarpSea;
tab[cnt++] = laDocks;
2017-10-08 10:10:40 +00:00
}
tab[cnt++] = laHalloween;
2024-03-14 18:38:26 +00:00
tab[cnt++] = laWildWest;
tab[cnt++] = laAsteroids;
tab[cnt++] = laCA;
2017-10-08 10:10:40 +00:00
// the advanced lands
2021-04-15 15:19:59 +00:00
if(all_unlocked || gold() >= R60) {
2017-10-08 10:10:40 +00:00
tab[cnt++] = laCrossroads;
if(!generatingEquidistant) tab[cnt++] = laCrossroads2;
2021-04-15 15:19:59 +00:00
if(all_unlocked || rlyehComplete()) tab[cnt++] = laRlyeh;
2021-04-11 20:15:40 +00:00
else if(ls::std_chaos() && (old == laWarpCoast || old == laLivefjord || old == laOcean))
2017-10-08 10:10:40 +00:00
tab[cnt++] = laRlyeh;
2023-09-14 09:41:51 +00:00
if((all_unlocked || items[itStatue] >= U5) && (ls::std_chaos() || ls::horodisk_structure()))
2017-10-08 10:10:40 +00:00
tab[cnt++] = laTemple;
if(old == laCrossroads || old == laCrossroads2) tab[cnt++] = laOcean;
if(old == laOcean) tab[cnt++] = laCrossroads;
2021-04-15 15:19:59 +00:00
if(items[itGold] >= U5 && items[itFernFlower] >= U5 && !kills[moVizier] && !all_unlocked)
2017-10-08 10:10:40 +00:00
tab[cnt++] = laEmerald;
}
2021-04-15 15:19:59 +00:00
if(all_unlocked || gold() >= R90) {
2021-04-11 20:15:40 +00:00
if(!ls::std_chaos()) tab[cnt++] = laPrairie;
2017-10-08 10:10:40 +00:00
if(old == laPrairie) LIKELY tab[cnt++] = laBull;
2021-04-11 20:15:40 +00:00
if(old == laBull && !ls::any_chaos()) LIKELY tab[cnt++] = laPrairie;
tab[cnt++] = laDual;
tab[cnt++] = laSnakeNest;
2017-10-08 10:10:40 +00:00
}
2023-09-14 09:41:51 +00:00
if(ls::horodisk_structure()) {
if(gold() >= R30) {
tab[cnt++] = laCaribbean;
tab[cnt++] = laKraken;
tab[cnt++] = laWhirlpool;
}
if(gold() >= R60) {
tab[cnt++] = laRlyeh;
if(landUnlocked(laTemple)) tab[cnt++] = laTemple;
}
if(items[itBone] >= 10)
tab[cnt++] = laHaunted;
}
if(ls::hv_structure() && landUnlocked(laMountain)) tab[cnt++] = laMountain;
if(ls::hv_structure() && landUnlocked(laClearing)) tab[cnt++] = laClearing;
if(ls::voronoi_structure() && landUnlocked(laRlyeh) && !rlyehComplete()) LIKELY tab[cnt++] = laRlyeh;
if(ls::hv_structure() && landUnlocked(laTemple)) tab[cnt++] = laTemple;
if(landUnlocked(laTrollheim)) {
2017-10-08 10:10:40 +00:00
if(isTrollLand(old)) LIKELY tab[cnt++] = laTrollheim;
if(old == laTrollheim) for(int i=0; i<landtypes; i++) {
eLand l2 = eLand(i);
if(isTrollLand(l2) && landUnlocked(l2)) LIKELY tab[cnt++] = l2;
2017-10-08 10:10:40 +00:00
}
}
if(landUnlocked(laElementalWall)) {
2020-02-25 11:28:24 +00:00
tab[cnt++] = randomElementalLandWeighted();
2017-10-08 10:10:40 +00:00
}
if(landUnlocked(laHell)) {
2017-10-08 10:10:40 +00:00
if(!generatingEquidistant && old != laPrairie) tab[cnt++] = laCrossroads3;
}
if(items[itHell] >= U10) {
if(old == laCrossroads || old == laCrossroads2) tab[cnt++] = laOcean;
if(old == laOcean) tab[cnt++] = laCrossroads2;
}
if(ls::horodisk_structure() && tortoise::seek()) LIKELY tab[cnt++] = laTortoise;
2017-10-08 10:10:40 +00:00
int idx = 0;
while (idx < cnt) {
eLand n = tab[idx];
if (incompatible(n, old) || !isLandIngame(n))
tab[idx] = tab[--cnt];
else
idx++;
}
if (!cnt) {
addMessage("No eligible land candidates!");
return old;
}
eLand n = tab[hrand(cnt)];
if (weirdhyperbolic && specialland == laCrossroads4 && isCrossroads(n))
n = laCrossroads4;
2017-10-08 10:10:40 +00:00
return n;
}
EX eLand getNewLand2(vector<eLand> olds) {
for(int i=0;; i++) {
auto old = hrand_elt(olds);
eLand l = getNewLand(old);
// how bad it is
int err = 0;
for(auto o: olds) if(l == o) err += 2000;
for(auto o: olds) if(incompatible(l, o)) err += 1000;
for(auto o: olds) if(voronoi_sea_incompatible(l, o)) err += 100;
// we still allow bad choices if we cannot obtain a good one
if(err <= i) return l;
}
}
2019-08-09 21:39:36 +00:00
EX vector<eLand> land_over = {
2017-11-03 18:31:42 +00:00
laIce, laCaves, laDesert, laHunting, laMotion, laJungle, laAlchemist,
laCrossroads,
2020-02-28 23:16:35 +00:00
laMirror, laMirrorOld, laMinefield, laPalace, laPrincessQuest, laZebra, laSwitch, laReptile, laWet,
laOcean, laDocks, laWarpCoast, laLivefjord, laKraken, laCaribbean, laBrownian, laWhirlpool, laRlyeh, laTemple,
laIvoryTower, laEndorian, laWestWall, laDungeon, laMountain,
2017-11-03 18:31:42 +00:00
laCrossroads2,
laDryForest, laWineyard, laDeadCaves, laGraveyard, laHaunted, laHive,
laRedRock, laVolcano,
2021-05-29 18:06:14 +00:00
laDragon, laTortoise, laDice,
2017-11-03 22:55:20 +00:00
laOvergrown, laClearing, laStorms, laBurial, laWhirlwind,
2017-11-03 18:31:42 +00:00
laBlizzard,
2021-05-29 18:06:14 +00:00
laFrog, laEclectic, laCursed,
laRuins, laEmerald, laVariant, laCamelot,
2017-11-03 22:55:20 +00:00
laPrairie, laBull, laTerracotta, laRose,
2017-11-03 18:31:42 +00:00
laElementalWall, laTrollheim,
laHell, laCrossroads3, laCocytus, laPower, laCrossroads4,
2017-12-30 14:12:15 +00:00
laCrossroads5,
2017-11-03 18:31:42 +00:00
// EXTRA
2019-04-07 01:09:01 +00:00
laWildWest, laHalloween, laDual, laSnakeNest, laMagnetic, laCA, laAsteroids
2017-11-03 18:31:42 +00:00
};
2019-08-09 21:39:36 +00:00
EX vector<eLand> landlist;
2017-11-03 18:31:42 +00:00
2019-08-09 21:39:36 +00:00
#if HDR
2017-11-03 18:31:42 +00:00
template<class T> void generateLandList(T t) {
landlist.clear();
for(auto l: land_over) if(t(l)) landlist.push_back(l);
}
2019-08-09 21:39:36 +00:00
#endif
2017-11-03 18:31:42 +00:00
2019-08-10 08:57:14 +00:00
#if HDR
namespace lv {
static constexpr flagtype appears_in_geom_exp = 1;
static constexpr flagtype display_error_message = 2;
static constexpr flagtype appears_in_full = 4;
static constexpr flagtype appears_in_ptm = 8;
static constexpr flagtype display_in_help = 16;
static constexpr flagtype one_and_half = 32;
static constexpr flagtype switch_to_single = 64;
}
2019-08-10 08:57:14 +00:00
struct land_validity_t {
int quality_level; // 0 (dont show), 1 (1/2), 2 (ok), 3(1!)
flagtype flags;
string msg;
};
#endif
2019-08-09 20:07:03 +00:00
EX eLand getLandForList(cell *c) {
2017-11-03 18:31:42 +00:00
eLand l = c->land;
if(isElemental(l)) return laElementalWall;
if(l == laWarpSea) return laWarpCoast;
if(l == laMercuryRiver) return laTerracotta;
if(l == laBarrier) return laCrossroads;
if(l == laOceanWall) return laOcean;
if(l == laPalace && princess::dist(cwt.at) < OUT_OF_PRISON)
2017-11-03 18:31:42 +00:00
l = laPrincessQuest;
// princess?
return l;
}
2024-03-14 18:27:08 +00:00
EX bool use_custom_land_list;
EX array<bool, landtypes> custom_land_list;
EX array<int, landtypes> custom_land_treasure;
EX array<int, landtypes> custom_land_difficulty;
EX array<int, landtypes> custom_land_wandering;
EX array<int, landtypes> custom_land_ptm_runs, custom_land_ptm_mult;
2024-03-14 18:27:08 +00:00
2019-08-09 20:07:03 +00:00
EX bool isLandIngame(eLand l) {
2018-02-12 19:23:07 +00:00
if(isElemental(l)) l = laElementalWall;
2024-03-14 18:27:08 +00:00
if(use_custom_land_list) return custom_land_list[l];
2019-05-28 23:09:38 +00:00
if(dual::state == 2 && !dual::check_side(l)) return false;
if((eubinary || sol) && isCyclic(l) && l != specialland) return false;
2019-08-02 15:29:53 +00:00
if(l == laCamelot && hyperbolic && WDIM == 3) return false;
2018-04-13 11:08:41 +00:00
return land_validity(l).flags & lv::appears_in_full;
}
EX bool landUnlockedIngame(eLand l) {
if(!peace::on && !landUnlocked(l)) return false;
return isLandIngame(l);
}
2018-04-13 11:08:41 +00:00
namespace lv {
2018-04-15 11:04:44 +00:00
flagtype q0 = lv::display_error_message | lv::display_in_help | lv::appears_in_geom_exp;
2018-04-13 11:08:41 +00:00
flagtype q1 = lv::display_error_message | lv::appears_in_geom_exp | lv::appears_in_full | lv::display_in_help;
2018-04-14 07:43:58 +00:00
flagtype q2 = lv::appears_in_geom_exp | lv::appears_in_full | lv::display_in_help | lv::appears_in_ptm;
flagtype q3 = lv::appears_in_geom_exp | lv::appears_in_full | lv::display_in_help | lv::appears_in_ptm;
2018-04-15 11:04:44 +00:00
flagtype qm2= q2 | lv::display_error_message;
flagtype qm3= q3 | lv::display_error_message;
land_validity_t hedgehogs = { 1, qm2 &~ lv::appears_in_full, "Cannot kill Hedgehog Warriors in this geometry."};
2018-04-13 11:08:41 +00:00
land_validity_t no_randpattern_version = { 0, q0, "No random pattern version."};
land_validity_t no_great_walls = { 0, q0, "Great Walls not implemented."};
land_validity_t pattern_incompatibility = { 0, q0, "Pattern incompatible."};
2018-05-01 17:34:57 +00:00
land_validity_t pattern_not_implemented_random = { 1, q1 | one_and_half, "Pattern not implemented -- using random."};
2018-04-13 11:08:41 +00:00
land_validity_t pattern_not_implemented_weird = { 1, q1, "Pattern not implemented."};
2018-04-15 11:04:44 +00:00
land_validity_t pattern_not_implemented_exclude = { 1, q1 & ~ lv::appears_in_full, "Pattern not implemented."};
2018-04-13 11:08:41 +00:00
land_validity_t not_enough_space = { 0, q0, "Not enough space."};
land_validity_t dont_work = { 0, q0, "Does not work in this geometry."};
land_validity_t bounded_only = { 0, q0, "This land is designed for bounded worlds."};
land_validity_t unbounded_only = { 0, q0, "This land is designed for infinite worlds."};
land_validity_t unbounded_only_except_bigsphere = { 0, q0, "This land is designed for infinite worlds or big spheres."};
2018-04-15 11:04:44 +00:00
land_validity_t out_of_theme = { 3, qm2 &~ lv::appears_in_full, "Out of theme for the full game."};
2018-04-13 11:08:41 +00:00
land_validity_t no_game = { 2, q2 &~ lv::appears_in_full, "No game here."};
land_validity_t not_in_chaos = { 0, q0, "Does not work in chaos mode."};
land_validity_t not_in_landscape = { 0, q0, "Does not work in landscape mode."};
2018-04-15 11:04:44 +00:00
land_validity_t not_in_full_game = {2, qm2 &~ lv::appears_in_full, "Not in the full game."};
land_validity_t not_in_full_game3 = {3, qm2 &~ lv::appears_in_full, "Not in the full game."};
land_validity_t special_chaos = { 2, qm2, "Special construction in the Chaos mode." };
land_validity_t special_euclidean = { 2, qm2, "Special construction in the Euclidean mode." };
land_validity_t special_geo = { 2, qm2, "Special construction in this geometry." };
land_validity_t special_geo3 = { 3, qm2, "Special construction in this geometry." };
2018-04-13 11:08:41 +00:00
land_validity_t not_implemented = {0, q0, "Not implemented."};
2018-05-01 17:34:57 +00:00
land_validity_t partially_implemented = {1, q1 | one_and_half, "Partially implemented."};
2018-04-13 11:08:41 +00:00
land_validity_t ok = {2, q2 &~ lv::display_in_help, "No comments."};
land_validity_t not_in_ptm = {0, q0, "Does not work in pure tactics mode."};
2018-04-15 11:04:44 +00:00
land_validity_t technical = {0, q0 &~ lv::appears_in_geom_exp, "Technical."};
land_validity_t full_game = {3, q3 &~ lv::display_in_help, "Full game."};
land_validity_t inaccurate = {1, q1, "Somewhat inaccurate."};
2018-05-01 17:34:57 +00:00
land_validity_t great_walls_missing = {1, q1 | one_and_half, "Mercury rivers not implemented (or could not work) in this geometry."};
2018-04-15 11:04:44 +00:00
land_validity_t pattern_compatibility = {3, qm3, "Patterns compatible."};
land_validity_t pattern_defined = {3, qm3, "Pattern defined."};
land_validity_t pattern_compatibility_notrec = {2, qm2, "Patterns compatible."};
2018-04-15 11:04:44 +00:00
land_validity_t specially_designed = {3, qm3, "This land is specially designed for this geometry."};
2018-04-13 11:08:41 +00:00
land_validity_t needs_threecolor = {0, q0, "Three-colorability required."};
2018-04-15 11:04:44 +00:00
land_validity_t land_not_implemented = {0, q0 &~ lv::appears_in_geom_exp, "Land not implemented."};
2018-04-13 11:08:41 +00:00
land_validity_t interesting = {3, q3, "Special interest."};
land_validity_t better_version_exists = {0, q0, "Better version exists."};
2018-04-15 11:04:44 +00:00
land_validity_t dont_work_but_ingame = {1, q0 | lv::appears_in_full, "Does not work in this geometry."};
land_validity_t ugly_version_infull = {1, q1 | lv::appears_in_full, "Grid does not work in this geometry."};
land_validity_t ugly_version_nofull = {1, q1, "Grid does not work in this geometry."};
2018-04-13 11:08:41 +00:00
land_validity_t bad_graphics = {1, q1, "Graphics not implemented in this geometry."};
land_validity_t some0 = {0, q0, "This land does not work in the current settings. Reason not available."};
land_validity_t some1 = {1, q1, "This land does not work well in the current settings. Reason not available."};
land_validity_t known_buggy = {1, q1, "This combination is known to be buggy at the moment."};
2018-05-01 17:34:57 +00:00
land_validity_t sloppy_pattern = {1, q1 | one_and_half, "Somewhat sloppy pattern."};
land_validity_t no_fractal_landscapes = {1, q1 | one_and_half, "Fractal landscapes not implemented in this geometry."};
land_validity_t simplified_walls = { 1, q1, "Only simplified walls implemented."};
land_validity_t no_walls = { 0, q0, "No walls implemented."};
2019-02-17 17:33:15 +00:00
land_validity_t disabled = {0, q0, "This land has been disabled with compilation flags."};
2019-03-16 21:18:19 +00:00
land_validity_t pattern_special = {3, qm3, "Special pattern implemented for this geometry."};
land_validity_t not_3d = {0, q0, "This land does not make much sense in 3D."};
land_validity_t not_binary = {0, q0, "This land does not make much sense in binary tiling."};
land_validity_t shmup_only = {0, q0, "This land works only in the shmup mode."};
land_validity_t not_in_shmup = {0, q0, "This land is not available in the shmup mode."};
land_validity_t not_in_multi = {0, q0, "This land is not available in multiplayer."};
land_validity_t single_only = {2, q0 | switch_to_single, "Available in single land mode only." };
2023-09-14 09:41:51 +00:00
land_validity_t not_in_hv = { 0, q0, "Does not work in horodisk/Voronoi mode."};
}
// old Daily Challenges should keep their validity forever
// set this number for historical values of land_validity
EX int old_daily_id = 1000000;
2019-12-06 13:07:11 +00:00
const int landscapes_when = 177;
2019-07-21 20:56:10 +00:00
EX const int frog_when = 205;
EX const int cursed_when = 386;
EX const int walls_when = 388;
2021-07-31 18:30:41 +00:00
2024-03-14 18:27:08 +00:00
EX void mark_tamper() { cheater++; }
EX void customize_land_in_list(eLand l) {
2024-03-23 23:51:20 +00:00
cmode = sm::SIDE | sm::MAYDARK; gamescreen();
2024-03-14 18:27:08 +00:00
dialog::init(XLATN(linf[l].name), linf[l].color);
help = generateHelpForLand(l);
addHelpWithTitle();
dialog::addBreak(100);
dialog::addBoolItem(XLAT("land in game"), custom_land_list[l], 'a');
dialog::add_action([l] {
custom_land_list[l] = !custom_land_list[l];
cheater++;
});
dialog::addSelItem(XLAT("treasure rate"), its(custom_land_treasure[l]), 't');
dialog::add_action([l] {
dialog::editNumber(custom_land_treasure[l], 0, 1000, 10, 100, XLAT("treasure rate in %the1", linf[l].name), "");
dialog::get_ne().reaction = mark_tamper;
});
dialog::addSelItem(XLAT("difficulty"), its(custom_land_difficulty[l]), 'd');
dialog::add_action([l] {
dialog::editNumber(custom_land_difficulty[l], 0, 1000, 10, 100, XLAT("difficulty of %the1", linf[l].name), "");
dialog::get_ne().reaction = mark_tamper;
});
dialog::addSelItem(XLAT("wandering"), its(custom_land_wandering[l]), 'w');
dialog::add_action([l] {
dialog::editNumber(custom_land_wandering[l], 0, 1000, 10, 100, XLAT("difficulty of %the1", linf[l].name), "");
dialog::get_ne().reaction = mark_tamper;
});
dialog::addSelItem(XLAT("PTM runs"), its(custom_land_ptm_runs[l]), 'r');
dialog::add_action([l] {
dialog::editNumber(custom_land_ptm_runs[l], 0, 10, 3, 1, XLAT("%the1: number of PTM runs", linf[l].name), "");
dialog::get_ne().reaction = mark_tamper;
dialog::bound_up(10);
dialog::bound_low(0);
});
dialog::addSelItem(XLAT("PTM multiplier"), its(custom_land_ptm_mult[l]), 'm');
dialog::add_action([l] {
dialog::editNumber(custom_land_ptm_mult[l], 0, 100, 1, 1, XLAT("%the1: PTM multiplier", linf[l].name), "");
dialog::get_ne().reaction = mark_tamper;
});
2024-03-23 23:51:20 +00:00
gen_landvisited();
if(landvisited[l]) {
dialog::addItem(XLAT("test"), 'T');
dialog::add_action([l] {
stop_game(); firstland = specialland = l; start_game();
});
}
2024-03-14 18:27:08 +00:00
dialog::addBack();
dialog::display();
}
EX void customize_land_list() {
2024-03-23 23:51:20 +00:00
cmode = sm::SIDE | sm::MAYDARK; gamescreen();
2024-03-14 18:27:08 +00:00
dialog::init(XLAT("custom land list"));
if(dialog::infix != "") mouseovers = dialog::infix;
generateLandList([] (eLand l) {
if(!use_custom_land_list) {
custom_land_list[l] = isLandIngame(l);
custom_land_treasure[l] = 100;
custom_land_difficulty[l] = 100;
custom_land_wandering[l] = 100;
custom_land_ptm_runs[l] = tactic::default_runs(l);
custom_land_ptm_mult[l] = tactic::default_mult(l);
2024-03-14 18:27:08 +00:00
}
if(dialog::infix != "" && !dialog::hasInfix(linf[l].name)) return false;
if(l == laCanvas) return true;
return !!(land_validity(l).flags & lv::appears_in_geom_exp);
});
stable_sort(landlist.begin(), landlist.end(), [] (eLand l1, eLand l2) { return land_validity(l1).quality_level > land_validity(l2).quality_level; });
dialog::start_list(900, 900, '1');
for(eLand l: landlist) {
dialog::addBoolItem(XLAT1(linf[l].name), custom_land_list[l], dialog::list_fake_key++);
string s;
if(custom_land_treasure[l] != 100) s += "$" + its(custom_land_treasure[l]) + " ";
if(custom_land_difficulty[l] != 100) s += "!" + its(custom_land_difficulty[l]) + " ";
if(custom_land_wandering[l] != 100) s += "^" + its(custom_land_wandering[l]) + " ";
if(s != "") dialog::lastItem().value = s;
dialog::add_action_confirmed([l] {
if(!use_custom_land_list) {
stop_game();
use_custom_land_list = true;
start_game();
}
2024-03-14 18:27:08 +00:00
pushScreen([l] { customize_land_in_list(l); });
});
}
dialog::end_list();
dialog::addInfo(XLAT("press letters to search"));
dialog::addBoolItem("custom land list mode", use_custom_land_list, 'U');
dialog::add_action_confirmed([] {
stop_game();
use_custom_land_list = !use_custom_land_list;
start_game();
});
if(use_custom_land_list) {
dialog::addItem("disable/enable all", 'D');
dialog::add_action([] {
int qty = 0;
for(int i=0; i<landtypes; i++) if(custom_land_list[i]) qty++;
for(int i=0; i<landtypes; i++) custom_land_list[i] = !qty;
});
}
else dialog::addBreak(100);
2024-03-14 18:27:08 +00:00
dialog::addHelp();
dialog::add_action([] {
gotoHelp(XLAT(
"In this mode, you can choose the lands you want to be in game. You can also customize their treasure rate and difficulty.\n\n"
"While the game automatically selects a list of lands by default, "
"based on whether it thinks they work well in the currently selected tiling, "
"you might not agree with this selection.\n\n"
"Note that, often, lands are enabled or disabled for a GOOD reason! Use at your own risk.\n\n"
"Just click on a land to configure it. If you are not in the custom land list mode, "
"this will restart the game. You can change the settings during a custom game, but it counts as a cheat."
));
});
dialog::addBack();
dialog::display();
keyhandler = [] (int sym, int uni) {
dialog::handleNavigation(sym, uni);
if(dialog::editInfix(uni)) dialog::list_skip = 0;
else if(doexiton(sym, uni)) popScreen();
};
}
2017-11-03 18:31:42 +00:00
// check if the given land should appear in lists
2019-08-09 20:07:03 +00:00
EX land_validity_t& land_validity(eLand l) {
2018-04-13 11:08:41 +00:00
bool stdeucx = stdeuc;
if(euclid && quotient) stdeucx = false;
2018-04-13 11:08:41 +00:00
using namespace lv;
2023-03-24 22:18:16 +00:00
if(hat::in()) {
if(l == laKraken) return dont_work;
if(l == laWineyard) return dont_work;
if(l == laReptile) return bad_graphics;
if(l == laBull) return ok;
if(l == laHaunted) return dont_work;
if(l == laHive) return not_in_full_game;
if(l == laRedRock) return ok;
if(l == laStorms) return ok;
if(l == laDice) return dont_work;
if(l == laVolcano) return dont_work;
if(l == laBlizzard) return dont_work;
if(l == laBurial) return dont_work;
if(l == laEclectic) return dont_work;
if(l == laCursed) return dont_work;
if(l == laElementalWall) return dont_work;
if(l == laDragon) return not_in_full_game;
}
if(l == laDice && geometry == gNormal && PURE)
return dont_work;
if(l == laDice && WDIM == 3)
return dont_work;
if(old_daily_id < frog_when && among(l, laFrog, laEclectic, laWet))
return not_implemented;
if(old_daily_id < cursed_when && among(l, laCursed, laDice))
return not_implemented;
2020-06-03 09:46:16 +00:00
if(arb::in() && among(l, laWarpCoast, laDual, laEclectic, laReptile, laKraken))
return not_implemented;
if(l == laEclectic && !(geometry == gNormal && BITRUNCATED))
return pattern_not_implemented_weird;
2020-03-07 22:44:22 +00:00
if(l == laFrog && shmup::on)
return not_in_shmup;
if(walls_not_implemented() && isCrossroads(l))
return no_walls;
2022-12-08 18:38:06 +00:00
if(mhybrid || hybrid::pmap) {
2019-08-19 12:29:32 +00:00
if(among(l, laPrincessQuest, laPrairie, laMirrorOld, laMirror, laDual, laWarpCoast, laKraken, laBrownian, laWhirlpool, laWestWall, laHive, laClearing, laWhirlwind, laBlizzard, laBull, laTerracotta, laCrossroads5,
laEndorian, laDungeon, laMountain))
return lv::not_implemented;
if(among(l, laReptile, laDragon, laTortoise))
return lv::bad_graphics;
if((hybrid::actual_geometry == gTwistedProduct || geometry == gTwistedProduct) && l == laDryForest)
2019-08-25 17:49:45 +00:00
return lv::hedgehogs;
2022-12-08 18:38:06 +00:00
if(mhybrid && hybrid::underlying && hybrid::underlying_cgip) {
return *PIU(&land_validity(l));
}
2019-08-19 12:29:32 +00:00
}
2019-02-17 17:33:15 +00:00
#if !CAP_FIELD
if(among(l, laPrairie, laBlizzard, laVolcano))
return disabled;
#endif
#if !CAP_COMPLEX2
if(among(l, laBrownian, laWestWall, laVariant))
return disabled;
#endif
if(l == laMinefield && closed_or_bounded)
2019-04-05 12:03:53 +00:00
return special_geo3;
if(l == laAsteroids) {
if(!shmup::on) return shmup_only;
if(!closed_manifold) return bounded_only;
return specially_designed;
}
2019-08-07 22:23:10 +00:00
if(nil) {
if(among(l, laCrossroads, laCrossroads2, laCrossroads3, laCrossroads4))
return lv::full_game;
if(among(l, laPalace, laGraveyard, laWineyard, laElementalWall))
return lv::pattern_special;
if(among(l, laEndorian, laCaribbean, laHaunted, laVolcano, laClearing, laStorms, laBlizzard))
return lv::not_implemented;
}
2019-05-08 16:33:08 +00:00
if(WDIM == 3) {
if(l == laWarpCoast) return ugly_version_nofull;
if(l == laWineyard && hyperbolic && !bt::in() && S7 == 6) return lv::pattern_special;
if(l == laEmerald && hyperbolic && !bt::in() && S7 == 12) return lv::pattern_special;
2019-03-16 21:18:19 +00:00
if(l == laZebra) return pattern_not_implemented_random;
if(among(l, laWhirlpool, laPrairie, laWestWall, laBull)) return lv::not_3d;
2019-07-28 09:43:58 +00:00
if(l == laEndorian && geometry == gKiteDart3) return not_implemented;
if(l == laEndorian && sol) return not_implemented;
if(l == laEndorian && hyperbolic && !quotient) return lv::pattern_special;
if(l == laIvoryTower && hyperbolic && bt::in()) return lv::pattern_special;
if(l == laDungeon || l == laBrownian) return not_implemented;
if(l == laKraken) return bt::in() ? not_binary : not_implemented;
2019-03-16 21:18:19 +00:00
if(l == laBurial && !shmup::on) return not_implemented;
if(l == laMirrorOld && !shmup::on) return not_implemented;
}
2023-09-14 09:41:51 +00:00
2023-10-05 11:53:24 +00:00
if(ls::hv_structure() && among(l, laDungeon, laEndorian, laBrownian, laPrincessQuest)) return not_in_hv;
if(ls::voronoi_structure() && among(l, laPrairie, laCamelot, laWhirlpool, laClearing, laHaunted, laWestWall)) return not_in_hv;
2023-09-18 09:09:35 +00:00
if(ls::horodisk_structure() && l != laCrossroads && isCrossroads(l)) return not_in_hv;
if(l == laBrownian) {
if(quotient || !hyperbolic || cryst) return dont_work;
}
if(bt::in()) {
if(among(l, laMountain, laTemple)) return lv::pattern_compatibility;
if(among(l, laDungeon, laIvoryTower, laOcean, laEndorian)) return lv::pattern_compatibility;
if(among(l, laCaribbean, laCamelot)) return lv::pattern_compatibility_notrec;
// Clearing -- does not generate
/* laCamelot, laCaribbean -> they are OK but not recommended */
}
2019-02-17 17:28:20 +00:00
#if CAP_ARCM
if(arcm::in()) {
if(among(l, laPower, laZebra, laFrog, laWineyard) && arcm::current.have_line) return lv::pattern_defined;
// horocycles not implemented
if(isCyclic(l)) return not_implemented;
}
2019-02-17 17:28:20 +00:00
#endif
2019-07-28 10:05:42 +00:00
2019-02-17 17:28:20 +00:00
#if CAP_CRYSTAL
if(cryst) {
2018-12-04 01:38:44 +00:00
if(l == laCamelot) return interesting;
if(isCrossroads(l)) return full_game;
}
2019-02-17 17:28:20 +00:00
#endif
2017-11-03 18:31:42 +00:00
// Random Pattern allowed only in some specific lands
if(randomPatternsMode && !isRandland(l))
2018-04-13 11:08:41 +00:00
return no_randpattern_version;
2017-11-03 18:31:42 +00:00
if(isElemental(l)) {
if(l != laElementalWall)
2018-04-13 11:08:41 +00:00
return technical;
2017-11-03 18:31:42 +00:00
// not good in Field quotient
2018-06-21 23:48:46 +00:00
if(geometry == gZebraQuotient)
2018-04-13 11:08:41 +00:00
return special_geo3;
2019-07-30 11:03:06 +00:00
if(quotient || sol)
2018-06-21 23:48:46 +00:00
return no_great_walls;
if(weirdhyperbolic)
return simplified_walls;
// works nice on a big non-tetrahedron-based sphere
if(sphere && S3 != 3 && GOLDBERG)
2018-04-13 11:08:41 +00:00
return special_geo3;
2017-11-03 18:31:42 +00:00
}
2018-11-30 14:26:50 +00:00
// not enough space
if(l == laStorms && (old_daily_id < 35 ? !BITRUNCATED : PURE) && elliptic)
return not_enough_space;
if(l == laStorms && WDIM == 3)
return not_in_full_game; /* uses too much memory */
2018-11-30 14:26:50 +00:00
if(l == laStorms && S7 == 3)
return not_enough_space;
2017-11-03 18:31:42 +00:00
// does not agree with the pattern
2018-06-21 23:48:46 +00:00
if(l == laStorms && quotient && geometry != gZebraQuotient)
return pattern_not_implemented_random;
2017-11-03 18:31:42 +00:00
// pattern not implemented
if(l == laStorms && S7 == 8)
2018-04-13 11:08:41 +00:00
return pattern_not_implemented_random;
// mirrors do not work in gp
if(among(l, laMirror, laMirrorOld) && (GOLDBERG && old_daily_id < 33))
2018-04-13 11:08:41 +00:00
return dont_work;
2019-07-28 09:43:58 +00:00
// mirrors do not work in kite and sol
if(among(l, laMirror, laMirrorOld) && (aperiodic || sol))
2019-07-28 09:43:58 +00:00
return dont_work;
2019-07-28 09:43:58 +00:00
if(isCrossroads(l) && geometry == gBinary4)
return not_implemented;
if(bt::in() && among(l, laMirror, laMirrorOld))
2018-08-21 13:37:59 +00:00
return dont_work;
if(l == laWhirlwind && hyperbolic_not37)
return pattern_incompatibility;
2024-04-06 09:45:51 +00:00
bool better_mirror = !geometry && STDVAR && !ls::hv_structure() && !among(land_structure, lsTotalChaos, lsPatchedChaos, lsLandscape, lsVineWalls);
2023-09-14 09:41:51 +00:00
// available only in non-standard geometries
2023-09-14 09:41:51 +00:00
if(l == laMirrorOld && better_mirror)
2018-04-13 11:08:41 +00:00
return better_version_exists;
2017-11-03 18:31:42 +00:00
// available only in standard geometry
2023-09-14 09:41:51 +00:00
if(l == laMirror && !better_mirror)
2018-04-13 11:08:41 +00:00
return not_implemented;
2017-11-03 18:31:42 +00:00
// Halloween needs bounded world (can be big bounded)
if(l == laHalloween && !closed_or_bounded)
2018-04-13 11:08:41 +00:00
return bounded_only;
2017-11-03 18:31:42 +00:00
// Crystal World is designed for nice_dual geometries
2019-08-07 22:23:10 +00:00
if(l == laDual && (!has_nice_dual() || nonisotropic))
2018-04-13 11:08:41 +00:00
return dont_work;
2017-11-03 18:31:42 +00:00
2021-04-11 20:15:40 +00:00
if(l == laHaunted && ls::std_chaos())
2018-04-13 11:08:41 +00:00
return not_in_chaos;
if(among(l, laHaunted, laElementalWall) && land_structure == lsLandscape)
return not_in_landscape;
2017-11-03 18:31:42 +00:00
// standard, non-PTM specific
if(l == laCrossroads5 && old_daily_id < 999 && tactic::on)
2018-04-13 11:08:41 +00:00
return not_in_ptm;
2017-11-03 18:31:42 +00:00
// standard non-PTM non-chaos specific
if((l == laCrossroads5 || l == laCrossroads2) && (geometry || ls::any_chaos() || ls::no_walls()))
2018-04-13 11:08:41 +00:00
return some0;
2017-11-03 21:05:08 +00:00
2018-05-01 17:34:37 +00:00
// special construction in the Chaos mode
2021-04-11 20:15:40 +00:00
if(ls::any_chaos() && (l == laTemple || l == laHive || l == laOcean || l == laHaunted))
2018-05-01 17:34:37 +00:00
return special_chaos;
2018-07-10 19:29:33 +00:00
if(l == laWhirlpool && a4)
return dont_work;
2018-05-01 17:34:37 +00:00
if(isWarpedType(l) && a4 && GOLDBERG)
return dont_work;
2019-02-17 17:28:20 +00:00
#if CAP_IRR
if((isWarpedType(l) || l == laDual) && IRREGULAR && !irr::bitruncations_performed)
2018-07-16 18:05:23 +00:00
return dont_work;
if(IRREGULAR && among(l, laPrairie, laMirror, laMirrorOld))
return dont_work;
2019-02-17 17:28:20 +00:00
#endif
2018-08-30 14:08:05 +00:00
if(arcm::in() && l == laPrairie) return dont_work;
if((IRREGULAR || arcm::in()) && among(l, laBlizzard, laVolcano) && !sphere)
2018-07-16 18:05:23 +00:00
return dont_work;
if(arcm::in() && DUAL && l == laCrossroads4)
2018-08-30 14:08:05 +00:00
return not_implemented;
2019-07-28 09:43:58 +00:00
if(geometry == gKiteDart3 && l == laGraveyard)
return lv::pattern_special;
2017-11-03 21:05:08 +00:00
// equidistant-based lands
2018-05-01 17:34:37 +00:00
if(isEquidLand(l)) {
2017-11-03 21:05:08 +00:00
// no equidistants supported in chaos mode
2021-04-11 20:15:40 +00:00
if(ls::any_chaos())
2018-04-13 11:08:41 +00:00
return not_in_chaos;
2018-08-30 14:08:05 +00:00
// the algorithm fails in Archimedean DUAL
if(arcm::in() && DUAL)
2018-08-30 14:08:05 +00:00
return not_implemented;
2019-07-28 09:43:58 +00:00
// the algorithm fails in Binary4
if(geometry == gBinary4)
return not_implemented;
2017-11-03 21:05:08 +00:00
// no equidistants supported in these geometries (big sphere is OK though)
if(closed_or_bounded && !bigsphere)
2018-04-13 11:08:41 +00:00
return unbounded_only_except_bigsphere;
2017-11-03 21:05:08 +00:00
// Yendorian only implemented in standard
2017-11-03 22:55:20 +00:00
if(l == laEndorian && geometry)
2018-04-13 11:08:41 +00:00
return not_implemented;
2017-11-03 21:05:08 +00:00
// special Euclidean implementations
if(euclid && !ls::single() && old_daily_id > 9999) return single_only;
if(euclid && (l == laIvoryTower || l == laMountain || l == laOcean || l == laMountain)) {
2018-04-13 11:08:41 +00:00
return special_geo;
}
// in other geometries, it works
2017-11-03 21:05:08 +00:00
if(geometry)
2018-04-13 11:08:41 +00:00
return ok;
2017-11-03 21:05:08 +00:00
}
2021-09-30 14:17:37 +00:00
if(euclid && l == laCaribbean && !ls::single() && old_daily_id > 9999) return single_only;
2017-11-03 18:31:42 +00:00
2021-04-11 20:15:40 +00:00
if(l == laPrincessQuest && ls::any_chaos())
2018-04-13 11:08:41 +00:00
return not_in_chaos;
if(l == laPrincessQuest && tactic::on)
return not_in_ptm;
if(l == laPrincessQuest && (!stdeucx || NONSTDVAR))
2018-04-13 11:08:41 +00:00
return not_implemented;
if(l == laPrincessQuest && shmup::on)
return not_in_shmup;
if(l == laPrincessQuest && multi::players > 1)
return not_in_multi;
2017-11-03 18:31:42 +00:00
2021-04-11 20:15:40 +00:00
if(l == laMountain && ls::any_chaos())
return not_in_chaos;
2021-04-11 20:15:40 +00:00
if(l == laBrownian && ls::any_chaos())
return not_in_chaos;
2017-11-03 18:31:42 +00:00
// works correctly only in some geometries
2021-04-11 20:15:40 +00:00
if(l == laClearing && ls::any_chaos())
2018-04-13 11:08:41 +00:00
return not_in_chaos;
2017-11-03 18:31:42 +00:00
if(l == laClearing)
2021-04-25 09:10:09 +00:00
if(!(stdeucx || geometry == gBinaryTiling || a38 || (a45 && BITRUNCATED) || (a47 && BITRUNCATED)) || NONSTDVAR)
if(!closed_or_bounded)
2018-04-13 11:08:41 +00:00
return not_implemented;
2017-11-03 18:31:42 +00:00
2018-01-06 21:34:03 +00:00
// does not work in non-bitrunc a4
if(l == laOvergrown && a4 && !BITRUNCATED)
2018-04-13 11:08:41 +00:00
return some0;
2017-11-03 18:31:42 +00:00
// does not work in bounded either
if(l == laOvergrown && closed_or_bounded)
2018-04-13 11:08:41 +00:00
return some0;
2017-11-03 18:31:42 +00:00
// horocycle-based lands, not available in bounded geometries nor in Chaos mode
2018-04-13 11:08:41 +00:00
if(l == laWhirlpool || l == laCamelot || l == laCaribbean || l == laTemple || l == laHive) {
2021-04-11 20:15:40 +00:00
if(ls::any_chaos()) {
2018-04-13 11:08:41 +00:00
if(l == laTemple || l == laHive)
return special_chaos;
return not_in_chaos;
}
if(arcm::in() || aperiodic) return not_implemented;
if(closed_or_bounded) return unbounded_only;
2020-07-12 22:53:48 +00:00
if(INVERSE) return not_implemented;
2018-04-13 11:08:41 +00:00
}
2017-11-03 18:31:42 +00:00
// this pattern does not work on elliptic and small spheres
if((l == laBlizzard || l == laVolcano) && elliptic && S7 < 5 && !arcm::in())
2018-04-13 11:08:41 +00:00
return not_enough_space;
2017-11-03 18:31:42 +00:00
// ... and it works in gp only partially
if((l == laBlizzard || l == laVolcano) && GOLDBERG && (old_daily_id < 33 || !sphere))
2018-04-13 11:08:41 +00:00
return partially_implemented;
// Kraken does not really work on odd-sided cells;
// a nice football pattern will solve the problem by forbidding the Kraken to go there
// (but we do have to allow it in non-bitrunc standard)
if(l == laKraken && (S7&1) && !has_nice_dual()) {
2018-04-13 11:08:41 +00:00
return dont_work_but_ingame;
}
2017-11-03 18:31:42 +00:00
// works in most spheres, Zebra quotient, and stdeucx
if(l == laWhirlwind) {
2018-06-21 23:48:46 +00:00
if(geometry == gZebraQuotient)
2018-04-13 11:08:41 +00:00
return pattern_compatibility;
if(stdeucx) ;
else if(S7 == 4 && BITRUNCATED) return special_geo;
else if(bigsphere && !BITRUNCATED && !elliptic) return special_geo;
2018-04-13 11:08:41 +00:00
else return dont_work;
}
2017-11-03 18:31:42 +00:00
// needs standard/Euclidean (needs fractal landscape)
if(among(l, laTortoise, laVariant) && !(old_daily_id < landscapes_when ? stdeucx : geometry_supports_cdata()))
2018-04-13 11:08:41 +00:00
return not_implemented;
2017-11-03 18:31:42 +00:00
// technical lands do not count
if(l != laCA && isTechnicalLand(l))
2018-04-13 11:08:41 +00:00
return technical;
2017-11-03 18:31:42 +00:00
// only in bounded geometry, and not in PTM
if(l == laCA && !closed_or_bounded)
2018-04-13 11:08:41 +00:00
return bounded_only;
2017-11-03 18:31:42 +00:00
if(l == laCA && tactic::on)
2018-04-13 11:08:41 +00:00
return not_in_ptm;
if(l == laCA)
return no_game;
2017-11-03 18:31:42 +00:00
// Dragon Chasm requires unbounded space [partial]
if(l == laDragon && smallbounded)
2018-04-13 11:08:41 +00:00
return unbounded_only;
2017-11-03 18:31:42 +00:00
2018-01-06 21:34:03 +00:00
// Graveyard pattern does not work on non-bitrunc weird geometries
2018-08-20 13:24:44 +00:00
if((l == laGraveyard && !randomPatternsMode) || l == laRuins || l == laRedRock) switch(geosupport_football()) {
2018-04-13 11:08:41 +00:00
case 0:
return dont_work;
case 1:
return sloppy_pattern;
default: ;
}
2017-11-03 18:31:42 +00:00
2018-01-06 21:34:03 +00:00
// Warped Coast does not work on non-bitrunc S3s (except standard heptagonal where we have to keep it)
if(l == laWarpCoast && (S3==3) && geosupport_football() != 2 && !(old_daily_id >= 33 && geosupport_chessboard())) {
return ugly_version_infull;
}
2018-04-13 11:15:00 +00:00
2018-06-21 23:48:46 +00:00
if(l == laWarpCoast && quotient && geometry != gZebraQuotient && !randomPatternsMode)
2018-04-13 11:15:00 +00:00
return pattern_incompatibility;
2017-11-03 18:31:42 +00:00
if(among(l, laEmerald, laCamelot, laDryForest) && valence() != 3 && old_daily_id >= 65)
2018-11-30 14:26:50 +00:00
return hedgehogs;
2018-04-12 18:53:50 +00:00
// laPower and laEmerald and laPalace -> [partial] in quotients and hyperbolic_non37
if((l == laPower || l == laEmerald || l == laPalace || l == laWildWest) && !randomPatternsMode) {
2018-04-13 11:08:41 +00:00
if(euclid || bigsphere) ;
2018-11-30 14:26:50 +00:00
else if(old_daily_id <= 65 && a45) ;
2018-04-13 11:15:00 +00:00
else if(!hyperbolic_37) return l == laWildWest ? some0 : pattern_not_implemented_random;
2018-04-13 11:08:41 +00:00
else if(quotient) return pattern_incompatibility;
}
2017-11-03 18:31:42 +00:00
if(among(l, laEmerald, laCamelot, laDryForest) && valence() != 3)
return hedgehogs;
2019-07-30 11:01:41 +00:00
if(l == laWineyard && sol)
return lv::pattern_special;
2018-04-12 18:53:50 +00:00
// ... wineyard pattern is GOOD only in the standard geometry or Euclidean
if(l == laWineyard && (NONSTDVAR || sphere) && !randomPatternsMode)
2018-04-13 11:08:41 +00:00
return pattern_not_implemented_random;
2019-07-30 11:01:41 +00:00
2018-06-21 23:48:46 +00:00
if(l == laTrollheim && quotient == qFIELD)
2018-04-13 11:08:41 +00:00
return not_enough_space;
if(l == laStorms && hyperbolic_not37)
return pattern_not_implemented_random;
2017-11-03 18:31:42 +00:00
if(l == laTrollheim && !stdeucx && !closed_or_bounded)
2018-04-13 11:08:41 +00:00
return some1;
2018-11-30 14:26:50 +00:00
if(l == laReptile && sol) return ugly_version_nofull;
2018-11-30 14:26:50 +00:00
if(l == laReptile) {
if(old_daily_id <= 64) {
2019-11-27 00:01:20 +00:00
if(l == laReptile && (a38 || a4 || sphere || !BITRUNCATED || (quotient && !euclid && geometry != gZebraQuotient)))
2018-11-30 14:26:50 +00:00
return bad_graphics;
}
else {
bool reptile_good = false;
if(hyperbolic_37 && BITRUNCATED) reptile_good = true;
if(euc::in(2,6)) reptile_good = true;
2019-11-27 00:01:20 +00:00
if(quotient && geometry != gZebraQuotient && !euclid)
2018-11-30 14:26:50 +00:00
reptile_good = false;
if(!reptile_good)
return bad_graphics;
}
}
if((l == laDragon || l == laReptile) && !stdeucx && !smallbounded && !randomPatternsMode)
return no_fractal_landscapes;
2017-11-03 18:31:42 +00:00
if(l == laCrossroads && smallsphere)
2018-04-13 11:08:41 +00:00
return not_enough_space;
2017-11-03 18:31:42 +00:00
if(l == laCrossroads3 && !stdeucx && !bigsphere)
2018-04-13 11:08:41 +00:00
return not_enough_space;
2017-11-03 18:31:42 +00:00
2021-07-31 18:30:41 +00:00
if(among(l, laCrossroads, laCrossroads2, laCrossroads3, laCrossroads5) && weirdhyperbolic && old_daily_id < walls_when)
2018-04-13 11:08:41 +00:00
return no_great_walls;
// Crossroads IV is great in weird hyperbolic
2018-04-13 11:08:41 +00:00
if(l == laCrossroads4 && weirdhyperbolic && !quotient)
return full_game;
// OK in small bounded worlds, and in Euclidean
2018-04-13 11:08:41 +00:00
if(l == laCrossroads4 && quotient)
return some0;
2017-11-03 18:31:42 +00:00
if(among(l, laZebra, laFrog) && quotient && geometry != gZebraQuotient && !randomPatternsMode)
2018-04-13 11:15:00 +00:00
return pattern_incompatibility;
if(among(l, laZebra, laFrog) && !(stdeucx || (a4 && !BITRUNCATED) || a46 || (geometry == gZebraQuotient && old_daily_id > 106)) && !randomPatternsMode)
2018-04-13 11:08:41 +00:00
return pattern_not_implemented_weird;
2017-11-03 18:31:42 +00:00
if(l == laCrossroads3 && euclid)
2018-04-13 11:08:41 +00:00
return inaccurate; // because it is not accurate
2017-11-03 18:31:42 +00:00
if(l == laPrairie) {
if(GOLDBERG) return not_implemented;
else if(stdeucx || (bigsphere && BITRUNCATED && !elliptic) || (geometry == gFieldQuotient)) ;
else if(!closed_or_bounded) return not_implemented;
2018-04-13 11:08:41 +00:00
else return unbounded_only;
2017-11-03 18:31:42 +00:00
}
if(l == laTerracotta && !stdeucx && !(bigsphere))
2018-04-13 11:08:41 +00:00
return great_walls_missing;
2017-11-03 18:31:42 +00:00
// highlight Crossroads on Euclidean
if(euclid && !quotient && (l == laCrossroads || l == laCrossroads4) && !aperiodic)
2018-04-13 11:08:41 +00:00
return full_game;
2019-07-28 09:43:58 +00:00
if(sol && among(l, laCrossroads, laCrossroads4))
return full_game;
if(sol && l == laCamelot)
return not_implemented;
if(euclid && quotient && !closed_or_bounded && l == laCrossroads && euc::sdxy().second == -2 * euc::sdxy().first)
return full_game;
if(euclid && quotient && !closed_or_bounded && l == laCrossroads4 && euc::sdxy().second == 0)
return full_game;
2017-11-03 18:31:42 +00:00
// highlight Zebra-based lands on Zebra Quotient!
2020-03-07 22:47:11 +00:00
if(among(l, laZebra, laWhirlwind, laStorms, laWarpCoast, laWarpSea, laFrog) && geometry == gZebraQuotient)
2018-04-13 11:08:41 +00:00
return pattern_compatibility;
2017-11-03 18:31:42 +00:00
// highlight FP-based lands on Field Quotient!
2018-06-21 23:48:46 +00:00
if((l == laPrairie || l == laVolcano || l == laBlizzard) && geometry == gFieldQuotient)
return pattern_compatibility;
// highlight Docks-based lands on Bolza and Bolza x2!
if(l == laDocks && among(geometry, gBolza, gBolza2))
2018-04-13 11:08:41 +00:00
return pattern_compatibility;
2017-11-03 18:31:42 +00:00
// these are highlighted whenever allowed
if(l == laHalloween)
2018-04-13 11:08:41 +00:00
return specially_designed;
if(l == laDual && geosupport_threecolor() == 2)
return specially_designed;
if(l == laDual && !geometry && !GOLDBERG)
2018-04-15 11:04:44 +00:00
return hyperbolic_37 ? not_in_full_game3 : not_in_full_game;
2017-11-03 18:31:42 +00:00
2019-05-08 16:33:08 +00:00
if(l == laSnakeNest && WDIM == 2) {
2018-04-13 11:08:41 +00:00
if(geosupport_threecolor() < 2)
return needs_threecolor;
else return specially_designed;
}
2019-07-28 09:43:58 +00:00
if(l == laDocks && !randomPatternsMode) {
2019-08-07 22:23:10 +00:00
if(a38 && !GOLDBERG && !nonisotropic) return specially_designed;
if(a38 && !nonisotropic) return pattern_not_implemented_weird;
2018-04-13 11:08:41 +00:00
return pattern_not_implemented_exclude;
}
2017-12-29 00:10:47 +00:00
if(l == laStorms && euclid && closed_manifold)
2018-04-13 11:08:41 +00:00
return interesting;
if(l == laMagnetic)
2018-04-13 11:08:41 +00:00
return land_not_implemented;
2018-06-21 23:48:46 +00:00
if(shmup::on && among(l, laMirror, laMirrorOld) && among(geometry, gElliptic, gZebraQuotient, gKleinQuartic, gBolza, gBolza2, gMinimal))
2018-04-13 11:08:41 +00:00
return known_buggy;
2018-04-13 11:15:00 +00:00
// these don't appear in normal game, but do appear in special modes
if(l == laWildWest && !randomPatternsMode)
2018-04-13 11:15:00 +00:00
return out_of_theme;
if(l == laIce && STDVAR && hyperbolic_37 && !quotient && !arcm::in() && !bt::in())
return full_game;
2018-04-13 11:15:00 +00:00
2018-04-13 11:08:41 +00:00
return ok;
2017-11-03 18:31:42 +00:00
}
auto ar = arg::add3("-land-info",
[] {
for(int li=0; li<landtypes; li++) {
eLand l = eLand(li);
println(hlog, dnameof(l), " : ", land_validity(l).msg);
}
});
2017-11-03 18:31:42 +00:00
/*
int checkLands() {
for(int i=0; i<landtypes; i++) {
eLand l = eLand(i);
char inover = 'N';
for(int i=0; i<LAND_OVERX; i++) if(land_over[i] == l) inover = 'X';
for(int i=0; i<LAND_OVER; i++) if(land_over[i] == l) inover = 'Y';
char ineuc = 'N';
for(int i=0; i<LAND_EUC; i++) if(land_euc[i] == l) ineuc = 'Y';
char insph = 'N';
for(int i=0; i<LAND_SPH; i++) if(land_sph[i] == l) insph = 'Y';
char inoct = 'N';
for(int i=0; i<LAND_OCT; i++) if(land_oct[i] == l) inoct = 'Y';
char intac = 'N';
for(auto ti: land_tac) if(l == ti.l) intac = 'Y';
printf("%c %c %c %c %c %c %c :: %s\n",
isTechnicalLand(l) ? 'T' : 'R',
inover, ineuc, insph, inoct, intac, noChaos(l) ? 'N' : 'Y', linf[i].name);
}
exit(0);
}
auto hookcl = addHook(hooks_args, 100, checkLands); */
}