mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-02-02 20:29:17 +00:00
canReachPlayer now can put frogs
This commit is contained in:
parent
3597342f28
commit
03dcd5fa17
@ -253,14 +253,21 @@ EX bool canReachPlayer(cell *cf, eMonster m) {
|
||||
cl.add(cf);
|
||||
for(int i=0; i<isize(cl.lst) && i < 10000; i++) {
|
||||
cell *c = cl.lst[i];
|
||||
for(int j=0; j<c->type; j++) {
|
||||
cell *c2 = c->move(j);
|
||||
if(!c2) continue;
|
||||
if(cl.listed(c2)) continue;
|
||||
if(!passable_for(m, c2, c, P_MONSTER | P_ONPLAYER | P_CHAIN)) continue;
|
||||
if(isPlayerOn(c2)) return true;
|
||||
bool found = false;
|
||||
|
||||
auto test = [&] (cell *c2) {
|
||||
if(cl.listed(c2)) return;
|
||||
if(!passable_for(m, c2, c, P_MONSTER | P_ONPLAYER | P_CHAIN)) return;
|
||||
if(isPlayerOn(c2)) found = true;
|
||||
cl.add(c2);
|
||||
};
|
||||
|
||||
forCellEx(c2, c) {
|
||||
if(among(m, moFrog, moVaulter, moPhaser)) forCellEx(c3, c2) test(c3);
|
||||
test(c2);
|
||||
}
|
||||
|
||||
if(found) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user