From a33f2a99aecb83af7194718ed7bf9b8d9854efb3 Mon Sep 17 00:00:00 2001 From: copperwater Date: Mon, 5 Jun 2023 18:37:47 -0400 Subject: [PATCH] Fix: Juiblex could be summoned an infinite number of times This is due to an interaction with the code that prevents him from being made extinct (if he was, he couldn't split). Fix this by changing the check for a summoned demon lord to respect its born counter rather than its extinction status (should be the same thing as long as this only considers uniques). --- src/minion.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/minion.c b/src/minion.c index b21901a26..0cec5c083 100644 --- a/src/minion.c +++ b/src/minion.c @@ -609,7 +609,12 @@ dlord(aligntyp atyp) for (tryct = !In_endgame(&u.uz) ? 20 : 0; tryct > 0; --tryct) { pm = rn1(PM_YEENOGHU + 1 - PM_JUIBLEX, PM_JUIBLEX); - if (!(gm.mvitals[pm].mvflags & G_GONE) + /* This previously checked G_GONE (as dprince still does), but Juiblex + * is weird in that he splits, and in order to split he doesn't get + * G_EXTINCT set. Instead, check the born counter (which also works fine + * for Yeenoghu or any other archfiend since the outcome is the same - + * if they have already been generated, they can't be summoned. */ + if (!(gm.mvitals[pm].born) && (atyp == A_NONE || sgn(mons[pm].maligntyp) == sgn(atyp))) return pm; }