eating gold in front of the vault guard (trunk only)

<email deleted> wrote:
> Eating gold in a vault (or polymorphing a pile of gold into 1 gold piece)
> doesn't anger the guard.

This addresses the eating part of that report, but the hero
has to get caught doing it.
This commit is contained in:
nethack.allison
2006-03-26 05:23:46 +00:00
parent 62b430601f
commit ecb98e019c
5 changed files with 26 additions and 1 deletions

View File

@@ -1900,6 +1900,7 @@ eatspecial() /* called after eating non-food */
#endif
else
useupf(otmp, otmp->quan);
vault_gd_watching(GD_EATGOLD);
return;
}
#ifdef MAIL

View File

@@ -510,6 +510,14 @@ register struct monst *grd;
if(abs(egrd->ogx - grd->mx) > 1 ||
abs(egrd->ogy - grd->my) > 1)
return(-1); /* teleported guard - treat as monster */
if(egrd->witness) {
verbalize("How dare you %s that gold, scoundrel!",
(egrd->witness & GD_EATGOLD) ? "consume" : "destroy");
egrd->witness = 0;
grd->mpeaceful = 0;
return(-1);
}
if(egrd->fcend == 1) {
if(u_in_vault &&
(u_carry_gold || um_dist(grd->mx, grd->my, 1))) {
@@ -864,4 +872,15 @@ gd_sound() /* prevent "You hear footsteps.." when inappropriate */
else return((boolean)(grd == (struct monst *)0));
}
void
vault_gd_watching(activity)
unsigned int activity;
{
struct monst *guard = findgd();
if (guard && guard->mcansee && m_canseeu(guard)) {
if (activity == GD_EATGOLD ||
activity == GD_DESTROYGOLD)
EGD(guard)->witness = activity;
}
}
/*vault.c*/