Vault guards are more reluctant to turn up if they keep dying

This is primarily meant as a fix for a farming strategy, although
it also makes sense in terms of the decisions the guards would
likely make.
This commit is contained in:
Alex Smith
2025-05-29 19:04:42 +01:00
parent 45bd98f10e
commit 2bf00395f1

View File

@@ -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;