1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-25 17:40:36 +00:00
hyperrogue/flags.cpp

773 lines
24 KiB
C++
Raw Normal View History

2016-08-26 09:58:03 +00:00
// Hyperbolic Rogue
// implementation of various simple flags for lands, items, monsters, and walls
// Copyright (C) 2011-2018 Zeno Rogue, see 'hyper.cpp' for details
2016-08-26 09:58:03 +00:00
namespace hr {
2016-08-26 09:58:03 +00:00
bool isIcyLand(eLand l) {
2017-09-30 09:46:41 +00:00
return l == laIce || l == laCocytus || l == laBlizzard;
2016-08-26 09:58:03 +00:00
}
bool isIcyLand(cell *c) {
return isIcyLand(c->land);
}
bool isGravityLand(eLand l) {
2018-12-21 13:41:23 +00:00
return among(l, laIvoryTower, laEndorian, laMountain, laDungeon, laWestWall);
2016-08-26 09:58:03 +00:00
}
2018-05-01 17:34:37 +00:00
bool isEquidLand(eLand l) {
2018-12-21 13:41:23 +00:00
return isHaunted(l) || among(l, laIvoryTower, laEndorian, laDungeon, laOcean, laWestWall);
2018-05-01 17:34:37 +00:00
}
2016-08-26 09:58:03 +00:00
// watery
bool isWatery(cell *c) {
return c->wall == waCamelotMoat || c->wall == waSea || c->wall == waLake;
}
bool isBoat(cell *c) {
return among(c->wall, waBoat, waStrandedBoat);
}
2016-08-26 09:58:03 +00:00
bool isChasmy(cell *c) {
return c->wall == waChasm || c->wall == waSulphur || c->wall == waSulphurC || c->wall == waBubble ||
c->wall == waMercury;
2016-08-26 09:58:03 +00:00
}
bool isWateryOrBoat(cell *c) {
return isWatery(c) || c->wall == waBoat;
}
bool isNoFlight(cell *c) {
return
c->wall == waBoat || c->wall == waVineHalfA || c->wall == waVineHalfB ||
2017-03-23 10:53:57 +00:00
c->wall == waStrandedBoat || c->wall == waTrunk ||
c->wall == waBigBush || c->wall == waSmallBush;
2016-08-26 09:58:03 +00:00
}
bool boatStrandable(cell *c) {
return c->wall == waNone && (c->land == laLivefjord || c->land == laOcean);
}
// monster/wall types
bool isFire(cell *w) {
2017-12-29 00:10:47 +00:00
return w->wall == waFire || w->wall == waPartialFire || w->wall == waEternalFire || w->wall == waBurningDock;
2016-08-26 09:58:03 +00:00
}
bool isFireOrMagma(cell *w) {
return isFire(w) || w->wall == waMagma;
}
2016-08-26 09:58:03 +00:00
bool isThumper(eWall w) {
return w == waThumperOff || w == waThumperOn;
}
bool isThumper(cell *c) {
return isThumper(c->wall);
}
bool isActivable(cell *c) {
return c->wall == waThumperOff || c->wall == waBonfireOff;
}
bool hasTimeout(cell *c) {
return c->wall == waThumperOn || c->wall == waFire || c->wall == waPartialFire ||
c->wall == waTempWall || c->wall == waTempFloor || c->wall == waTempBridge ||
2017-12-29 00:10:47 +00:00
c->wall == waTempBridgeBlocked || c->wall == waBurningDock;
2016-08-26 09:58:03 +00:00
}
bool isMimic(eMonster m) {
2017-07-22 23:33:27 +00:00
return m == moMimic;
}
int mirrorcolor(bool mirrored) {
return winf[mirrored ? waMirror : waCloud].color;
2016-08-26 09:58:03 +00:00
}
bool isMimic(cell *c) {
return isMimic(c->monst);
}
bool isPrincess(eMonster m) {
return
m == moPrincess || m == moPrincessMoved ||
m == moPrincessArmed || m == moPrincessArmedMoved;
}
bool isGolemOrKnight(eMonster m) {
return
m == moGolem || m == moGolemMoved ||
m == moKnight || m == moKnightMoved ||
m == moTameBomberbird || m == moTameBomberbirdMoved ||
m == moMouse || m == moMouseMoved ||
m == moFriendlyGhost ||
isPrincess(m);
}
bool isGolemOrKnight(cell *c) { return isGolemOrKnight(c->monst); }
bool isNonliving(eMonster m) {
return
2017-07-22 23:33:27 +00:00
m == moMimic || m == moGolem || m == moGolemMoved ||
2016-08-26 09:58:03 +00:00
m == moZombie || m == moGhost || m == moShadow || m == moSkeleton ||
m == moEvilGolem || m == moIllusion || m == moEarthElemental ||
2017-10-04 19:26:26 +00:00
m == moWaterElemental || m == moDraugr || m == moTerraWarrior ||
2017-10-08 12:02:03 +00:00
m == moIceGolem || m == moVoidBeast || m == moJiangshi;
2016-08-26 09:58:03 +00:00
}
bool isMetalBeast(eMonster m) {
return m == moMetalBeast || m == moMetalBeast2;
}
bool isStunnable(eMonster m) {
2018-10-25 00:43:14 +00:00
return
isMetalBeast(m) || isDragon(m) || isPrincess(m) ||
among(m, moPalace, moFatGuard, moSkeleton, moTortoise, moReptile, moTerraWarrior, moSalamander, moVizier, moBrownBug);
2016-08-26 09:58:03 +00:00
}
bool hasHitpoints(eMonster m) {
2017-10-04 19:26:26 +00:00
return m == moPalace || m == moFatGuard || m == moVizier || isPrincess(m) || m == moTerraWarrior;
2016-08-26 09:58:03 +00:00
}
bool isMountable(eMonster m) {
2017-03-23 10:53:57 +00:00
return isWorm(m) && m != moTentacleGhost;
2016-08-26 09:58:03 +00:00
}
bool isFriendly(eMonster m) {
2017-03-23 10:53:57 +00:00
return isMimic(m) || isGolemOrKnight(m) || m == moIllusion || m == moFriendlyIvy;
}
bool isFriendlyOrPlayer(eMonster m) {
return isFriendly(m) || m == moPlayer;
2016-08-26 09:58:03 +00:00
}
2018-02-27 22:43:21 +00:00
bool isMounted(cell *c) {
if(c && c->monst && c->monst != moTentacleGhost && isMountable(c->monst)) {
2018-02-27 22:43:21 +00:00
for(int i=0; i<numplayers(); i++) {
if(playerpos(i)->monst && sameMonster(c, playerpos(i)))
return true;
if(lastmountpos[i] && lastmountpos[i]->monst && sameMonster(c, lastmountpos[i]))
2017-03-23 10:53:57 +00:00
return true;
2018-02-27 22:43:21 +00:00
}
2017-03-23 10:53:57 +00:00
}
2018-02-27 22:43:21 +00:00
return false;
}
bool isFriendly(cell *c) {
return isMounted(c) || isFriendly(c->monst);
2016-08-26 09:58:03 +00:00
}
bool isBug(eMonster m) {
return m >= moBug0 && m < moBug0+BUGCOLORS;
}
bool isBug(cell *c) {
return isBug(c->monst);
}
bool isFriendlyOrBug(cell *c) { // or killable discord!
// do not attack the stunned Princess
if(isPrincess(c->monst) && c->stuntime) return false;
return isFriendly(c) || isBug(c) || (c->monst && markOrb(itOrbDiscord) && !c->stuntime);
}
bool isIvy(eMonster m) {
return m == moIvyRoot || m == moIvyHead || m == moIvyBranch || m == moIvyWait ||
m == moIvyNext || m == moIvyDead;
}
bool isIvy(cell *c) {
return isIvy(c->monst);
}
bool isMonsterPart(eMonster m) {
2017-03-23 10:53:57 +00:00
return m == moMutant || (isIvy(m) && m != moIvyRoot) ||
m == moDragonTail || m == moKrakenT;
2016-08-26 09:58:03 +00:00
}
bool isMutantIvy(eMonster m) {
return m == moMutant;
}
2017-03-23 10:53:57 +00:00
bool isAnyIvy(eMonster m) {
return isIvy(m) || isMutantIvy(m) || m == moFriendlyIvy;
}
2016-08-26 09:58:03 +00:00
bool isBulletType(eMonster m) {
return
2017-10-12 09:33:26 +00:00
m == moBullet || m == moFlailBullet || m == moFireball ||
m == moTongue || m == moAirball || m == moArrowTrap;
2016-08-26 09:58:03 +00:00
}
bool isMutantIvy(cell *c) { return isMutantIvy(c->monst); }
bool isDemon(eMonster m) {
return m == moLesser || m == moLesserM || m == moGreater || m == moGreaterM;
}
bool isDemon(cell *c) {
return isDemon(c->monst);
}
bool isWorm(eMonster m) {
return m == moWorm || m == moWormtail || m == moWormwait ||
m == moTentacle || m == moTentacletail || m == moTentaclewait ||
m == moTentacleEscaping || m == moTentacleGhost ||
m == moHexSnake || m == moHexSnakeTail ||
m == moDragonHead || m == moDragonTail;
}
bool isWorm(cell *c) {
return isWorm(c->monst);
}
bool isWitch(eMonster m) {
// evil golems don't count
return m >= moWitch && m < moWitch+NUMWITCH-1;
}
bool isOnCIsland(cell *c) {
return (c->wall == waCIsland || c->wall == waCTree || c->wall == waCIsland2);
}
bool isGhostable(eMonster m) {
return m && !isFriendly(m) && !isIvy(m) && !isMultitile(m) && !isMutantIvy(m);
}
bool cellUnstable(cell *c) {
return (c->land == laMotion && c->wall == waNone) || c->wall == waTrapdoor;
}
bool cellUnstableOrChasm(cell *c) {
return
(c->land == laMotion && c->wall == waNone) ||
c->wall == waChasm || c->wall == waTrapdoor;
}
bool cellHalfvine(cell *c) {
return c->wall == waVineHalfA || c->wall == waVineHalfB;
}
bool isWarped(eLand l) {
2017-03-23 10:53:57 +00:00
return l == laWarpCoast || l == laWarpSea;
2016-08-26 09:58:03 +00:00
}
bool isElementalShard(eItem i) {
return
i == itFireShard || i == itAirShard || i == itEarthShard || i == itWaterShard;
}
eMonster elementalOf(eLand l) {
if(l == laEFire) return moFireElemental;
if(l == laEWater) return moWaterElemental;
if(l == laEAir) return moAirElemental;
if(l == laEEarth) return moEarthElemental;
return moNone;
}
2017-03-23 10:53:57 +00:00
eItem localshardof(eLand l) {
return eItem(itFireShard + (l - laEFire));
}
2016-08-26 09:58:03 +00:00
int itemclass(eItem i) {
if(i == 0) return -1;
if(i < itKey || i == itFernFlower ||
i == itWine || i == itSilver || i == itEmerald || i == itRoyalJelly || i == itPower ||
i == itGrimoire || i == itPirate || i == itRedGem || i == itBombEgg ||
i == itCoast || i == itWhirlpool || i == itPalace || i == itFjord ||
2017-03-23 10:53:57 +00:00
i == itElemental || i == itZebra || i == itIvory ||
2016-08-26 09:58:03 +00:00
i == itBounty || i == itFulgurite || i == itMutant || i == itLotus || i == itMutant2 ||
i == itWindstone || i == itCoral || i == itRose ||
2017-03-23 10:53:57 +00:00
i == itBabyTortoise || i == itDragon || i == itApple ||
i == itKraken || i == itBarrow || i == itTrollEgg || i == itTreat ||
i == itSlime || i == itAmethyst || i == itDodeca ||
2017-09-30 09:46:41 +00:00
i == itGreenGrass || i == itBull ||
2017-10-10 12:24:39 +00:00
i == itLavaLily || i == itHunting ||
2017-12-29 00:10:47 +00:00
i == itBlizzard || i == itTerra || i == itGlowCrystal || i == itSnake ||
i == itDock || i == itRuins || i == itSwitch || i == itMagnet ||
among(i, itWest, itVarTreasure, itBrownian)
2017-09-30 09:46:41 +00:00
)
2016-08-26 09:58:03 +00:00
return IC_TREASURE;
2018-04-30 22:21:51 +00:00
if(i == itSavedPrincess || i == itStrongWind || i == itWarning || i == itBuggy || i == itBuggy2)
2017-03-23 10:53:57 +00:00
return IC_NAI;
2016-08-26 09:58:03 +00:00
if(i == itKey || i == itOrbYendor || i == itGreenStone || i == itHolyGrail || i == itCompass ||
2017-07-12 16:03:53 +00:00
isElementalShard(i) || i == itRevolver || i == itInventory)
2016-08-26 09:58:03 +00:00
return IC_OTHER;
return IC_ORB;
}
bool isAlch(eWall w) {
return w == waFloorA || w == waFloorB;
}
2017-10-08 09:12:03 +00:00
/* bool isAlch2(eWall w, bool bubbletoo) {
2017-09-30 09:46:41 +00:00
return w == waSlime1 || w == waSlime2 || (bubbletoo && w == waBubble);
2017-10-08 09:12:03 +00:00
} */
2017-09-30 09:46:41 +00:00
2017-10-08 09:12:03 +00:00
/* bool isAlch2(cell *c, bool bubbletoo) {
2017-09-30 09:46:41 +00:00
return isAlch2(c->wall, bubbletoo);
2017-10-08 09:12:03 +00:00
} */
2017-09-30 09:46:41 +00:00
2016-08-26 09:58:03 +00:00
bool isAlch(cell *c) { return isAlch(c->wall); }
bool isAlchAny(eWall w) {
2017-09-30 09:46:41 +00:00
return w == waFloorA || w == waFloorB;
2016-08-26 09:58:03 +00:00
}
bool isAlchAny(cell *c) { return isAlchAny(c->wall); }
bool realred(eWall w) {
return w == waRed1 || w == waRed2 || w == waRed3;
}
int snakelevel(eWall w) {
if(w == waRed1 || w == waDeadfloor2 || w == waRubble || w == waGargoyleFloor ||
w == waGargoyleBridge || w == waTempFloor || w == waTempBridge || w == waRoundTable ||
2017-10-08 09:12:03 +00:00
w == waPetrifiedBridge || w == waMagma)
2016-08-26 09:58:03 +00:00
return 1;
if(w == waRed2) return 2;
if(w == waRed3) return 3;
2017-03-23 10:53:57 +00:00
if(w == waTower) return 3;
2016-08-26 09:58:03 +00:00
return 0;
}
2018-10-25 00:43:14 +00:00
int snakelevel(cell *c) {
#if CAP_COMPLEX2
if(c->land == laBrownian && among(c->wall, waNone, waMineMine, waFire)) return min(c->landparam / brownian::level, 3);
#endif
return snakelevel(c->wall);
}
2016-08-26 09:58:03 +00:00
bool isWall(cell *w) {
if(w->wall == waNone || isAlchAny(w) ||
w->wall == waCavefloor || w->wall == waFrozenLake || w->wall == waVineHalfA ||
w->wall == waVineHalfB || w->wall == waDeadfloor || w->wall == waDeadfloor2 ||
w->wall == waRubble || w->wall == waGargoyleFloor || w->wall == waGargoyleBridge ||
w->wall == waTempFloor || w->wall == waTempBridge || w->wall == waPetrifiedBridge ||
2016-08-26 09:58:03 +00:00
w->wall == waBoat || w->wall == waCIsland || w->wall == waCIsland2 ||
w->wall == waRed1 || w->wall == waRed2 || w->wall == waRed3 ||
w->wall == waMineUnknown || w->wall == waMineMine || w->wall == waMineOpen ||
w->wall == waStrandedBoat || w->wall == waOpenGate || w->wall == waClosePlate ||
w->wall == waOpenPlate || w->wall == waTrapdoor || w->wall == waGiantRug ||
w->wall == waLadder || w->wall == waTrunk || w->wall == waSolidBranch ||
2017-03-23 10:53:57 +00:00
w->wall == waWeakBranch || w->wall == waCanopy || w->wall == waTower ||
w->wall == waSmallBush || w->wall == waBigBush ||
2017-09-30 09:46:41 +00:00
w->wall == waReptile || w->wall == waReptileBridge || w->wall == waInvisibleFloor ||
2017-12-29 00:10:47 +00:00
w->wall == waSlime1 || w->wall == waSlime2 || w->wall == waArrowTrap || w->wall == waMagma ||
2018-12-16 23:04:59 +00:00
w->wall == waDock || w->wall == waFireTrap)
2016-08-26 09:58:03 +00:00
return false;
if(isWatery(w) || isChasmy(w) || isFire(w)) return false;
return true;
}
2018-12-16 23:04:59 +00:00
bool isPushable(eWall w) {
return w == waThumperOn || w == waExplosiveBarrel;
}
2016-08-26 09:58:03 +00:00
bool isAngryBird(eMonster m) {
return m == moEagle || m == moAlbatross || m == moBomberbird || m == moGargoyle ||
2017-03-23 10:53:57 +00:00
m == moWindCrow || m == moSparrowhawk ||
2018-10-25 00:43:14 +00:00
m == moVampire || m == moBat || m == moButterfly || m == moGadfly ||
2018-12-23 16:41:12 +00:00
m == moAcidBird || m == moWestHawk;
2016-08-26 09:58:03 +00:00
}
bool isBird(eMonster m) {
2017-03-23 10:53:57 +00:00
return isAngryBird(m) || m == moTameBomberbird || m == moTameBomberbirdMoved;
}
bool slowMover(eMonster m) {
return
m == moLesser || m == moGreater || isMetalBeast(m) ||
m == moTortoise || m == moDraugr;
2016-08-26 09:58:03 +00:00
}
2018-01-02 10:15:42 +00:00
bool isMagneticPole(eMonster m) {
return m == moNorthPole || m == moSouthPole;
}
2016-08-26 09:58:03 +00:00
bool normalMover(eMonster m) {
return
m == moYeti || m == moRanger || m == moGoblin || m == moTroll || m == moDesertman ||
m == moMonkey || m == moZombie || m == moNecromancer || m == moCultist ||
2017-03-23 10:53:57 +00:00
m == moRunDog || m == moPyroCultist ||
2016-08-26 09:58:03 +00:00
m == moFireFairy || m == moCrystalSage || m == moHedge ||
m == moVineBeast || m == moLancer || m == moFlailer ||
m == moMiner || m == moDarkTroll ||
(playerInPower() && (
(isWitch(m) && m != moWitchGhost && m != moWitchWinter) || m == moEvilGolem
)) ||
m == moRedTroll ||
m == moPalace || m == moFatGuard || m == moSkeleton || m == moVizier ||
m == moFjordTroll || m == moStormTroll || m == moForestTroll ||
2017-03-23 10:53:57 +00:00
m == moFamiliar ||
m == moFireElemental || m == moOrangeDog ||
2016-08-26 09:58:03 +00:00
m == moOutlaw || m == moRedFox || m == moFalsePrincess || m == moRoseLady ||
m == moRoseBeauty || m == moWolf ||
2017-03-23 10:53:57 +00:00
m == moResearcher || m == moRagingBull ||
2017-07-22 23:33:27 +00:00
m == moNarciss || m == moMirrorSpirit ||
2017-10-08 09:12:03 +00:00
m == moHunterDog || m == moTerraWarrior || m == moJiangshi ||
m == moLavaWolf || m == moSalamander ||
2017-10-15 22:15:54 +00:00
m == moHunterGuard || m == moHunterChanging ||
2017-12-30 14:12:15 +00:00
m == moIceGolem ||
2018-01-02 10:15:42 +00:00
m == moSwitch1 || m == moSwitch2 || m == moCrusher || m == moPair ||
2018-12-23 16:41:12 +00:00
m == moBrownBug || m == moVariantWarrior || m == moFallingDog ||
2018-01-02 10:15:42 +00:00
isMagneticPole(m) ||
2017-12-30 14:12:15 +00:00
slowMover(m);
}
bool isSwitch(eMonster m) {
return m == moSwitch1 || m == moSwitch2;
2016-08-26 09:58:03 +00:00
}
// from-to
bool isGhost(eMonster m) {
return m == moGhost || m == moTentacleGhost || m == moFriendlyGhost;
}
bool isGhostMover(eMonster m) {
return m == moGhost || m == moGreaterShark || m == moTentacleGhost ||
(playerInPower() && (m == moWitchGhost || m == moWitchWinter));
}
bool isShark(eMonster m) {
return m == moShark || m == moCShark || m == moGreaterShark;
}
bool isSlimeMover(eMonster m) {
return
2017-03-23 10:53:57 +00:00
m == moSlime || m == moSeep || m == moVineSpirit || m == moParrot;
2016-08-26 09:58:03 +00:00
}
2017-03-23 10:53:57 +00:00
bool isDragon(eMonster m) { return m == moDragonHead || m == moDragonTail; }
bool isKraken(eMonster m) { return m == moKrakenH || m == moKrakenT; }
2016-08-26 09:58:03 +00:00
bool isBlowableMonster(eMonster m) {
return m && !(
isWorm(m) || isIvy(m) || isMutantIvy(m) || isSlimeMover(m) ||
m == moGhost || m == moGreaterShark ||
2017-03-23 10:53:57 +00:00
m == moWaterElemental || m == moWitchGhost || isMimic(m) ||
isKraken(m)
2016-08-26 09:58:03 +00:00
);
}
bool isMultitile(eMonster m) {
2017-03-23 10:53:57 +00:00
return isWorm(m) || isIvy(m) || isMutantIvy(m) || isKraken(m);
2016-08-26 09:58:03 +00:00
}
bool isSlimeMover(cell *c) {
return isSlimeMover(c->monst);
}
int slimegroup(cell *c) {
if(c->wall == waCavewall || c->wall == waDeadwall)
return 1;
if(isWatery(c))
return 2;
if(c->wall == waFloorA)
return 3;
if(c->wall == waFloorB)
return 4;
if(c->wall == waVinePlant || cellHalfvine(c))
return 5;
if(c->wall == waCTree)
return 6;
return 0;
}
bool isLeader(eMonster m) {
return m == moPirate || m == moCultistLeader || m == moViking || m == moRatling || m == moRatlingAvenger;
}
bool isFlying(eMonster m) {
2017-03-23 10:53:57 +00:00
return isBird(m) || isGhost(m) || m == moAirElemental || isDragon(m) || checkOrb(m, itOrbAether);
2016-08-26 09:58:03 +00:00
}
bool survivesChasm(eMonster m) {
return isFlying(m);
}
bool ignoresPlates(eMonster m) {
return m == moMouse || isFlying(m) || m == moIllusion;
2016-08-26 09:58:03 +00:00
}
bool itemBurns(eItem it) {
return it && it != itOrbDragon && it != itOrbFire && it != itDragon && it != itOrbWinter && it != itOrbLava && it != itTreat && it != itLavaLily;
2016-08-26 09:58:03 +00:00
}
bool attackThruVine(eMonster m) {
return m == moGhost || m == moVineSpirit || m == moFriendlyGhost || m == moTentacleGhost;
}
bool attackNonAdjacent(eMonster m) {
return m == moGhost || m == moFriendlyGhost || m == moTentacleGhost;
}
2017-03-23 10:53:57 +00:00
bool noHighlight(eMonster m) {
return
(m == moIvyWait || m == moIvyNext || m == moIvyDead);
}
2016-08-26 09:58:03 +00:00
bool isInactiveEnemy(cell *w, eMonster forwho) {
if(w->monst == moWormtail || w->monst == moWormwait || w->monst == moTentacletail || w->monst == moTentaclewait || w->monst == moHexSnakeTail)
return true;
if(w->monst == moLesserM || w->monst == moGreaterM)
return true;
if(w->monst == moIvyRoot || w->monst == moIvyWait || w->monst == moIvyNext || w->monst == moIvyDead)
return true;
if(w->monst && ((forwho == moPlayer) ? realstuntime(w) : realstuntime(w) > 1) && !isFriendly(w))
return true;
return false;
}
// forpc = true (for PC), false (for golems)
bool isActiveEnemy(cell *w, eMonster forwho) {
if(((forwho == moPlayer) ? realstuntime(w) : realstuntime(w) > 1))
return false;
2017-12-30 14:12:15 +00:00
if(w->monst == passive_switch) return false;
2016-08-26 09:58:03 +00:00
if(w->monst == moNone) return false;
if(isFriendly(w)) return false;
if(isInactiveEnemy(w, forwho)) return false;
return true;
}
bool isUnarmed(eMonster m) {
return
m == moMouse || m == moMouseMoved || m == moPrincess || m == moPrincessMoved ||
2017-03-23 10:53:57 +00:00
m == moCrystalSage || m == moVampire || m == moBat;
2016-08-26 09:58:03 +00:00
}
bool isArmedEnemy(cell *w, eMonster forwho) {
2018-01-02 10:15:42 +00:00
return w->monst != moCrystalSage && w->monst != moCrusher && isActiveEnemy(w, forwho);
2016-08-26 09:58:03 +00:00
}
bool isHive(eLand l) {
return l == laHive;
}
bool isIcyWall(cell *c) {
return c->wall == waNone || c->wall == waIcewall || c->wall == waFrozenLake || c->wall == waLake;
}
bool eternalFire(cell *c) {
return c->land == laDryForest || (c->land == laPower && !smallbounded) || c->land == laMinefield ||
2016-08-26 09:58:03 +00:00
c->land == laEFire || c->land == laElementalWall;
}
bool isCyclic(eLand l) {
return
2017-03-23 10:53:57 +00:00
l == laWhirlpool || l == laTemple || l == laCamelot || l == laClearing ||
l == laMountain;
2016-08-26 09:58:03 +00:00
}
bool haveRangedOrb() {
return
items[itOrbPsi] || items[itOrbDragon] || items[itOrbTeleport] ||
2017-03-23 10:53:57 +00:00
items[itOrbIllusion] || items[itOrbSpace] || items[itOrbAir] ||
2016-08-26 09:58:03 +00:00
items[itOrbFrog] || items[itOrbSummon] || items[itOrbMatter] ||
items[itRevolver] || items[itOrbStunning] || items[itStrongWind] ||
items[itOrbDomination] || items[itOrbNature] || items[itOrbDash] ||
items[itOrbMorph] || items[itOrbPhasing];
2016-08-26 09:58:03 +00:00
}
bool isOffensiveOrb(eItem it) {
return it == itOrbLightning || it == itOrbFlash || it == itOrbThorns ||
it == itOrbDragon || it == itOrbStunning ||
it == itOrbFreedom || it == itOrbPsi ||
it == itOrbSide1 || it == itOrbSide2 || it == itOrbSide3 ||
it == itOrbSlaying;
2016-08-26 09:58:03 +00:00
}
bool isRangedOrb(eItem i) {
return i == itOrbPsi || i == itOrbDragon || i == itOrbTeleport || i == itOrbIllusion ||
2017-03-23 10:53:57 +00:00
i == itOrbSpace || i == itOrbAir || i == itOrbFrog ||
2016-08-26 09:58:03 +00:00
i == itOrbSummon || i == itOrbMatter || i == itRevolver || i == itOrbStunning ||
i == itOrbDomination || i == itOrbNature || i == itOrbDash || i == itOrbMorph;
2016-08-26 09:58:03 +00:00
}
bool isProtectionOrb(eItem i) {
return i == itOrbWinter || i == itOrbShield || i == itOrbInvis || i == itOrbShell;
}
bool isEmpathyOrb(eItem i) {
return
i == itOrbFire || i == itOrbDigging || i == itOrbWinter ||
i == itOrbUndeath || i == itOrbSpeed || i == itOrbShield ||
2017-03-23 10:53:57 +00:00
i == itOrbAether || i == itOrbInvis || i == itOrbThorns ||
2017-10-12 10:05:00 +00:00
i == itOrbWater || i == itOrbStone ||
i == itOrbSide1 || i == itOrbSide2 || i == itOrbSide3 ||
i == itOrbSlaying || i == itOrbFish;
2016-08-26 09:58:03 +00:00
}
bool isUtilityOrb(eItem i) {
return i == itOrbSpeed || i == itOrbDigging ||
2017-03-23 10:53:57 +00:00
i == itOrbSafety || i == itOrbTeleport || i == itOrbAether ||
i == itOrbTime || i == itOrbSpace ||
i == itOrbSummon || i == itOrbLuck || i == itOrbEnergy ||
i == itOrbLava;
2016-08-26 09:58:03 +00:00
}
2017-03-23 10:53:57 +00:00
bool isDirectionalOrb(eItem i) {
return i == itOrbHorns || i == itOrbBull || i == itOrbSword || i == itOrbSword2;
2017-03-23 10:53:57 +00:00
}
bool isRevivalOrb(eItem i) {
return i == itOrbLife || i == itOrbFriend || i == itOrbUndeath;
}
2016-08-26 09:58:03 +00:00
bool isFriendOrb(eItem i) {
return i == itOrbLife || i == itOrbFriend || i == itOrbDiscord || i == itOrbLove ||
i == itOrbEmpathy || i == itOrbUndeath;
}
bool isFriendlyGhost(eMonster m) {
2017-03-23 10:53:57 +00:00
return m == moFriendlyGhost || (markEmpathy(itOrbAether) && isFriendly(m));
2016-08-26 09:58:03 +00:00
}
bool survivesWater(eMonster m) {
return
m == moShark || m == moGreaterShark || m == moCShark ||
2017-03-23 10:53:57 +00:00
isGhost(m) || m == moWitchGhost || m == moShadow ||
2016-08-26 09:58:03 +00:00
isBird(m) || m == moWaterElemental || m == moAirElemental ||
2017-03-23 10:53:57 +00:00
isWorm(m) || isIvy(m) || isDragon(m) || isKraken(m) ||
m == moMutant || m == moFriendlyIvy ||
(isFriendly(m) && markOrb(itOrbFish)) ||
2016-08-26 09:58:03 +00:00
m == moTortoise; // Tortoises and Ivies survive, but don't go through water
}
// survives Mercury or Sulphur or Lava
bool survivesPoison(eMonster m, eWall p) {
return
isGhost(m) || m == moWitchGhost || m == moShadow ||
isBird(m) || m == moAirElemental || isDragon(m) || isWorm(m);
}
2017-03-23 10:53:57 +00:00
// flying even if stunned
bool isPermanentFlying(eMonster m) {
return m == moAirElemental || isGhost(m);
}
2016-08-26 09:58:03 +00:00
bool survivesFire(eMonster m) {
return
isGhost(m) || m == moWitchWinter || m == moWitchGhost ||
m == moBomberbird || m == moTameBomberbird || m == moTameBomberbirdMoved ||
2017-10-08 09:12:03 +00:00
(isFriendly(m) && markOrb(itOrbWinter)) || m == moFireElemental ||
2017-03-23 10:53:57 +00:00
isDragon(m) || m == moShadow;
2016-08-26 09:58:03 +00:00
}
bool survivesWall(eMonster m) {
return isGhost(m);
}
bool survivesThorns(eMonster m) {
2017-03-23 10:53:57 +00:00
return isGhost(m) || m == moSkeleton || m == moDraugr;
2016-08-26 09:58:03 +00:00
}
bool survivesFall(eMonster m) {
return isBird(m) || m == moAirElemental || m == moSkeleton || isDragon(m) || m == moShadow || isGhost(m);
2016-08-26 09:58:03 +00:00
}
bool isThorny(eWall w) { return w == waRose; }
bool checkOrb(eMonster m1, eItem orb) {
if(m1 == moPlayer) return markOrb(orb);
if(isFriendly(m1)) return markEmpathy(orb);
return false;
}
2017-03-23 10:53:57 +00:00
bool checkOrb2(eMonster m1, eItem orb) {
if(m1 == moPlayer) return markOrb2(orb);
if(isFriendly(m1)) return markEmpathy2(orb);
return false;
}
2016-08-26 09:58:03 +00:00
bool ignoresSmell(eMonster m) {
return
m == moHexSnake || isIvy(m) || isMutantIvy(m) || isGhostMover(m) || isSlimeMover(m) ||
2017-03-23 10:53:57 +00:00
m == moRoseLady || checkOrb(m, itOrbBeauty) || checkOrb(m, itOrbAether) || checkOrb(m, itOrbShield);
}
bool isTroll(eMonster m) {
return
m == moTroll || m == moRedTroll || m == moDarkTroll ||
m == moForestTroll || m == moStormTroll || m == moFjordTroll;
}
bool isGrave(eWall w) {
return w == waFreshGrave || w == waAncientGrave;
}
bool isStandardTree(cell *c) {
return c->wall == waBigTree || c->wall == waSmallTree;
2017-03-23 10:53:57 +00:00
}
bool highwall(cell *c) {
if(c->wall == waGlass) return false;
if(wmescher && wmspatial && c->wall == waBarrier && c->land == laOceanWall)
return false;
// if(wmspatial && isTree(c)) return false;
if(isGrave(c->wall)) return true;
2017-07-16 21:00:55 +00:00
if(c->wall == waMirrorWall) return false;
2019-02-28 16:06:53 +00:00
if(c->wall == waEditStatue) return false;
2017-03-23 10:53:57 +00:00
return winf[c->wall].glyph == '#' || c->wall == waClosedGate;
}
int chasmgraph(cell *c) {
2017-07-04 13:38:33 +00:00
if(c->wall == waChasm || c->wall == waInvisibleFloor) return 2;
2017-03-23 10:53:57 +00:00
if(isChasmy(c)) return 1;
if(isWateryOrBoat(c)) return 1;
if(wmescher && c->wall == waBarrier && c->land == laOceanWall) return 1;
if(c->wall == waReptileBridge) return 1;
return 0;
}
bool conegraph(cell *c) {
return wmescher && wmspatial && (c->wall == waDune || c->wall == waBigTree || c->wall == waSmallTree || c->wall == waCTree || (c->wall == waBarrier && c->land == laOceanWall));
}
bool isReptile(eWall w) {
return w == waReptile || w == waReptileBridge;
}
bool isBull(eMonster m) {
return m == moRagingBull || m == moHerdBull || m == moSleepBull;
}
bool hornStuns(cell *c) {
eMonster m = c->monst;
return
m == moRagingBull || m == moSleepBull || m == moHerdBull ||
m == moButterfly || m == moGreater || m == moGreaterM || m == moDraugr ||
m == moHedge || m == moFlailer || m == moVizier || m == moReptile || m == moSalamander ||
m == moPair || m == moAltDemon || m == moHexDemon || m == moMonk || m == moCrusher ||
2018-12-16 23:04:59 +00:00
attackJustStuns(c, AF_NORMAL, moNone);
2017-03-23 10:53:57 +00:00
}
// generate all the world first in the quotient geometry
bool generateAll(eLand l) {
return
l == laIce || l == laDryForest || l == laCocytus || l == laLivefjord ||
l == laCaves || l == laCA;
2016-08-26 09:58:03 +00:00
}
bool isRaider(eMonster m) {
return m == moPair || m == moMonk || m == moCrusher || m == moAltDemon || m == moHexDemon;
}
2018-03-24 14:19:44 +00:00
bool isTechnicalLand(eLand l) {
return l == laNone || l == laOceanWall || l == laBarrier || l == laCanvas ||
l == laHauntedWall || l == laHauntedBorder || l == laCA ||
l == laMirrorWall || l == laMirrored || l == laMirrored2 ||
l == laMirrorWall2 || l == laMercuryRiver || l == laMemory;
}
2018-08-21 13:37:59 +00:00
bool is_mirrorland(cell *c) {
return among(c->land, laMirror, laMirrorOld);
}
}