alignment of Angels

From a bug report, the probing/stethoscope code assumed that all Angels
(the specific monster type, not the whole 'A' class) used the epri extension
to hold alignment, but that's not true for randomly generated ones.  So
monster status feedback gave erroneous results, and it would vary based on
pet behavior if the random Angel had been tamed.  Also, touch_artifact()
didn't know about special alignment handling for Angels and aligned priests
so always used their default alignment.

     There are other problems with Angels--such as whether they should even
be allowed to be generated randomly in the first place--that this doesn't
attempt to address.  The patch for that was starting to sprawl all over the
place so I pulled this simpler bit out for a first cut.  Probing now shows
the Wizard of Yendor as unaligned instead of lumping him in with chaotics.

     Another Makefile update needed:  pline.[c,o] no longer needs epri.h.
This commit is contained in:
nethack.rankin
2005-10-05 05:15:46 +00:00
parent 7391587006
commit 7b1b472c33
5 changed files with 20 additions and 15 deletions

View File

@@ -149,6 +149,7 @@ unicorn can't catch gems if it is asleep or paralyzed
fix grammar when choking on gold
some messages which referred to "mirror" ought to have used "looking glass"
incubi react to mirrors
alignment of Angels was handled inconsistently
Platform- and/or Interface-Specific Fixes

View File

@@ -1663,6 +1663,7 @@ E int FDECL(move_special, (struct monst *,BOOLEAN_P,SCHAR_P,BOOLEAN_P,BOOLEAN_P,
E char FDECL(temple_occupied, (char *));
E int FDECL(pri_move, (struct monst *));
E void FDECL(priestini, (d_level *,struct mkroom *,int,int,BOOLEAN_P));
E aligntyp FDECL(mon_aligntyp, (struct monst *));
E char *FDECL(priestname, (struct monst *,char *));
E boolean FDECL(p_coaligned, (struct monst *));
E struct monst *FDECL(findpriest, (CHAR_P));

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)artifact.c 3.5 2005/09/20 */
/* SCCS Id: @(#)artifact.c 3.5 2005/10/01 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -507,7 +507,7 @@ touch_artifact(obj,mon)
badclass = self_willed &&
oart->role != NON_PM && oart != &artilist[ART_EXCALIBUR];
badalign = (oart->spfx & SPFX_RESTR) && oart->alignment != A_NONE &&
(oart->alignment != sgn(mon->data->maligntyp));
(oart->alignment != sgn(mon_aligntyp(mon)));
} else { /* an M3_WANTSxxx monster or a fake player */
/* special monsters trying to take the Amulet, invocation tools or
quest item can touch anything except for `spec_applies' artifacts */

View File

@@ -1,10 +1,9 @@
/* SCCS Id: @(#)pline.c 3.5 2005/06/22 */
/* SCCS Id: @(#)pline.c 3.5 2005/10/01 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
#define NEED_VARARGS /* Uses ... */ /* comment line for pre-compiled headers */
#include "hack.h"
#include "epri.h"
#ifdef WIZARD
#include "edog.h"
#endif
@@ -304,18 +303,9 @@ void
mstatusline(mtmp)
register struct monst *mtmp;
{
aligntyp alignment;
aligntyp alignment = mon_aligntyp(mtmp);
char info[BUFSZ], monnambuf[BUFSZ];
if (mtmp->ispriest || mtmp->data == &mons[PM_ALIGNED_PRIEST]
|| mtmp->data == &mons[PM_ANGEL])
alignment = EPRI(mtmp)->shralign;
else
alignment = mtmp->data->maligntyp;
alignment = (alignment > 0) ? A_LAWFUL :
(alignment < 0) ? A_CHAOTIC :
A_NEUTRAL;
info[0] = 0;
if (mtmp->mtame) { Strcat(info, ", tame");
#ifdef WIZARD

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)priest.c 3.5 2002/11/06 */
/* SCCS Id: @(#)priest.c 3.5 2005/10/01 */
/* Copyright (c) Izchak Miller, Steve Linhart, 1989. */
/* NetHack may be freely redistributed. See license for details. */
@@ -221,6 +221,19 @@ boolean sanctum; /* is it the seat of the high priest? */
}
}
/* get a monster's alignment type without caller needing EPRI & EMIN */
aligntyp
mon_aligntyp(mon)
struct monst *mon;
{
aligntyp algn = mon->ispriest ? EPRI(mon)->shralign :
mon->isminion ? EMIN(mon)->min_align :
mon->data->maligntyp;
if (algn == A_NONE) return A_NONE; /* negative but differs from chaotic */
return (algn > 0) ? A_LAWFUL : (algn < 0) ? A_CHAOTIC : A_NEUTRAL;
}
/*
* Specially aligned monsters are named specially.
* - aligned priests with ispriest and high priests have shrines