diff --git a/src/vault.c b/src/vault.c index dc95128d0..90157b7fa 100644 --- a/src/vault.c +++ b/src/vault.c @@ -320,12 +320,19 @@ invault(void) struct obj *otmp; boolean spotted; int trycount, vaultroom = (int) vault_occupied(u.urooms); + int vgdeathcount; if (!vaultroom) { u.uinvault = 0; return; } - ++u.uinvault; + /* after a couple of guards don't come back from their trips to + the vault, future guards become more reluctant to turn up (even + if summoned via whistle) */ + vgdeathcount = svm.mvitals[PM_GUARD].died; + if (vgdeathcount < 2 || + (vgdeathcount < 50 && !rn2(vgdeathcount * vgdeathcount))) + ++u.uinvault; if (u.uinvault < VAULT_GUARD_TIME || (u.uinvault % (VAULT_GUARD_TIME / 2)) != 0) return; @@ -409,6 +416,10 @@ invault(void) EGD(guard)->vroom = vaultroom; EGD(guard)->warncnt = 0; + /* ensure the guard doesn't respawn again next turn if killed + immediately */ + ++u.uinvault; + reset_faint(); /* if fainted - wake up */ /* if there are any boulders in the guard's way, destroy them; perhaps the guard knows a touch equivalent of force bolt;