Frogs implemented

This commit is contained in:
Zeno Rogue 2020-02-26 01:37:02 +01:00
parent 73bd3c7369
commit 7e75c28fc1
4 changed files with 33 additions and 0 deletions

View File

@ -42,6 +42,7 @@ namespace hr {
#define HF_ALT Flag(29)
#define HF_MONK Flag(30)
#define HF_WESTWALL Flag(31)
#define HF_JUMP Flag(32)
#endif
EX flagtype havewhat, hadwhat;
@ -408,6 +409,8 @@ EX void bfs() {
if(c2->monst == moBat) havewhat |= HF_BATS | HF_EAGLES;
if(c2->monst == moEagle) havewhat |= HF_EAGLES;
}
else if(among(c2->monst, moFrog, moVaulter, moPhaser))
havewhat |= HF_JUMP;
else if(c2->monst == moReptile) havewhat |= HF_REPTILE;
else if(isLeader(c2->monst)) havewhat |= HF_LEADER;
else if(c2->monst == moEarthElemental) havewhat |= HF_EARTH;

View File

@ -448,6 +448,7 @@ constexpr int STRONGWIND = 99;
constexpr int FALL = 98;
constexpr int NO_SPACE = 97;
constexpr int TELEPORT = 96;
constexpr int JUMP = 95;
namespace whirlwind { cell *jumpDestination(cell*); }

View File

@ -151,6 +151,13 @@ EX void moveMonster(const movei& mi) {
}
if(fri || isBug(m) || items[itOrbDiscord]) stabbingAttack(cf, ct, m);
if(mi.d == JUMP && m == moVaulter) {
cell *cm = common_neighbor(cf, ct);
if(cm->wall == waShrub) cm->wall = waNone;
if(cm->monst)
attackMonster(cm, AF_NORMAL | AF_MSG | AF_GETPLAYER, m);
}
if(isLeader(m)) {
if(ct->wall == waBigStatue) {
@ -1165,6 +1172,11 @@ EX void groupmove(eMonster movtype, flagtype mf) {
cell *c2 = whirlwind::jumpFromWhereTo(c, false);
groupmove2(movei(c2, c, STRONGWIND), movtype, mf);
}
if(among(movtype, moFrog, moVaulter, moPhaser) && c->monst == moNone && !isPlayerOn(c)) {
forCellEx(c2, c) forCellEx(c3, c2)
groupmove2(movei(c3, c, JUMP), movtype, mf);
}
}
if(movtype != moDragonHead) for(int i=0; i<isize(dcal); i++) {
@ -1951,6 +1963,12 @@ EX void movemonsters() {
if(havewhat & HF_EAGLES) groupmove(moEagle, MF_NOATTACKS | MF_ONLYEAGLE);
DEBB(DF_TURN, ("eagles"));
if(havewhat & HF_REPTILE) groupmove(moReptile, 0);
DEBB(DF_TURN, ("jumpers"));
if(havewhat & HF_JUMP) {
groupmove(moFrog, 0);
groupmove(moVaulter, 0);
groupmove(moPhaser, 0);
}
DEBB(DF_TURN, ("air"));
if(havewhat & HF_AIR) {
airmap.clear();

View File

@ -448,7 +448,12 @@ EX bool notNearItem(cell *c) {
return true;
}
EX bool isNeighbor1(cell *f, cell *w) {
return !f || f == w || isNeighbor(f, w);
}
EX bool passable_for(eMonster m, cell *w, cell *from, flagtype extra) {
cell *dummy;
if(w->monst && !(extra & P_MONSTER) && !isPlayerOn(w))
return false;
if(m == moWolf) {
@ -524,6 +529,12 @@ EX bool passable_for(eMonster m, cell *w, cell *from, flagtype extra) {
}
return !pseudohept(w) && passable(w, from, extra);
}
if(m == moFrog)
return (!from || from == w) ? passable(w, from, extra) : check_jump(from, w, extra, dummy) == 3;
if(m == moPhaser)
return isNeighbor1(from, w) ? passable(w, from, extra) : check_phase(from, w, extra, dummy) == 3;
if(m == moVaulter)
return isNeighbor1(from, w) ? passable(w, from, extra) : check_vault(from, w, extra, dummy) == 6;
if(m == moAltDemon) {
if(extra & P_ONPLAYER) {
if(isPlayerOn(w)) return true;