refactored frog_power and a minor fix

This commit is contained in:
Zeno Rogue 2020-02-29 20:45:01 +01:00
parent c390b63e0a
commit 20910ec364
5 changed files with 14 additions and 7 deletions

View File

@ -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;

View File

@ -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

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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;