mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-01-11 09:50:34 +00:00
changes:: ambush
This commit is contained in:
parent
6e3e9e3eca
commit
75bbbe6b42
32
complex2.cpp
32
complex2.cpp
@ -768,7 +768,8 @@ EX int size(cell *c, eItem what) {
|
||||
|
||||
}
|
||||
|
||||
EX int ambush(cell *c, eItem what) {
|
||||
EX void ambush(cell *c, eItem what) {
|
||||
LATE ( ambush(c, what); )
|
||||
int maxdist = gamerange();
|
||||
celllister cl(c, maxdist, 1000000, NULL);
|
||||
cell *c0 = c;
|
||||
@ -821,19 +822,24 @@ EX int ambush(cell *c, eItem what) {
|
||||
int dogs = size(c, what);
|
||||
|
||||
int gaps = dogs;
|
||||
if(!N) return dogs0;
|
||||
ambushed = true;
|
||||
int shift = hrand(N);
|
||||
dogs = min(dogs, N);
|
||||
gaps = min(gaps, N);
|
||||
for(int i=0; i<dogs; i++) {
|
||||
int pos = (shift + (N * i) / gaps) % N;
|
||||
cell *nextdog = around[pos];
|
||||
nextdog->monst = moHunterDog;
|
||||
nextdog->stuntime = 1;
|
||||
drawFlash(nextdog);
|
||||
int result = dogs0;
|
||||
if(N) {
|
||||
ambushed = true;
|
||||
int shift = hrand(N);
|
||||
dogs = min(dogs, N);
|
||||
gaps = min(gaps, N);
|
||||
for(int i=0; i<dogs; i++) {
|
||||
int pos = (shift + (N * i) / gaps) % N;
|
||||
cell *nextdog = around[pos];
|
||||
nextdog->monst = moHunterDog;
|
||||
nextdog->stuntime = 1;
|
||||
drawFlash(nextdog);
|
||||
}
|
||||
result += dogs;
|
||||
}
|
||||
return dogs + dogs0;
|
||||
|
||||
if(result)
|
||||
addMessage(XLAT("You are ambushed!"));
|
||||
}
|
||||
EX }
|
||||
|
||||
|
@ -80,9 +80,7 @@ EX bool collectItem(cell *c2, bool telekinesis IS(false)) {
|
||||
}
|
||||
|
||||
if(c2->land == laHunting && c2->item && !inv::activating) {
|
||||
int dogs = ambush::ambush(c2, c2->item);
|
||||
if(dogs)
|
||||
addMessage(XLAT("You are ambushed!"));
|
||||
ambush::ambush(c2, c2->item);
|
||||
}
|
||||
|
||||
if(isRevivalOrb(c2->item) && multi::revive_queue.size()) {
|
||||
|
Loading…
Reference in New Issue
Block a user