1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-20 23:50:27 +00:00

Hyperbugs now ignore the player in peace mode.

This commit is contained in:
Zeno Rogue 2021-12-12 21:21:27 +01:00
parent 7350af18f2
commit c4a55669c8

View File

@ -1710,7 +1710,7 @@ EX namespace hive {
EX int bugcount[BUGCOLORS]; EX int bugcount[BUGCOLORS];
bool isBugEnemy(cell *c, int k) { bool isBugEnemy(cell *c, int k) {
if(isPlayerOn(c) && !invismove) return true; if(isPlayerOn(c) && !invismove && !peace::on) return true;
if(!c->monst) return false; if(!c->monst) return false;
if(c->monst == moBug0+k) return false; if(c->monst == moBug0+k) return false;
if(isIvy(c)) return false; if(isIvy(c)) return false;
@ -1866,12 +1866,15 @@ EX namespace hive {
if(againstRose(c, NULL)) bqual = -40; if(againstRose(c, NULL)) bqual = -40;
auto getplayer = peace::on ? AF_GETPLAYER : 0;
for(int dir=0; dir<c->type; dir++) { for(int dir=0; dir<c->type; dir++) {
cell *c2 = c->move(dir); cell *c2 = c->move(dir);
int qual = -10; int qual = -10;
if(!c2) continue; if(!c2) continue;
else if(againstRose(c, c2)) qual = -50; else if(againstRose(c, c2)) qual = -50;
else if(canAttack(c, m, c2, c2->monst, AF_GETPLAYER)) else if(isPlayerOn(c2) && peace::on) qual = -45;
else if(canAttack(c, m, c2, c2->monst, getplayer))
qual = c2->monst == moDeadBug ? -60: isBugEnemy(c2,k) ? 2 : -20; qual = c2->monst == moDeadBug ? -60: isBugEnemy(c2,k) ? 2 : -20;
else if(!passable(c2, c, 0)) else if(!passable(c2, c, 0))
qual = passable(c2, c, P_DEADLY) ? -30 : -60; qual = passable(c2, c, P_DEADLY) ? -30 : -60;
@ -1890,13 +1893,13 @@ EX namespace hive {
int d = gmoves[hrand(q)]; int d = gmoves[hrand(q)];
movei mi(c, d); movei mi(c, d);
auto& c2 = mi.t; auto& c2 = mi.t;
if(c2->monst || isPlayerOn(c2)) { if(c2->monst || (isPlayerOn(c2) && !peace::on)) {
eMonster killed = c2->monst; eMonster killed = c2->monst;
if(isPlayerOn(c2)) killed = moPlayer; if(isPlayerOn(c2) && !peace::on) killed = moPlayer;
if(isBug(killed)) battlecount++; if(isBug(killed)) battlecount++;
else if(killed != moPlayer && !fightspam(c2)) else if(killed != moPlayer && !fightspam(c2))
addMessage(XLAT("%The1 fights with %the2!", c->monst, killed)); addMessage(XLAT("%The1 fights with %the2!", c->monst, killed));
attackMonster(c2, AF_NORMAL | AF_GETPLAYER, c->monst); attackMonster(c2, AF_NORMAL | getplayer, c->monst);
// killMonster(c); // killMonster(c);
if(isBug(killed)) { if(isBug(killed)) {
c2->monst = moDeadBug, deadbug.push_back(c2); c2->monst = moDeadBug, deadbug.push_back(c2);