From 3d1772a13b84e4643c8938010e4dca0931fa0406 Mon Sep 17 00:00:00 2001 From: "nethack.rankin" Date: Tue, 22 Jan 2008 05:31:19 +0000 Subject: [PATCH] fix #1586 - stale alignment record after changing alignment type (trunk only) From a bug report, putting on a helm of opposite alignment wipes out divine protection (regardless of which god originally bestored it) but leaves piety level towards the old god in place for the new one. Reset alignment record to 0 when changing alignment type. Yes, that means that the helm can now be used to clear a negative alignment, which I think is in keeping with having subtle positive uses for bad items. Permanent alignment change did try to tweak alignment record, but I'm not sure that it worked as intended. Lawfuls changing away from law got a bonus for their new alignment, neutrals retained their old record, and chaotics changing away from chaos took a penalty to their record, all without regard to what the new alignment became. The magnitude of the bonus or penalty was half the record limit (which gradually increases with turn count) so could be very big, but I don't think it made much sense. Reset alignment record to 0 for permanent conversion same as for temporary conversion. It's simpler and reflects the fact that you haven't yet done anything to bolster or weaken your new alignment. --- doc/fixes35.0 | 1 + src/attrib.c | 7 +++++-- src/pray.c | 3 +-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/doc/fixes35.0 b/doc/fixes35.0 index 9cf5a268e..1690cfcdf 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -276,6 +276,7 @@ secret door detection's trap finding is no longer blocked by water or clouds potion thrown by monster which hit a long worm's tail gave feedback about hitting its head implement energy vortex's previously unused energy drain attack +changing alignment type resets alignment record to 0 (nomimally aligned) Platform- and/or Interface-Specific Fixes diff --git a/src/attrib.c b/src/attrib.c index 138b3f2ac..0326c6f8a 100644 --- a/src/attrib.c +++ b/src/attrib.c @@ -704,7 +704,7 @@ int propidx; /* special cases can have negative values */ /* remove some verbosity and/or redundancy */ if ((p = strstri(buf, " pair of ")) != 0) - do ++p; while ((*p = *(p + 8)) != '\0'); + copynchars(p + 1, p + 9, BUFSZ); /* overlapping buffers ok */ else if (propidx == STRANGLED && (p = strstri(buf, " of strangulation")) != 0) *p = '\0'; @@ -948,7 +948,10 @@ int reason; /* 0==conversion, 1==helm-of-OA on, 2==helm-of-OA off */ "back in sync with your body"); } - if (u.ualign.type != oldalign) retouch_equipment(0); + if (u.ualign.type != oldalign) { + u.ualign.record = 0; /* slate is wiped clean */ + retouch_equipment(0); + } } /*attrib.c*/ diff --git a/src/pray.c b/src/pray.c index ebb77fbf2..bfd0e3bf8 100644 --- a/src/pray.c +++ b/src/pray.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)pray.c 3.5 2007/05/29 */ +/* SCCS Id: @(#)pray.c 3.5 2008/01/21 */ /* Copyright (c) Benson I. Margulies, Mike Stephenson, Steve Linhart, 1989. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1439,7 +1439,6 @@ verbalize("In return for thy service, I grant thee the gift of Immortality!"); /* Beware, Conversion is costly */ change_luck(-3); u.ublesscnt += 300; - adjalign((int)(u.ualignbase[A_ORIGINAL] * (ALIGNLIM / 2))); } else { u.ugangr += 3; adjalign(-5);