mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-10-22 09:27:40 +00:00
ratlings no longer react to useless shoots
This commit is contained in:
@@ -347,6 +347,7 @@ EX void shoot() {
|
|||||||
if(logical_adjacent(c, moPlayer, c1)) stabthere = true;
|
if(logical_adjacent(c, moPlayer, c1)) stabthere = true;
|
||||||
|
|
||||||
if(stabthere && canAttack(cf,who,c1,c1->monst,AF_STAB)) {
|
if(stabthere && canAttack(cf,who,c1,c1->monst,AF_STAB)) {
|
||||||
|
hit_anything = true;
|
||||||
changes.ccell(c1);
|
changes.ccell(c1);
|
||||||
eMonster m = c->monst;
|
eMonster m = c->monst;
|
||||||
if(attackMonster(c1, AF_STAB | AF_MSG, who)) {
|
if(attackMonster(c1, AF_STAB | AF_MSG, who)) {
|
||||||
@@ -369,7 +370,7 @@ EX void shoot() {
|
|||||||
bool push = (items[itCurseWeakness] || (isStunnable(c->monst) && c->hitpoints > 1));
|
bool push = (items[itCurseWeakness] || (isStunnable(c->monst) && c->hitpoints > 1));
|
||||||
push = push && (!(mov.flags & bpLAST) && monsterPushable(c));
|
push = push && (!(mov.flags & bpLAST) && monsterPushable(c));
|
||||||
|
|
||||||
if(m) attackMonster(c, attackflags | AF_MSG, who);
|
if(m && attackMonster(c, attackflags | AF_MSG, who)) hit_anything = true;
|
||||||
|
|
||||||
if(!c->monst || isAnyIvy(m)) {
|
if(!c->monst || isAnyIvy(m)) {
|
||||||
spread_plague(cf, c, movei(mov.prev).rev().d, moPlayer);
|
spread_plague(cf, c, movei(mov.prev).rev().d, moPlayer);
|
||||||
@@ -385,6 +386,7 @@ EX void shoot() {
|
|||||||
cell *ct = mov.next.cpeek();
|
cell *ct = mov.next.cpeek();
|
||||||
bool can_push = passable(ct, c, P_BLOW);
|
bool can_push = passable(ct, c, P_BLOW);
|
||||||
if(can_push) {
|
if(can_push) {
|
||||||
|
hit_anything = true;
|
||||||
changes.ccell(c);
|
changes.ccell(c);
|
||||||
changes.ccell(ct);
|
changes.ccell(ct);
|
||||||
pushMonster(mov.next);
|
pushMonster(mov.next);
|
||||||
|
12
pcmove.cpp
12
pcmove.cpp
@@ -62,6 +62,8 @@ enum eForcemovetype { fmSkip, fmMove, fmAttack, fmInstant, fmActivate };
|
|||||||
extern eForcemovetype forcedmovetype;
|
extern eForcemovetype forcedmovetype;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
EX bool hit_anything;
|
||||||
|
|
||||||
EX namespace orbbull {
|
EX namespace orbbull {
|
||||||
cell *prev[MAXPLAYER];
|
cell *prev[MAXPLAYER];
|
||||||
eLastmovetype prevtype[MAXPLAYER];
|
eLastmovetype prevtype[MAXPLAYER];
|
||||||
@@ -243,6 +245,7 @@ EX bool movepcto(int d, int subdir IS(1), bool checkonly IS(false)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool pcmove::try_shooting(bool auto_target) {
|
bool pcmove::try_shooting(bool auto_target) {
|
||||||
|
hit_anything = false;
|
||||||
if(auto_target) {
|
if(auto_target) {
|
||||||
auto b = bow::auto_path();
|
auto b = bow::auto_path();
|
||||||
if(!b) {
|
if(!b) {
|
||||||
@@ -264,7 +267,6 @@ bool pcmove::try_shooting(bool auto_target) {
|
|||||||
gravity_state = get_static_gravity(cwt.at);
|
gravity_state = get_static_gravity(cwt.at);
|
||||||
if(gravity_state) markOrb(itOrbGravity);
|
if(gravity_state) markOrb(itOrbGravity);
|
||||||
}
|
}
|
||||||
lastmovetype = lmAttack; lastmove = NULL;
|
|
||||||
|
|
||||||
if(cellEdgeUnstable(cwt.at) || cwt.at->land == laWhirlpool) {
|
if(cellEdgeUnstable(cwt.at) || cwt.at->land == laWhirlpool) {
|
||||||
if(checkonly) return true;
|
if(checkonly) return true;
|
||||||
@@ -277,7 +279,8 @@ bool pcmove::try_shooting(bool auto_target) {
|
|||||||
if(checkNeedMove(checkonly, false))
|
if(checkNeedMove(checkonly, false))
|
||||||
return false;
|
return false;
|
||||||
swordAttackStatic();
|
swordAttackStatic();
|
||||||
nextmovetype = lmAttack;
|
nextmovetype = hit_anything ? lmAttack : lmSkip;
|
||||||
|
lastmovetype = hit_anything ? lmAttack : lmSkip; lastmove = NULL;
|
||||||
|
|
||||||
mi = movei(cwt.at, STAY);
|
mi = movei(cwt.at, STAY);
|
||||||
if(last_gravity_state && !gravity_state)
|
if(last_gravity_state && !gravity_state)
|
||||||
@@ -1628,6 +1631,7 @@ EX void sideAttackAt(cell *mf, int dir, cell *mt, eMonster who, eItem orb, cell
|
|||||||
int kk = 0;
|
int kk = 0;
|
||||||
if(orb == itOrbPlague) kk = tkills();
|
if(orb == itOrbPlague) kk = tkills();
|
||||||
if(attackMonster(mt, AF_NORMAL | f | AF_MSG, who) || isAnyIvy(m)) {
|
if(attackMonster(mt, AF_NORMAL | f | AF_MSG, who) || isAnyIvy(m)) {
|
||||||
|
hit_anything = true;
|
||||||
if(orb == itOrbPlague && kk < tkills())
|
if(orb == itOrbPlague && kk < tkills())
|
||||||
plague_kills++;
|
plague_kills++;
|
||||||
if(mt->monst != m) spread_plague(mf, mt, dir, who);
|
if(mt->monst != m) spread_plague(mf, mt, dir, who);
|
||||||
@@ -1640,6 +1644,7 @@ EX void sideAttackAt(cell *mf, int dir, cell *mt, eMonster who, eItem orb, cell
|
|||||||
markOrb(orb);
|
markOrb(orb);
|
||||||
mt->wall = waNone;
|
mt->wall = waNone;
|
||||||
spread_plague(mf, mt, dir, who);
|
spread_plague(mf, mt, dir, who);
|
||||||
|
hit_anything = true;
|
||||||
}
|
}
|
||||||
else if(mt->wall == waShrub && markEmpathy(itOrbSlaying)) {
|
else if(mt->wall == waShrub && markEmpathy(itOrbSlaying)) {
|
||||||
changes.ccell(mt);
|
changes.ccell(mt);
|
||||||
@@ -1647,16 +1652,19 @@ EX void sideAttackAt(cell *mf, int dir, cell *mt, eMonster who, eItem orb, cell
|
|||||||
markOrb(orb);
|
markOrb(orb);
|
||||||
mt->wall = waNone;
|
mt->wall = waNone;
|
||||||
spread_plague(mf, mt, dir, who);
|
spread_plague(mf, mt, dir, who);
|
||||||
|
hit_anything = true;
|
||||||
}
|
}
|
||||||
else if(mt->wall == waBigTree) {
|
else if(mt->wall == waBigTree) {
|
||||||
changes.ccell(mt);
|
changes.ccell(mt);
|
||||||
plague_particles();
|
plague_particles();
|
||||||
markOrb(orb);
|
markOrb(orb);
|
||||||
mt->wall = waSmallTree;
|
mt->wall = waSmallTree;
|
||||||
|
hit_anything = true;
|
||||||
}
|
}
|
||||||
else if(mt->wall == waExplosiveBarrel && orb != itOrbPlague) {
|
else if(mt->wall == waExplosiveBarrel && orb != itOrbPlague) {
|
||||||
changes.ccell(mt);
|
changes.ccell(mt);
|
||||||
explodeBarrel(mt);
|
explodeBarrel(mt);
|
||||||
|
hit_anything = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user