1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-07-04 10:42:51 +00:00

no more 'Ambushed' messages when picking up dead orbs etc.

This commit is contained in:
Zeno Rogue 2017-12-03 19:15:56 +01:00
parent 12d21161bf
commit 26569e799a

View File

@ -6183,16 +6183,17 @@ int ambushSize(cell *c, eItem what) {
} }
void ambush(cell *c, eItem what) { int ambush(cell *c, eItem what) {
int maxdist = getDistLimit(); int maxdist = getDistLimit();
celllister cl(c, maxdist, 1000000, NULL); celllister cl(c, maxdist, 1000000, NULL);
cell *c0 = c; cell *c0 = c;
int d = 0; int d = 0;
cl.prepare(); cl.prepare();
int dogs0 = 0;
for(cell *cx: cl.lst) { for(cell *cx: cl.lst) {
int dh = cl.getdist(cx); int dh = cl.getdist(cx);
if(dh <= 2 && cx->monst == moHunterGuard) if(dh <= 2 && cx->monst == moHunterGuard)
cx->monst = moHunterDog; cx->monst = moHunterDog, dogs0++;
if(dh > d) c0 = cx, d = dh; if(dh > d) c0 = cx, d = dh;
} }
if(sphere) { if(sphere) {
@ -6219,7 +6220,7 @@ void ambush(cell *c, eItem what) {
int dogs = ambushSize(c, what); int dogs = ambushSize(c, what);
int gaps = dogs; int gaps = dogs;
if(!N) return; if(!N) return dogs0;
ambushed = true; ambushed = true;
int shift = hrand(N); int shift = hrand(N);
dogs = min(dogs, N); dogs = min(dogs, N);
@ -6231,6 +6232,7 @@ void ambush(cell *c, eItem what) {
nextdog->stuntime = 1; nextdog->stuntime = 1;
drawFlash(nextdog); drawFlash(nextdog);
} }
return dogs + dogs0;
} }
bool collectItem(cell *c2, bool telekinesis) { bool collectItem(cell *c2, bool telekinesis) {
@ -6257,8 +6259,9 @@ bool collectItem(cell *c2, bool telekinesis) {
} }
if(c2->land == laHunting && c2->item) { if(c2->land == laHunting && c2->item) {
int dogs = ambush(c2, c2->item);
if(dogs)
addMessage(XLAT("You are ambushed!")); addMessage(XLAT("You are ambushed!"));
ambush(c2, c2->item);
} }
if(isRevivalOrb(c2->item) && multi::revive_queue.size()) { if(isRevivalOrb(c2->item) && multi::revive_queue.size()) {
@ -6913,6 +6916,7 @@ bool monsterPushable(cell *c2) {
} }
bool movepcto(int d, int subdir, bool checkonly) { bool movepcto(int d, int subdir, bool checkonly) {
if(d >= 0 && !checkonly && subdir != 1 && subdir != -1) printf("subdir = %d\n", subdir);
global_pushto = NULL; global_pushto = NULL;
bool switchplaces = false; bool switchplaces = false;