#define ORBLINES 56 struct orbinfo { eLand l; int lchance; int gchance; eItem orb; }; const orbinfo orbinfos[ORBLINES] = { {laGraveyard, 200, 200,itGreenStone}, // must be first so that it does not reduce // chance of other orbs {laJungle, 1200, 1500,itOrbLightning}, {laIce, 2000, 1500,itOrbFlash}, {laCaves, 1800, 2000,itOrbLife}, {laAlchemist, 800, 800,itOrbSpeed}, {laDesert, 2500, 1500,itOrbShield}, {laHell, 2000, 1000,itOrbYendor}, {laRlyeh, 1500, 1500,itOrbTeleport}, {laMotion, 2000, 700, itOrbSafety}, {laIce, 1500, 0, itOrbWinter}, {laDragon, 2500, 0, itOrbWinter}, {laDryForest, 2500, 0, itOrbWinter}, {laCocytus, 1500, 1500, itOrbWinter}, {laCaves, 1200, 0, itOrbDigging}, {laDryForest, 500, 4500, itOrbThorns}, {laDeadCaves, 1800, 0, itGreenStone}, {laDeadCaves, 1800, 1500, itOrbDigging}, {laEmerald, 1500, 3500, itOrbPsi}, {laWineyard, 900, 1200, itOrbAether}, {laHive, 800, 1200, itOrbInvis}, {laPower, 0, 3000, itOrbFire}, {laMinefield, 0, 3500, itOrbFriend}, {laTemple, 0, 3000, itOrbDragon}, {laCaribbean, 0, 3500, itOrbTime}, {laRedRock, 0, 2500, itOrbSpace}, {laCamelot, 1000, 1500, itOrbIllusion}, {laOcean, 0, 3000, itOrbEmpathy}, {laOcean, 0, 0, itOrbAir}, {laPalace, 0, 4000, itOrbDiscord}, {laPalace, 0, 0, itOrbFrog}, {laZebra, 500, 2100, itOrbFrog}, {laLivefjord, 0, 1800, itOrbFish}, {laPrincessQuest, 0, 200, itOrbLove}, {laIvoryTower, 500, 4000, itOrbMatter}, {laElementalWall, 1500, 4000, itOrbSummon}, {laStorms, 1000, 2500, itOrbStunning}, {laOvergrown, 1000, 800, itOrbLuck}, {laWhirlwind, 1250, 3000, itOrbAir}, {laHaunted, 1000, 5000, itOrbUndeath}, {laClearing, 5000, 5000, itOrbFreedom}, {laRose, 2000, 8000, itOrbBeauty}, {laWarpCoast, 2000, 8000, itOrb37}, {laDragon, 500, 5000, itOrbDomination}, {laTortoise, 2500, 1500, itOrbShell}, {laEndorian, 150, 2500, itOrbEnergy}, {laEndorian, 450, 0, itOrbTeleport}, {laKraken, 500, 2500, itOrbSword}, {laBurial, 500, 2500, itOrbSword2}, {laTrollheim, 750, 1800, itOrbStone}, {laMountain, 400, 3500, itOrbNature}, {laDungeon, 120, 2500, itOrbRecall}, {laReptile, 500, 2100, itOrbDash}, {laBull, 720, 3000, itOrbHorns}, {laPrairie, 0, 3500, itOrbBull}, {laWhirlpool, 0, 0, itOrbSafety}, {laWhirlpool, 0, 2000, itOrbWater}, // must be last because it generates a boat }; eItem orbType(eLand l) { if(isElemental(l)) l = laElementalWall; if(inv::on && (l == laMirror || l == laMirrorOld || isCrossroads(l))) return itOrbMirror; if(l == laMirror || l == laMirrorOld) return itShard; for(int i=0; i= R10) i++; return i; } bool hellUnlocked() { return orbsUnlocked() >= 9; } ld orbprizefun(int tr) { if(tr < 10) return 0; return .6 + .4 * log(tr/25.) / log(2); } ld orbcrossfun(int tr) { if(tr < 10) return 0; if(tr > 25) return 1; return (tr*2 + 50) / 100.; } bool buildPrizeMirror(cell *c, int freq) { if(inv::on) return false; if(c->type == 7 && !purehepta) return false; if(items[itShard] < 25) return false; if(freq && hrand(freq * 100 / orbprizefun(items[itShard])) >= 100) return false; c->wall = hrand(2) ? waCloud : waMirror; return true; } eLand getPrizeLand(cell *c = cwt.c) { eLand l = c->land; if(isElemental(l)) l = laElementalWall; if(l == laPalace && princess::dist(c) < OUT_OF_PRISON) l = laPrincessQuest; return l; } void placePrizeOrb(cell *c) { if(peace::on) return; eLand l = getPrizeLand(c); // these two lands would have too much orbs according to normal rules if(l == laPalace && hrand(100) >= 20) return; if(l == laPrincessQuest && hrand(100) >= 20) return; if(l == laGraveyard && hrand(100) >= 15) return; if(l == laBurial && hrand(100) >= 10) return; if(l == laLivefjord && hrand(100) >= 35) return; if(l == laMinefield && hrand(100) >= 25) return; if(l == laElementalWall && hrand(100) >= 25) return; for(int i=0; i= 100) ; else continue; } eOrbLandRelation olr = getOLR(oi.orb, l); if(olr != olrPrize25 && olr != olrPrize3) continue; int treas = items[treasureType(oi.l)]; if(olr == olrPrize3) treas *= 10; if(olr == olrPrize25 || olr == olrPrize3 || olr == olrGuest || olr == olrMonster || olr == olrAlways) { if(treas < 25) continue; } else continue; int gch = oi.gchance; if(!gch) continue; gch = int(gch / orbprizefun(treas)); if(hrand(gch) >= 60) continue; if(oi.orb == itOrbWater && c->land != laOcean && c->land != laKraken) { if(cellHalfvine(c)) continue; c->item = oi.orb; c->wall = waStrandedBoat; return; } c->item = oi.orb; } // printf("land: %s orb: %s\n", dnameof(l), dnameof(c->item)); } void placeLocalOrbs(cell *c) { eLand l = c->land; if(l == laZebra && c->wall == waTrapdoor) return; if(isGravityLand(l) && cellEdgeUnstable(c)) return; if(isElemental(l)) l = laElementalWall; if(peace::on) return; for(int i=0; i= (11+hrand(15))) ch = 0; if(tactic::trailer && ch < 5) ch = 0; if(ch == 0 && items[treasureType(oi.l)] * landMultiplier(oi.l) >= (chaosmode ? 1+hrand(10) : 10)) { // printf("local orb\n"); c->item = oi.orb; if(oi.orb == itOrbWater && c->land != laOcean) c->wall = waStrandedBoat; return; } else if(oi.gchance && (ch >= 1 && ch < 11) && getOLR(itShard, l) == olrPrize25 && l != laRedRock && l != laWhirlwind) buildPrizeMirror(c, 10); else if(oi.gchance && (ch >= 11 && ch < 11+PRIZEMUL)) placePrizeOrb(c); } } void placeCrossroadOrbs(cell *c) { if(peace::on) return; for(int i=0; i= 50) ; else if(oi.orb == itOrbSafety && items[itFeather] >= 25) ; else continue; } int treas = items[treasureType(oi.l)] * landMultiplier(oi.l); if(tactic::on && isCrossroads(tactic::lasttactic)) { if(oi.orb == itOrbYendor || oi.orb == itOrbSummon || oi.orb == itOrbFish || oi.orb == itOrbDigging || oi.orb == itOrbLove || oi.orb == itOrbLuck) continue; } else { if(treas < 10) continue; } if(oi.orb == itOrbSafety && c->land == laCrossroads5) continue; int mul = c->land == laCrossroads5 ? 10 : 1; int gch = oi.gchance; if(!inv::on) gch /= orbcrossfun(treas); else gch /= 2; if(hrand(gch) >= mul) continue; if(hrand(50+items[itHyperstone]) >= 50) continue; c->item = oi.orb; if(oi.orb == itOrbWater && c->land != laOcean) c->wall = waStrandedBoat; } } void placeOceanOrbs(cell *c) { if(peace::on) return; for(int i=0; i= 50) ; else if(oi.orb == itOrbSafety && items[itFeather] >= 25) ; else continue; } if(items[treasureType(oi.l)] * landMultiplier(oi.l) < 10) continue; if(!oi.gchance) continue; if(oi.orb == itOrbLife) continue; // useless if(hrand(oi.gchance) >= 20) continue; c->item = oi.orb; } }