From 308c5ab237ee3c7925e77fee299e48f8b1414203 Mon Sep 17 00:00:00 2001 From: Alex Smith Date: Fri, 30 May 2025 02:10:58 +0100 Subject: [PATCH] The Amulet of Yendor gives a wish when initially picked up Part 4 of implementing wish spreading. (This is now a complete implementation, although the details are likely to change - but it makes sense to commit something with the right balance properties, and then tweak it based on feedback from playtesting.) This helps to make the Amulet of Yendor feel special, and restores approximately the same average number of wishes per game as existed prior to the nerf to wands of wishing. Placing the wish in allmain helps to avoid the wish happening at an awkward place in the game's control flow, and is simpler than testing every possible mechanism for gaining items for bugs (message order is a common issue when trying to place it in addinv-related functions, and this also avoids issues with the wished-for item immediately invalidating an assumption that was made by the calling code). It is possible that this would be better as an invoke effect, although I like the impact of picking up the Amulet and immediately being given a wish. --- include/patchlevel.h | 2 +- include/you.h | 3 +++ src/allmain.c | 7 +++++++ src/u_init.c | 1 + 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/include/patchlevel.h b/include/patchlevel.h index 339095f25..4992b7f3a 100644 --- a/include/patchlevel.h +++ b/include/patchlevel.h @@ -17,7 +17,7 @@ * Incrementing EDITLEVEL can be used to force invalidation of old bones * and save files. */ -#define EDITLEVEL 126 +#define EDITLEVEL 127 /* * Development status possibilities. diff --git a/include/you.h b/include/you.h index 2683eec8f..bbd679d8f 100644 --- a/include/you.h +++ b/include/you.h @@ -52,6 +52,9 @@ struct u_event { Bitfield(udemigod, 1); /* killed the wiz */ Bitfield(uvibrated, 1); /* stepped on "vibrating square" */ Bitfield(ascended, 1); /* has offered the Amulet */ + + Bitfield(amulet_wish, 1); /* has gained a wish from the Amulet */ + /* 7 free bits */ }; /* diff --git a/src/allmain.c b/src/allmain.c index 5620e1eac..d80e50a78 100644 --- a/src/allmain.c +++ b/src/allmain.c @@ -428,6 +428,13 @@ moveloop_core(void) /****************************************/ clear_splitobjs(); + + /* the Amulet of Yendor gives a wish when initially picked up */ + if (u.uhave.amulet && !u.uevent.amulet_wish) { + u.uevent.amulet_wish = 1; + makewish(); + } + find_ac(); if (!svc.context.mv || Blind) { /* redo monsters if hallu or wearing a helm of telepathy */ diff --git a/src/u_init.c b/src/u_init.c index 1d0913f80..e4d60dd62 100644 --- a/src/u_init.c +++ b/src/u_init.c @@ -963,6 +963,7 @@ u_init(void) u.uevent.uheard_tune = 0; u.uevent.uopened_dbridge = 0; u.uevent.udemigod = 0; /* not a demi-god yet... */ + u.uevent.amulet_wish = 0; u.udg_cnt = 0; u.mh = u.mhmax = u.mtimedone = 0; u.uz.dnum = u.uz0.dnum = 0;