diff --git a/environment.cpp b/environment.cpp index 59802837..51f3d1c4 100644 --- a/environment.cpp +++ b/environment.cpp @@ -240,6 +240,7 @@ EX void computePathdist(eMonster param, bool include_allies IS(true)) { cell *c2 = cw1.peek(); flagtype f = P_MONSTER; + if(param == moIvyRoot) f |= P_IVY; if(param == moTameBomberbird) f |= P_FLYING | P_ISFRIEND; if(isPrincess(param)) f |= P_ISFRIEND | P_USEBOAT | P_CHAIN; if(param == moGolem) f |= P_ISFRIEND; @@ -251,7 +252,7 @@ EX void computePathdist(eMonster param, bool include_allies IS(true)) { if(qb >= qtarg) { if(param == moTortoise && nogoSlow(c, c2)) continue; - if(param == moIvyRoot && strictlyAgainstGravity(c, c2, false, MF_IVY)) continue; + if(param == moIvyRoot && !ivy_passable(c, c2)) continue; if(param == moWorm && (cellUnstable(c) || cellEdgeUnstable(c) || prairie::no_worms(c))) continue; if(!isFriendly(param) && items[itOrbLava] && c2->cpdist <= 5 && pseudohept(c) && makeflame(c2, 1, true)) continue; diff --git a/flags.cpp b/flags.cpp index 87f8b60c..d5792362 100644 --- a/flags.cpp +++ b/flags.cpp @@ -214,7 +214,7 @@ EX bool isFlying(eMonster m) { } EX bool survivesChasm(eMonster m) { - return isFlying(m); + return isFlying(m) || isAnyIvy(m); } EX bool ignoresPlates(eMonster m) { diff --git a/monstermove.cpp b/monstermove.cpp index 38813aaa..c45994b3 100644 --- a/monstermove.cpp +++ b/monstermove.cpp @@ -1041,7 +1041,7 @@ EX void moveivy() { } continue; } - if(c2 && c2->pathdist < pd && passable(c2, c, 0) && !strictlyAgainstGravity(c2, c, false, MF_IVY)) + if(c2 && c2->pathdist < pd && ivy_passable(c2, c)) mi = movei(c, j), pd = c2->pathdist; } c = c->move(c->mondir); @@ -1437,7 +1437,7 @@ EX void movemutant() { if(isPlayerOn(c2)) continue; - if((c2->land == laOvergrown || !pseudohept(c2)) && passable(c2, c, 0)) { + if((c2->land == laOvergrown || !pseudohept(c2)) && ivy_passable(c2, c)) { if(c2->land == laClearing && !closed_or_bounded && c2->mpdist > 7) continue; c2->monst = moMutant; c2->mondir = c->c.spin(j); diff --git a/orbs.cpp b/orbs.cpp index b28800a6..eb95dd27 100644 --- a/orbs.cpp +++ b/orbs.cpp @@ -1482,7 +1482,7 @@ EX eItem targetRangedOrb(cell *c, orbAction a) { if(c->monst ? ( CHK(canAttack(cf, moFriendlyIvy, c, c->monst, f), XLAT("Cannot attack there!")) ) : ( - CHK(passable(c, cf, P_ISFRIEND | P_MONSTER), XLAT("Cannot grow there!")) && + CHK(passable(c, cf, P_ISFRIEND | P_MONSTER | P_IVY), XLAT("Cannot grow there!")) && CHK(!strictlyAgainstGravity(c, cf, false, MF_IVY), XLAT("Cannot grow against gravity!")) )) dirs.push_back(d); diff --git a/passable.cpp b/passable.cpp index 662d4ea5..a34435a7 100644 --- a/passable.cpp +++ b/passable.cpp @@ -138,6 +138,7 @@ EX bool anti_alchemy(cell *w, cell *from) { #define P_PHASE Flag(33) // phasing movement #define P_PULLMAGNET Flag(34) // pull the other part of the magnet #define P_WATERCURSE Flag(35) // Curse of Water +#define P_IVY Flag(36) // ivy #endif EX bool passable(cell *w, cell *from, flagtype flags) { @@ -270,7 +271,7 @@ EX bool passable(cell *w, cell *from, flagtype flags) { } if(isChasmy(w)) { if(in_gravity_zone(w)) ; - else if(!F(P_AETHER | P_FLYING | P_BLOW | P_JUMP1 | P_BULLET | P_DEADLY | P_REPTILE)) return false; + else if(!F(P_AETHER | P_FLYING | P_BLOW | P_JUMP1 | P_BULLET | P_DEADLY | P_REPTILE | P_IVY)) return false; } if(w->wall == waRoundTable && from && from->wall != waRoundTable && (flags & P_ISPLAYER)) return true; @@ -467,6 +468,14 @@ EX bool isNeighbor1(cell *f, cell *w) { return !f || f == w || isNeighbor(f, w); } +EX bool ivy_passable(cell *c2, cell *c) { + if(!passable(c2, c, P_IVY)) return false; + if(isWatery(c2)) return false; + if(strictlyAgainstGravity(c2, c, false, MF_IVY)) return false; + if(cellUnstableOrChasm(c) && cellUnstableOrChasm(c2)) return false; + return true; + } + EX bool passable_for(eMonster m, cell *w, cell *from, flagtype extra) { jumpdata jdummy; if(w->monst && !(extra & P_MONSTER) && !isPlayerOn(w))