fixed the bug in the Prairie which caused the Bulls not to attack correctly

This commit is contained in:
Zeno Rogue 2019-11-15 11:48:51 +01:00
parent 610d6ee1b3
commit 8bc4cb5207
2 changed files with 8 additions and 12 deletions

View File

@ -3144,13 +3144,9 @@ EX namespace prairie {
cell *cp = whirlline[q];
cell *cn = whirlline[q+1];
if(cp->monst == moHerdBull && !cp->stuntime) {
forCellEx(c2, cp) {
int flags = AF_GETPLAYER | AF_BULL;
if(c2 != cn) flags |= AF_ONLY_FBUG;
if(canAttack(c, moHerdBull, c2, c2->monst, flags))
attackMonster(c2, flags | AF_MSG, moHerdBull);
}
cp->mondir = neighborId(cp, cn);
beastAttack(cp, true, true);
if(!cn->monst && !isPlayerOn(cn) && passable_for(cp->monst, cn, cp, P_DEADLY))
moveMonster(cn, cp, NODIR);
else {

View File

@ -4429,10 +4429,10 @@ cell *determinePush(cellwalker who, cell *c2, int subdir, const T& valid, int& p
// Angry Beast attack
// note: this is done both before and after movement
EX void beastAttack(cell *c, bool player) {
EX void beastAttack(cell *c, bool player, bool targetdir) {
if(c->mondir == NODIR) return;
forCellIdEx(c2, d, c) {
bool opposite = anglestraight(c, d, c->mondir);
bool opposite = targetdir ? (d==c->mondir) : anglestraight(c, d, c->mondir);
int flags = AF_BULL;
if(player) flags |= AF_GETPLAYER;
if(!opposite) flags |= AF_ONLY_FBUG;
@ -4481,7 +4481,7 @@ EX cell *moveNormal(cell *c, flagtype mf) {
}
else {
// Angry Beasts attack all neighbors first
if(m == moRagingBull) beastAttack(c, true);
if(m == moRagingBull) beastAttack(c, true, false);
d = pickMoveDirection(c, mf);
}
if(d == -1) {
@ -4519,7 +4519,7 @@ EX cell *moveNormal(cell *c, flagtype mf) {
}
moveMonster(c2, c, d);
if(m == moRagingBull) beastAttack(c2, false);
if(m == moRagingBull) beastAttack(c2, false, false);
return c2;
}
else {
@ -4547,7 +4547,7 @@ EX cell *moveNormal(cell *c, flagtype mf) {
cell *c2 = c->move(posdir[i]);
if(!c->monst) c->monst = m;
moveMonster(c2, c, posdir[i]);
if(m == moRagingBull) beastAttack(c2, false);
if(m == moRagingBull) beastAttack(c2, false, false);
}
return c->move(d);
}