Skip to content

Commit

Permalink
Wishpain tweaks. Having the number of wishes not match the luck and m…
Browse files Browse the repository at this point in the history
…onster generation was confusing, so I bumped up the luck penalty by 1 so it matches. This definitely makes the second wish a bit more zesty! But there will be no mental gymnastics to know what the current luck penalty or spawn rate is. I also refactored some stuff to make the spawn rate correctly sync up with the wish changes as they happen.
  • Loading branch information
elunna committed Oct 27, 2023
1 parent c03d2cd commit 6e99cff
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 53 deletions.
108 changes: 56 additions & 52 deletions src/allmain.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ STATIC_DCL void FDECL(interrupt_multi, (const char *));
STATIC_DCL void FDECL(debug_fields, (const char *));
STATIC_DCL void NDECL(init_mchest);
STATIC_DCL void NDECL(pickup_spirits);

STATIC_DCL void NDECL(update_monclock);

#ifdef EXTRAINFO_FN
static long prev_dgl_extrainfo = 0;
Expand Down Expand Up @@ -274,56 +274,9 @@ boolean resuming;
been purged at end of their previous round of moving */
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon)
mtmp->movement += mcalcmove(mtmp);

/* From SporkHack & UnNetHack (modified)
* Vanilla generates a critter every 70-ish turns.
* The rate accelerates to every 50 or so below the Castle,
* and 'round every 25 turns once you've done the Invocation.
*
* (From EvilHack)
* We will push it even further. Monsters post-Invocation
* will almost always appear on the stairs (if present), and
* much more frequently; this, along with the extra intervene()
* calls, should certainly make it seem like you're wading back
* through the teeming hordes.
*
* Aside from that, a more general clock should be put on things;
* after about 50,000 turns, the frequency rate of appearance
* and difficulty of monsters generated will slowly increase until
* it reaches the point it will be at as if you were post-Invocation.
*
* The rate increases linearly with turns. The rule of thumb is that
* at turn x the rate is approximately (x / 30.0000) times the normal
* rate. Maximal rate is 8x the normal rate.
* -------------------------------------------------------------------
* In Hack'EM - we are going to put Yet Another Twist on monster generation
* and use it to "punish" wishes. For every wish the player makes, the
* rate will increase! This lets the player have their wishes at the cost
* of a harder game later.
*/
monclock = MIN_MONGEN_RATE;
/* Don't let wishes influence the fuzzer */
if (!iflags.debug_fuzzer) {
if (monclock > MIN_MONGEN_RATE / 2 && (u.uconduct.wishes >= 2L))
monclock = MIN_MONGEN_RATE / 2;
if (monclock > MIN_MONGEN_RATE / 3 && (u.uconduct.wishes >= 3L))
monclock = MIN_MONGEN_RATE / 3;
if (monclock > MIN_MONGEN_RATE / 4 && (u.uconduct.wishes >= 4L))
monclock = MIN_MONGEN_RATE / 4;
if (monclock > MIN_MONGEN_RATE / 5 && (u.uconduct.wishes >= 5L))
monclock = MIN_MONGEN_RATE / 5;
if (monclock > MIN_MONGEN_RATE / 6 && (u.uconduct.wishes >= 6L))
monclock = MIN_MONGEN_RATE / 6;
if (monclock > MIN_MONGEN_RATE / 7 && (u.uconduct.wishes >= 7L))
monclock = MIN_MONGEN_RATE / 7;
if (u.uconduct.wishes >= 8L)
monclock = MAX_MONGEN_RATE;
}
/* make sure we don't fall off the bottom */
if (monclock < MAX_MONGEN_RATE)
monclock = MAX_MONGEN_RATE;
if (monclock > MIN_MONGEN_RATE)
monclock = MIN_MONGEN_RATE;

/* Handle monster spawn rates */
update_monclock();

if (!rn2(monclock)) {
if (u.uevent.invoked && xupstair && rn2(10))
Expand Down Expand Up @@ -1450,10 +1403,14 @@ wishluck()
return 0;
if (u.uconduct.wishes < 2)
return 0;

/* For synchronizing monster spawn rates with wishes */
update_monclock();

/* Technically we can only get the player to -10,
* so we force them to carry a virtual cursed luckstone. */
if (u.uconduct.wishes < 13)
return u.uconduct.wishes - 1;
return -(u.uconduct.wishes);
else
return -10;
}
Expand Down Expand Up @@ -1491,6 +1448,53 @@ pickup_spirits()
}
}
}
}

STATIC_OVL void
update_monclock()
{
/* From SporkHack & UnNetHack (modified)
* Vanilla generates a critter every 70-ish turns.
* The rate accelerates to every 50 or so below the Castle,
* and 'round every 25 turns once you've done the Invocation.
*
* (From EvilHack)
* We will push it even further. Monsters post-Invocation
* will almost always appear on the stairs (if present), and
* much more frequently; this, along with the extra intervene()
* calls, should certainly make it seem like you're wading back
* through the teeming hordes.
*
* Aside from that, a more general clock should be put on things;
* after about 50,000 turns, the frequency rate of appearance
* and difficulty of monsters generated will slowly increase until
* it reaches the point it will be at as if you were post-Invocation.
*
* The rate increases linearly with turns. The rule of thumb is that
* at turn x the rate is approximately (x / 30.0000) times the normal
* rate. Maximal rate is 8x the normal rate.
* -------------------------------------------------------------------
* In Hack'EM - we are going to put Yet Another Twist on monster generation
* and use it to "punish" wishes. For every wish the player makes, the
* rate will increase! This lets the player have their wishes at the cost
* of a harder game later.
*/
monclock = MIN_MONGEN_RATE;
/* Don't let wishes influence the fuzzer */
if (!iflags.debug_fuzzer) {
for (long i = 2; i <= 7; i++) {
if (monclock > MIN_MONGEN_RATE / i && (u.uconduct.wishes >= i)) {
monclock = MIN_MONGEN_RATE / i;
}
}
if (u.uconduct.wishes >= 8L) {
monclock = MAX_MONGEN_RATE;
}
}
/* make sure we don't fall off the bottom */
if (monclock < MAX_MONGEN_RATE)
monclock = MAX_MONGEN_RATE;
if (monclock > MIN_MONGEN_RATE)
monclock = MIN_MONGEN_RATE;
}
/*allmain.c*/
5 changes: 4 additions & 1 deletion src/zap.c
Original file line number Diff line number Diff line change
Expand Up @@ -7396,7 +7396,10 @@ makewish()
"wished for \"%s\"", bufcpy);

if ((adjust = wishluck())) {
change_luck(adjust == -10 ? -10 : -1);
if (adjust == -2 || adjust == -10)
change_luck(adjust);
else
change_luck(-1);
set_moreluck();
}
if (otmp != &zeroobj) {
Expand Down

0 comments on commit 6e99cff

Please sign in to comment.