diff --git a/game.cpp b/game.cpp index a4ce4d25..58137d59 100644 --- a/game.cpp +++ b/game.cpp @@ -1140,19 +1140,18 @@ bool flashWouldKill(cell *c, flagtype extra) { return false; } -// this is not completely correct, but it works in the Wild West -bool outlawNearby(cell *c, int dist) { - if(dist == 0) return false; - for(int i=0; itype; i++) { - cell *c2 = c->mov[i]; - if(!c2) continue; - if(c2->monst == moOutlaw && !stalemate::isKilled(c2)) - return true; - if((passable(c2, NULL, 0) || (c2->monst && stalemate::isKilled(c2))) && - outlawNearby(c2, dist-1)) - return true; +vector gun_targets(cell *c) { + manual_celllister cl; + vector dists; + cl.add(c); dists.push_back(0); + for(int i=0; imonst == moOutlaw && !c1->stuntime && !stalemate::isKilled(c1)) { + res++; who_kills_me = moOutlaw; + } + } + for(int t=0; ttype; t++) { cell *c2 = c->mov[t]; @@ -5398,9 +5399,13 @@ void specialMoves() { } } - else if(m == moOutlaw && c->pathdist <= GUNRANGE) { - killThePlayer(m, nearestPathPlayer(c), 0); - c->stuntime = 1; + else if(m == moOutlaw) { + for(cell *c1: gun_targets(c)) + if(canAttack(c, moOutlaw, c1, c1->monst, AF_GETPLAYER | AF_ONLY_FBUG | AF_GUN)) { + attackMonster(c1, AF_GETPLAYER | AF_ONLY_FBUG | AF_GUN, moOutlaw); + c->stuntime = 1; + break; + } } else if(m == moWitchFlash && flashWouldKill(c, AF_GETPLAYER | AF_ONLY_FBUG) && !flashWouldKill(c, false)) { diff --git a/graph.cpp b/graph.cpp index eafc7877..e01f5dc7 100644 --- a/graph.cpp +++ b/graph.cpp @@ -3047,9 +3047,16 @@ void setcolors(cell *c, int& wcol, int &fcol) { wcol = gradient(0x804060, wcol, 0,2,3), fcol = gradient(0x804060, fcol, 0,2,3); - if(items[itRevolver] && c->pathdist > GUNRANGE && !shmup::on) - fcol = gradient(fcol, 0, 0, 25, 100), - wcol = gradient(wcol, 0, 0, 25, 100); + if(items[itRevolver] && !shmup::on) { + bool inrange = c->mpdist <= GUNRANGE; + if(inrange) { + inrange = false; + for(int i=0; imonst && canAttack(cwt.c, moPlayer, c, c->monst, AF_GUN)) { - pathdata pd(moEagle); - if(c->pathdist <= GUNRANGE && !monstersnearO(a, cwt.c, c, moPlayer, NULL, cwt.c)) { + bool inrange = false; + for(cell *c1: gun_targets(cwt.c)) if(c1 == c) inrange = true; + if(inrange && !monstersnearO(a, cwt.c, c, moPlayer, NULL, cwt.c)) { if(!isCheck(a)) gun_attack(c); return itRevolver; }