1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-06-16 10:19:58 +00:00

fixed Friendly Ghosts

This commit is contained in:
Zeno Rogue 2020-09-21 12:03:19 +02:00
parent a0865998db
commit 4ce821bf7a
2 changed files with 5 additions and 5 deletions

View File

@ -1466,7 +1466,7 @@ EX void moveghosts() {
int goodmoves = 0; int goodmoves = 0;
for(int k=0; k<c->type; k++) if(c->move(k) && c->move(k)->cpdist < c->cpdist) for(int k=0; k<c->type; k++) if(c->move(k) && c->move(k)->cpdist < c->cpdist)
if(ghostmove(c->monst, c->move(k), c) && !isPlayerOn(c->move(k))) if(ghostmove(c->monst, c->move(k), c, 0) && !isPlayerOn(c->move(k)))
goodmoves++; goodmoves++;
movesofgood.grow(goodmoves).push_back(c); movesofgood.grow(goodmoves).push_back(c);
@ -1491,7 +1491,7 @@ EX void moveghosts() {
} }
for(int k=0; k<c->type; k++) if(c->move(k) && c->move(k)->cpdist < c->cpdist) for(int k=0; k<c->type; k++) if(c->move(k) && c->move(k)->cpdist < c->cpdist)
if(ghostmove(c->monst, c->move(k), c)) if(ghostmove(c->monst, c->move(k), c, 0))
mdir.push_back(k); mdir.push_back(k);
if(mdir.empty()) continue; if(mdir.empty()) continue;
int d = hrand_elt(mdir); int d = hrand_elt(mdir);

View File

@ -330,12 +330,12 @@ EX bool againstWind(cell *cto, cell *cfrom) {
return false; return false;
} }
EX bool ghostmove(eMonster m, cell* to, cell* from) { EX bool ghostmove(eMonster m, cell* to, cell* from, flagtype extra) {
if(!isGhost(m) && nonAdjacent(to, from)) return false; if(!isGhost(m) && nonAdjacent(to, from)) return false;
if(sword::at(to, 0)) return false; if(sword::at(to, 0)) return false;
if(!shmup::on && isPlayerOn(to)) return false; if(!shmup::on && isPlayerOn(to)) return false;
if(to->monst && !(to->monst == moTentacletail && isGhost(m) && m != moFriendlyGhost) if(to->monst && !(to->monst == moTentacletail && isGhost(m) && m != moFriendlyGhost)
&& !(to->monst == moTortoise && isGhost(m) && m != moFriendlyGhost)) && !(to->monst == moTortoise && isGhost(m) && m != moFriendlyGhost) && !(extra & P_MONSTER))
return false; return false;
if((m == moWitchGhost || m == moWitchWinter) && to->land != laPower) if((m == moWitchGhost || m == moWitchWinter) && to->land != laPower)
return false; return false;
@ -499,7 +499,7 @@ EX bool passable_for(eMonster m, cell *w, cell *from, flagtype extra) {
if(m == moGreaterShark) if(m == moGreaterShark)
return isWatery(w) || w->wall == waBoat || w->wall == waFrozenLake; return isWatery(w) || w->wall == waBoat || w->wall == waFrozenLake;
if(isGhostMover(m) || m == moFriendlyGhost) if(isGhostMover(m) || m == moFriendlyGhost)
return ghostmove(m, w, from); return ghostmove(m, w, from, extra);
// for the purpose of Shmup this is correct // for the purpose of Shmup this is correct
if(m == moTameBomberbird) if(m == moTameBomberbird)
return passable(w, from, extra | P_FLYING | P_ISFRIEND); return passable(w, from, extra | P_FLYING | P_ISFRIEND);