mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-20 23:50:27 +00:00
fixed ambushes in non-three-valent geometries
This commit is contained in:
parent
d23af4b71b
commit
25cbf1129b
11
game.cpp
11
game.cpp
@ -6861,11 +6861,22 @@ int ambush(cell *c, eItem what) {
|
|||||||
vector<cell*> around;
|
vector<cell*> around;
|
||||||
cell *clast = NULL;
|
cell *clast = NULL;
|
||||||
cell *ccur = c0;
|
cell *ccur = c0;
|
||||||
|
int v = VALENCE;
|
||||||
for(int tries=0; tries<10000; tries++) {
|
for(int tries=0; tries<10000; tries++) {
|
||||||
cell *c2 = NULL;
|
cell *c2 = NULL;
|
||||||
|
if(v == 3) {
|
||||||
forCellEx(c1, ccur)
|
forCellEx(c1, ccur)
|
||||||
if(c1 != clast && cl.listed(c1) && cl.getdist(c1) == d)
|
if(c1 != clast && cl.listed(c1) && cl.getdist(c1) == d)
|
||||||
c2 = c1;
|
c2 = c1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
for(int i=0; i<ccur->type; i++) {
|
||||||
|
cell *c1 = (cellwalker(ccur, i) + wstep + 1).peek();
|
||||||
|
if(!c1) continue;
|
||||||
|
if(c1 != clast && cl.listed(c1) && cl.getdist(c1) == d)
|
||||||
|
c2 = c1;
|
||||||
|
}
|
||||||
|
}
|
||||||
if(!c2) break;
|
if(!c2) break;
|
||||||
if(c2->land == laHunting && c2->wall == waNone && c2->monst == moNone)
|
if(c2->land == laHunting && c2->wall == waNone && c2->monst == moNone)
|
||||||
around.push_back(c2);
|
around.push_back(c2);
|
||||||
|
Loading…
Reference in New Issue
Block a user