1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-10-21 08:57:39 +00:00

[10.3i] fixed shooting in the Wild West

This commit is contained in:
Zeno Rogue
2018-06-29 13:14:49 +02:00
parent 0faccacaf6
commit 0f4de1fa9a
3 changed files with 38 additions and 25 deletions

View File

@@ -1140,19 +1140,18 @@ bool flashWouldKill(cell *c, flagtype extra) {
return false; return false;
} }
// this is not completely correct, but it works in the Wild West vector<cell*> gun_targets(cell *c) {
bool outlawNearby(cell *c, int dist) { manual_celllister cl;
if(dist == 0) return false; vector<int> dists;
for(int i=0; i<c->type; i++) { cl.add(c); dists.push_back(0);
cell *c2 = c->mov[i]; for(int i=0; i<isize(dists); i++) {
if(!c2) continue; cell *c1 = cl.lst[i];
if(c2->monst == moOutlaw && !stalemate::isKilled(c2)) if(dists[i] <= 2)
return true; forCellEx(c2, c1)
if((passable(c2, NULL, 0) || (c2->monst && stalemate::isKilled(c2))) && if(passable(c2, c1, P_BULLET | P_FLYING | P_MONSTER))
outlawNearby(c2, dist-1)) if(cl.add(c2)) dists.push_back(dists[i] + 1);
return true;
} }
return false; return cl.lst;
} }
namespace stalemate { namespace stalemate {
@@ -1218,11 +1217,13 @@ bool monstersnear(stalemate1& sm) {
fast = (items[itOrbSpeed] && (items[itOrbSpeed] & 1)); fast = (items[itOrbSpeed] && (items[itOrbSpeed] & 1));
} }
if(havewhat&HF_OUTLAW) if(havewhat&HF_OUTLAW) {
if(outlawNearby(c, 3)) { for(cell *c1: gun_targets(c))
res++; who_kills_me = moOutlaw; if(c1->monst == moOutlaw && !c1->stuntime && !stalemate::isKilled(c1)) {
} res++; who_kills_me = moOutlaw;
}
}
for(int t=0; t<c->type; t++) { for(int t=0; t<c->type; t++) {
cell *c2 = c->mov[t]; cell *c2 = c->mov[t];
@@ -5398,9 +5399,13 @@ void specialMoves() {
} }
} }
else if(m == moOutlaw && c->pathdist <= GUNRANGE) { else if(m == moOutlaw) {
killThePlayer(m, nearestPathPlayer(c), 0); for(cell *c1: gun_targets(c))
c->stuntime = 1; 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)) { else if(m == moWitchFlash && flashWouldKill(c, AF_GETPLAYER | AF_ONLY_FBUG) && !flashWouldKill(c, false)) {

View File

@@ -3047,9 +3047,16 @@ void setcolors(cell *c, int& wcol, int &fcol) {
wcol = gradient(0x804060, wcol, 0,2,3), wcol = gradient(0x804060, wcol, 0,2,3),
fcol = gradient(0x804060, fcol, 0,2,3); fcol = gradient(0x804060, fcol, 0,2,3);
if(items[itRevolver] && c->pathdist > GUNRANGE && !shmup::on) if(items[itRevolver] && !shmup::on) {
fcol = gradient(fcol, 0, 0, 25, 100), bool inrange = c->mpdist <= GUNRANGE;
wcol = gradient(wcol, 0, 0, 25, 100); if(inrange) {
inrange = false;
for(int i=0; i<numplayers(); i++) for(cell *c1: gun_targets(playerpos(i))) if(c1 == c) inrange = true;
}
if(!inrange)
fcol = gradient(fcol, 0, 0, 25, 100),
wcol = gradient(wcol, 0, 0, 25, 100);
}
if(highwall(c) && !wmspatial) if(highwall(c) && !wmspatial)
fcol = wcol; fcol = wcol;

View File

@@ -1172,8 +1172,9 @@ eItem targetRangedOrb(cell *c, orbAction a) {
// (4a) colt // (4a) colt
if(!shmup::on && items[itRevolver] && c->monst && canAttack(cwt.c, moPlayer, c, c->monst, AF_GUN)) { if(!shmup::on && items[itRevolver] && c->monst && canAttack(cwt.c, moPlayer, c, c->monst, AF_GUN)) {
pathdata pd(moEagle); bool inrange = false;
if(c->pathdist <= GUNRANGE && !monstersnearO(a, cwt.c, c, moPlayer, NULL, cwt.c)) { 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); if(!isCheck(a)) gun_attack(c);
return itRevolver; return itRevolver;
} }