diff --git a/attack.cpp b/attack.cpp index 6c6c1a49..2cd15971 100644 --- a/attack.cpp +++ b/attack.cpp @@ -667,10 +667,9 @@ EX void killMonster(cell *c, eMonster who, flagtype deathflags IS(0)) { c->item = itNone; } if(who == moPlayer || (isFriendly(who) && items[itOrbEmpathy])) { - if(who != moPlayer) markOrb2(itOrbEmpathy); - if(m == moFrog) items[itOrbFrog] += 5; - if(m == moVaulter) items[itOrbDash] += 5; - if(m == moPhaser) items[itOrbPhasing] += 5; + eItem o = frog_power(m); + if(o && who != moPlayer) markOrb2(itOrbEmpathy); + items[o] += 5; } if(checkOrb(who, itOrbStone)) petrify(c, waPetrified, m), pcount = 0; diff --git a/flags.cpp b/flags.cpp index 17cca831..c21a97f3 100644 --- a/flags.cpp +++ b/flags.cpp @@ -345,6 +345,14 @@ EX bool conegraph(cell *c) { return ((wmescher && wmspatial) || wmascii3) && (conegraphtype(c) || (c->wall == waBarrier && c->land == laOceanWall)); } +/** Determine the power of a frog monster. Also used to determine whether monster is a frog. */ +EX eItem frog_power(eMonster m) { + if(m == moFrog) return itOrbFrog; + if(m == moPhaser) return itOrbPhasing; + if(m == moVaulter) return itOrbDash; + return itNone; + } + EX bool hornStuns(cell *c) { eMonster m = c->monst; return diff --git a/monstergen.cpp b/monstergen.cpp index 7ac0b490..2810fbac 100644 --- a/monstergen.cpp +++ b/monstergen.cpp @@ -263,7 +263,7 @@ EX bool canReachPlayer(cell *cf, eMonster m) { }; forCellEx(c2, c) { - if(among(m, moFrog, moVaulter, moPhaser)) forCellEx(c3, c2) test(c3); + if(frog_power(m)) forCellEx(c3, c2) test(c3); test(c2); } diff --git a/monstermove.cpp b/monstermove.cpp index 193925f5..81e8ef32 100644 --- a/monstermove.cpp +++ b/monstermove.cpp @@ -1177,7 +1177,7 @@ EX void groupmove(eMonster movtype, flagtype mf) { groupmove2(movei(c2, c, STRONGWIND), movtype, mf); } - if(among(movtype, moFrog, moVaulter, moPhaser) && c->monst == moNone && !isPlayerOn(c)) { + if(frog_power(movtype) && c->monst == moNone && !isPlayerOn(c)) { forCellEx(c2, c) forCellEx(c3, c2) groupmove2(movei(c3, c, JUMP), movtype, mf); } diff --git a/orbs.cpp b/orbs.cpp index 0ac5997e..b284be99 100644 --- a/orbs.cpp +++ b/orbs.cpp @@ -1129,7 +1129,7 @@ EX int check_vault(cell *cf, cell *ct, flagtype flags, cell*& jumpthru) { if(!c2) return 0; if(!c2->monst && c2->wall != waShrub) return 1; bool for_monster = !(flags & P_ISPLAYER); - if(for_monster && c2->monst && among(c2->monst, moFrog, moVaulter, moPhaser) && !items[itOrbDiscord]) return 1; + if(for_monster && c2->monst && frog_power(c2->monst) && !items[itOrbDiscord]) return 1; if(c3) return 2; if(c2->wall != waShrub && !passable(c2, cwt.at, flags | P_JUMP1 | P_MONSTER)) return 3; if(!passable(ct, c2, flags | P_JUMP2)) return 4;