Merge branch 'NetHack-3.7' into to500

This commit is contained in:
nhmall
2026-05-02 00:19:08 -04:00
74 changed files with 1102 additions and 1136 deletions
+1
View File
@@ -1082,6 +1082,7 @@ struct instance_globals_y {
/* decl.c */ /* decl.c */
int y_maze_max; int y_maze_max;
struct monst youmonst;
/* pline.c */ /* pline.c */
/* work buffer for You(), &c and verbalize() */ /* work buffer for You(), &c and verbalize() */
+3 -3
View File
@@ -253,11 +253,11 @@
((int) U_AP_TYPE == M_AP_NOTHING) \ ((int) U_AP_TYPE == M_AP_NOTHING) \
? hero_glyph \ ? hero_glyph \
: ((int) U_AP_TYPE == M_AP_FURNITURE) \ : ((int) U_AP_TYPE == M_AP_FURNITURE) \
? cmap_to_glyph((int) u.umonst->mappearance) \ ? cmap_to_glyph((int) gy.youmonst.mappearance) \
: ((int) U_AP_TYPE == M_AP_OBJECT) \ : ((int) U_AP_TYPE == M_AP_OBJECT) \
? objnum_to_glyph((int) u.umonst->mappearance) \ ? objnum_to_glyph((int) gy.youmonst.mappearance) \
/* else U_AP_TYPE == M_AP_MONSTER */ \ /* else U_AP_TYPE == M_AP_MONSTER */ \
: monnum_to_glyph((int) u.umonst->mappearance, Ugender))) : monnum_to_glyph((int) gy.youmonst.mappearance, Ugender)))
/* /*
* NetHack glyphs * NetHack glyphs
+2 -2
View File
@@ -464,7 +464,7 @@ enum encumbrance_types {
}; };
struct entity { struct entity {
struct monst *emon; /* u.umonst for the player */ struct monst *emon; /* youmonst for the player */
struct permonst *edata; /* must be non-zero for record to be valid */ struct permonst *edata; /* must be non-zero for record to be valid */
int ex, ey; int ex, ey;
}; };
@@ -1294,7 +1294,7 @@ typedef uint32_t mmflags_nht; /* makemon MM_ flags */
#define FM_FMON 0x01 /* search the fmon chain */ #define FM_FMON 0x01 /* search the fmon chain */
#define FM_MIGRATE 0x02 /* search the migrating monster chain */ #define FM_MIGRATE 0x02 /* search the migrating monster chain */
#define FM_MYDOGS 0x04 /* search gm.mydogs */ #define FM_MYDOGS 0x04 /* search gm.mydogs */
#define FM_YOU 0x08 /* check for u.umonst */ #define FM_YOU 0x08 /* check for gy.youmonst */
#define FM_EVERYWHERE (FM_YOU | FM_FMON | FM_MIGRATE | FM_MYDOGS) #define FM_EVERYWHERE (FM_YOU | FM_FMON | FM_MIGRATE | FM_MYDOGS)
/* Flags to control pick_[race,role,gend,align] routines in role.c */ /* Flags to control pick_[race,role,gend,align] routines in role.c */
+2 -2
View File
@@ -68,8 +68,8 @@ enum m_ap_types {
#define M_AP_TYPMASK 0x7 #define M_AP_TYPMASK 0x7
#define M_AP_F_DKNOWN 0x8 #define M_AP_F_DKNOWN 0x8
#define U_AP_TYPE (u.umonst->m_ap_type & M_AP_TYPMASK) #define U_AP_TYPE (gy.youmonst.m_ap_type & M_AP_TYPMASK)
#define U_AP_FLAG (u.umonst->m_ap_type & ~M_AP_TYPMASK) #define U_AP_FLAG (gy.youmonst.m_ap_type & ~M_AP_TYPMASK)
#define M_AP_TYPE(m) ((m)->m_ap_type & M_AP_TYPMASK) #define M_AP_TYPE(m) ((m)->m_ap_type & M_AP_TYPMASK)
#define M_AP_FLAG(m) ((m)->m_ap_type & ~M_AP_TYPMASK) #define M_AP_FLAG(m) ((m)->m_ap_type & ~M_AP_TYPMASK)
+1 -2
View File
@@ -496,9 +496,8 @@ struct you {
struct skills weapon_skills[P_NUM_SKILLS]; struct skills weapon_skills[P_NUM_SKILLS];
boolean twoweap; /* KMH -- Using two-weapon combat */ boolean twoweap; /* KMH -- Using two-weapon combat */
short mcham; /* vampire mndx if shapeshifted to bat/cloud */ short mcham; /* vampire mndx if shapeshifted to bat/cloud */
short umovement; /* instead of u.umonst->movement */ short umovement; /* instead of youmonst.movement */
schar uachieved[N_ACH]; /* list of achievements in the order attained */ schar uachieved[N_ACH]; /* list of achievements in the order attained */
struct monst *umonst;
}; /* end of `struct you' */ }; /* end of `struct you' */
+4 -4
View File
@@ -67,7 +67,7 @@
#define HSick_resistance u.uprops[SICK_RES].intrinsic #define HSick_resistance u.uprops[SICK_RES].intrinsic
#define ESick_resistance u.uprops[SICK_RES].extrinsic #define ESick_resistance u.uprops[SICK_RES].extrinsic
#define Sick_resistance (HSick_resistance || ESick_resistance \ #define Sick_resistance (HSick_resistance || ESick_resistance \
|| defended(u.umonst, AD_DISE)) || defended(&gy.youmonst, AD_DISE))
/* Intrinsics only */ /* Intrinsics only */
#define Invulnerable u.uprops[INVULNERABLE].intrinsic /* [Tom] */ #define Invulnerable u.uprops[INVULNERABLE].intrinsic /* [Tom] */
@@ -270,11 +270,11 @@
#define HMagical_breathing u.uprops[MAGICAL_BREATHING].intrinsic #define HMagical_breathing u.uprops[MAGICAL_BREATHING].intrinsic
#define EMagical_breathing u.uprops[MAGICAL_BREATHING].extrinsic #define EMagical_breathing u.uprops[MAGICAL_BREATHING].extrinsic
#define Amphibious \ #define Amphibious \
(HMagical_breathing || EMagical_breathing || amphibious(u.umonst->data)) (HMagical_breathing || EMagical_breathing || amphibious(gy.youmonst.data))
/* Get wet, may go under surface */ /* Get wet, may go under surface */
#define Breathless \ #define Breathless \
(HMagical_breathing || EMagical_breathing || breathless(u.umonst->data)) (HMagical_breathing || EMagical_breathing || breathless(gy.youmonst.data))
#define Underwater (u.uinwater) #define Underwater (u.uinwater)
/* Note that Underwater and u.uinwater are both used in code. /* Note that Underwater and u.uinwater are both used in code.
@@ -398,7 +398,7 @@
redundant but allows the function calls to be skipped most of the time */ redundant but allows the function calls to be skipped most of the time */
#define Unaware (gm.multi < 0 && (unconscious() || is_fainted())) #define Unaware (gm.multi < 0 && (unconscious() || is_fainted()))
#define Hate_silver (u.ulycn >= LOW_PM || hates_silver(u.umonst->data)) #define Hate_silver (u.ulycn >= LOW_PM || hates_silver(gy.youmonst.data))
/* _The_Hitchhikers_Guide_to_the_Galaxy_ on uses for 'towel': "wrap it round /* _The_Hitchhikers_Guide_to_the_Galaxy_ on uses for 'towel': "wrap it round
your head to ward off noxious fumes" [we require it to be damp or wet] */ your head to ward off noxious fumes" [we require it to be damp or wet] */
+5 -5
View File
@@ -120,7 +120,7 @@ u_calc_moveamt(int wtcap)
/* your speed doesn't augment steed's speed */ /* your speed doesn't augment steed's speed */
moveamt = mcalcmove(u.usteed, TRUE); moveamt = mcalcmove(u.usteed, TRUE);
} else { } else {
moveamt = u.umonst->data->mmove; moveamt = gy.youmonst.data->mmove;
if (Very_fast) { /* speed boots, potion, or spell */ if (Very_fast) { /* speed boots, potion, or spell */
/* gain a free action on 2/3 of turns */ /* gain a free action on 2/3 of turns */
@@ -292,7 +292,7 @@ moveloop_core(void)
mvl_wtcap = UNENCUMBERED; mvl_wtcap = UNENCUMBERED;
} else if (!Upolyd ? (u.uhp < u.uhpmax) } else if (!Upolyd ? (u.uhp < u.uhpmax)
: (u.mh < u.mhmax : (u.mh < u.mhmax
|| u.umonst->data->mlet == S_EEL)) { || gy.youmonst.data->mlet == S_EEL)) {
/* maybe heal */ /* maybe heal */
regen_hp(mvl_wtcap); regen_hp(mvl_wtcap);
} }
@@ -483,7 +483,7 @@ moveloop_core(void)
curs_on_u(); curs_on_u();
} }
m_everyturn_effect(u.umonst); m_everyturn_effect(&gy.youmonst);
svc.context.move = 1; svc.context.move = 1;
@@ -636,7 +636,7 @@ regen_hp(int wtcap)
if (Upolyd) { if (Upolyd) {
if (u.mh < 1) { /* shouldn't happen... */ if (u.mh < 1) { /* shouldn't happen... */
rehumanize(); rehumanize();
} else if (u.umonst->data->mlet == S_EEL } else if (gy.youmonst.data->mlet == S_EEL
&& !is_pool(u.ux, u.uy) && !Is_waterlevel(&u.uz) && !is_pool(u.ux, u.uy) && !Is_waterlevel(&u.uz)
&& !Breathless) { && !Breathless) {
/* eel out of water loses hp, similar to monster eels; /* eel out of water loses hp, similar to monster eels;
@@ -775,7 +775,7 @@ newgame(void)
/* make sure welcome messages are given before noticing monsters */ /* make sure welcome messages are given before noticing monsters */
notice_mon_off(); notice_mon_off();
disp.botlx = TRUE; disp.botlx = TRUE;
svc.context.ident = 2; /* id 1 is reserved for u.umonst->m_id */ svc.context.ident = 2; /* id 1 is reserved for gy.youmonst */
svc.context.warnlevel = 1; svc.context.warnlevel = 1;
svc.context.next_attrib_check = 600L; /* arbitrary first setting */ svc.context.next_attrib_check = 600L; /* arbitrary first setting */
svc.context.tribute.enabled = TRUE; /* turn on 3.6 tributes */ svc.context.tribute.enabled = TRUE; /* turn on 3.6 tributes */
+18 -18
View File
@@ -324,7 +324,7 @@ use_stethoscope(struct obj *obj)
boolean interference = (u.uswallow && is_whirly(u.ustuck->data) boolean interference = (u.uswallow && is_whirly(u.ustuck->data)
&& !rn2(Role_if(PM_HEALER) ? 10 : 3)); && !rn2(Role_if(PM_HEALER) ? 10 : 3));
if (nohands(u.umonst->data)) { if (nohands(gy.youmonst.data)) {
You("have no hands!"); /* not `body_part(HAND)' */ You("have no hands!"); /* not `body_part(HAND)' */
return ECMD_OK; return ECMD_OK;
} else if (Deaf) { } else if (Deaf) {
@@ -475,7 +475,7 @@ static const char whistle_str[] = "produce a %s whistling sound.",
staticfn void staticfn void
use_whistle(struct obj *obj) use_whistle(struct obj *obj)
{ {
if (!can_blow(u.umonst)) { if (!can_blow(&gy.youmonst)) {
You("are incapable of using the whistle."); You("are incapable of using the whistle.");
} else if (Underwater) { } else if (Underwater) {
You("blow bubbles through %s.", yname(obj)); You("blow bubbles through %s.", yname(obj));
@@ -494,13 +494,13 @@ use_whistle(struct obj *obj)
staticfn void staticfn void
use_magic_whistle(struct obj *obj) use_magic_whistle(struct obj *obj)
{ {
if (!can_blow(u.umonst)) { if (!can_blow(&gy.youmonst)) {
You("are incapable of using the whistle."); You("are incapable of using the whistle.");
} else if (obj->cursed && !rn2(2)) { } else if (obj->cursed && !rn2(2)) {
You("produce a %shigh-%s.", Underwater ? "very " : "", You("produce a %shigh-%s.", Underwater ? "very " : "",
Deaf ? "frequency vibration" : "pitched humming noise"); Deaf ? "frequency vibration" : "pitched humming noise");
wake_nearby(TRUE); wake_nearby(TRUE);
if (!rn2(2) && !noteleport_level(u.umonst)) if (!rn2(2) && !noteleport_level(&gy.youmonst))
tele_to_rnd_pet(); tele_to_rnd_pet();
} else { } else {
/* it's magic! it works underwater too (at a higher pitch) */ /* it's magic! it works underwater too (at a higher pitch) */
@@ -1054,8 +1054,8 @@ use_mirror(struct obj *obj)
} }
gn.nomovemsg = 0; /* default, "you can move again" */ gn.nomovemsg = 0; /* default, "you can move again" */
} }
} else if (is_vampire(u.umonst->data) } else if (is_vampire(gy.youmonst.data)
|| is_vampshifter(u.umonst)) { || is_vampshifter(&gy.youmonst)) {
You("don't have a reflection."); You("don't have a reflection.");
} else if (u.umonnum == PM_UMBER_HULK) { } else if (u.umonnum == PM_UMBER_HULK) {
pline("Huh? That doesn't look like you!"); pline("Huh? That doesn't look like you!");
@@ -1786,7 +1786,7 @@ dorub(void)
{ {
struct obj *obj; struct obj *obj;
if (nohands(u.umonst->data)) { if (nohands(gy.youmonst.data)) {
You("aren't able to rub anything without hands."); You("aren't able to rub anything without hands.");
return ECMD_OK; return ECMD_OK;
} }
@@ -1884,7 +1884,7 @@ check_jump(genericptr arg, coordxy x, coordxy y)
/* let giants jump over boulders (what about Flying? /* let giants jump over boulders (what about Flying?
and is there really enough head room for giants to jump and is there really enough head room for giants to jump
at all, let alone over something tall?) */ at all, let alone over something tall?) */
if (sobj_at(BOULDER, x, y) && !throws_rocks(u.umonst->data)) if (sobj_at(BOULDER, x, y) && !throws_rocks(gy.youmonst.data))
return FALSE; return FALSE;
return TRUE; return TRUE;
} }
@@ -1993,7 +1993,7 @@ jump(int magic) /* 0=Physical, otherwise skill level */
if (!magic && !Jumping && known_spell(SPE_JUMPING) >= spe_Fresh) if (!magic && !Jumping && known_spell(SPE_JUMPING) >= spe_Fresh)
return spelleffects(SPE_JUMPING, FALSE, FALSE); return spelleffects(SPE_JUMPING, FALSE, FALSE);
if (!magic && (nolimbs(u.umonst->data) || slithy(u.umonst->data))) { if (!magic && (nolimbs(gy.youmonst.data) || slithy(gy.youmonst.data))) {
/* normally (nolimbs || slithy) implies !Jumping, /* normally (nolimbs || slithy) implies !Jumping,
but that isn't necessarily the case for knights */ but that isn't necessarily the case for knights */
You_cant("jump; you have no legs!"); You_cant("jump; you have no legs!");
@@ -2197,7 +2197,7 @@ use_tinning_kit(struct obj *obj)
char kbuf[BUFSZ]; char kbuf[BUFSZ];
const char *corpse_name = an(cxname(corpse)); const char *corpse_name = an(cxname(corpse));
if (poly_when_stoned(u.umonst->data)) { if (poly_when_stoned(gy.youmonst.data)) {
You("tin %s without wearing gloves.", corpse_name); You("tin %s without wearing gloves.", corpse_name);
kbuf[0] = '\0'; kbuf[0] = '\0';
} else { } else {
@@ -2634,7 +2634,7 @@ use_grease(struct obj *obj)
if (otmp != &hands_obj) { if (otmp != &hands_obj) {
You("cover %s with a thick layer of grease.", yname(otmp)); You("cover %s with a thick layer of grease.", yname(otmp));
otmp->greased = 1; otmp->greased = 1;
if (obj->cursed && !nohands(u.umonst->data)) { if (obj->cursed && !nohands(gy.youmonst.data)) {
make_glib(oldglib + rn1(6, 10)); /* + 10..15 */ make_glib(oldglib + rn1(6, 10)); /* + 10..15 */
pline("Some of the grease gets all over your %s.", pline("Some of the grease gets all over your %s.",
fingers_or_gloves(TRUE)); fingers_or_gloves(TRUE));
@@ -2826,7 +2826,7 @@ use_trap(struct obj *otmp)
int levtyp = levl[u.ux][u.uy].typ; int levtyp = levl[u.ux][u.uy].typ;
const char *occutext = "setting the trap"; const char *occutext = "setting the trap";
if (nohands(u.umonst->data)) if (nohands(gy.youmonst.data))
what = "without hands"; what = "without hands";
else if (Stunned) else if (Stunned)
what = "while stunned"; what = "while stunned";
@@ -3108,7 +3108,7 @@ use_whip(struct obj *obj)
cc.y = ry; cc.y = ry;
You("wrap your bullwhip around %s.", wrapped_what); You("wrap your bullwhip around %s.", wrapped_what);
if (proficient && rn2(proficient + 2)) { if (proficient && rn2(proficient + 2)) {
if (!mtmp || enexto(&cc, rx, ry, u.umonst->data)) { if (!mtmp || enexto(&cc, rx, ry, gy.youmonst.data)) {
You("yank yourself out of the pit!"); You("yank yourself out of the pit!");
reset_utrap(TRUE); /* [was after teleds(); do this before reset_utrap(TRUE); /* [was after teleds(); do this before
* in case it has no alternative other * in case it has no alternative other
@@ -3192,7 +3192,7 @@ use_whip(struct obj *obj)
so proficient at catching weapons */ so proficient at catching weapons */
int dam, hitvalu, hitu; int dam, hitvalu, hitu;
dam = dmgval(otmp, u.umonst); dam = dmgval(otmp, &gy.youmonst);
hitvalu = 8 + otmp->spe; hitvalu = 8 + otmp->spe;
hitu = thitu(hitvalu, Maybe_Half_Phys(dam), hitu = thitu(hitvalu, Maybe_Half_Phys(dam),
&otmp, (char *) 0); &otmp, (char *) 0);
@@ -3210,7 +3210,7 @@ use_whip(struct obj *obj)
if (otmp->otyp == CORPSE if (otmp->otyp == CORPSE
&& touch_petrifies(&mons[otmp->corpsenm]) && !uarmg && touch_petrifies(&mons[otmp->corpsenm]) && !uarmg
&& !Stone_resistance && !Stone_resistance
&& !(poly_when_stoned(u.umonst->data) && !(poly_when_stoned(gy.youmonst.data)
&& polymon(PM_STONE_GOLEM))) { && polymon(PM_STONE_GOLEM))) {
char kbuf[BUFSZ]; char kbuf[BUFSZ];
@@ -3581,7 +3581,7 @@ use_cream_pie(struct obj *obj)
You("immerse your %s in %s%s.", body_part(FACE), You("immerse your %s in %s%s.", body_part(FACE),
several ? "one of " : "", several ? "one of " : "",
several ? makeplural(the(xname(obj))) : the(xname(obj))); several ? makeplural(the(xname(obj))) : the(xname(obj)));
if (can_blnd((struct monst *) 0, u.umonst, AT_WEAP, obj)) { if (can_blnd((struct monst *) 0, &gy.youmonst, AT_WEAP, obj)) {
int blindinc = rnd(25); int blindinc = rnd(25);
u.ucreamed += blindinc; u.ucreamed += blindinc;
@@ -3921,7 +3921,7 @@ do_break_wand(struct obj *obj)
boolean is_fragile = (objdescr_is(obj, "balsa") boolean is_fragile = (objdescr_is(obj, "balsa")
|| objdescr_is(obj, "glass")); || objdescr_is(obj, "glass"));
if (nohands(u.umonst->data)) { if (nohands(gy.youmonst.data)) {
You_cant("break %s without hands!", yname(obj)); You_cant("break %s without hands!", yname(obj));
return ECMD_OK; return ECMD_OK;
} else if (!freehand()) { } else if (!freehand()) {
@@ -4216,7 +4216,7 @@ doapply(void)
struct obj *obj; struct obj *obj;
int res = ECMD_TIME; int res = ECMD_TIME;
if (nohands(u.umonst->data)) { if (nohands(gy.youmonst.data)) {
You("aren't able to use or apply tools in your current form."); You("aren't able to use or apply tools in your current form.");
return ECMD_OK; return ECMD_OK;
} }
+20 -20
View File
@@ -914,7 +914,7 @@ touch_artifact(struct obj *obj, struct monst *mon)
if (oart == &artilist[ART_NONARTIFACT]) if (oart == &artilist[ART_NONARTIFACT])
return 1; return 1;
yours = (mon == u.umonst); yours = (mon == &gy.youmonst);
/* all quest artifacts are self-willed; if this ever changes, `badclass' /* all quest artifacts are self-willed; if this ever changes, `badclass'
will have to be extended to explicitly include quest artifacts */ will have to be extended to explicitly include quest artifacts */
self_willed = ((oart->spfx & SPFX_INTEL) != 0); self_willed = ((oart->spfx & SPFX_INTEL) != 0);
@@ -1014,7 +1014,7 @@ spec_applies(const struct artifact *weap, struct monst *mtmp)
if (!(weap->spfx & (SPFX_DBONUS | SPFX_ATTK))) if (!(weap->spfx & (SPFX_DBONUS | SPFX_ATTK)))
return (weap->attk.adtyp == AD_PHYS); return (weap->attk.adtyp == AD_PHYS);
yours = (mtmp == u.umonst); yours = (mtmp == &gy.youmonst);
ptr = mtmp->data; ptr = mtmp->data;
if (weap->spfx & SPFX_DMONS) { if (weap->spfx & SPFX_DMONS) {
@@ -1256,8 +1256,8 @@ Mb_hit(struct monst *magr, /* attacker */
{ {
struct permonst *old_mdat; struct permonst *old_mdat;
const char *verb; const char *verb;
boolean youattack = (magr == u.umonst), boolean youattack = (magr == &gy.youmonst),
youdefend = (mdef == u.umonst), youdefend = (mdef == &gy.youmonst),
resisted = FALSE, do_stun, do_confuse, result; resisted = FALSE, do_stun, do_confuse, result;
int attack_indx, fakeidx, scare_dieroll = MB_MAX_DIEROLL / 2; int attack_indx, fakeidx, scare_dieroll = MB_MAX_DIEROLL / 2;
@@ -1313,7 +1313,7 @@ Mb_hit(struct monst *magr, /* attacker */
/* now perform special effects */ /* now perform special effects */
switch (attack_indx) { switch (attack_indx) {
case MB_INDEX_CANCEL: case MB_INDEX_CANCEL:
old_mdat = youdefend ? u.umonst->data : mdef->data; old_mdat = youdefend ? gy.youmonst.data : mdef->data;
/* No mdef->mcan check: even a cancelled monster can be polymorphed /* No mdef->mcan check: even a cancelled monster can be polymorphed
* into a golem, and the "cancel" effect acts as if some magical * into a golem, and the "cancel" effect acts as if some magical
* energy remains in spellcasting defenders to be absorbed later. * energy remains in spellcasting defenders to be absorbed later.
@@ -1323,7 +1323,7 @@ Mb_hit(struct monst *magr, /* attacker */
} else { } else {
do_stun = FALSE; do_stun = FALSE;
if (youdefend) { if (youdefend) {
if (u.umonst->data != old_mdat) if (gy.youmonst.data != old_mdat)
*dmgptr = 0; /* rehumanized, so no more damage */ *dmgptr = 0; /* rehumanized, so no more damage */
if (u.uenmax > 0) { if (u.uenmax > 0) {
u.uenmax--; u.uenmax--;
@@ -1359,7 +1359,7 @@ Mb_hit(struct monst *magr, /* attacker */
nomul(-3); nomul(-3);
gm.multi_reason = "being scared stiff"; gm.multi_reason = "being scared stiff";
gn.nomovemsg = ""; gn.nomovemsg = "";
if (magr && magr == u.ustuck && sticks(u.umonst->data)) { if (magr && magr == u.ustuck && sticks(gy.youmonst.data)) {
set_ustuck((struct monst *) 0); set_ustuck((struct monst *) 0);
You("release %s!", mon_nam(magr)); You("release %s!", mon_nam(magr));
} }
@@ -1445,14 +1445,14 @@ DISABLE_WARNING_FORMAT_NONLITERAL
*/ */
boolean boolean
artifact_hit( artifact_hit(
struct monst *magr, /* attacker; might be Null if 'mdef' is u.umonst */ struct monst *magr, /* attacker; might be Null if 'mdef' is youmonst */
struct monst *mdef, /* defender */ struct monst *mdef, /* defender */
struct obj *otmp, /* artifact weapon */ struct obj *otmp, /* artifact weapon */
int *dmgptr, /* output */ int *dmgptr, /* output */
int dieroll) /* needed for Magicbane and vorpal blades */ int dieroll) /* needed for Magicbane and vorpal blades */
{ {
boolean youattack = (magr == u.umonst); boolean youattack = (magr == &gy.youmonst);
boolean youdefend = (mdef == u.umonst); boolean youdefend = (mdef == &gy.youmonst);
boolean vis = (!youattack && magr && cansee(magr->mx, magr->my)) boolean vis = (!youattack && magr && cansee(magr->mx, magr->my))
|| (!youdefend && cansee(mdef->mx, mdef->my)) || (!youdefend && cansee(mdef->mx, mdef->my))
|| (youattack && engulfing_u(mdef) && !Blind); || (youattack && engulfing_u(mdef) && !Blind);
@@ -1575,7 +1575,7 @@ artifact_hit(
observe_object(otmp); observe_object(otmp);
return TRUE; return TRUE;
} else { } else {
if (bigmonst(u.umonst->data)) { if (bigmonst(gy.youmonst.data)) {
pline("%s cuts deeply into you!", pline("%s cuts deeply into you!",
magr ? Monnam(magr) : wepdesc); magr ? Monnam(magr) : wepdesc);
*dmgptr *= 2; *dmgptr *= 2;
@@ -1622,14 +1622,14 @@ artifact_hit(
observe_object(otmp); observe_object(otmp);
return TRUE; return TRUE;
} else { } else {
if (!has_head(u.umonst->data)) { if (!has_head(gy.youmonst.data)) {
pline("Somehow, %s misses you wildly.", pline("Somehow, %s misses you wildly.",
magr ? mon_nam(magr) : wepdesc); magr ? mon_nam(magr) : wepdesc);
*dmgptr = 0; *dmgptr = 0;
return TRUE; return TRUE;
} }
if (noncorporeal(u.umonst->data) if (noncorporeal(gy.youmonst.data)
|| amorphous(u.umonst->data)) { || amorphous(gy.youmonst.data)) {
pline("%s slices through your %s.", wepdesc, pline("%s slices through your %s.", wepdesc,
body_part(NECK)); body_part(NECK));
return TRUE; return TRUE;
@@ -2517,11 +2517,11 @@ retouch_object(
return 1; return 1;
} }
if (touch_artifact(obj, u.umonst)) { if (touch_artifact(obj, &gy.youmonst)) {
char buf[BUFSZ]; char buf[BUFSZ];
int dmg = 0, tmp; int dmg = 0, tmp;
boolean ag = (objects[obj->otyp].oc_material == SILVER && Hate_silver), boolean ag = (objects[obj->otyp].oc_material == SILVER && Hate_silver),
bane = bane_applies(get_artifact(obj), u.umonst); bane = bane_applies(get_artifact(obj), &gy.youmonst);
/* nothing else to do if hero can successfully handle this object */ /* nothing else to do if hero can successfully handle this object */
if (!ag && !bane) if (!ag && !bane)
@@ -2776,7 +2776,7 @@ is_magic_key(struct monst *mon, /* if null, non-rogue is assumed */
struct obj *obj) struct obj *obj)
{ {
if (is_art(obj, ART_MASTER_KEY_OF_THIEVERY)) { if (is_art(obj, ART_MASTER_KEY_OF_THIEVERY)) {
if ((mon == u.umonst) ? Role_if(PM_ROGUE) if ((mon == &gy.youmonst) ? Role_if(PM_ROGUE)
: (mon && mon->data == &mons[PM_ROGUE])) : (mon && mon->data == &mons[PM_ROGUE]))
return !obj->cursed; /* a rogue; non-cursed suffices for magic */ return !obj->cursed; /* a rogue; non-cursed suffices for magic */
/* not a rogue; key must be blessed to behave as a magic one */ /* not a rogue; key must be blessed to behave as a magic one */
@@ -2785,7 +2785,7 @@ is_magic_key(struct monst *mon, /* if null, non-rogue is assumed */
return FALSE; return FALSE;
} }
/* figure out whether 'mon' (usually u.umonst) is carrying the magic key */ /* figure out whether 'mon' (usually youmonst) is carrying the magic key */
struct obj * struct obj *
has_magic_key(struct monst *mon) /* if null, hero assumed */ has_magic_key(struct monst *mon) /* if null, hero assumed */
{ {
@@ -2793,8 +2793,8 @@ has_magic_key(struct monst *mon) /* if null, hero assumed */
short key = artilist[ART_MASTER_KEY_OF_THIEVERY].otyp; short key = artilist[ART_MASTER_KEY_OF_THIEVERY].otyp;
if (!mon) if (!mon)
mon = u.umonst; mon = &gy.youmonst;
for (o = ((mon == u.umonst) ? gi.invent : mon->minvent); o; for (o = ((mon == &gy.youmonst) ? gi.invent : mon->minvent); o;
o = nxtobj(o, key, FALSE)) { o = nxtobj(o, key, FALSE)) {
if (is_magic_key(mon, o)) if (is_magic_key(mon, o))
return o; return o;
+2 -2
View File
@@ -893,7 +893,7 @@ is_innate(int propidx)
ignore innateness if equipment is going to claim responsibility */ ignore innateness if equipment is going to claim responsibility */
&& !u.uprops[propidx].extrinsic) && !u.uprops[propidx].extrinsic)
return FROM_ROLE; return FROM_ROLE;
if ((propidx == BLINDED && !haseyes(u.umonst->data)) if ((propidx == BLINDED && !haseyes(gy.youmonst.data))
|| (propidx == BLND_RES && (HBlnd_resist & FROMFORM) != 0)) || (propidx == BLND_RES && (HBlnd_resist & FROMFORM) != 0))
return FROM_FORM; return FROM_FORM;
return FROM_NONE; return FROM_NONE;
@@ -1219,7 +1219,7 @@ acurr(int chridx)
there would limit Str to 18/07 [18 + 7] */ there would limit Str to 18/07 [18 + 7] */
result = max(tmp, 3); result = max(tmp, 3);
} else if (chridx == A_CHA) { } else if (chridx == A_CHA) {
if (tmp < 18 && (u.umonst->data->mlet == S_NYMPH if (tmp < 18 && (gy.youmonst.data->mlet == S_NYMPH
|| u.umonnum == PM_AMOROUS_DEMON)) || u.umonnum == PM_AMOROUS_DEMON))
result = 18; result = 18;
} else if (chridx == A_CON) { } else if (chridx == A_CON) {
+3 -3
View File
@@ -256,7 +256,7 @@ bot(void)
return; return;
/* dosave() flags completion by setting u.uhp to -1; suppress_map_output() /* dosave() flags completion by setting u.uhp to -1; suppress_map_output()
covers program_state.restoring and is used for status as well as map */ covers program_state.restoring and is used for status as well as map */
if (u.uhp != -1 && u.umonst->data if (u.uhp != -1 && gy.youmonst.data
&& iflags.status_updates && !suppress_map_output()) { && iflags.status_updates && !suppress_map_output()) {
if (VIA_WINDOWPORT()) { if (VIA_WINDOWPORT()) {
bot_via_windowport(); bot_via_windowport();
@@ -487,7 +487,7 @@ weapon_status(char *outbuf)
/* no weapon; gloves imply hands; humanoid also implies hands; /* no weapon; gloves imply hands; humanoid also implies hands;
otherwise make no assumptions */ otherwise make no assumptions */
res = uarmg ? "Empty-hnd" /* empty handed means "gloves only" */ res = uarmg ? "Empty-hnd" /* empty handed means "gloves only" */
: humanoid(u.umonst->data) ? "Bare-hnds" /* bare hands */ : humanoid(gy.youmonst.data) ? "Bare-hnds" /* bare hands */
: "No-weapon"; : "No-weapon";
} else if (u.twoweap) { } else if (u.twoweap) {
/* two-weaponing implies hands and a weapon or wep-tool /* two-weaponing implies hands and a weapon or wep-tool
@@ -1179,7 +1179,7 @@ bot_via_windowport(void)
#else #else
test_if_enabled(bl_held) = TRUE; test_if_enabled(bl_held) = TRUE;
#endif #endif
} else if (Upolyd && sticks(u.umonst->data)) { } else if (Upolyd && sticks(gy.youmonst.data)) {
test_if_enabled(bl_holding) = TRUE; test_if_enabled(bl_holding) = TRUE;
} else { } else {
/* grab == hero is held by sea monster and about to be drowned; /* grab == hero is held by sea monster and about to be drowned;
+4 -4
View File
@@ -889,7 +889,7 @@ RESTORE_WARNING_FORMAT_NONLITERAL
int int
domonability(void) domonability(void)
{ {
struct permonst *uptr = u.umonst->data; struct permonst *uptr = gy.youmonst.data;
boolean might_hide = (is_hider(uptr) || hides_under(uptr)); boolean might_hide = (is_hider(uptr) || hides_under(uptr));
char c = '\0'; char c = '\0';
@@ -917,12 +917,12 @@ domonability(void)
return domindblast(); return domindblast();
else if (u.umonnum == PM_GREMLIN) { else if (u.umonnum == PM_GREMLIN) {
if (IS_FOUNTAIN(levl[u.ux][u.uy].typ)) { if (IS_FOUNTAIN(levl[u.ux][u.uy].typ)) {
if (split_mon(u.umonst, (struct monst *) 0)) if (split_mon(&gy.youmonst, (struct monst *) 0))
dryup(u.ux, u.uy, TRUE); dryup(u.ux, u.uy, TRUE);
} else if (is_pool(u.ux, u.uy)) { } else if (is_pool(u.ux, u.uy)) {
/* is_pool: might be wearing water walking boots or amulet of /* is_pool: might be wearing water walking boots or amulet of
magical breathing */ magical breathing */
(void) split_mon(u.umonst, (struct monst *) 0); (void) split_mon(&gy.youmonst, (struct monst *) 0);
} else { } else {
There("is no fountain here."); There("is no fountain here.");
} }
@@ -935,7 +935,7 @@ domonability(void)
pline("Unfortunately sound does not carry well through rock."); pline("Unfortunately sound does not carry well through rock.");
else else
aggravate(); aggravate();
} else if (is_vampire(uptr) || is_vampshifter(u.umonst)) { } else if (is_vampire(uptr) || is_vampshifter(&gy.youmonst)) {
return dopoly(); return dopoly();
} else if (u.usteed && can_breathe(u.usteed->data)) { } else if (u.usteed && can_breathe(u.usteed->data)) {
(void) pet_ranged_attk(u.usteed, TRUE); (void) pet_ranged_attk(u.usteed, TRUE);
+3 -3
View File
@@ -320,10 +320,10 @@ m_to_e(struct monst *mtmp, coordxy x, coordxy y, struct entity *etmp)
staticfn void staticfn void
u_to_e(struct entity *etmp) u_to_e(struct entity *etmp)
{ {
etmp->emon = u.umonst; etmp->emon = &gy.youmonst;
etmp->ex = u.ux; etmp->ex = u.ux;
etmp->ey = u.uy; etmp->ey = u.uy;
etmp->edata = u.umonst->data; etmp->edata = gy.youmonst.data;
} }
staticfn void staticfn void
@@ -337,7 +337,7 @@ set_entity(
m_to_e(m_at(x, y), x, y, etmp); m_to_e(m_at(x, y), x, y, etmp);
} }
#define is_u(etmp) (etmp->emon == u.umonst) #define is_u(etmp) (etmp->emon == &gy.youmonst)
#define e_canseemon(etmp) (is_u(etmp) || canseemon(etmp->emon)) #define e_canseemon(etmp) (is_u(etmp) || canseemon(etmp->emon))
/* /*
+1
View File
@@ -842,6 +842,7 @@ static const struct instance_globals_x g_init_x = {
static const struct instance_globals_y g_init_y = { static const struct instance_globals_y g_init_y = {
/* decl.c */ /* decl.c */
(ROWNO - 1) & ~1, /* y_maze_max */ (ROWNO - 1) & ~1, /* y_maze_max */
DUMMY, /* youmonst */
/* pline.c */ /* pline.c */
NULL, /* you_buf */ NULL, /* you_buf */
0, /* you_buf_siz */ 0, /* you_buf_siz */
+3 -3
View File
@@ -386,7 +386,7 @@ gold_detect(struct obj *sobj)
adjust message if you have gold in your inventory */ adjust message if you have gold in your inventory */
char buf[BUFSZ]; char buf[BUFSZ];
if (u.umonst->data == &mons[PM_GOLD_GOLEM]) if (gy.youmonst.data == &mons[PM_GOLD_GOLEM])
Sprintf(buf, "You feel like a million %s!", currency(2L)); Sprintf(buf, "You feel like a million %s!", currency(2L));
else if (money_cnt(gi.invent) || hidden_gold(TRUE)) else if (money_cnt(gi.invent) || hidden_gold(TRUE))
Strcpy(buf, Strcpy(buf,
@@ -1227,7 +1227,7 @@ use_crystal_ball(struct obj **optr)
make_confused((HConfusion & TIMEOUT) + impair, FALSE); make_confused((HConfusion & TIMEOUT) + impair, FALSE);
break; break;
case 3: case 3:
if (!resists_blnd(u.umonst)) { if (!resists_blnd(&gy.youmonst)) {
pline("%s your vision!", Tobjnam(obj, "damage")); pline("%s your vision!", Tobjnam(obj, "damage"));
make_blinded(BlindedTimeout + impair, FALSE); make_blinded(BlindedTimeout + impair, FALSE);
if (!Blind) if (!Blind)
@@ -1776,7 +1776,7 @@ openone(coordxy zx, coordxy zy, genericptr_t num)
newsym(zx, zy); newsym(zx, zy);
(*num_p)++; (*num_p)++;
} }
mon = u_at(zx, zy) ? u.umonst : m_at(zx, zy); mon = u_at(zx, zy) ? &gy.youmonst : m_at(zx, zy);
if (openholdingtrap(mon, &dummy) if (openholdingtrap(mon, &dummy)
|| openfallingtrap(mon, TRUE, &dummy)) || openfallingtrap(mon, TRUE, &dummy))
(*num_p)++; (*num_p)++;
+13 -13
View File
@@ -200,7 +200,7 @@ is_digging(void)
return FALSE; return FALSE;
} }
#define BY_YOU (u.umonst) #define BY_YOU (&gy.youmonst)
#define BY_OBJECT ((struct monst *) 0) #define BY_OBJECT ((struct monst *) 0)
enum digcheck_result enum digcheck_result
@@ -392,7 +392,7 @@ dig(void)
} else if (ttmp && ttmp->ttyp == BEAR_TRAP && u.utrap) { } else if (ttmp && ttmp->ttyp == BEAR_TRAP && u.utrap) {
if (rnl(7) > (Fumbling ? 1 : 4)) { if (rnl(7) > (Fumbling ? 1 : 4)) {
char kbuf[BUFSZ]; char kbuf[BUFSZ];
int dmg = dmgval(uwep, u.umonst) + dbon(); int dmg = dmgval(uwep, &gy.youmonst) + dbon();
if (dmg < 1) if (dmg < 1)
dmg = 1; dmg = 1;
@@ -2181,8 +2181,8 @@ rot_corpse(anything *arg, long timeout)
&& hides_under(mtmp->data)) { && hides_under(mtmp->data)) {
mtmp->mundetected = 0; mtmp->mundetected = 0;
} else if (u_at(x, y) } else if (u_at(x, y)
&& u.uundetected && hides_under(u.umonst->data)) && u.uundetected && hides_under(gy.youmonst.data))
(void) hideunder(u.umonst); (void) hideunder(&gy.youmonst);
newsym(x, y); newsym(x, y);
} else if (in_invent) } else if (in_invent)
update_inventory(); update_inventory();
@@ -2241,27 +2241,27 @@ void
escape_tomb(void) escape_tomb(void)
{ {
debugpline0("escape_tomb"); debugpline0("escape_tomb");
if ((Teleportation || can_teleport(u.umonst->data)) if ((Teleportation || can_teleport(gy.youmonst.data))
&& (Teleport_control || rn2(3) < Luck+2)) { && (Teleport_control || rn2(3) < Luck+2)) {
You("attempt a teleport spell."); You("attempt a teleport spell.");
(void) dotele(FALSE); /* calls unearth_you() */ (void) dotele(FALSE); /* calls unearth_you() */
} else if (u.uburied) { /* still buried after 'port attempt */ } else if (u.uburied) { /* still buried after 'port attempt */
boolean good; boolean good;
if (amorphous(u.umonst->data) || Passes_walls if (amorphous(gy.youmonst.data) || Passes_walls
|| noncorporeal(u.umonst->data) || noncorporeal(gy.youmonst.data)
|| (unsolid(u.umonst->data) || (unsolid(gy.youmonst.data)
&& u.umonst->data != &mons[PM_WATER_ELEMENTAL]) && gy.youmonst.data != &mons[PM_WATER_ELEMENTAL])
|| (tunnels(u.umonst->data) && !needspick(u.umonst->data))) { || (tunnels(gy.youmonst.data) && !needspick(gy.youmonst.data))) {
You("%s up through the %s.", You("%s up through the %s.",
(tunnels(u.umonst->data) && !needspick(u.umonst->data)) (tunnels(gy.youmonst.data) && !needspick(gy.youmonst.data))
? "try to tunnel" ? "try to tunnel"
: (amorphous(u.umonst->data)) : (amorphous(gy.youmonst.data))
? "ooze" ? "ooze"
: "phase", : "phase",
surface(u.ux, u.uy)); surface(u.ux, u.uy));
good = (tunnels(u.umonst->data) && !needspick(u.umonst->data)) good = (tunnels(gy.youmonst.data) && !needspick(gy.youmonst.data))
? dighole(TRUE, FALSE, (coord *) 0) : TRUE; ? dighole(TRUE, FALSE, (coord *) 0) : TRUE;
if (good) if (good)
unearth_you(); unearth_you();
+5 -5
View File
@@ -228,7 +228,7 @@ flooreffects(
} }
mtmp->mtrapped = 0; mtmp->mtrapped = 0;
} else { } else {
if (!Passes_walls && !throws_rocks(u.umonst->data)) { if (!Passes_walls && !throws_rocks(gy.youmonst.data)) {
losehp(Maybe_Half_Phys(rnd(15)), losehp(Maybe_Half_Phys(rnd(15)),
"squished under a boulder", NO_KILLER_PREFIX); "squished under a boulder", NO_KILLER_PREFIX);
goto deletedwithboulder; goto deletedwithboulder;
@@ -1110,7 +1110,7 @@ staticfn boolean
u_stuck_cannot_go(const char *updn) u_stuck_cannot_go(const char *updn)
{ {
if (u.ustuck) { if (u.ustuck) {
if (u.uswallow || !sticks(u.umonst->data)) { if (u.uswallow || !sticks(gy.youmonst.data)) {
You("are %s, and cannot go %s.", You("are %s, and cannot go %s.",
!u.uswallow ? "being held" !u.uswallow ? "being held"
: digests(u.ustuck->data) ? "swallowed" : digests(u.ustuck->data) ? "swallowed"
@@ -1257,7 +1257,7 @@ dodown(void)
const char *down_or_thru = trap->ttyp == HOLE ? "down" : "through"; const char *down_or_thru = trap->ttyp == HOLE ? "down" : "through";
const char *actn = u_locomotion("jump"); const char *actn = u_locomotion("jump");
if (u.umonst->data->msize >= MZ_HUGE) { if (gy.youmonst.data->msize >= MZ_HUGE) {
char qbuf[QBUFSZ]; char qbuf[QBUFSZ];
You("don't fit %s easily.", down_or_thru); You("don't fit %s easily.", down_or_thru);
@@ -1426,7 +1426,7 @@ u_collide_m(struct monst *mtmp)
it was already here. Randomly move you to an adjacent spot it was already here. Randomly move you to an adjacent spot
or else the monster to any nearby location. Prior to 3.3.0 or else the monster to any nearby location. Prior to 3.3.0
the latter was done unconditionally. */ the latter was done unconditionally. */
if (!rn2(2) && enexto(&cc, u.ux, u.uy, u.umonst->data) if (!rn2(2) && enexto(&cc, u.ux, u.uy, gy.youmonst.data)
&& next2u(cc.x, cc.y)) && next2u(cc.x, cc.y))
u_on_newpos(cc.x, cc.y); /*[maybe give message here?]*/ u_on_newpos(cc.x, cc.y); /*[maybe give message here?]*/
else else
@@ -2008,7 +2008,7 @@ hellish_smoke_mesg(void)
if (In_hell(&u.uz) && svl.level.flags.temperature > 0) if (In_hell(&u.uz) && svl.level.flags.temperature > 0)
You("%s smoke...", You("%s smoke...",
olfaction(u.umonst->data) ? "smell" : "sense"); olfaction(gy.youmonst.data) ? "smell" : "sense");
} }
/* give a message when the level temperature is different from previous */ /* give a message when the level temperature is different from previous */
+3 -3
View File
@@ -689,7 +689,7 @@ namefloorobj(void)
been moved off the hero's '@' yet, but there's no way to adjust been moved off the hero's '@' yet, but there's no way to adjust
the help text once getpos() has started */ the help text once getpos() has started */
Sprintf(buf, "object on map (or '.' for one %s you)", Sprintf(buf, "object on map (or '.' for one %s you)",
(u.uundetected && hides_under(u.umonst->data)) (u.uundetected && hides_under(gy.youmonst.data))
? "over" : "under"); ? "over" : "under");
if (getpos(&cc, FALSE, buf) < 0 || cc.x <= 0) if (getpos(&cc, FALSE, buf) < 0 || cc.x <= 0)
return; return;
@@ -840,7 +840,7 @@ x_monnam(
mappear_as_mon = (M_AP_TYPE(mtmp) == M_AP_MONSTER); mappear_as_mon = (M_AP_TYPE(mtmp) == M_AP_MONSTER);
char *bp, buf2[BUFSZ]; char *bp, buf2[BUFSZ];
if (mtmp == u.umonst) if (mtmp == &gy.youmonst)
return strcpy(buf, "you"); /* ignore article, "invisible", &c */ return strcpy(buf, "you"); /* ignore article, "invisible", &c */
if (program_state.gameover) if (program_state.gameover)
@@ -1290,7 +1290,7 @@ Mgender(struct monst *mtmp)
{ {
int mgender = MALE; int mgender = MALE;
if (mtmp == u.umonst) { if (mtmp == &gy.youmonst) {
if (Upolyd ? u.mfemale : flags.female) if (Upolyd ? u.mfemale : flags.female)
mgender = FEMALE; mgender = FEMALE;
} else if (mtmp->female) { } else if (mtmp->female) {
+28 -28
View File
@@ -281,7 +281,7 @@ Boots_off(void)
/* check for lava since fireproofed boots make it viable */ /* check for lava since fireproofed boots make it viable */
if ((is_pool(u.ux, u.uy) || is_lava(u.ux, u.uy)) if ((is_pool(u.ux, u.uy) || is_lava(u.ux, u.uy))
&& !Levitation && !Flying && !Levitation && !Flying
&& !(is_clinger(u.umonst->data) && has_ceiling(&u.uz)) && !(is_clinger(gy.youmonst.data) && has_ceiling(&u.uz))
&& !svc.context.takeoff.cancelled_don && !svc.context.takeoff.cancelled_don
/* avoid recursive call to lava_effects() */ /* avoid recursive call to lava_effects() */
&& !iflags.in_lava_effects) { && !iflags.in_lava_effects) {
@@ -1035,7 +1035,7 @@ Amulet_on(struct obj *amul)
} }
case AMULET_OF_STRANGULATION: case AMULET_OF_STRANGULATION:
/* note: might already be Strangled (via #wizintrinsic) */ /* note: might already be Strangled (via #wizintrinsic) */
if (can_be_strangled(u.umonst) && !Strangled) { if (can_be_strangled(&gy.youmonst) && !Strangled) {
makeknown(AMULET_OF_STRANGULATION); makeknown(AMULET_OF_STRANGULATION);
Strangled = 6L; Strangled = 6L;
disp.botl = TRUE; disp.botl = TRUE;
@@ -1118,7 +1118,7 @@ Amulet_off(void)
early_off_msg = TRUE; early_off_msg = TRUE;
if (Underwater) { if (Underwater) {
if (!cant_drown(u.umonst->data) && !Swimming) { if (!cant_drown(gy.youmonst.data) && !Swimming) {
You("suddenly inhale an unhealthy amount of %s!", You("suddenly inhale an unhealthy amount of %s!",
hliquid("water")); hliquid("water"));
mkn = TRUE; /* in case of life-saving */ mkn = TRUE; /* in case of life-saving */
@@ -2034,7 +2034,7 @@ canwearobj(struct obj *otmp, long *mask, boolean noisy)
/* this is the same check as for 'W' (dowear), but different message, /* this is the same check as for 'W' (dowear), but different message,
in case we get here via 'P' (doputon) */ in case we get here via 'P' (doputon) */
if (verysmall(u.umonst->data) || nohands(u.umonst->data)) { if (verysmall(gy.youmonst.data) || nohands(gy.youmonst.data)) {
if (noisy) if (noisy)
You("can't wear any armor in your current form."); You("can't wear any armor in your current form.");
return 0; return 0;
@@ -2044,13 +2044,13 @@ canwearobj(struct obj *otmp, long *mask, boolean noisy)
: is_shirt(otmp) ? c_shirt : is_shirt(otmp) ? c_shirt
: is_suit(otmp) ? c_suit : is_suit(otmp) ? c_suit
: 0; : 0;
if (which && cantweararm(u.umonst->data) if (which && cantweararm(gy.youmonst.data)
/* same exception for cloaks as used in m_dowear() */ /* same exception for cloaks as used in m_dowear() */
&& (which != c_cloak && (which != c_cloak
|| ((otmp->otyp != MUMMY_WRAPPING) || ((otmp->otyp != MUMMY_WRAPPING)
? u.umonst->data->msize != MZ_SMALL ? gy.youmonst.data->msize != MZ_SMALL
: !WrappingAllowed(u.umonst->data))) : !WrappingAllowed(gy.youmonst.data)))
&& (racial_exception(u.umonst, otmp) < 1)) { && (racial_exception(&gy.youmonst, otmp) < 1)) {
if (noisy) if (noisy)
pline_The("%s will not fit on your body.", which); pline_The("%s will not fit on your body.", which);
return 0; return 0;
@@ -2072,12 +2072,12 @@ canwearobj(struct obj *otmp, long *mask, boolean noisy)
if (noisy) if (noisy)
already_wearing(an(helm_simple_name(uarmh))); already_wearing(an(helm_simple_name(uarmh)));
err++; err++;
} else if (Upolyd && has_horns(u.umonst->data) && !is_flimsy(otmp)) { } else if (Upolyd && has_horns(gy.youmonst.data) && !is_flimsy(otmp)) {
/* (flimsy exception matches polyself handling) */ /* (flimsy exception matches polyself handling) */
if (noisy) if (noisy)
pline_The("%s won't fit over your horn%s.", pline_The("%s won't fit over your horn%s.",
helm_simple_name(otmp), helm_simple_name(otmp),
plur(num_horns(u.umonst->data))); plur(num_horns(gy.youmonst.data)));
err++; err++;
} else } else
*mask = W_ARMH; *mask = W_ARMH;
@@ -2104,11 +2104,11 @@ canwearobj(struct obj *otmp, long *mask, boolean noisy)
if (noisy) if (noisy)
already_wearing(c_boots); already_wearing(c_boots);
err++; err++;
} else if (Upolyd && slithy(u.umonst->data)) { } else if (Upolyd && slithy(gy.youmonst.data)) {
if (noisy) if (noisy)
You("have no feet..."); /* not body_part(FOOT) */ You("have no feet..."); /* not body_part(FOOT) */
err++; err++;
} else if (Upolyd && u.umonst->data->mlet == S_CENTAUR) { } else if (Upolyd && gy.youmonst.data->mlet == S_CENTAUR) {
/* break_armor() pushes boots off for centaurs, so don't let /* break_armor() pushes boots off for centaurs, so don't let
dowear() put them back on; dowear() put them back on;
makeplural(body_part(FOOT)) would yield "rear hooves" here, makeplural(body_part(FOOT)) would yield "rear hooves" here,
@@ -2251,13 +2251,13 @@ accessory_or_armor_on(struct obj *obj)
char answer, qbuf[QBUFSZ]; char answer, qbuf[QBUFSZ];
int res = 0; int res = 0;
if (nolimbs(u.umonst->data)) { if (nolimbs(gy.youmonst.data)) {
You("cannot make the ring stick to your body."); You("cannot make the ring stick to your body.");
return ECMD_OK; return ECMD_OK;
} }
if (uleft && uright) { if (uleft && uright) {
There("are no more %s%s to fill.", There("are no more %s%s to fill.",
humanoid(u.umonst->data) ? "ring-" : "", humanoid(gy.youmonst.data) ? "ring-" : "",
fingers_or_gloves(FALSE)); fingers_or_gloves(FALSE));
return ECMD_OK; return ECMD_OK;
} }
@@ -2268,7 +2268,7 @@ accessory_or_armor_on(struct obj *obj)
} else { } else {
do { do {
Sprintf(qbuf, "Which %s%s, Right or Left?", Sprintf(qbuf, "Which %s%s, Right or Left?",
humanoid(u.umonst->data) ? "ring-" : "", humanoid(gy.youmonst.data) ? "ring-" : "",
body_part(FINGER)); body_part(FINGER));
answer = yn_function(qbuf, rightleftchars, '\0', TRUE); answer = yn_function(qbuf, rightleftchars, '\0', TRUE);
switch (answer) { switch (answer) {
@@ -2321,7 +2321,7 @@ accessory_or_armor_on(struct obj *obj)
return ECMD_OK; return ECMD_OK;
} }
} else if (eyewear) { } else if (eyewear) {
if (!has_head(u.umonst->data)) { if (!has_head(gy.youmonst.data)) {
You("have no head to wear %s on.", ansimpleoname(obj)); You("have no head to wear %s on.", ansimpleoname(obj));
return ECMD_OK; return ECMD_OK;
} }
@@ -2435,7 +2435,7 @@ dowear(void)
/* cantweararm() checks for suits of armor, not what we want here; /* cantweararm() checks for suits of armor, not what we want here;
verysmall() or nohands() checks for shields, gloves, etc... */ verysmall() or nohands() checks for shields, gloves, etc... */
if (verysmall(u.umonst->data) || nohands(u.umonst->data)) { if (verysmall(gy.youmonst.data) || nohands(gy.youmonst.data)) {
pline("Don't even bother."); pline("Don't even bother.");
return ECMD_OK; return ECMD_OK;
} }
@@ -2459,7 +2459,7 @@ doputon(void)
&& uarm && uarmu && uarmc && uarmh && uarms && uarmg && uarmf) { && uarm && uarmu && uarmc && uarmh && uarms && uarmg && uarmf) {
/* 'P' message doesn't mention armor */ /* 'P' message doesn't mention armor */
Your("%s%s are full, and you're already wearing an amulet and %s.", Your("%s%s are full, and you're already wearing an amulet and %s.",
humanoid(u.umonst->data) ? "ring-" : "", humanoid(gy.youmonst.data) ? "ring-" : "",
fingers_or_gloves(FALSE), fingers_or_gloves(FALSE),
(ublindf->otyp == LENSES) ? "some lenses" : "a blindfold"); (ublindf->otyp == LENSES) ? "some lenses" : "a blindfold");
return ECMD_OK; return ECMD_OK;
@@ -2544,7 +2544,7 @@ glibr(void)
rightfall = (uright && !uright->cursed && (!welded(uwep))); rightfall = (uright && !uright->cursed && (!welded(uwep)));
*/ */
if (!uarmg && (leftfall || rightfall) && !nolimbs(u.umonst->data)) { if (!uarmg && (leftfall || rightfall) && !nolimbs(gy.youmonst.data)) {
/* changed so cursed rings don't fall off, GAN 10/30/86 */ /* changed so cursed rings don't fall off, GAN 10/30/86 */
Your("%s off your %s.", Your("%s off your %s.",
(leftfall && rightfall) ? "rings slip" : "ring slips", (leftfall && rightfall) ? "rings slip" : "ring slips",
@@ -2631,22 +2631,22 @@ some_armor(struct monst *victim)
{ {
struct obj *otmph, *otmp; struct obj *otmph, *otmp;
otmph = (victim == u.umonst) ? uarmc : which_armor(victim, W_ARMC); otmph = (victim == &gy.youmonst) ? uarmc : which_armor(victim, W_ARMC);
if (!otmph) if (!otmph)
otmph = (victim == u.umonst) ? uarm : which_armor(victim, W_ARM); otmph = (victim == &gy.youmonst) ? uarm : which_armor(victim, W_ARM);
if (!otmph) if (!otmph)
otmph = (victim == u.umonst) ? uarmu : which_armor(victim, W_ARMU); otmph = (victim == &gy.youmonst) ? uarmu : which_armor(victim, W_ARMU);
otmp = (victim == u.umonst) ? uarmh : which_armor(victim, W_ARMH); otmp = (victim == &gy.youmonst) ? uarmh : which_armor(victim, W_ARMH);
if (otmp && (!otmph || !rn2(4))) if (otmp && (!otmph || !rn2(4)))
otmph = otmp; otmph = otmp;
otmp = (victim == u.umonst) ? uarmg : which_armor(victim, W_ARMG); otmp = (victim == &gy.youmonst) ? uarmg : which_armor(victim, W_ARMG);
if (otmp && (!otmph || !rn2(4))) if (otmp && (!otmph || !rn2(4)))
otmph = otmp; otmph = otmp;
otmp = (victim == u.umonst) ? uarmf : which_armor(victim, W_ARMF); otmp = (victim == &gy.youmonst) ? uarmf : which_armor(victim, W_ARMF);
if (otmp && (!otmph || !rn2(4))) if (otmp && (!otmph || !rn2(4)))
otmph = otmp; otmph = otmp;
otmp = (victim == u.umonst) ? uarms : which_armor(victim, W_ARMS); otmp = (victim == &gy.youmonst) ? uarms : which_armor(victim, W_ARMS);
if (otmp && (!otmph || !rn2(4))) if (otmp && (!otmph || !rn2(4)))
otmph = otmp; otmph = otmp;
return otmph; return otmph;
@@ -2664,7 +2664,7 @@ stuck_ring(struct obj *ring, int otyp)
if (ring && ring->otyp == otyp) { if (ring && ring->otyp == otyp) {
/* reasons ring can't be removed match those checked by select_off(); /* reasons ring can't be removed match those checked by select_off();
limbless case has extra checks because ordinarily it's temporary */ limbless case has extra checks because ordinarily it's temporary */
if (nolimbs(u.umonst->data) && uamul if (nolimbs(gy.youmonst.data) && uamul
&& uamul->otyp == AMULET_OF_UNCHANGING && uamul->cursed) && uamul->otyp == AMULET_OF_UNCHANGING && uamul->cursed)
return uamul; return uamul;
if (welded(uwep) && ((ring == RING_ON_PRIMARY) || bimanual(uwep))) if (welded(uwep) && ((ring == RING_ON_PRIMARY) || bimanual(uwep)))
@@ -2706,7 +2706,7 @@ select_off(struct obj *otmp)
if (otmp == uright || otmp == uleft) { if (otmp == uright || otmp == uleft) {
struct obj glibdummy; struct obj glibdummy;
if (nolimbs(u.umonst->data)) { if (nolimbs(gy.youmonst.data)) {
pline_The("ring is stuck."); pline_The("ring is stuck.");
return 0; return 0;
} }
+3 -3
View File
@@ -1185,7 +1185,7 @@ tamedog(
if (mtmp == u.ustuck) { if (mtmp == u.ustuck) {
if (u.uswallow) if (u.uswallow)
expels(mtmp, mtmp->data, TRUE); expels(mtmp, mtmp->data, TRUE);
else if (!(Upolyd && sticks(u.umonst->data))) else if (!(Upolyd && sticks(gy.youmonst.data)))
unstuck(mtmp); unstuck(mtmp);
} }
@@ -1243,7 +1243,7 @@ tamedog(
with each other anymore] */ with each other anymore] */
|| mtmp->isshk || mtmp->isgd || mtmp->ispriest || mtmp->isminion || mtmp->isshk || mtmp->isgd || mtmp->ispriest || mtmp->isminion
|| is_covetous(mtmp->data) || is_human(mtmp->data) || is_covetous(mtmp->data) || is_human(mtmp->data)
|| (is_demon(mtmp->data) && !is_demon(u.umonst->data)) || (is_demon(mtmp->data) && !is_demon(gy.youmonst.data))
|| (obj && dogfood(mtmp, obj) >= MANFOOD)) || (obj && dogfood(mtmp, obj) >= MANFOOD))
return FALSE; return FALSE;
@@ -1313,7 +1313,7 @@ wary_dog(struct monst *mtmp, boolean was_dead)
if (!rn2(edog->abuse + 1)) if (!rn2(edog->abuse + 1))
mtmp->mpeaceful = 1; mtmp->mpeaceful = 1;
if (!quietly && cansee(mtmp->mx, mtmp->my)) { if (!quietly && cansee(mtmp->mx, mtmp->my)) {
if (haseyes(u.umonst->data)) { if (haseyes(gy.youmonst.data)) {
if (haseyes(mtmp->data)) if (haseyes(mtmp->data))
pline_mon(mtmp, pline_mon(mtmp,
"%s %s to look you in the %s.", Monnam(mtmp), "%s %s to look you in the %s.", Monnam(mtmp),
+5 -5
View File
@@ -675,7 +675,7 @@ find_targ(
break; break;
if (curx == mtmp->mux && cury == mtmp->muy) if (curx == mtmp->mux && cury == mtmp->muy)
return u.umonst; return &gy.youmonst;
if ((targ = m_at(curx, cury)) != 0) { if ((targ = m_at(curx, cury)) != 0) {
/* Is the monster visible to the pet? */ /* Is the monster visible to the pet? */
@@ -778,7 +778,7 @@ score_targ(struct monst *mtmp, struct monst *mtarg)
return score; return score;
} }
/* Is the monster peaceful or tame? */ /* Is the monster peaceful or tame? */
if (/*mtarg->mpeaceful ||*/ mtarg->mtame || mtarg == u.umonst) { if (/*mtarg->mpeaceful ||*/ mtarg->mtame || mtarg == &gy.youmonst) {
/* Pets will never be targeted */ /* Pets will never be targeted */
score -= 3000L; score -= 3000L;
return score; return score;
@@ -907,7 +907,7 @@ pet_ranged_attk(struct monst *mtmp, boolean forced)
if (mtarg && (!hungry || !rn2(5))) { if (mtarg && (!hungry || !rn2(5))) {
int mstatus = M_ATTK_MISS; int mstatus = M_ATTK_MISS;
if (mtarg == u.umonst) { if (mtarg == &gy.youmonst) {
if (mattacku(mtmp)) if (mattacku(mtmp))
return MMOVE_DIED; return MMOVE_DIED;
/* Treat this as the pet having initiated an attack even if it /* Treat this as the pet having initiated an attack even if it
@@ -931,7 +931,7 @@ pet_ranged_attk(struct monst *mtmp, boolean forced)
* nothing will happen. * nothing will happen.
*/ */
if ((mstatus & M_ATTK_HIT) && !(mstatus & M_ATTK_DEF_DIED) if ((mstatus & M_ATTK_HIT) && !(mstatus & M_ATTK_DEF_DIED)
&& rn2(4) && mtarg != u.umonst) { && rn2(4) && mtarg != &gy.youmonst) {
/* Can monster see? If it can, it can retaliate /* Can monster see? If it can, it can retaliate
* even if the pet is invisible, since it'll see * even if the pet is invisible, since it'll see
@@ -1054,7 +1054,7 @@ dog_move(
} }
#if 0 /* [this is now handled in dochug()] */ #if 0 /* [this is now handled in dochug()] */
if (!Conflict && !mtmp->mconf if (!Conflict && !mtmp->mconf
&& mtmp == u.ustuck && !sticks(u.umonst->data)) { && mtmp == u.ustuck && !sticks(gy.youmonst.data)) {
unstuck(mtmp); /* swallowed case handled above */ unstuck(mtmp); /* swallowed case handled above */
You("get released!"); You("get released!");
} }
+11 -11
View File
@@ -6,7 +6,7 @@
#define is_bigfoot(x) ((x) == &mons[PM_SASQUATCH]) #define is_bigfoot(x) ((x) == &mons[PM_SASQUATCH])
#define martial() \ #define martial() \
(martial_bonus() || is_bigfoot(u.umonst->data) \ (martial_bonus() || is_bigfoot(gy.youmonst.data) \
|| (uarmf && uarmf->otyp == KICKING_BOOTS)) || (uarmf && uarmf->otyp == KICKING_BOOTS))
/* gk.kickedobj (decl.c) tracks a kicked object until placed or destroyed */ /* gk.kickedobj (decl.c) tracks a kicked object until placed or destroyed */
@@ -53,7 +53,7 @@ kickdmg(struct monst *mon, boolean clumsy)
if (mon->data == &mons[PM_SHADE]) if (mon->data == &mons[PM_SHADE])
dmg = 0; dmg = 0;
specialdmg = special_dmgval(u.umonst, mon, W_ARMF, (long *) 0); specialdmg = special_dmgval(&gy.youmonst, mon, W_ARMF, (long *) 0);
if (mon->data == &mons[PM_SHADE] && !specialdmg) { if (mon->data == &mons[PM_SHADE] && !specialdmg) {
pline_The("%s.", kick_passes_thru); pline_The("%s.", kick_passes_thru);
@@ -180,7 +180,7 @@ kick_monster(struct monst *mon, coordxy x, coordxy y)
* normally, getting all your attacks _including_ all your kicks. * normally, getting all your attacks _including_ all your kicks.
* If you have >1 kick attack, you get all of them. * If you have >1 kick attack, you get all of them.
*/ */
if (Upolyd && attacktype(u.umonst->data, AT_KICK)) { if (Upolyd && attacktype(gy.youmonst.data, AT_KICK)) {
struct attack *uattk; struct attack *uattk;
int sum, kickdieroll, armorpenalty, specialdmg, int sum, kickdieroll, armorpenalty, specialdmg,
attknum = 0, attknum = 0,
@@ -194,13 +194,13 @@ kick_monster(struct monst *mon, coordxy x, coordxy y)
if (gm.multi < 0) if (gm.multi < 0)
break; break;
uattk = &u.umonst->data->mattk[i]; uattk = &gy.youmonst.data->mattk[i];
/* we only care about kicking attacks here */ /* we only care about kicking attacks here */
if (uattk->aatyp != AT_KICK) if (uattk->aatyp != AT_KICK)
continue; continue;
kickdieroll = rnd(20); kickdieroll = rnd(20);
specialdmg = special_dmgval(u.umonst, mon, W_ARMF, specialdmg = special_dmgval(&gy.youmonst, mon, W_ARMF,
(long *) 0); (long *) 0);
if (mon->data == &mons[PM_SHADE] && !specialdmg) { if (mon->data == &mons[PM_SHADE] && !specialdmg) {
/* doesn't matter whether it would have hit or missed, /* doesn't matter whether it would have hit or missed,
@@ -545,7 +545,7 @@ really_kick_object(coordxy x, coordxy y)
You("kick %s with your bare %s.", You("kick %s with your bare %s.",
corpse_xname(gk.kickedobj, (const char *) 0, CXN_PFX_THE), corpse_xname(gk.kickedobj, (const char *) 0, CXN_PFX_THE),
makeplural(body_part(FOOT))); makeplural(body_part(FOOT)));
if (poly_when_stoned(u.umonst->data) && polymon(PM_STONE_GOLEM)) { if (poly_when_stoned(gy.youmonst.data) && polymon(PM_STONE_GOLEM)) {
; /* hero has been transformed but kick continues */ ; /* hero has been transformed but kick continues */
} else { } else {
/* normalize body shape here; foot, not body_part(FOOT) */ /* normalize body shape here; foot, not body_part(FOOT) */
@@ -924,7 +924,7 @@ kick_door(coordxy x, coordxy y, int avrg_attrib)
} }
exercise(A_DEX, TRUE); exercise(A_DEX, TRUE);
doorbuster = Upolyd && is_giant(u.umonst->data); doorbuster = Upolyd && is_giant(gy.youmonst.data);
/* door is known to be CLOSED or LOCKED */ /* door is known to be CLOSED or LOCKED */
if (doorbuster if (doorbuster
|| (rnl(35) < avrg_attrib + (!martial() ? 0 : ACURR(A_DEX)))) { || (rnl(35) < avrg_attrib + (!martial() ? 0 : ACURR(A_DEX)))) {
@@ -1262,10 +1262,10 @@ dokick(void)
struct monst *mtmp; struct monst *mtmp;
boolean no_kick = FALSE; boolean no_kick = FALSE;
if (nolimbs(u.umonst->data) || slithy(u.umonst->data)) { if (nolimbs(gy.youmonst.data) || slithy(gy.youmonst.data)) {
You("have no legs to kick with."); You("have no legs to kick with.");
no_kick = TRUE; no_kick = TRUE;
} else if (verysmall(u.umonst->data)) { } else if (verysmall(gy.youmonst.data)) {
You("are too small to do any kicking."); You("are too small to do any kicking.");
no_kick = TRUE; no_kick = TRUE;
} else if (u.usteed) { } else if (u.usteed) {
@@ -1282,7 +1282,7 @@ dokick(void)
} else if (near_capacity() > SLT_ENCUMBER) { } else if (near_capacity() > SLT_ENCUMBER) {
Your("load is too heavy to balance yourself for a kick."); Your("load is too heavy to balance yourself for a kick.");
no_kick = TRUE; no_kick = TRUE;
} else if (u.umonst->data->mlet == S_LIZARD) { } else if (gy.youmonst.data->mlet == S_LIZARD) {
Your("legs cannot kick effectively."); Your("legs cannot kick effectively.");
no_kick = TRUE; no_kick = TRUE;
} else if (u.uinwater && !rn2(2)) { } else if (u.uinwater && !rn2(2)) {
@@ -1429,7 +1429,7 @@ dokick(void)
int range; int range;
range = range =
((int) u.umonst->data->cwt + (weight_cap() + inv_weight())); ((int) gy.youmonst.data->cwt + (weight_cap() + inv_weight()));
if (range < 1) if (range < 1)
range = 1; /* divide by zero avoidance */ range = 1; /* divide by zero avoidance */
range = (3 * (int) mdat->cwt) / range; range = (3 * (int) mdat->cwt) / range;
+29 -29
View File
@@ -125,7 +125,7 @@ throw_obj(struct obj *obj, int shotlimit)
goto unsplit_stack; goto unsplit_stack;
} }
if ((is_art(obj, ART_MJOLLNIR) && ACURR(A_STR) < STR19(25)) if ((is_art(obj, ART_MJOLLNIR) && ACURR(A_STR) < STR19(25))
|| (obj->otyp == BOULDER && !throws_rocks(u.umonst->data))) { || (obj->otyp == BOULDER && !throws_rocks(gy.youmonst.data))) {
pline("It's too heavy."); pline("It's too heavy.");
res = ECMD_TIME; res = ECMD_TIME;
goto unsplit_stack; goto unsplit_stack;
@@ -299,10 +299,10 @@ ok_to_throw(int *shotlimit_p) /* (see dothrow()) */
*shotlimit_p = LIMIT_TO_RANGE_INT(0, LARGEST_INT, gc.command_count); *shotlimit_p = LIMIT_TO_RANGE_INT(0, LARGEST_INT, gc.command_count);
gm.multi = 0; /* reset; it's been used up */ gm.multi = 0; /* reset; it's been used up */
if (notake(u.umonst->data)) { if (notake(gy.youmonst.data)) {
You("are physically incapable of throwing or shooting anything."); You("are physically incapable of throwing or shooting anything.");
return FALSE; return FALSE;
} else if (nohands(u.umonst->data)) { } else if (nohands(gy.youmonst.data)) {
You_cant("throw or shoot without hands."); /* not body_part(HAND) */ You_cant("throw or shoot without hands."); /* not body_part(HAND) */
return FALSE; return FALSE;
/*[what about !freehand(), aside from cursed missile launcher?]*/ /*[what about !freehand(), aside from cursed missile launcher?]*/
@@ -341,7 +341,7 @@ throw_ok(struct obj *obj)
if (uslinging() && obj->oclass == GEM_CLASS) if (uslinging() && obj->oclass == GEM_CLASS)
return GETOBJ_SUGGEST; return GETOBJ_SUGGEST;
if (throws_rocks(u.umonst->data) && obj->otyp == BOULDER) if (throws_rocks(gy.youmonst.data) && obj->otyp == BOULDER)
return GETOBJ_SUGGEST; return GETOBJ_SUGGEST;
return GETOBJ_DOWNPLAY; return GETOBJ_DOWNPLAY;
@@ -820,12 +820,12 @@ hurtle_step(genericptr_t arg, coordxy x, coordxy y)
why = "touching the edge of the universe"; why = "touching the edge of the universe";
You("smack into something!"); You("smack into something!");
} else if (diagonal } else if (diagonal
&& bad_rock(u.umonst->data, u.ux, y) && bad_rock(gy.youmonst.data, u.ux, y)
&& bad_rock(u.umonst->data, x, u.uy)) { && bad_rock(gy.youmonst.data, x, u.uy)) {
boolean too_much = (gi.invent boolean too_much = (gi.invent
&& (inv_weight() + weight_cap() > WT_TOOMUCH_DIAGONAL)); && (inv_weight() + weight_cap() > WT_TOOMUCH_DIAGONAL));
if (bigmonst(u.umonst->data) || too_much) { if (bigmonst(gy.youmonst.data) || too_much) {
why = "wedging into a narrow crevice"; why = "wedging into a narrow crevice";
You("%sget forcefully wedged into a crevice.", You("%sget forcefully wedged into a crevice.",
too_much ? "and all your belongings " : ""); too_much ? "and all your belongings " : "");
@@ -874,7 +874,7 @@ hurtle_step(genericptr_t arg, coordxy x, coordxy y)
an(pmname(mon->data, NEUTRAL))); an(pmname(mon->data, NEUTRAL)));
instapetrify(svk.killer.name); instapetrify(svk.killer.name);
} }
if (touch_petrifies(u.umonst->data) if (touch_petrifies(gy.youmonst.data)
&& !which_armor(mon, W_ARMU | W_ARM | W_ARMC)) { && !which_armor(mon, W_ARMU | W_ARM | W_ARMC)) {
minstapetrify(mon, TRUE); minstapetrify(mon, TRUE);
} }
@@ -883,8 +883,8 @@ hurtle_step(genericptr_t arg, coordxy x, coordxy y)
} }
if ((u.ux - x) && (u.uy - y) if ((u.ux - x) && (u.uy - y)
&& bad_rock(u.umonst->data, u.ux, y) && bad_rock(gy.youmonst.data, u.ux, y)
&& bad_rock(u.umonst->data, x, u.uy)) { && bad_rock(gy.youmonst.data, x, u.uy)) {
/* Move at a diagonal. */ /* Move at a diagonal. */
if (Sokoban) { if (Sokoban) {
You("come to an abrupt halt!"); You("come to an abrupt halt!");
@@ -1045,7 +1045,7 @@ mhurtle_step(genericptr_t arg, coordxy x, coordxy y)
pline("%s bumps into you.", Some_Monnam(mon)); pline("%s bumps into you.", Some_Monnam(mon));
stop_occupation(); stop_occupation();
/* check whether 'mon' is turned to stone by touching poly'd hero */ /* check whether 'mon' is turned to stone by touching poly'd hero */
if (Upolyd && touch_petrifies(u.umonst->data) if (Upolyd && touch_petrifies(gy.youmonst.data)
&& !which_armor(mon, W_ARMU | W_ARM | W_ARMC)) { && !which_armor(mon, W_ARMU | W_ARM | W_ARMC)) {
/* give poly'd hero credit/blame despite a monster causing it */ /* give poly'd hero credit/blame despite a monster causing it */
minstapetrify(mon, TRUE); minstapetrify(mon, TRUE);
@@ -1287,14 +1287,14 @@ toss_up(struct obj *obj, boolean hitsroof)
/* object now hits you */ /* object now hits you */
if (obj->oclass == POTION_CLASS) { if (obj->oclass == POTION_CLASS) {
potionhit(u.umonst, obj, POTHIT_HERO_THROW); potionhit(&gy.youmonst, obj, POTHIT_HERO_THROW);
} else if (breaktest(obj)) { } else if (breaktest(obj)) {
int blindinc; int blindinc;
/* need to check for blindness result prior to destroying obj */ /* need to check for blindness result prior to destroying obj */
blindinc = ((otyp == CREAM_PIE || otyp == BLINDING_VENOM) blindinc = ((otyp == CREAM_PIE || otyp == BLINDING_VENOM)
/* AT_WEAP is ok here even if attack type was AT_SPIT */ /* AT_WEAP is ok here even if attack type was AT_SPIT */
&& can_blnd(u.umonst, u.umonst, AT_WEAP, obj)) && can_blnd(&gy.youmonst, &gy.youmonst, AT_WEAP, obj))
? rnd(25) ? rnd(25)
: 0; : 0;
breakmsg(obj, !Blind); breakmsg(obj, !Blind);
@@ -1304,7 +1304,7 @@ toss_up(struct obj *obj, boolean hitsroof)
switch (otyp) { switch (otyp) {
case EGG: case EGG:
if (petrifier && !Stone_resistance if (petrifier && !Stone_resistance
&& !(poly_when_stoned(u.umonst->data) && !(poly_when_stoned(gy.youmonst.data)
&& polymon(PM_STONE_GOLEM))) { && polymon(PM_STONE_GOLEM))) {
/* egg ends up "all over your face"; perhaps /* egg ends up "all over your face"; perhaps
visored helmet should still save you here */ visored helmet should still save you here */
@@ -1344,13 +1344,13 @@ toss_up(struct obj *obj, boolean hitsroof)
less_damage = (hard_helmet(uarmh) less_damage = (hard_helmet(uarmh)
&& (!is_silver || !Hate_silver)), && (!is_silver || !Hate_silver)),
harmless = (stone_missile(obj) harmless = (stone_missile(obj)
&& passes_rocks(u.umonst->data)), && passes_rocks(gy.youmonst.data)),
artimsg = FALSE; artimsg = FALSE;
int dmg = dmgval(obj, u.umonst); int dmg = dmgval(obj, &gy.youmonst);
if (obj->oartifact && !harmless) if (obj->oartifact && !harmless)
/* need a fake die roll here; rn1(18,2) avoids 1 and 20 */ /* need a fake die roll here; rn1(18,2) avoids 1 and 20 */
artimsg = artifact_hit((struct monst *) 0, u.umonst, obj, artimsg = artifact_hit((struct monst *) 0, &gy.youmonst, obj,
&dmg, rn1(18, 2)); &dmg, rn1(18, 2));
if (!dmg) { /* probably wasn't a weapon; base damage on weight */ if (!dmg) { /* probably wasn't a weapon; base damage on weight */
@@ -1364,9 +1364,9 @@ toss_up(struct obj *obj, boolean hitsroof)
dmgval()'s artifact light against gremlin or axe against dmgval()'s artifact light against gremlin or axe against
woody creature since both involve weapons; hero-as-shade is woody creature since both involve weapons; hero-as-shade is
hypothetical because hero can't polymorph into that form */ hypothetical because hero can't polymorph into that form */
if (u.umonst->data == &mons[PM_SHADE] && !is_silver) if (gy.youmonst.data == &mons[PM_SHADE] && !is_silver)
dmg = 0; dmg = 0;
if (obj->blessed && mon_hates_blessings(u.umonst)) if (obj->blessed && mon_hates_blessings(&gy.youmonst))
dmg += rnd(4); dmg += rnd(4);
if (is_silver && Hate_silver) if (is_silver && Hate_silver)
dmg += rnd(20); dmg += rnd(20);
@@ -1399,7 +1399,7 @@ toss_up(struct obj *obj, boolean hitsroof)
harmless, but hitting a worn helmet negates that */ harmless, but hitting a worn helmet negates that */
harmless = FALSE; harmless = FALSE;
} else if (petrifier && !Stone_resistance } else if (petrifier && !Stone_resistance
&& !(poly_when_stoned(u.umonst->data) && !(poly_when_stoned(gy.youmonst.data)
&& polymon(PM_STONE_GOLEM))) { && polymon(PM_STONE_GOLEM))) {
petrify: petrify:
svk.killer.format = KILLED_BY; svk.killer.format = KILLED_BY;
@@ -1415,7 +1415,7 @@ toss_up(struct obj *obj, boolean hitsroof)
if (is_silver && Hate_silver) if (is_silver && Hate_silver)
pline_The("silver sears you!"); pline_The("silver sears you!");
if (harmless) if (harmless)
hit(thesimpleoname(obj), u.umonst, " but doesn't hurt."); hit(thesimpleoname(obj), &gy.youmonst, " but doesn't hurt.");
hitfloor(obj, TRUE); hitfloor(obj, TRUE);
gt.thrownobj = 0; gt.thrownobj = 0;
@@ -1603,7 +1603,7 @@ throwit(
hurtle(-u.dx, -u.dy, 1, TRUE); hurtle(-u.dx, -u.dy, 1, TRUE);
mon = boomhit(obj, u.dx, u.dy); mon = boomhit(obj, u.dx, u.dy);
iflags.returning_missile = 0; /* has returned or isn't going to */ iflags.returning_missile = 0; /* has returned or isn't going to */
if (mon == u.umonst) { /* the thing was caught */ if (mon == &gy.youmonst) { /* the thing was caught */
exercise(A_DEX, TRUE); exercise(A_DEX, TRUE);
obj = return_throw_to_inv(obj, wep_mask, twoweap, oldslot); obj = return_throw_to_inv(obj, wep_mask, twoweap, oldslot);
throwit_return(TRUE); throwit_return(TRUE);
@@ -1743,7 +1743,7 @@ throwit(
body_part(ARM)); body_part(ARM));
if (obj->oartifact) if (obj->oartifact)
(void) artifact_hit((struct monst *) 0, (void) artifact_hit((struct monst *) 0,
u.umonst, obj, &dmg, 0); &gy.youmonst, obj, &dmg, 0);
losehp(Maybe_Half_Phys(dmg), killer_xname(obj), losehp(Maybe_Half_Phys(dmg), killer_xname(obj),
KILLED_BY); KILLED_BY);
} }
@@ -2034,7 +2034,7 @@ thitmonst(
* Distance and monster size affect chance to hit. * Distance and monster size affect chance to hit.
*/ */
tmp = -1 + Luck + find_mac(mon) + u.uhitinc tmp = -1 + Luck + find_mac(mon) + u.uhitinc
+ maybe_polyd(u.umonst->data->mlevel, u.ulevel); + maybe_polyd(gy.youmonst.data->mlevel, u.ulevel);
if (ACURR(A_DEX) < 4) if (ACURR(A_DEX) < 4)
tmp -= 3; tmp -= 3;
else if (ACURR(A_DEX) < 6) else if (ACURR(A_DEX) < 6)
@@ -2073,7 +2073,7 @@ thitmonst(
tmp += omon_adj(mon, obj, TRUE); tmp += omon_adj(mon, obj, TRUE);
if (is_orc(mon->data) if (is_orc(mon->data)
&& maybe_polyd(is_elf(u.umonst->data), Race_if(PM_ELF))) && maybe_polyd(is_elf(gy.youmonst.data), Race_if(PM_ELF)))
tmp++; tmp++;
if (guaranteed_hit) { if (guaranteed_hit) {
tmp += 1000; /* Guaranteed hit */ tmp += 1000; /* Guaranteed hit */
@@ -2170,7 +2170,7 @@ thitmonst(
* Polymorphing won't make you a bow expert. * Polymorphing won't make you a bow expert.
*/ */
if ((Race_if(PM_ELF) || Role_if(PM_SAMURAI)) if ((Race_if(PM_ELF) || Role_if(PM_SAMURAI))
&& (!Upolyd || your_race(u.umonst->data)) && (!Upolyd || your_race(gy.youmonst.data))
&& objects[uwep->otyp].oc_skill == P_BOW) { && objects[uwep->otyp].oc_skill == P_BOW) {
++tmp; ++tmp;
if ((Race_if(PM_ELF) && uwep->otyp == ELVEN_BOW) if ((Race_if(PM_ELF) && uwep->otyp == ELVEN_BOW)
@@ -2500,16 +2500,16 @@ breakobj(
if (obj->otyp == POT_OIL && obj->lamplit) { if (obj->otyp == POT_OIL && obj->lamplit) {
explode_oil(obj, x, y); explode_oil(obj, x, y);
} else if (next2u(x, y)) { } else if (next2u(x, y)) {
if (!breathless(u.umonst->data) || haseyes(u.umonst->data)) { if (!breathless(gy.youmonst.data) || haseyes(gy.youmonst.data)) {
/* wet towel protects both eyes and breathing */ /* wet towel protects both eyes and breathing */
if (obj->otyp != POT_WATER && !Half_gas_damage) { if (obj->otyp != POT_WATER && !Half_gas_damage) {
if (!breathless(u.umonst->data)) { if (!breathless(gy.youmonst.data)) {
/* [what about "familiar odor" when known?] */ /* [what about "familiar odor" when known?] */
You("smell a peculiar odor..."); You("smell a peculiar odor...");
} else { } else {
const char *eyes = body_part(EYE); const char *eyes = body_part(EYE);
if (eyecount(u.umonst->data) != 1) if (eyecount(gy.youmonst.data) != 1)
eyes = makeplural(eyes); eyes = makeplural(eyes);
Your("%s %s.", eyes, vtense(eyes, "water")); Your("%s %s.", eyes, vtense(eyes, "water"));
} }
+56 -56
View File
@@ -97,12 +97,12 @@ is_edible(struct obj *obj)
/* above also prevents the Amulet from being eaten, so we must never /* above also prevents the Amulet from being eaten, so we must never
allow fake amulets to be eaten either [which is already the case] */ allow fake amulets to be eaten either [which is already the case] */
if (u.umonst->data == &mons[PM_FIRE_ELEMENTAL] if (gy.youmonst.data == &mons[PM_FIRE_ELEMENTAL]
&& is_flammable(obj)) && is_flammable(obj))
return TRUE; return TRUE;
if (metallivorous(u.umonst->data) && is_metallic(obj) if (metallivorous(gy.youmonst.data) && is_metallic(obj)
&& (u.umonst->data != &mons[PM_RUST_MONSTER] || is_rustprone(obj))) && (gy.youmonst.data != &mons[PM_RUST_MONSTER] || is_rustprone(obj)))
return TRUE; return TRUE;
/* Ghouls only eat non-veggy corpses or eggs (see dogfood()) */ /* Ghouls only eat non-veggy corpses or eggs (see dogfood()) */
@@ -170,7 +170,7 @@ eatmdone(void)
} }
/* update display */ /* update display */
if (U_AP_TYPE) { if (U_AP_TYPE) {
u.umonst->m_ap_type = M_AP_NOTHING; gy.youmonst.m_ap_type = M_AP_NOTHING;
newsym(u.ux, u.uy); newsym(u.ux, u.uy);
} }
return 0; return 0;
@@ -186,11 +186,11 @@ eatmupdate(void)
if (!ge.eatmbuf || gn.nomovemsg != ge.eatmbuf) if (!ge.eatmbuf || gn.nomovemsg != ge.eatmbuf)
return; return;
if (is_obj_mappear(u.umonst,ORANGE) && !Hallucination) { if (is_obj_mappear(&gy.youmonst,ORANGE) && !Hallucination) {
/* revert from hallucinatory to "normal" mimicking */ /* revert from hallucinatory to "normal" mimicking */
altmsg = "You now prefer mimicking yourself."; altmsg = "You now prefer mimicking yourself.";
altapp = GOLD_PIECE; altapp = GOLD_PIECE;
} else if (is_obj_mappear(u.umonst,GOLD_PIECE) && Hallucination) { } else if (is_obj_mappear(&gy.youmonst,GOLD_PIECE) && Hallucination) {
/* won't happen; anything which might make immobilized /* won't happen; anything which might make immobilized
hero begin hallucinating (black light attack, theft hero begin hallucinating (black light attack, theft
of Grayswandir) will terminate the mimicry first */ of Grayswandir) will terminate the mimicry first */
@@ -207,7 +207,7 @@ eatmupdate(void)
} }
gn.nomovemsg = strcpy(ge.eatmbuf, altmsg); gn.nomovemsg = strcpy(ge.eatmbuf, altmsg);
/* update current image */ /* update current image */
u.umonst->mappearance = altapp; gy.youmonst.mappearance = altapp;
newsym(u.ux, u.uy); newsym(u.ux, u.uy);
} }
} }
@@ -343,12 +343,12 @@ adj_victual_nutrition(void)
assert(nut > 0); assert(nut > 0);
if (otyp == LEMBAS_WAFER) { if (otyp == LEMBAS_WAFER) {
if (maybe_polyd(is_elf(u.umonst->data), Race_if(PM_ELF))) if (maybe_polyd(is_elf(gy.youmonst.data), Race_if(PM_ELF)))
nut += (nut + 2) / 4; /* 800 -> 1000 */ nut += (nut + 2) / 4; /* 800 -> 1000 */
else if (maybe_polyd(is_orc(u.umonst->data), Race_if(PM_ORC))) else if (maybe_polyd(is_orc(gy.youmonst.data), Race_if(PM_ORC)))
nut -= (nut + 2) / 4; /* 800 -> 600 */ nut -= (nut + 2) / 4; /* 800 -> 600 */
} else if (otyp == CRAM_RATION) { } else if (otyp == CRAM_RATION) {
if (maybe_polyd(is_dwarf(u.umonst->data), Race_if(PM_DWARF))) if (maybe_polyd(is_dwarf(gy.youmonst.data), Race_if(PM_DWARF)))
nut += (nut + 3) / 6; /* 600 -> 700 */ nut += (nut + 3) / 6; /* 600 -> 700 */
} }
nut = max(nut, 1); nut = max(nut, 1);
@@ -554,7 +554,7 @@ done_eating(boolean message)
gn.nomovemsg = 0; gn.nomovemsg = 0;
} else if (message) { } else if (message) {
You("finish %s %s.", You("finish %s %s.",
(u.umonst->data == &mons[PM_FIRE_ELEMENTAL]) ? "consuming" (gy.youmonst.data == &mons[PM_FIRE_ELEMENTAL]) ? "consuming"
: "eating", : "eating",
food_xname(piece, TRUE)); food_xname(piece, TRUE));
} }
@@ -612,18 +612,18 @@ eat_brains(
/* previous tentacle attack might have triggered fatal passive /* previous tentacle attack might have triggered fatal passive
counterattack [callers ought to be updated to avoid this situation] */ counterattack [callers ought to be updated to avoid this situation] */
if (magr != u.umonst && DEADMONSTER(magr)) { if (magr != &gy.youmonst && DEADMONSTER(magr)) {
return M_ATTK_AGR_DIED; return M_ATTK_AGR_DIED;
} }
if (noncorporeal(pd)) { if (noncorporeal(pd)) {
if (visflag) if (visflag)
pline("%s brain is unharmed.", pline("%s brain is unharmed.",
(mdef == u.umonst) ? "Your" : s_suffix(Monnam(mdef))); (mdef == &gy.youmonst) ? "Your" : s_suffix(Monnam(mdef)));
return M_ATTK_MISS; /* side-effects can't occur */ return M_ATTK_MISS; /* side-effects can't occur */
} else if (magr == u.umonst) { } else if (magr == &gy.youmonst) {
You("eat %s brain!", s_suffix(mon_nam(mdef))); You("eat %s brain!", s_suffix(mon_nam(mdef)));
} else if (mdef == u.umonst) { } else if (mdef == &gy.youmonst) {
Your("brain is eaten!"); Your("brain is eaten!");
} else { /* monster against monster */ } else { /* monster against monster */
if (visflag && canspotmon(mdef)) if (visflag && canspotmon(mdef))
@@ -634,7 +634,7 @@ eat_brains(
/* mind flayer has attempted to eat the brains of a petrification /* mind flayer has attempted to eat the brains of a petrification
inducing critter (most likely Medusa; attacking a cockatrice via inducing critter (most likely Medusa; attacking a cockatrice via
tentacle-touch should have been caught before reaching this far) */ tentacle-touch should have been caught before reaching this far) */
if (magr == u.umonst) { if (magr == &gy.youmonst) {
if (!Stone_resistance && !Stoned) if (!Stone_resistance && !Stoned)
make_stoned(5L, (char *) 0, KILLED_BY_AN, make_stoned(5L, (char *) 0, KILLED_BY_AN,
pmname(pd, Mgender(mdef))); pmname(pd, Mgender(mdef)));
@@ -656,7 +656,7 @@ eat_brains(
} }
} }
if (magr == u.umonst) { if (magr == &gy.youmonst) {
/* /*
* player mind flayer is eating something's brain * player mind flayer is eating something's brain
*/ */
@@ -690,7 +690,7 @@ eat_brains(
is cannibalism */ is cannibalism */
(void) maybe_cannibal(monsndx(pd), TRUE); (void) maybe_cannibal(monsndx(pd), TRUE);
} else if (mdef == u.umonst) { } else if (mdef == &gy.youmonst) {
/* /*
* monster mind flayer is eating hero's brain * monster mind flayer is eating hero's brain
*/ */
@@ -773,7 +773,7 @@ maybe_cannibal(int pm, boolean allowmsg)
(even if having the form of something which doesn't care (even if having the form of something which doesn't care
about cannibalism--hero's innate traits aren't altered) */ about cannibalism--hero's innate traits aren't altered) */
&& (your_race(fptr) && (your_race(fptr)
|| (Upolyd && same_race(u.umonst->data, fptr)) || (Upolyd && same_race(gy.youmonst.data, fptr))
|| (ismnum(u.ulycn) && were_beastie(pm) == u.ulycn))) { || (ismnum(u.ulycn) && were_beastie(pm) == u.ulycn))) {
if (allowmsg) { if (allowmsg) {
if (Upolyd && your_race(fptr)) if (Upolyd && your_race(fptr))
@@ -793,7 +793,7 @@ cprefx(int pm)
(void) maybe_cannibal(pm, TRUE); (void) maybe_cannibal(pm, TRUE);
if (flesh_petrifies(&mons[pm])) { if (flesh_petrifies(&mons[pm])) {
if (!Stone_resistance if (!Stone_resistance
&& !(poly_when_stoned(u.umonst->data) && !(poly_when_stoned(gy.youmonst.data)
&& polymon(PM_STONE_GOLEM))) { && polymon(PM_STONE_GOLEM))) {
/* if food was a tin, use it up early to keep it out of bones */ /* if food was a tin, use it up early to keep it out of bones */
if (svc.context.tin.tin) if (svc.context.tin.tin)
@@ -849,7 +849,7 @@ cprefx(int pm)
return; return;
} }
case PM_GREEN_SLIME: case PM_GREEN_SLIME:
if (!Slimed && !Unchanging && !slimeproof(u.umonst->data)) { if (!Slimed && !Unchanging && !slimeproof(gy.youmonst.data)) {
You("don't feel very well."); You("don't feel very well.");
make_slimed(10L, (char *) 0); make_slimed(10L, (char *) 0);
delayed_killer(SLIMED, KILLED_BY_AN, ""); delayed_killer(SLIMED, KILLED_BY_AN, "");
@@ -1191,7 +1191,7 @@ cpostfx(int pm)
/*FALLTHRU*/ /*FALLTHRU*/
case PM_SMALL_MIMIC: case PM_SMALL_MIMIC:
tmp += 20; tmp += 20;
if (u.umonst->data->mlet != S_MIMIC && !Unchanging) { if (gy.youmonst.data->mlet != S_MIMIC && !Unchanging) {
char buf[BUFSZ]; char buf[BUFSZ];
const char *tempshape = !Hallucination ? "a pile of gold" const char *tempshape = !Hallucination ? "a pile of gold"
: "an orange"; : "an orange";
@@ -1210,14 +1210,14 @@ cpostfx(int pm)
Hallucination Hallucination
? "You suddenly dread being peeled and mimic %s again!" ? "You suddenly dread being peeled and mimic %s again!"
: "You now prefer mimicking %s again.", : "You now prefer mimicking %s again.",
an(Upolyd ? pmname(u.umonst->data, Ugender) an(Upolyd ? pmname(gy.youmonst.data, Ugender)
: gu.urace.noun)); : gu.urace.noun));
ge.eatmbuf = dupstr(buf); ge.eatmbuf = dupstr(buf);
gn.nomovemsg = ge.eatmbuf; gn.nomovemsg = ge.eatmbuf;
ga.afternmv = eatmdone; ga.afternmv = eatmdone;
/* ??? what if this was set before? */ /* ??? what if this was set before? */
u.umonst->m_ap_type = M_AP_OBJECT; gy.youmonst.m_ap_type = M_AP_OBJECT;
u.umonst->mappearance = Hallucination ? ORANGE : GOLD_PIECE; gy.youmonst.mappearance = Hallucination ? ORANGE : GOLD_PIECE;
newsym(u.ux, u.uy); newsym(u.ux, u.uy);
curs_on_u(); curs_on_u();
/* make gold symbol show up now */ /* make gold symbol show up now */
@@ -1253,7 +1253,7 @@ cpostfx(int pm)
if (svc.context.tin.tin) { if (svc.context.tin.tin) {
use_up_tin(svc.context.tin.tin); use_up_tin(svc.context.tin.tin);
/* most tin effects end up being skipped */ /* most tin effects end up being skipped */
lesshungry(200 + (metallivorous(u.umonst->data) ? 5 : 0)); lesshungry(200 + (metallivorous(gy.youmonst.data) ? 5 : 0));
} }
You("%s.", (pm == PM_GENETIC_ENGINEER) You("%s.", (pm == PM_GENETIC_ENGINEER)
@@ -1530,7 +1530,7 @@ consume_tin(const char *mesg)
const char *what; const char *what;
int which, mnum, r, nutamt; int which, mnum, r, nutamt;
/* if you've eaten tin itself, chance to not eat contents gets bypassed */ /* if you've eaten tin itself, chance to not eat contents gets bypassed */
boolean always_eat = metallivorous(u.umonst->data); boolean always_eat = metallivorous(gy.youmonst.data);
struct obj *tin = svc.context.tin.tin; struct obj *tin = svc.context.tin.tin;
r = tin_variety(tin, FALSE); r = tin_variety(tin, FALSE);
@@ -1725,10 +1725,10 @@ start_tin(struct obj *otmp)
const char *mesg = 0; const char *mesg = 0;
int tmp; int tmp;
if (metallivorous(u.umonst->data)) { if (metallivorous(gy.youmonst.data)) {
mesg = "You bite right into the metal tin..."; mesg = "You bite right into the metal tin...";
tmp = 0; tmp = 0;
} else if (cantwield(u.umonst->data)) { /* nohands || verysmall */ } else if (cantwield(gy.youmonst.data)) { /* nohands || verysmall */
You("cannot handle the tin properly to open it."); You("cannot handle the tin properly to open it.");
return; return;
} else if (otmp->blessed) { } else if (otmp->blessed) {
@@ -1859,12 +1859,12 @@ eatcorpse(struct obj *otmp)
int ll_conduct = 0; int ll_conduct = 0;
boolean stoneable, boolean stoneable,
slimeable = (mnum == PM_GREEN_SLIME && !Slimed && !Unchanging slimeable = (mnum == PM_GREEN_SLIME && !Slimed && !Unchanging
&& !slimeproof(u.umonst->data)), && !slimeproof(gy.youmonst.data)),
glob = otmp->globby ? TRUE : FALSE; glob = otmp->globby ? TRUE : FALSE;
assert(ismnum(mnum)); assert(ismnum(mnum));
stoneable = (flesh_petrifies(&mons[mnum]) && !Stone_resistance stoneable = (flesh_petrifies(&mons[mnum]) && !Stone_resistance
&& !poly_when_stoned(u.umonst->data)); && !poly_when_stoned(gy.youmonst.data));
/* KMH, conduct */ /* KMH, conduct */
if (!vegan(&mons[mnum])) if (!vegan(&mons[mnum]))
@@ -1978,13 +1978,13 @@ eatcorpse(struct obj *otmp)
} else { } else {
/* yummy is always False for omnivores, palatable always True */ /* yummy is always False for omnivores, palatable always True */
boolean yummy = (vegan(&mons[mnum]) boolean yummy = (vegan(&mons[mnum])
? (!carnivorous(u.umonst->data) ? (!carnivorous(gy.youmonst.data)
&& herbivorous(u.umonst->data)) && herbivorous(gy.youmonst.data))
: (carnivorous(u.umonst->data) : (carnivorous(gy.youmonst.data)
&& !herbivorous(u.umonst->data))), && !herbivorous(gy.youmonst.data))),
palatable = ((vegetarian(&mons[mnum]) palatable = ((vegetarian(&mons[mnum])
? herbivorous(u.umonst->data) ? herbivorous(gy.youmonst.data)
: carnivorous(u.umonst->data)) : carnivorous(gy.youmonst.data))
&& rn2(10) && rn2(10)
&& (rotted < 1 || !rn2((int) rotted + 1))); && (rotted < 1 || !rn2((int) rotted + 1)));
const char *pmxnam = food_xname(otmp, FALSE); const char *pmxnam = food_xname(otmp, FALSE);
@@ -2129,9 +2129,9 @@ fprefx(struct obj *otmp)
/* [satiation message may be inaccurate if eating gets interrupted] */ /* [satiation message may be inaccurate if eating gets interrupted] */
break; break;
case TRIPE_RATION: case TRIPE_RATION:
if (carnivorous(u.umonst->data) && !humanoid(u.umonst->data)) { if (carnivorous(gy.youmonst.data) && !humanoid(gy.youmonst.data)) {
pline("This tripe ration is surprisingly good!"); pline("This tripe ration is surprisingly good!");
} else if (maybe_polyd(is_orc(u.umonst->data), Race_if(PM_ORC))) { } else if (maybe_polyd(is_orc(gy.youmonst.data), Race_if(PM_ORC))) {
pline(Hallucination ? "Tastes great! Less filling!" pline(Hallucination ? "Tastes great! Less filling!"
: "Mmm, tripe... not bad!"); : "Mmm, tripe... not bad!");
} else { } else {
@@ -2146,10 +2146,10 @@ fprefx(struct obj *otmp)
} }
break; break;
case LEMBAS_WAFER: case LEMBAS_WAFER:
if (maybe_polyd(is_orc(u.umonst->data), Race_if(PM_ORC))) { if (maybe_polyd(is_orc(gy.youmonst.data), Race_if(PM_ORC))) {
pline("%s", "!#?&* elf kibble!"); pline("%s", "!#?&* elf kibble!");
break; break;
} else if (maybe_polyd(is_elf(u.umonst->data), Race_if(PM_ELF))) { } else if (maybe_polyd(is_elf(gy.youmonst.data), Race_if(PM_ELF))) {
pline("A little goes a long way."); pline("A little goes a long way.");
break; break;
} }
@@ -2160,7 +2160,7 @@ fprefx(struct obj *otmp)
case MEAT_RING: case MEAT_RING:
goto give_feedback; goto give_feedback;
case CLOVE_OF_GARLIC: case CLOVE_OF_GARLIC:
if (is_undead(u.umonst->data)) { if (is_undead(gy.youmonst.data)) {
make_vomiting((long) rn1(svc.context.victual.reqtime, 5), FALSE); make_vomiting((long) rn1(svc.context.victual.reqtime, 5), FALSE);
break; break;
} }
@@ -2293,7 +2293,7 @@ eataccessory(struct obj *otmp)
set_mimic_blocking(); set_mimic_blocking();
see_monsters(); see_monsters();
if (Invis && !oldprop && !ESee_invisible if (Invis && !oldprop && !ESee_invisible
&& !perceives(u.umonst->data) && !Blind) { && !perceives(gy.youmonst.data) && !Blind) {
newsym(u.ux, u.uy); newsym(u.ux, u.uy);
pline("Suddenly you can see yourself."); pline("Suddenly you can see yourself.");
makeknown(typ); makeknown(typ);
@@ -2511,7 +2511,7 @@ fpostfx(struct obj *otmp)
{ {
switch (otmp->otyp) { switch (otmp->otyp) {
case SPRIG_OF_WOLFSBANE: case SPRIG_OF_WOLFSBANE:
if (ismnum(u.ulycn) || is_were(u.umonst->data)) if (ismnum(u.ulycn) || is_were(gy.youmonst.data))
you_unwere(TRUE); you_unwere(TRUE);
break; break;
case CARROT: case CARROT:
@@ -2527,7 +2527,7 @@ fpostfx(struct obj *otmp)
"became literate by reading the fortune inside a cookie"); "became literate by reading the fortune inside a cookie");
break; break;
case LUMP_OF_ROYAL_JELLY: case LUMP_OF_ROYAL_JELLY:
if (u.umonst->data == &mons[PM_KILLER_BEE] && !Unchanging if (gy.youmonst.data == &mons[PM_KILLER_BEE] && !Unchanging
&& polymon(PM_QUEEN_BEE)) && polymon(PM_QUEEN_BEE))
break; break;
@@ -2561,7 +2561,7 @@ fpostfx(struct obj *otmp)
if (ismnum(otmp->corpsenm) if (ismnum(otmp->corpsenm)
&& flesh_petrifies(&mons[otmp->corpsenm])) { && flesh_petrifies(&mons[otmp->corpsenm])) {
if (!Stone_resistance if (!Stone_resistance
&& !(poly_when_stoned(u.umonst->data) && !(poly_when_stoned(gy.youmonst.data)
&& polymon(PM_STONE_GOLEM))) { && polymon(PM_STONE_GOLEM))) {
if (!Stoned) { if (!Stoned) {
Sprintf(svk.killer.name, "%s egg", Sprintf(svk.killer.name, "%s egg",
@@ -2646,10 +2646,10 @@ edibility_prompts(struct obj *otmp)
stoneorslime = (ismnum(mnum) stoneorslime = (ismnum(mnum)
&& flesh_petrifies(&mons[mnum]) && flesh_petrifies(&mons[mnum])
&& !Stone_resistance && !Stone_resistance
&& !poly_when_stoned(u.umonst->data)); && !poly_when_stoned(gy.youmonst.data));
if (mnum == PM_GREEN_SLIME || otmp->otyp == GLOB_OF_GREEN_SLIME) if (mnum == PM_GREEN_SLIME || otmp->otyp == GLOB_OF_GREEN_SLIME)
stoneorslime = (!Unchanging && !slimeproof(u.umonst->data)); stoneorslime = (!Unchanging && !slimeproof(gy.youmonst.data));
if (cadaver && !nonrotting_corpse(mnum)) { if (cadaver && !nonrotting_corpse(mnum)) {
long age = peek_at_iced_corpse_age(otmp); long age = peek_at_iced_corpse_age(otmp);
@@ -2870,7 +2870,7 @@ doeat(void)
You_cant("eat %s you're wearing.", something); You_cant("eat %s you're wearing.", something);
return ECMD_OK; return ECMD_OK;
} else if (!(carried(otmp) ? retouch_object(&otmp, FALSE) } else if (!(carried(otmp) ? retouch_object(&otmp, FALSE)
: touch_artifact(otmp, u.umonst))) { : touch_artifact(otmp, &gy.youmonst))) {
return ECMD_TIME; /* got blasted so use a turn */ return ECMD_TIME; /* got blasted so use a turn */
} }
if (is_metallic(otmp) && u.umonnum == PM_RUST_MONSTER if (is_metallic(otmp) && u.umonnum == PM_RUST_MONSTER
@@ -3172,9 +3172,9 @@ gethungry(void)
will need to wear an Amulet of Unchanging so still burn a small will need to wear an Amulet of Unchanging so still burn a small
amount of nutrition in the 'moves % 20' ring/amulet check below */ amount of nutrition in the 'moves % 20' ring/amulet check below */
if ((!Unaware || !rn2(10)) /* slow metabolic rate while asleep */ if ((!Unaware || !rn2(10)) /* slow metabolic rate while asleep */
&& (carnivorous(u.umonst->data) && (carnivorous(gy.youmonst.data)
|| herbivorous(u.umonst->data) || herbivorous(gy.youmonst.data)
|| metallivorous(u.umonst->data)) || metallivorous(gy.youmonst.data))
&& !Slow_digestion) && !Slow_digestion)
u.uhunger--; /* ordinary food consumption */ u.uhunger--; /* ordinary food consumption */
@@ -3583,7 +3583,7 @@ floorfood(
struct obj *otmp; struct obj *otmp;
char qbuf[QBUFSZ]; char qbuf[QBUFSZ];
char c; char c;
struct permonst *uptr = u.umonst->data; struct permonst *uptr = gy.youmonst.data;
boolean feeding = !strcmp(verb, "eat"), /* corpsecheck==0 */ boolean feeding = !strcmp(verb, "eat"), /* corpsecheck==0 */
offering = !strcmp(verb, "sacrifice"); /* corpsecheck==1 */ offering = !strcmp(verb, "sacrifice"); /* corpsecheck==1 */
@@ -3737,7 +3737,7 @@ vomit(void) /* A good idea from David Neves */
{ {
boolean spewed = FALSE; boolean spewed = FALSE;
if (cantvomit(u.umonst->data)) { if (cantvomit(gy.youmonst.data)) {
/* doesn't cure food poisoning; message assumes that we aren't /* doesn't cure food poisoning; message assumes that we aren't
dealing with some esoteric body_part() */ dealing with some esoteric body_part() */
Your("jaw gapes convulsively."); Your("jaw gapes convulsively.");
@@ -3764,7 +3764,7 @@ vomit(void) /* A good idea from David Neves */
if (spewed) { if (spewed) {
struct attack struct attack
*mattk = attacktype_fordmg(u.umonst->data, AT_BREA, AD_ACID); *mattk = attacktype_fordmg(gy.youmonst.data, AT_BREA, AD_ACID);
/* currently, only yellow dragons can breathe acid */ /* currently, only yellow dragons can breathe acid */
if (mattk) { if (mattk) {
@@ -3775,7 +3775,7 @@ vomit(void) /* A good idea from David Neves */
if (IS_ALTAR(levl[u.ux][u.uy].typ)) if (IS_ALTAR(levl[u.ux][u.uy].typ))
altar_wrath(u.ux, u.uy); altar_wrath(u.ux, u.uy);
/* if poly'd into acidic form, stomach acid is stronger than normal */ /* if poly'd into acidic form, stomach acid is stronger than normal */
if (acidic(u.umonst->data)) { if (acidic(gy.youmonst.data)) {
/* TODO: if there's a web here, destroy that too (before ice) */ /* TODO: if there's a web here, destroy that too (before ice) */
if (is_ice(u.ux, u.uy)) if (is_ice(u.ux, u.uy))
melt_ice(u.ux, u.uy, melt_ice(u.ux, u.uy,
+1 -1
View File
@@ -747,7 +747,7 @@ savelife(int how)
/* might drop hero onto a trap that kills her all over again */ /* might drop hero onto a trap that kills her all over again */
expels(u.ustuck, u.ustuck->data, TRUE); expels(u.ustuck, u.ustuck->data, TRUE);
} else if (u.ustuck) { } else if (u.ustuck) {
if (Upolyd && sticks(u.umonst->data)) if (Upolyd && sticks(gy.youmonst.data))
You("release %s.", mon_nam(u.ustuck)); You("release %s.", mon_nam(u.ustuck));
else else
pline("%s releases you.", Monnam(u.ustuck)); pline("%s releases you.", Monnam(u.ustuck));
+6 -6
View File
@@ -189,7 +189,7 @@ can_reach_floor(boolean check_pit)
struct trap *t; struct trap *t;
if (u.uswallow if (u.uswallow
|| (u.ustuck && !sticks(u.umonst->data) || (u.ustuck && !sticks(gy.youmonst.data)
/* assume that arms are pinned rather than that the hero /* assume that arms are pinned rather than that the hero
has been lifted up above the floor [doesn't explain has been lifted up above the floor [doesn't explain
how hero can attack the creature holding him or her; how hero can attack the creature holding him or her;
@@ -200,10 +200,10 @@ can_reach_floor(boolean check_pit)
/* Restricted/unskilled riders can't reach the floor */ /* Restricted/unskilled riders can't reach the floor */
if (u.usteed && P_SKILL(P_RIDING) < P_BASIC) if (u.usteed && P_SKILL(P_RIDING) < P_BASIC)
return FALSE; return FALSE;
if (u.uundetected && ceiling_hider(u.umonst->data)) if (u.uundetected && ceiling_hider(gy.youmonst.data))
return FALSE; return FALSE;
if (Flying || u.umonst->data->msize >= MZ_HUGE) if (Flying || gy.youmonst.data->msize >= MZ_HUGE)
return TRUE; return TRUE;
if (check_pit && (t = t_at(u.ux, u.uy)) != 0 if (check_pit && (t = t_at(u.ux, u.uy)) != 0
@@ -531,7 +531,7 @@ u_can_engrave(void)
return FALSE; return FALSE;
} }
if (cantwield(u.umonst->data)) { if (cantwield(gy.youmonst.data)) {
You_cant("even hold anything!"); You_cant("even hold anything!");
return FALSE; return FALSE;
} }
@@ -570,7 +570,7 @@ doengrave_ctx_init(struct _doengrave_ctx *de)
if (de->oep) if (de->oep)
de->oetype = de->oep->engr_type; de->oetype = de->oep->engr_type;
if (is_demon(u.umonst->data) || is_vampire(u.umonst->data)) if (is_demon(gy.youmonst.data) || is_vampire(gy.youmonst.data))
de->type = ENGR_BLOOD; de->type = ENGR_BLOOD;
de->jello = (u.uswallow && !(is_animal(u.ustuck->data) de->jello = (u.uswallow && !(is_animal(u.ustuck->data)
@@ -1245,7 +1245,7 @@ doengrave(void)
if (de->post_engr_text[0]) if (de->post_engr_text[0])
pline("%s", de->post_engr_text); pline("%s", de->post_engr_text);
if (de->doblind && !resists_blnd(u.umonst)) { if (de->doblind && !resists_blnd(&gy.youmonst)) {
You("are blinded by the flash!"); You("are blinded by the flash!");
make_blinded((long) rnd(50), FALSE); make_blinded((long) rnd(50), FALSE);
if (!Blind) if (!Blind)
+3 -3
View File
@@ -213,7 +213,7 @@ losexp(
wizard mode request to reduce level; never fatal though */ wizard mode request to reduce level; never fatal though */
if (drainer && !strcmp(drainer, "#levelchange")) if (drainer && !strcmp(drainer, "#levelchange"))
drainer = 0; drainer = 0;
else if (resists_drli(u.umonst)) else if (resists_drli(&gy.youmonst))
return; return;
/* level-loss message; "Goodbye level 1." is fatal; divine anger /* level-loss message; "Goodbye level 1." is fatal; divine anger
@@ -280,7 +280,7 @@ losexp(
u.uexp = newuexp(u.ulevel) - 1; u.uexp = newuexp(u.ulevel) - 1;
if (Upolyd) { if (Upolyd) {
num = monhp_per_lvl(u.umonst); num = monhp_per_lvl(&gy.youmonst);
u.mhmax -= num; u.mhmax -= num;
u.mh -= num; u.mh -= num;
if (u.mh <= 0) if (u.mh <= 0)
@@ -317,7 +317,7 @@ pluslvl(
/* increase hit points (when polymorphed, do monster form first /* increase hit points (when polymorphed, do monster form first
in order to retain normal human/whatever increase for later) */ in order to retain normal human/whatever increase for later) */
if (Upolyd) { if (Upolyd) {
hpinc = monhp_per_lvl(u.umonst); hpinc = monhp_per_lvl(&gy.youmonst);
u.mh += hpinc; u.mh += hpinc;
setuhpmax(u.mhmax, FALSE); /* acts as setmhmax() when Upolyd */ setuhpmax(u.mhmax, FALSE); /* acts as setmhmax() when Upolyd */
} }
+10 -10
View File
@@ -24,13 +24,13 @@ enum explode_action {
/* check if shield effects are needed for location affected by explosion */ /* check if shield effects are needed for location affected by explosion */
staticfn int staticfn int
explosionmask( explosionmask(
struct monst *m, /* target monster (might be u.umonst) */ struct monst *m, /* target monster (might be youmonst) */
uchar adtyp, /* damage type */ uchar adtyp, /* damage type */
char olet) /* object class (only matters for AD_DISN) */ char olet) /* object class (only matters for AD_DISN) */
{ {
int res = EXPL_NONE; int res = EXPL_NONE;
if (m == u.umonst) { if (m == &gy.youmonst) {
switch (adtyp) { switch (adtyp) {
case AD_PHYS: case AD_PHYS:
/* leave 'res' with EXPL_NONE */ /* leave 'res' with EXPL_NONE */
@@ -274,7 +274,7 @@ explode(
so might get hit by double damage */ so might get hit by double damage */
grabbed = grabbing = FALSE; grabbed = grabbing = FALSE;
if (u.ustuck && !u.uswallow) { if (u.ustuck && !u.uswallow) {
if (Upolyd && sticks(u.umonst->data)) if (Upolyd && sticks(gy.youmonst.data))
grabbing = TRUE; grabbing = TRUE;
else else
grabbed = TRUE; grabbed = TRUE;
@@ -363,7 +363,7 @@ explode(
explmask[i][j] = EXPL_NONE; explmask[i][j] = EXPL_NONE;
if (u_at(xx, yy)) { if (u_at(xx, yy)) {
explmask[i][j] = explosionmask(u.umonst, adtyp, olet); explmask[i][j] = explosionmask(&gy.youmonst, adtyp, olet);
} }
/* can be both you and mtmp if you're swallowed or riding */ /* can be both you and mtmp if you're swallowed or riding */
mtmp = m_at(xx, yy); mtmp = m_at(xx, yy);
@@ -611,10 +611,10 @@ explode(
} else if (adtyp == AD_PHYS || adtyp == AD_ACID) } else if (adtyp == AD_PHYS || adtyp == AD_ACID)
damu = Maybe_Half_Phys(damu); damu = Maybe_Half_Phys(damu);
if (adtyp == AD_FIRE) { if (adtyp == AD_FIRE) {
(void) burnarmor(u.umonst); (void) burnarmor(&gy.youmonst);
ignite_items(gi.invent); ignite_items(gi.invent);
} }
(void) destroy_items(u.umonst, (int) adtyp, dam); (void) destroy_items(&gy.youmonst, (int) adtyp, dam);
ugolemeffects((int) adtyp, damu); ugolemeffects((int) adtyp, damu);
if (uhurt == 2) { if (uhurt == 2) {
@@ -869,9 +869,9 @@ scatter(
if (gm.multi) if (gm.multi)
nomul(0); nomul(0);
dam = dmgval(stmp->obj, u.umonst); dam = dmgval(stmp->obj, &gy.youmonst);
hitvalu = 8 + stmp->obj->spe; hitvalu = 8 + stmp->obj->spe;
if (bigmonst(u.umonst->data)) if (bigmonst(gy.youmonst.data))
hitvalu++; hitvalu++;
hitu = thitu(hitvalu, Maybe_Half_Phys(dam), hitu = thitu(hitvalu, Maybe_Half_Phys(dam),
&stmp->obj, (char *) 0); &stmp->obj, (char *) 0);
@@ -936,8 +936,8 @@ scatter(
newsym(x, y); newsym(x, y);
} }
newsym(sx, sy); newsym(sx, sy);
if (u_at(sx, sy) && u.uundetected && hides_under(u.umonst->data)) if (u_at(sx, sy) && u.uundetected && hides_under(gy.youmonst.data))
(void) hideunder(u.umonst); (void) hideunder(&gy.youmonst);
if (((mtmp = m_at(sx, sy)) != 0) && mtmp->mtrapped) if (((mtmp = m_at(sx, sy)) != 0) && mtmp->mtrapped)
mtmp->mtrapped = 0; mtmp->mtrapped = 0;
maybe_unhide_at(sx, sy); maybe_unhide_at(sx, sy);
+1 -1
View File
@@ -791,7 +791,7 @@ dipsink(struct obj *obj)
breathless for this message */ breathless for this message */
pline("A wisp of vapor rises up..."); pline("A wisp of vapor rises up...");
/* NB: potionbreathe calls trycall or makeknown as appropriate */ /* NB: potionbreathe calls trycall or makeknown as appropriate */
if (!breathless(u.umonst->data) || haseyes(u.umonst->data)) if (!breathless(gy.youmonst.data) || haseyes(gy.youmonst.data))
potionbreathe(obj); potionbreathe(obj);
break; break;
} }
+62 -62
View File
@@ -152,11 +152,11 @@ could_move_onto_boulder(coordxy sx, coordxy sy)
return FALSE; return FALSE;
/* can if a giant, unless doing so allows hero to pass into a /* can if a giant, unless doing so allows hero to pass into a
diagonal squeeze at the same time */ diagonal squeeze at the same time */
if (throws_rocks(u.umonst->data)) if (throws_rocks(gy.youmonst.data))
return (!u.dx || !u.dy || !(IS_OBSTRUCTED(levl[u.ux][sy].typ) return (!u.dx || !u.dy || !(IS_OBSTRUCTED(levl[u.ux][sy].typ)
&& IS_OBSTRUCTED(levl[sx][u.uy].typ))); && IS_OBSTRUCTED(levl[sx][u.uy].typ)));
/* can if tiny (implies carrying very little else couldn't move at all) */ /* can if tiny (implies carrying very little else couldn't move at all) */
if (verysmall(u.umonst->data)) if (verysmall(gy.youmonst.data))
return TRUE; return TRUE;
/* can squeeze to spot if carrying extremely little, otherwise can't */ /* can squeeze to spot if carrying extremely little, otherwise can't */
return squeezeablylightinvent(); return squeezeablylightinvent();
@@ -189,7 +189,7 @@ dopush(
|| svm.moves < gb.bldrpushtime); || svm.moves < gb.bldrpushtime);
what = givemesg ? the(xname(otmp)) : 0; what = givemesg ? the(xname(otmp)) : 0;
if (!u.usteed) { if (!u.usteed) {
easypush = throws_rocks(u.umonst->data); easypush = throws_rocks(gy.youmonst.data);
if (givemesg) if (givemesg)
pline("With %s effort you move %s.", pline("With %s effort you move %s.",
easypush ? "little" : "great", what); easypush ? "little" : "great", what);
@@ -261,7 +261,7 @@ cannot_push_msg(struct obj *otmp, coordxy sx, coordxy sy)
staticfn int staticfn int
cannot_push(struct obj *otmp, coordxy sx, coordxy sy) cannot_push(struct obj *otmp, coordxy sx, coordxy sy)
{ {
if (throws_rocks(u.umonst->data)) { if (throws_rocks(gy.youmonst.data)) {
boolean boolean
canpickup = (!Sokoban canpickup = (!Sokoban
/* similar exception as in can_lift(): /* similar exception as in can_lift():
@@ -388,7 +388,7 @@ moverock_core(coordxy sx, coordxy sy)
int res; int res;
feel_location(sx, sy); /* same for all 3 if/else-if/else cases */ feel_location(sx, sy); /* same for all 3 if/else-if/else cases */
if (throws_rocks(u.umonst->data)) { if (throws_rocks(gy.youmonst.data)) {
/* player has used 'm<dir>' to move, so step to boulder's /* player has used 'm<dir>' to move, so step to boulder's
spot without pushing it; hero is poly'd into a giant, spot without pushing it; hero is poly'd into a giant,
so exotic forms of locomotion are out, but might be so exotic forms of locomotion are out, but might be
@@ -423,7 +423,7 @@ moverock_core(coordxy sx, coordxy sy)
/* Give them a chance to climb over it? */ /* Give them a chance to climb over it? */
return -1; return -1;
} }
if (verysmall(u.umonst->data) && !u.usteed) { if (verysmall(gy.youmonst.data) && !u.usteed) {
if (Blind) if (Blind)
feel_location(sx, sy); feel_location(sx, sy);
pline("You're too small to push that %s.", xname(otmp)); pline("You're too small to push that %s.", xname(otmp));
@@ -667,7 +667,7 @@ still_chewing(coordxy x, coordxy y)
nomul(0); nomul(0);
return 1; return 1;
} else if (lev->typ == IRONBARS } else if (lev->typ == IRONBARS
&& metallivorous(u.umonst->data) && u.uhunger > 1500) { && metallivorous(gy.youmonst.data) && u.uhunger > 1500) {
/* finishing eating via 'morehungry()' doesn't handle choking */ /* finishing eating via 'morehungry()' doesn't handle choking */
You("are too full to eat the bars."); You("are too full to eat the bars.");
nomul(0); nomul(0);
@@ -767,7 +767,7 @@ still_chewing(coordxy x, coordxy y)
digtxt = "chew through the tree."; digtxt = "chew through the tree.";
lev->typ = ROOM; lev->typ = ROOM;
} else if (lev->typ == IRONBARS) { } else if (lev->typ == IRONBARS) {
if (metallivorous(u.umonst->data)) { /* should always be True here */ if (metallivorous(gy.youmonst.data)) { /* should always be True here */
/* arbitrary amount; unlike proper eating, nutrition is /* arbitrary amount; unlike proper eating, nutrition is
bestowed in a lump sum at the end */ bestowed in a lump sum at the end */
int nut = (int) objects[HEAVY_IRON_BALL].oc_weight; int nut = (int) objects[HEAVY_IRON_BALL].oc_weight;
@@ -955,7 +955,7 @@ cant_squeeze_thru(struct monst *mon)
int amt; int amt;
struct permonst *ptr = mon->data; struct permonst *ptr = mon->data;
if ((mon == u.umonst) ? Passes_walls : passes_walls(ptr)) if ((mon == &gy.youmonst) ? Passes_walls : passes_walls(ptr))
return 0; return 0;
/* too big? */ /* too big? */
@@ -965,13 +965,13 @@ cant_squeeze_thru(struct monst *mon)
return 1; return 1;
/* lugging too much junk? */ /* lugging too much junk? */
amt = (mon == u.umonst) ? inv_weight() + weight_cap() amt = (mon == &gy.youmonst) ? inv_weight() + weight_cap()
: curr_mon_load(mon); : curr_mon_load(mon);
if (amt > WT_TOOMUCH_DIAGONAL) if (amt > WT_TOOMUCH_DIAGONAL)
return 2; return 2;
/* Sokoban restriction applies to hero only */ /* Sokoban restriction applies to hero only */
if (mon == u.umonst && Sokoban) if (mon == &gy.youmonst && Sokoban)
return 3; return 3;
/* can squeeze through */ /* can squeeze through */
@@ -1023,19 +1023,19 @@ test_move(
return FALSE; return FALSE;
} else if (tmpr->typ == IRONBARS) { } else if (tmpr->typ == IRONBARS) {
if (mode == DO_MOVE if (mode == DO_MOVE
&& (dmgtype(u.umonst->data, AD_RUST) && (dmgtype(gy.youmonst.data, AD_RUST)
|| dmgtype(u.umonst->data, AD_CORR) || dmgtype(gy.youmonst.data, AD_CORR)
|| metallivorous(u.umonst->data)) || metallivorous(gy.youmonst.data))
&& still_chewing(x, y)) { && still_chewing(x, y)) {
return FALSE; return FALSE;
} }
if (!(Passes_walls || passes_bars(u.umonst->data))) { if (!(Passes_walls || passes_bars(gy.youmonst.data))) {
if (mode == DO_MOVE && flags.mention_walls) if (mode == DO_MOVE && flags.mention_walls)
You("cannot pass through the bars."); You("cannot pass through the bars.");
return FALSE; return FALSE;
} }
} else if (tunnels(u.umonst->data) } else if (tunnels(gy.youmonst.data)
&& !needspick(u.umonst->data)) { && !needspick(gy.youmonst.data)) {
/* Eat the rock. */ /* Eat the rock. */
if (mode == DO_MOVE && still_chewing(x, y)) if (mode == DO_MOVE && still_chewing(x, y))
return FALSE; return FALSE;
@@ -1077,21 +1077,21 @@ test_move(
feel_location(x, y); feel_location(x, y);
if (Passes_walls) { if (Passes_walls) {
; /* do nothing */ ; /* do nothing */
} else if (can_ooze(u.umonst)) { } else if (can_ooze(&gy.youmonst)) {
if (mode == DO_MOVE) if (mode == DO_MOVE)
You("ooze under the door."); You("ooze under the door.");
} else if (Underwater) { } else if (Underwater) {
if (mode == DO_MOVE) if (mode == DO_MOVE)
pline("There is an obstacle there."); pline("There is an obstacle there.");
return FALSE; return FALSE;
} else if (tunnels(u.umonst->data) } else if (tunnels(gy.youmonst.data)
&& !needspick(u.umonst->data)) { && !needspick(gy.youmonst.data)) {
/* Eat the door. */ /* Eat the door. */
if (mode == DO_MOVE && still_chewing(x, y)) if (mode == DO_MOVE && still_chewing(x, y))
return FALSE; return FALSE;
} else { } else {
if (mode == DO_MOVE) { if (mode == DO_MOVE) {
if (amorphous(u.umonst->data)) if (amorphous(gy.youmonst.data))
You("try to ooze under the door," You("try to ooze under the door,"
" but can't squeeze your possessions through."); " but can't squeeze your possessions through.");
if (flags.autoopen && !svc.context.run if (flags.autoopen && !svc.context.run
@@ -1150,10 +1150,10 @@ test_move(
} }
} }
} }
if (dx && dy && bad_rock(u.umonst->data, ux, y) if (dx && dy && bad_rock(gy.youmonst.data, ux, y)
&& bad_rock(u.umonst->data, x, uy)) { && bad_rock(gy.youmonst.data, x, uy)) {
/* Move at a diagonal. */ /* Move at a diagonal. */
switch (cant_squeeze_thru(u.umonst)) { switch (cant_squeeze_thru(&gy.youmonst)) {
case 3: case 3:
if (mode == DO_MOVE) if (mode == DO_MOVE)
You("cannot pass that way."); You("cannot pass that way.");
@@ -1222,7 +1222,7 @@ test_move(
} }
if (mode == DO_MOVE) { if (mode == DO_MOVE) {
/* tunneling monsters will chew before pushing */ /* tunneling monsters will chew before pushing */
if (tunnels(u.umonst->data) && !needspick(u.umonst->data) if (tunnels(gy.youmonst.data) && !needspick(gy.youmonst.data)
&& !Sokoban) { && !Sokoban) {
if (still_chewing(x, y)) if (still_chewing(x, y))
return FALSE; return FALSE;
@@ -1239,8 +1239,8 @@ test_move(
if (sobj_at(BOULDER, ux, uy) && !Sokoban) { if (sobj_at(BOULDER, ux, uy) && !Sokoban) {
if (!Passes_walls if (!Passes_walls
&& !could_move_onto_boulder(ux, uy) && !could_move_onto_boulder(ux, uy)
&& !(tunnels(u.umonst->data) && !(tunnels(gy.youmonst.data)
&& !needspick(u.umonst->data)) && !needspick(gy.youmonst.data))
&& !carrying(PICK_AXE) && !carrying(DWARVISH_MATTOCK) && !carrying(PICK_AXE) && !carrying(DWARVISH_MATTOCK)
&& !((obj = carrying(WAN_DIGGING)) && !((obj = carrying(WAN_DIGGING))
&& !objects[obj->otyp].oc_name_known)) && !objects[obj->otyp].oc_name_known))
@@ -1372,7 +1372,7 @@ findtravelpath(int mode)
if (!isok(nx, ny) if (!isok(nx, ny)
|| ((mode == TRAVP_GUESS) && !couldsee(nx, ny))) || ((mode == TRAVP_GUESS) && !couldsee(nx, ny)))
continue; continue;
if ((!Passes_walls && !can_ooze(u.umonst) if ((!Passes_walls && !can_ooze(&gy.youmonst)
&& closed_door(x, y)) && closed_door(x, y))
|| (sobj_at(BOULDER, x, y) || (sobj_at(BOULDER, x, y)
&& !could_move_onto_boulder(x, y)) && !could_move_onto_boulder(x, y))
@@ -1693,7 +1693,7 @@ trapmove(
boolean boolean
u_rooted(void) u_rooted(void)
{ {
if (!u.umonst->data->mmove) { if (!gy.youmonst.data->mmove) {
You("are rooted %s.", You("are rooted %s.",
Levitation || Is_airlevel(&u.uz) || Is_waterlevel(&u.uz) Levitation || Is_airlevel(&u.uz) || Is_waterlevel(&u.uz)
? "in place" ? "in place"
@@ -1825,14 +1825,14 @@ u_locomotion(const char *def)
or boots/ring/spell of levitation */ or boots/ring/spell of levitation */
return Levitation ? (capitalize ? "Float" : "float") return Levitation ? (capitalize ? "Float" : "float")
: Flying ? (capitalize ? "Fly" : "fly") : Flying ? (capitalize ? "Fly" : "fly")
: locomotion(u.umonst->data, def); : locomotion(gy.youmonst.data, def);
} }
/* Return a simplified floor solid/liquid state based on hero's state */ /* Return a simplified floor solid/liquid state based on hero's state */
staticfn schar staticfn schar
u_simple_floortyp(coordxy x, coordxy y) u_simple_floortyp(coordxy x, coordxy y)
{ {
boolean u_in_air = (Levitation || Flying || !grounded(u.umonst->data)); boolean u_in_air = (Levitation || Flying || !grounded(gy.youmonst.data));
if (is_waterwall(x, y)) if (is_waterwall(x, y))
return WATER; /* wall of water, fly/lev does not matter */ return WATER; /* wall of water, fly/lev does not matter */
@@ -1978,8 +1978,8 @@ domove_attackmon_at(
&& (NODIAG(u.umonnum) && (NODIAG(u.umonnum)
|| (bad_rock(mtmp->data, x, u.uy0) || (bad_rock(mtmp->data, x, u.uy0)
&& bad_rock(mtmp->data, u.ux0, y)) && bad_rock(mtmp->data, u.ux0, y))
|| (bad_rock(u.umonst->data, u.ux0, y) || (bad_rock(gy.youmonst.data, u.ux0, y)
&& bad_rock(u.umonst->data, x, u.uy0)))) && bad_rock(gy.youmonst.data, x, u.uy0))))
&& goodpos(u.ux0, u.uy0, mtmp, GP_ALLOW_U)); && goodpos(u.ux0, u.uy0, mtmp, GP_ALLOW_U));
/* if not displacing, try to attack; note that it might evade; /* if not displacing, try to attack; note that it might evade;
also, we don't attack tame or peaceful when safemon() */ also, we don't attack tame or peaceful when safemon() */
@@ -2244,7 +2244,7 @@ domove_fight_empty(coordxy x, coordxy y)
|| (glyph_is_invisible(glyph) && !m_at(x, y) || (glyph_is_invisible(glyph) && !m_at(x, y)
&& !svc.context.nopick)) { && !svc.context.nopick)) {
struct obj *boulder = 0; struct obj *boulder = 0;
boolean explo = (Upolyd && attacktype(u.umonst->data, AT_EXPL)), boolean explo = (Upolyd && attacktype(gy.youmonst.data, AT_EXPL)),
solid = (off_edge || (!accessible(x, y) solid = (off_edge || (!accessible(x, y)
|| IS_FURNITURE(levl[x][y].typ))); || IS_FURNITURE(levl[x][y].typ)));
char buf[BUFSZ]; char buf[BUFSZ];
@@ -2323,7 +2323,7 @@ domove_fight_empty(coordxy x, coordxy y)
nomul(0); nomul(0);
if (explo) { if (explo) {
struct attack *attk struct attack *attk
= attacktype_fordmg(u.umonst->data, AT_EXPL, AD_ANY); = attacktype_fordmg(gy.youmonst.data, AT_EXPL, AD_ANY);
/* no monster has been attacked so we have bypassed explum() */ /* no monster has been attacked so we have bypassed explum() */
wake_nearto(u.ux, u.uy, 7 * 7); /* same radius as explum() */ wake_nearto(u.ux, u.uy, 7 * 7); /* same radius as explum() */
@@ -2396,7 +2396,7 @@ staticfn void
slippery_ice_fumbling(void) slippery_ice_fumbling(void)
{ {
boolean on_ice = !Levitation && is_ice(u.ux, u.uy); boolean on_ice = !Levitation && is_ice(u.ux, u.uy);
struct monst *iceskater = u.usteed ? u.usteed : u.umonst; struct monst *iceskater = u.usteed ? u.usteed : &gy.youmonst;
if (on_ice) { if (on_ice) {
if ((uarmf && objdescr_is(uarmf, "snow boots")) if ((uarmf && objdescr_is(uarmf, "snow boots"))
@@ -2435,7 +2435,7 @@ impaired_movement(coordxy *x, coordxy *y)
confdir(TRUE); confdir(TRUE);
*x = u.ux + u.dx; *x = u.ux + u.dx;
*y = u.uy + u.dy; *y = u.uy + u.dy;
} while (!isok(*x, *y) || bad_rock(u.umonst->data, *x, *y)); } while (!isok(*x, *y) || bad_rock(gy.youmonst.data, *x, *y));
} }
return FALSE; return FALSE;
} }
@@ -2475,7 +2475,7 @@ avoid_moving_on_liquid(
/* and you know you won't fall in */ /* and you know you won't fall in */
&& (in_air || Known_lwalking || (is_pool(x, y) && Known_wwalking)) && (in_air || Known_lwalking || (is_pool(x, y) && Known_wwalking))
&& !(IS_WATERWALL(levl[x][y].typ) || levl[x][y].typ == LAVAWALL)) { && !(IS_WATERWALL(levl[x][y].typ) || levl[x][y].typ == LAVAWALL)) {
/* XXX: should send 'is_clinger(u.umonst->data)' here once clinging /* XXX: should send 'is_clinger(gy.youmonst.data)' here once clinging
polyforms are allowed to move over water */ polyforms are allowed to move over water */
return FALSE; /* liquid is safe to traverse */ return FALSE; /* liquid is safe to traverse */
} else if (is_pool_or_lava(x, y) && levl[x][y].seenv) { } else if (is_pool_or_lava(x, y) && levl[x][y].seenv) {
@@ -2558,7 +2558,7 @@ avoid_trap_andor_region(coordxy x, coordxy y)
/* check whether attempted move will be viable */ /* check whether attempted move will be viable */
&& test_move(u.ux, u.uy, u.dx, u.dy, TEST_MOVE) && test_move(u.ux, u.uy, u.dx, u.dy, TEST_MOVE)
/* override confirmation if the trap is harmless to the hero */ /* override confirmation if the trap is harmless to the hero */
&& (immune_to_trap(u.umonst, trap->ttyp) != TRAP_CLEARLY_IMMUNE && (immune_to_trap(&gy.youmonst, trap->ttyp) != TRAP_CLEARLY_IMMUNE
/* Hallucination: all traps still show as ^, but the /* Hallucination: all traps still show as ^, but the
hero can't tell what they are, so treat as dangerous */ hero can't tell what they are, so treat as dangerous */
|| Hallucination)) { || Hallucination)) {
@@ -2644,7 +2644,7 @@ escape_from_sticky_mon(coordxy x, coordxy y)
if (!m_next2u(u.ustuck)) { if (!m_next2u(u.ustuck)) {
/* perhaps it fled (or was teleported or ... ) */ /* perhaps it fled (or was teleported or ... ) */
set_ustuck((struct monst *) 0); set_ustuck((struct monst *) 0);
} else if (sticks(u.umonst->data)) { } else if (sticks(gy.youmonst.data)) {
/* When polymorphed into a sticking monster, /* When polymorphed into a sticking monster,
* u.ustuck means it's stuck to you, not you to it. * u.ustuck means it's stuck to you, not you to it.
*/ */
@@ -2874,7 +2874,7 @@ domove_core(void)
u.ux += u.dx; u.ux += u.dx;
u.uy += u.dy; u.uy += u.dy;
m_postmove_effect(u.umonst); m_postmove_effect(&gy.youmonst);
if (u.usteed) { if (u.usteed) {
u.usteed->mx = u.ux; u.usteed->mx = u.ux;
@@ -2943,12 +2943,12 @@ domove_core(void)
/* your tread on the ground may disturb the slumber of nearby zombies */ /* your tread on the ground may disturb the slumber of nearby zombies */
if (!Levitation && !Flying && !Stealth if (!Levitation && !Flying && !Stealth
&& u.umonst->data->cwt >= (WT_ELF / 2)) && gy.youmonst.data->cwt >= (WT_ELF / 2))
disturb_buried_zombies(u.ux, u.uy); disturb_buried_zombies(u.ux, u.uy);
if (hides_under(u.umonst->data) || u.umonst->data->mlet == S_EEL if (hides_under(gy.youmonst.data) || gy.youmonst.data->mlet == S_EEL
|| u.dx || u.dy) || u.dx || u.dy)
(void) hideunder(u.umonst); (void) hideunder(&gy.youmonst);
/* /*
* Mimics (or whatever) become noticeable if they move and are * Mimics (or whatever) become noticeable if they move and are
@@ -2957,7 +2957,7 @@ domove_core(void)
*/ */
if ((u.dx || u.dy) && (U_AP_TYPE == M_AP_OBJECT if ((u.dx || u.dy) && (U_AP_TYPE == M_AP_OBJECT
|| U_AP_TYPE == M_AP_FURNITURE)) || U_AP_TYPE == M_AP_FURNITURE))
u.umonst->m_ap_type = M_AP_NOTHING; gy.youmonst.m_ap_type = M_AP_NOTHING;
check_leash(u.ux0, u.uy0); check_leash(u.ux0, u.uy0);
@@ -3804,8 +3804,8 @@ pickup_checks(void)
} }
} }
if (is_pool(u.ux, u.uy)) { if (is_pool(u.ux, u.uy)) {
if (Wwalking || is_floater(u.umonst->data) if (Wwalking || is_floater(gy.youmonst.data)
|| is_clinger(u.umonst->data) || (Flying && !Breathless)) { || is_clinger(gy.youmonst.data) || (Flying && !Breathless)) {
You("cannot dive into the %s to pick things up.", You("cannot dive into the %s to pick things up.",
hliquid("water")); hliquid("water"));
return 0; return 0;
@@ -3815,11 +3815,11 @@ pickup_checks(void)
} }
} }
if (is_lava(u.ux, u.uy)) { if (is_lava(u.ux, u.uy)) {
if (Wwalking || is_floater(u.umonst->data) if (Wwalking || is_floater(gy.youmonst.data)
|| is_clinger(u.umonst->data) || (Flying && !Breathless)) { || is_clinger(gy.youmonst.data) || (Flying && !Breathless)) {
You_cant("reach the bottom to pick things up."); You_cant("reach the bottom to pick things up.");
return 0; return 0;
} else if (!likes_lava(u.umonst->data)) { } else if (!likes_lava(gy.youmonst.data)) {
You("would burn to a crisp trying to pick things up."); You("would burn to a crisp trying to pick things up.");
return 0; return 0;
} }
@@ -4079,7 +4079,7 @@ boolean
crawl_destination(coordxy x, coordxy y) crawl_destination(coordxy x, coordxy y)
{ {
/* is location ok in general? */ /* is location ok in general? */
if (!goodpos(x, y, u.umonst, 0)) if (!goodpos(x, y, &gy.youmonst, 0))
return FALSE; return FALSE;
/* orthogonal movement is unrestricted when destination is ok */ /* orthogonal movement is unrestricted when destination is ok */
@@ -4095,9 +4095,9 @@ crawl_destination(coordxy x, coordxy y)
if (IS_DOOR(levl[x][y].typ) && (!doorless_door(x, y) || block_door(x, y))) if (IS_DOOR(levl[x][y].typ) && (!doorless_door(x, y) || block_door(x, y)))
return FALSE; return FALSE;
/* finally, are we trying to squeeze through a too-narrow gap? */ /* finally, are we trying to squeeze through a too-narrow gap? */
return !(bad_rock(u.umonst->data, u.ux, y) return !(bad_rock(gy.youmonst.data, u.ux, y)
&& bad_rock(u.umonst->data, x, u.uy) && bad_rock(gy.youmonst.data, x, u.uy)
&& cant_squeeze_thru(u.umonst)); && cant_squeeze_thru(&gy.youmonst));
} }
/* something like lookaround, but we are not running */ /* something like lookaround, but we are not running */
@@ -4367,14 +4367,14 @@ weight_cap(void)
+ WT_WEIGHTCAP_SPARE; + WT_WEIGHTCAP_SPARE;
if (Upolyd) { if (Upolyd) {
/* consistent with can_carry() in mon.c */ /* consistent with can_carry() in mon.c */
if (u.umonst->data->mlet == S_NYMPH) if (gy.youmonst.data->mlet == S_NYMPH)
carrcap = MAX_CARR_CAP; carrcap = MAX_CARR_CAP;
else if (!u.umonst->data->cwt) else if (!gy.youmonst.data->cwt)
carrcap = (carrcap * (long) u.umonst->data->msize) / MZ_HUMAN; carrcap = (carrcap * (long) gy.youmonst.data->msize) / MZ_HUMAN;
else if (!strongmonst(u.umonst->data) else if (!strongmonst(gy.youmonst.data)
|| (strongmonst(u.umonst->data) || (strongmonst(gy.youmonst.data)
&& (u.umonst->data->cwt > WT_HUMAN))) && (gy.youmonst.data->cwt > WT_HUMAN)))
carrcap = (carrcap * (long) u.umonst->data->cwt / WT_HUMAN); carrcap = (carrcap * (long) gy.youmonst.data->cwt / WT_HUMAN);
} }
if (Levitation || Is_airlevel(&u.uz) /* pugh@cornell */ if (Levitation || Is_airlevel(&u.uz) /* pugh@cornell */
@@ -4411,7 +4411,7 @@ inv_weight(void)
while (otmp) { while (otmp) {
if (otmp->oclass == COIN_CLASS) if (otmp->oclass == COIN_CLASS)
wt += (int) (((long) otmp->quan + 50L) / 100L); wt += (int) (((long) otmp->quan + 50L) / 100L);
else if (otmp->otyp != BOULDER || !throws_rocks(u.umonst->data)) else if (otmp->otyp != BOULDER || !throws_rocks(gy.youmonst.data))
wt += otmp->owt; wt += otmp->owt;
otmp = otmp->nobj; otmp = otmp->nobj;
} }
+2 -2
View File
@@ -605,7 +605,7 @@ itemactions(struct obj *otmp)
/* w: wield, hold in hands, works on everything but with different /* w: wield, hold in hands, works on everything but with different
advice text; not mentioned for things that are already wielded */ advice text; not mentioned for things that are already wielded */
if (otmp == uwep || cantwield(u.umonst->data)) { if (otmp == uwep || cantwield(gy.youmonst.data)) {
; /* either already wielded or can't wield anything; skip 'w' */ ; /* either already wielded or can't wield anything; skip 'w' */
} else if (otmp->oclass == WEAPON_CLASS || is_weptool(otmp) } else if (otmp->oclass == WEAPON_CLASS || is_weptool(otmp)
|| is_wet_towel(otmp) || otmp->otyp == HEAVY_IRON_BALL) { || is_wet_towel(otmp) || otmp->otyp == HEAVY_IRON_BALL) {
@@ -674,7 +674,7 @@ itemactions(struct obj *otmp)
/* if already two-weaponing, no special checks needed to toggle off */ /* if already two-weaponing, no special checks needed to toggle off */
&& (u.twoweap && (u.twoweap
/* but if not, try to filter most "you can't do that" here */ /* but if not, try to filter most "you can't do that" here */
|| (could_twoweap(u.umonst->data) && !uarms || (could_twoweap(gy.youmonst.data) && !uarms
&& uwep && MAYBETWOWEAPON(uwep) && uwep && MAYBETWOWEAPON(uwep)
&& uswapwep && MAYBETWOWEAPON(uswapwep)))) { && uswapwep && MAYBETWOWEAPON(uswapwep)))) {
Sprintf(buf, "Toggle two-weapon combat %s", u.twoweap ? "off" : "on"); Sprintf(buf, "Toggle two-weapon combat %s", u.twoweap ? "off" : "on");
+22 -22
View File
@@ -489,8 +489,8 @@ background_enlightenment(int unused_mode UNUSED, int final)
the player to know he's not a samurai at the moment... */ the player to know he's not a samurai at the moment... */
if (Upolyd) { if (Upolyd) {
char anbuf[20]; /* includes trailing space; [4] suffices */ char anbuf[20]; /* includes trailing space; [4] suffices */
struct permonst *uasmon = u.umonst->data; struct permonst *uasmon = gy.youmonst.data;
boolean altphrasing = vampshifted(u.umonst); boolean altphrasing = vampshifted(&gy.youmonst);
tmpbuf[0] = '\0'; tmpbuf[0] = '\0';
/* here we always use current gender, not saved role gender */ /* here we always use current gender, not saved role gender */
@@ -498,7 +498,7 @@ background_enlightenment(int unused_mode UNUSED, int final)
Sprintf(tmpbuf, "%s ", genders[flags.female ? 1 : 0].adj); Sprintf(tmpbuf, "%s ", genders[flags.female ? 1 : 0].adj);
if (altphrasing) if (altphrasing)
Sprintf(eos(tmpbuf), "%s in ", Sprintf(eos(tmpbuf), "%s in ",
pmname(&mons[u.umonst->cham], pmname(&mons[gy.youmonst.cham],
flags.female ? FEMALE : MALE)); flags.female ? FEMALE : MALE));
Snprintf(buf, sizeof(buf), "%s%s%s%s form", Snprintf(buf, sizeof(buf), "%s%s%s%s form",
!final ? "currently " : "", !final ? "currently " : "",
@@ -1068,7 +1068,7 @@ status_enlightenment(int mode, int final)
if (wizard && (HBlinded == BlindedTimeout && !Blindfolded)) if (wizard && (HBlinded == BlindedTimeout && !Blindfolded))
Sprintf(eos(buf), " (%ld)", BlindedTimeout); Sprintf(eos(buf), " (%ld)", BlindedTimeout);
/* !haseyes: avoid "you are innately blind innately" */ /* !haseyes: avoid "you are innately blind innately" */
you_are(buf, !haseyes(u.umonst->data) ? "" : from_what(BLINDED)); you_are(buf, !haseyes(gy.youmonst.data) ? "" : from_what(BLINDED));
} }
if (Deaf) if (Deaf)
you_are("deaf", from_what(DEAF)); you_are("deaf", from_what(DEAF));
@@ -1122,7 +1122,7 @@ status_enlightenment(int mode, int final)
Sprintf(eos(buf), " (%u)", u.uswldtim); Sprintf(eos(buf), " (%u)", u.uswldtim);
you_are(buf, ""); you_are(buf, "");
} else if (u.ustuck) { } else if (u.ustuck) {
boolean ustick = (Upolyd && sticks(u.umonst->data)); boolean ustick = (Upolyd && sticks(gy.youmonst.data));
int dx = u.ustuck->mx - u.ux, dy = u.ustuck->my - u.uy; int dx = u.ustuck->mx - u.ux, dy = u.ustuck->my - u.uy;
Snprintf(buf, sizeof buf, "%s %s (%s)", Snprintf(buf, sizeof buf, "%s %s (%s)",
@@ -1736,7 +1736,7 @@ attributes_enlightenment(
} }
/* including this might bring attention to the fact that ceiling /* including this might bring attention to the fact that ceiling
clinging has inconsistencies... */ clinging has inconsistencies... */
if (is_clinger(u.umonst->data)) { if (is_clinger(gy.youmonst.data)) {
boolean has_lid = has_ceiling(&u.uz); boolean has_lid = has_ceiling(&u.uz);
if (has_lid && !u.uinwater) { if (has_lid && !u.uinwater) {
@@ -1797,7 +1797,7 @@ attributes_enlightenment(
if (prot) if (prot)
you_have(enlght_combatinc("defense", prot, final, buf), ""); you_have(enlght_combatinc("defense", prot, final, buf), "");
} }
if ((armpro = magic_negation(u.umonst)) > 0) { if ((armpro = magic_negation(&gy.youmonst)) > 0) {
/* magic cancellation factor, conferred by worn armor */ /* magic cancellation factor, conferred by worn armor */
static const char *const mc_types[] = { static const char *const mc_types[] = {
"" /*ordinary*/, "warded", "guarded", "protected", "" /*ordinary*/, "warded", "guarded", "protected",
@@ -1863,20 +1863,20 @@ attributes_enlightenment(
&& !(final == ENL_GAMEOVERDEAD && !(final == ENL_GAMEOVERDEAD
&& u.umonnum == PM_GREEN_SLIME && !Unchanging)) { && u.umonnum == PM_GREEN_SLIME && !Unchanging)) {
/* foreign shape (except were-form which is handled below) */ /* foreign shape (except were-form which is handled below) */
if (!vampshifted(u.umonst)) if (!vampshifted(&gy.youmonst))
Sprintf(buf, "polymorphed into %s", Sprintf(buf, "polymorphed into %s",
an(pmname(u.umonst->data, an(pmname(gy.youmonst.data,
flags.female ? FEMALE : MALE))); flags.female ? FEMALE : MALE)));
else else
Sprintf(buf, "polymorphed into %s in %s form", Sprintf(buf, "polymorphed into %s in %s form",
an(pmname(&mons[u.umonst->cham], an(pmname(&mons[gy.youmonst.cham],
flags.female ? FEMALE : MALE)), flags.female ? FEMALE : MALE)),
pmname(u.umonst->data, flags.female ? FEMALE : MALE)); pmname(gy.youmonst.data, flags.female ? FEMALE : MALE));
if (wizard) if (wizard)
Sprintf(eos(buf), " (%d)", u.mtimedone); Sprintf(eos(buf), " (%d)", u.mtimedone);
you_are(buf, ""); you_are(buf, "");
} }
if (lays_eggs(u.umonst->data) && flags.female) /* Upolyd */ if (lays_eggs(gy.youmonst.data) && flags.female) /* Upolyd */
you_can("lay eggs", ""); you_can("lay eggs", "");
if (ismnum(u.ulycn)) { if (ismnum(u.ulycn)) {
/* "you are a werecreature [in beast form]" */ /* "you are a werecreature [in beast form]" */
@@ -2046,7 +2046,7 @@ youhiding(boolean via_enlghtmt, /* enlightenment line vs topl message */
for the hypothetical furniture and monster cases */ for the hypothetical furniture and monster cases */
bp = eos(strcpy(buf, "mimicking")); bp = eos(strcpy(buf, "mimicking"));
if (U_AP_TYPE == M_AP_OBJECT) { if (U_AP_TYPE == M_AP_OBJECT) {
Sprintf(bp, " %s", an(simple_typename(u.umonst->mappearance))); Sprintf(bp, " %s", an(simple_typename(gy.youmonst.mappearance)));
} else if (U_AP_TYPE == M_AP_FURNITURE) { } else if (U_AP_TYPE == M_AP_FURNITURE) {
Strcpy(bp, " something"); Strcpy(bp, " something");
} else if (U_AP_TYPE == M_AP_MONSTER) { } else if (U_AP_TYPE == M_AP_MONSTER) {
@@ -2056,15 +2056,15 @@ youhiding(boolean via_enlghtmt, /* enlightenment line vs topl message */
} }
} else if (u.uundetected) { } else if (u.uundetected) {
bp = eos(buf); /* points past "hiding" */ bp = eos(buf); /* points past "hiding" */
if (u.umonst->data->mlet == S_EEL) { if (gy.youmonst.data->mlet == S_EEL) {
if (is_pool(u.ux, u.uy)) if (is_pool(u.ux, u.uy))
Sprintf(bp, " in the %s", waterbody_name(u.ux, u.uy)); Sprintf(bp, " in the %s", waterbody_name(u.ux, u.uy));
} else if (hides_under(u.umonst->data)) { } else if (hides_under(gy.youmonst.data)) {
struct obj *o = svl.level.objects[u.ux][u.uy]; struct obj *o = svl.level.objects[u.ux][u.uy];
if (o) if (o)
Sprintf(bp, " underneath %s", ansimpleoname(o)); Sprintf(bp, " underneath %s", ansimpleoname(o));
} else if (is_clinger(u.umonst->data) || Flying) { } else if (is_clinger(gy.youmonst.data) || Flying) {
/* Flying: 'lurker above' hides on ceiling but doesn't cling */ /* Flying: 'lurker above' hides on ceiling but doesn't cling */
Sprintf(bp, " on the %s", ceiling(u.ux, u.uy)); Sprintf(bp, " on the %s", ceiling(u.ux, u.uy));
} else { } else {
@@ -3368,7 +3368,7 @@ mstatusline(struct monst *mtmp)
if (mtmp == u.ustuck) { if (mtmp == u.ustuck) {
struct permonst *pm = u.ustuck->data; struct permonst *pm = u.ustuck->data;
/* being swallowed/engulfed takes priority over sticks(u.umonst); /* being swallowed/engulfed takes priority over sticks(youmonst);
this used to have that backwards and checked sticks() first */ this used to have that backwards and checked sticks() first */
Strcat(info, u.uswallow ? (digests(pm) Strcat(info, u.uswallow ? (digests(pm)
? ", digesting you" ? ", digesting you"
@@ -3380,9 +3380,9 @@ mstatusline(struct monst *mtmp)
: (is_animal(pm) && !enfolds(pm)) : (is_animal(pm) && !enfolds(pm))
? ", swallowing you" ? ", swallowing you"
: ", engulfing you") : ", engulfing you")
/* !u.uswallow; if both u.umonst and ustuck are holders, /* !u.uswallow; if both youmonst and ustuck are holders,
u.umonst wins */ youmonst wins */
: (!sticks(u.umonst->data) ? ", holding you" : (!sticks(gy.youmonst.data) ? ", holding you"
: ", held by you")); : ", held by you"));
} }
if (mtmp == u.usteed) { if (mtmp == u.usteed) {
@@ -3445,7 +3445,7 @@ ustatusline(void)
Strcat(info, ", blind"); Strcat(info, ", blind");
if (u.ucreamed) { if (u.ucreamed) {
if ((long) u.ucreamed < BlindedTimeout || Blindfolded if ((long) u.ucreamed < BlindedTimeout || Blindfolded
|| !haseyes(u.umonst->data)) || !haseyes(gy.youmonst.data))
Strcat(info, ", cover"); Strcat(info, ", cover");
Strcat(info, "ed by sticky goop"); Strcat(info, "ed by sticky goop");
} /* note: "goop" == "glop"; variation is intentional */ } /* note: "goop" == "glop"; variation is intentional */
@@ -3481,7 +3481,7 @@ ustatusline(void)
if (u.uswallow) if (u.uswallow)
Strcat(info, digests(u.ustuck->data) ? ", being digested by " Strcat(info, digests(u.ustuck->data) ? ", being digested by "
: ", engulfed by "); : ", engulfed by ");
else if (!sticks(u.umonst->data)) else if (!sticks(gy.youmonst.data))
Strcat(info, ", held by "); Strcat(info, ", held by ");
else else
Strcat(info, ", holding "); Strcat(info, ", holding ");
+8 -8
View File
@@ -1224,7 +1224,7 @@ hold_another_object(
/* in case touching this object turns out to be fatal */ /* in case touching this object turns out to be fatal */
place_object(obj, u.ux, u.uy); place_object(obj, u.ux, u.uy);
if (!touch_artifact(obj, u.umonst)) { if (!touch_artifact(obj, &gy.youmonst)) {
obj_extract_self(obj); /* remove it from the floor */ obj_extract_self(obj); /* remove it from the floor */
dropy(obj); /* now put it back again :-) */ dropy(obj); /* now put it back again :-) */
return obj; return obj;
@@ -1496,7 +1496,7 @@ carrying(int type)
{ {
struct obj *otmp; struct obj *otmp;
/* this could be replaced by 'return m_carrying(u.umonst, type);' */ /* this could be replaced by 'return m_carrying(&gy.youmonst, type);' */
for (otmp = gi.invent; otmp; otmp = otmp->nobj) for (otmp = gi.invent; otmp; otmp = otmp->nobj)
if (otmp->otyp == type) if (otmp->otyp == type)
break; break;
@@ -4269,7 +4269,7 @@ look_here(
: (otmp->quan > 1L) ? "They're" : (otmp->quan > 1L) ? "They're"
: "It's", : "It's",
corpse_xname(otmp, (const char *) 0, CXN_ARTICLE), corpse_xname(otmp, (const char *) 0, CXN_ARTICLE),
poly_when_stoned(u.umonst->data) ? "" poly_when_stoned(gy.youmonst.data) ? ""
: ", unfortunately"); : ", unfortunately");
feel_cockatrice(otmp, FALSE); feel_cockatrice(otmp, FALSE);
break; break;
@@ -4348,7 +4348,7 @@ feel_cockatrice(struct obj *otmp, boolean force_touch)
/* "the <cockatrice> corpse" */ /* "the <cockatrice> corpse" */
Strcpy(kbuf, corpse_xname(otmp, (const char *) 0, CXN_PFX_THE)); Strcpy(kbuf, corpse_xname(otmp, (const char *) 0, CXN_PFX_THE));
if (poly_when_stoned(u.umonst->data)) if (poly_when_stoned(gy.youmonst.data))
You("touched %s with your bare %s.", kbuf, You("touched %s with your bare %s.", kbuf,
makeplural(body_part(HAND))); makeplural(body_part(HAND)));
else else
@@ -4778,8 +4778,8 @@ useupf(struct obj *obj, long numused)
(void) stolen_value(otmp, otmp->ox, otmp->oy, FALSE, FALSE); (void) stolen_value(otmp, otmp->ox, otmp->oy, FALSE, FALSE);
} }
delobj(otmp); delobj(otmp);
if (at_u && u.uundetected && hides_under(u.umonst->data)) if (at_u && u.uundetected && hides_under(gy.youmonst.data))
(void) hideunder(u.umonst); (void) hideunder(&gy.youmonst);
} }
/* /*
@@ -5360,7 +5360,7 @@ display_minventory(
/* Fool the 'weapon in hand' routine into /* Fool the 'weapon in hand' routine into
* displaying 'weapon in claw', etc. properly. * displaying 'weapon in claw', etc. properly.
*/ */
u.umonst->data = mon->data; gy.youmonst.data = mon->data;
/* in case inside a shop, don't append "for sale" prices */ /* in case inside a shop, don't append "for sale" prices */
iflags.suppress_price++; iflags.suppress_price++;
@@ -5371,7 +5371,7 @@ display_minventory(
iflags.suppress_price--; iflags.suppress_price--;
/* was 'set_uasmon();' but that potentially has side-effects */ /* was 'set_uasmon();' but that potentially has side-effects */
u.umonst->data = &mons[u.umonnum]; /* basic part of set_uasmon() */ gy.youmonst.data = &mons[u.umonnum]; /* basic part of set_uasmon() */
} else { } else {
invdisp_nothing(title ? title : tmp, "(none)"); invdisp_nothing(title ? title : tmp, "(none)");
n = 0; n = 0;
+5 -5
View File
@@ -13,8 +13,8 @@
* Light sources are "things" that have a physical position and range. * Light sources are "things" that have a physical position and range.
* They have a type, which gives us information about them. Currently * They have a type, which gives us information about them. Currently
* they are only attached to objects and monsters. Note well: the * they are only attached to objects and monsters. Note well: the
* polymorphed-player handling assumes that u.umonst->m_id will * polymorphed-player handling assumes that gy.youmonst.m_id will
* always remain 1 and u.umonst->mx will always remain 0. * always remain 1 and gy.youmonst.mx will always remain 0.
* *
* Light sources, like timers, either follow game play (RANGE_GLOBAL) or * Light sources, like timers, either follow game play (RANGE_GLOBAL) or
* stay on a level (RANGE_LEVEL). Light sources are unique by their * stay on a level (RANGE_LEVEL). Light sources are unique by their
@@ -378,7 +378,7 @@ find_mid(unsigned nid, unsigned fmflags)
struct monst *mtmp; struct monst *mtmp;
if ((fmflags & FM_YOU) && nid == 1) if ((fmflags & FM_YOU) && nid == 1)
return u.umonst; return &gy.youmonst;
if (fmflags & FM_FMON) if (fmflags & FM_FMON)
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) for (mtmp = fmon; mtmp; mtmp = mtmp->nmon)
if (!DEADMONSTER(mtmp) && mtmp->m_id == nid) if (!DEADMONSTER(mtmp) && mtmp->m_id == nid)
@@ -399,7 +399,7 @@ whereis_mon(struct monst *mon, unsigned fmflags)
{ {
struct monst *mtmp; struct monst *mtmp;
if ((fmflags & FM_YOU) && mon == u.umonst) if ((fmflags & FM_YOU) && mon == &gy.youmonst)
return FM_YOU; return FM_YOU;
if (fmflags & FM_FMON) if (fmflags & FM_FMON)
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) for (mtmp = fmon; mtmp; mtmp = mtmp->nmon)
@@ -957,7 +957,7 @@ wiz_light_sources(void)
: ls->type == LS_MONSTER : ls->type == LS_MONSTER
? (mon_is_local(ls->id.a_monst) ? (mon_is_local(ls->id.a_monst)
? "mon" ? "mon"
: (ls->id.a_monst == u.umonst) : (ls->id.a_monst == &gy.youmonst)
? "you" ? "you"
/* migrating monster */ /* migrating monster */
: "<m>") : "<m>")
+14 -14
View File
@@ -89,7 +89,7 @@ picklock(void)
} }
} }
if (gx.xlock.usedtime++ >= 50 || nohands(u.umonst->data)) { if (gx.xlock.usedtime++ >= 50 || nohands(gy.youmonst.data)) {
You("give up your attempt at %s.", lock_action()); You("give up your attempt at %s.", lock_action());
exercise(A_DEX, TRUE); /* even if you don't succeed */ exercise(A_DEX, TRUE); /* even if you don't succeed */
return ((gx.xlock.usedtime = 0)); return ((gx.xlock.usedtime = 0));
@@ -218,7 +218,7 @@ forcelock(void)
if ((gx.xlock.box->ox != u.ux) || (gx.xlock.box->oy != u.uy)) if ((gx.xlock.box->ox != u.ux) || (gx.xlock.box->oy != u.uy))
return ((gx.xlock.usedtime = 0)); /* you or it moved */ return ((gx.xlock.usedtime = 0)); /* you or it moved */
if (gx.xlock.usedtime++ >= 50 || !uwep || nohands(u.umonst->data)) { if (gx.xlock.usedtime++ >= 50 || !uwep || nohands(gy.youmonst.data)) {
You("give up your attempt to force the lock."); You("give up your attempt to force the lock.");
if (gx.xlock.usedtime >= 50) /* you made the effort */ if (gx.xlock.usedtime >= 50) /* you made the effort */
exercise((gx.xlock.picktyp) ? A_DEX : A_STR, TRUE); exercise((gx.xlock.picktyp) ? A_DEX : A_STR, TRUE);
@@ -315,7 +315,7 @@ autokey(boolean opening) /* True: key, pick, or card; False: key or pick */
} else { } else {
switch (o->otyp) { switch (o->otyp) {
case SKELETON_KEY: case SKELETON_KEY:
if (!key || is_magic_key(u.umonst, o)) if (!key || is_magic_key(&gy.youmonst, o))
key = o; key = o;
break; break;
case LOCK_PICK: case LOCK_PICK:
@@ -380,7 +380,7 @@ pick_lock(
if (gx.xlock.usedtime && picktyp == gx.xlock.picktyp) { if (gx.xlock.usedtime && picktyp == gx.xlock.picktyp) {
static char no_longer[] = "Unfortunately, you can no longer %s %s."; static char no_longer[] = "Unfortunately, you can no longer %s %s.";
if (nohands(u.umonst->data)) { if (nohands(gy.youmonst.data)) {
const char *what = (picktyp == LOCK_PICK) ? "pick" : "key"; const char *what = (picktyp == LOCK_PICK) ? "pick" : "key";
if (picktyp == CREDIT_CARD) if (picktyp == CREDIT_CARD)
@@ -396,13 +396,13 @@ pick_lock(
const char *action = lock_action(); const char *action = lock_action();
You("resume your attempt at %s.", action); You("resume your attempt at %s.", action);
gx.xlock.magic_key = is_magic_key(u.umonst, pick); gx.xlock.magic_key = is_magic_key(&gy.youmonst, pick);
set_occupation(picklock, action, 0); set_occupation(picklock, action, 0);
return PICKLOCK_DID_SOMETHING; return PICKLOCK_DID_SOMETHING;
} }
} }
if (nohands(u.umonst->data)) { if (nohands(gy.youmonst.data)) {
You_cant("hold %s -- you have no hands!", doname(pick)); You_cant("hold %s -- you have no hands!", doname(pick));
return PICKLOCK_DID_NOTHING; return PICKLOCK_DID_NOTHING;
} else if (u.uswallow) { } else if (u.uswallow) {
@@ -513,7 +513,7 @@ pick_lock(
an(simple_typename(picktyp))); an(simple_typename(picktyp)));
return PICKLOCK_LEARNED_SOMETHING; return PICKLOCK_LEARNED_SOMETHING;
} else if (autounlock } else if (autounlock
&& !touch_artifact(pick, u.umonst)) { && !touch_artifact(pick, &gy.youmonst)) {
/* note: for !autounlock, apply already did touch check */ /* note: for !autounlock, apply already did touch check */
return PICKLOCK_DID_SOMETHING; return PICKLOCK_DID_SOMETHING;
} }
@@ -626,7 +626,7 @@ pick_lock(
return PICKLOCK_DID_NOTHING; return PICKLOCK_DID_NOTHING;
/* note: for !autounlock, 'apply' already did touch check */ /* note: for !autounlock, 'apply' already did touch check */
if (autounlock && !touch_artifact(pick, u.umonst)) if (autounlock && !touch_artifact(pick, &gy.youmonst))
return PICKLOCK_DID_SOMETHING; return PICKLOCK_DID_SOMETHING;
switch (picktyp) { switch (picktyp) {
@@ -649,7 +649,7 @@ pick_lock(
svc.context.move = 0; svc.context.move = 0;
gx.xlock.chance = ch; gx.xlock.chance = ch;
gx.xlock.picktyp = picktyp; gx.xlock.picktyp = picktyp;
gx.xlock.magic_key = is_magic_key(u.umonst, pick); gx.xlock.magic_key = is_magic_key(&gy.youmonst, pick);
gx.xlock.usedtime = 0; gx.xlock.usedtime = 0;
set_occupation(picklock, lock_action(), 0); set_occupation(picklock, lock_action(), 0);
return PICKLOCK_DID_SOMETHING; return PICKLOCK_DID_SOMETHING;
@@ -785,7 +785,7 @@ doopen_indir(coordxy x, coordxy y)
const char *dirprompt; const char *dirprompt;
int res = ECMD_OK; int res = ECMD_OK;
if (nohands(u.umonst->data)) { if (nohands(gy.youmonst.data)) {
You_cant("open anything -- you have no hands!"); You_cant("open anything -- you have no hands!");
return ECMD_OK; return ECMD_OK;
} }
@@ -895,7 +895,7 @@ doopen_indir(coordxy x, coordxy y)
return res; return res;
} }
if (verysmall(u.umonst->data)) { if (verysmall(gy.youmonst.data)) {
pline("You're too small to pull the door open."); pline("You're too small to pull the door open.");
return res; return res;
} }
@@ -961,7 +961,7 @@ doclose(void)
boolean portcullis; boolean portcullis;
int res = ECMD_OK; int res = ECMD_OK;
if (nohands(u.umonst->data)) { if (nohands(gy.youmonst.data)) {
You_cant("close anything -- you have no hands!"); You_cant("close anything -- you have no hands!");
return ECMD_OK; return ECMD_OK;
} }
@@ -1031,7 +1031,7 @@ doclose(void)
} }
if (door->doormask == D_ISOPEN) { if (door->doormask == D_ISOPEN) {
if (verysmall(u.umonst->data) && !u.usteed) { if (verysmall(gy.youmonst.data) && !u.usteed) {
pline("You're too small to push the door closed."); pline("You're too small to push the door closed.");
return res; return res;
} }
@@ -1281,7 +1281,7 @@ chest_shatter_msg(struct obj *otmp)
if (otmp->oclass == POTION_CLASS) { if (otmp->oclass == POTION_CLASS) {
You("%s %s shatter!", Blind ? "hear" : "see", an(bottlename())); You("%s %s shatter!", Blind ? "hear" : "see", an(bottlename()));
if (!breathless(u.umonst->data) || haseyes(u.umonst->data)) if (!breathless(gy.youmonst.data) || haseyes(gy.youmonst.data))
potionbreathe(otmp); potionbreathe(otmp);
return; return;
} }
+6 -6
View File
@@ -69,7 +69,7 @@ cursetxt(struct monst *mtmp, boolean undirected)
point_msg = "all around, then curses"; point_msg = "all around, then curses";
else if ((Invis && !perceives(mtmp->data) else if ((Invis && !perceives(mtmp->data)
&& (mtmp->mux != u.ux || mtmp->muy != u.uy)) && (mtmp->mux != u.ux || mtmp->muy != u.uy))
|| is_obj_mappear(u.umonst, STRANGE_OBJECT) || is_obj_mappear(&gy.youmonst, STRANGE_OBJECT)
|| u.uundetected) || u.uundetected)
point_msg = "and curses in your general direction"; point_msg = "and curses in your general direction";
else if (Displaced && (mtmp->mux != u.ux || mtmp->muy != u.uy)) else if (Displaced && (mtmp->mux != u.ux || mtmp->muy != u.uy))
@@ -389,7 +389,7 @@ staticfn void
mcast_death_touch(struct monst *mtmp) mcast_death_touch(struct monst *mtmp)
{ {
pline("Oh no, %s's using the touch of death!", mhe(mtmp)); pline("Oh no, %s's using the touch of death!", mhe(mtmp));
if (nonliving(u.umonst->data) || is_demon(u.umonst->data)) { if (nonliving(gy.youmonst.data) || is_demon(gy.youmonst.data)) {
You("seem no deader than before."); You("seem no deader than before.");
} else if (!Antimagic && rn2(mtmp->m_lev) > 12) { } else if (!Antimagic && rn2(mtmp->m_lev) > 12) {
if (Hallucination) { if (Hallucination) {
@@ -553,9 +553,9 @@ mcast_fire_pillar(struct monst *mtmp, int dmg)
if (Half_spell_damage) if (Half_spell_damage)
dmg = (dmg + 1) / 2; dmg = (dmg + 1) / 2;
burn_away_slime(); burn_away_slime();
(void) burnarmor(u.umonst); (void) burnarmor(&gy.youmonst);
/* item destruction dmg */ /* item destruction dmg */
(void) destroy_items(u.umonst, AD_FIRE, orig_dmg); (void) destroy_items(&gy.youmonst, AD_FIRE, orig_dmg);
ignite_items(gi.invent); ignite_items(gi.invent);
/* burn up flammable items on the floor, melt ice terrain */ /* burn up flammable items on the floor, melt ice terrain */
mon_spell_hits_spot(mtmp, AD_FIRE, u.ux, u.uy); mon_spell_hits_spot(mtmp, AD_FIRE, u.ux, u.uy);
@@ -586,7 +586,7 @@ mcast_lightning(struct monst *mtmp, int dmg)
} }
if (Half_spell_damage) if (Half_spell_damage)
dmg = (dmg + 1) / 2; dmg = (dmg + 1) / 2;
(void) destroy_items(u.umonst, AD_ELEC, orig_dmg); (void) destroy_items(&gy.youmonst, AD_ELEC, orig_dmg);
/* lightning might destroy iron bars if hero is on such a spot; /* lightning might destroy iron bars if hero is on such a spot;
reflection protects terrain here [execution won't get here due reflection protects terrain here [execution won't get here due
to 'if (reflects) break' above] but hero resistance doesn't; to 'if (reflects) break' above] but hero resistance doesn't;
@@ -730,7 +730,7 @@ mcast_blind_you(void)
{ {
/* note: resists_blnd() doesn't apply here */ /* note: resists_blnd() doesn't apply here */
if (!Blinded) { if (!Blinded) {
int num_eyes = eyecount(u.umonst->data); int num_eyes = eyecount(gy.youmonst.data);
pline("Scales cover your %s!", (num_eyes == 1) pline("Scales cover your %s!", (num_eyes == 1)
? body_part(EYE) ? body_part(EYE)
+16 -16
View File
@@ -607,7 +607,7 @@ failed_grab(
&& (mattk->aatyp == AT_HUGS || mattk->adtyp == AD_WRAP && (mattk->aatyp == AT_HUGS || mattk->adtyp == AD_WRAP
|| mattk->adtyp == AD_STCK || mattk->adtyp == AD_DGST)) { || mattk->adtyp == AD_STCK || mattk->adtyp == AD_DGST)) {
if ((gv.vis && canspotmon(mdef)) /* mon-vs-mon */ if ((gv.vis && canspotmon(mdef)) /* mon-vs-mon */
|| magr == u.umonst || mdef == u.umonst) { || magr == &gy.youmonst || mdef == &gy.youmonst) {
char magrnam[BUFSZ], mdefnam[BUFSZ]; char magrnam[BUFSZ], mdefnam[BUFSZ];
boolean tailmiss = gn.notonhead; boolean tailmiss = gn.notonhead;
const char *verb = (mattk->adtyp == AD_DGST) ? "gulp" const char *verb = (mattk->adtyp == AD_DGST) ? "gulp"
@@ -618,14 +618,14 @@ failed_grab(
mon_nam(x_monnam) calls s_suffix() for named ghosts and mon_nam(x_monnam) calls s_suffix() for named ghosts and
s_suffix() uses a single static buffer; make copies of both s_suffix() uses a single static buffer; make copies of both
names to overcome that [note: comment predates 'tailmiss'] */ names to overcome that [note: comment predates 'tailmiss'] */
Strcpy(magrnam, (magr == u.umonst) ? "Your" Strcpy(magrnam, (magr == &gy.youmonst) ? "Your"
: s_suffix(Monnam(magr))); : s_suffix(Monnam(magr)));
if (!tailmiss) { if (!tailmiss) {
Strcpy(mdefnam, (mdef == u.umonst) ? "you" Strcpy(mdefnam, (mdef == &gy.youmonst) ? "you"
: mon_nam(mdef)); : mon_nam(mdef));
} else { } else {
/* hero poly'd into long worm can't grow tail /* hero poly'd into long worm can't grow tail
so no 'u.umonst' handling is needed here */ so no 'youmonst' handling is needed here */
Sprintf(mdefnam, "%s tail", s_suffix(some_mon_nam(mdef))); Sprintf(mdefnam, "%s tail", s_suffix(some_mon_nam(mdef)));
} }
/* unsolid grab misses are actually somewhat iffy--how come /* unsolid grab misses are actually somewhat iffy--how come
@@ -808,8 +808,8 @@ engulf_target(struct monst *magr, struct monst *mdef)
{ {
struct rm *lev; struct rm *lev;
int ax, ay, dx, dy; int ax, ay, dx, dy;
boolean uatk = (magr == u.umonst), boolean uatk = (magr == &gy.youmonst),
udef = (mdef == u.umonst); udef = (mdef == &gy.youmonst);
/* can't swallow something that's too big */ /* can't swallow something that's too big */
if (mdef->data->msize >= MZ_HUGE if (mdef->data->msize >= MZ_HUGE
@@ -825,16 +825,16 @@ engulf_target(struct monst *magr, struct monst *mdef)
might not be able to place attacker and defender both back on map; might not be able to place attacker and defender both back on map;
when defender is the hero, a sanity_check complaint about placing when defender is the hero, a sanity_check complaint about placing
the hero on top of a monster can occur */ the hero on top of a monster can occur */
dx = (mdef == u.umonst) ? u.ux : mdef->mx; dx = (mdef == &gy.youmonst) ? u.ux : mdef->mx;
dy = (mdef == u.umonst) ? u.uy : mdef->my; dy = (mdef == &gy.youmonst) ? u.uy : mdef->my;
lev = &levl[dx][dy]; lev = &levl[dx][dy];
if (!(udef ? Passes_walls : passes_walls(mdef->data)) if (!(udef ? Passes_walls : passes_walls(mdef->data))
&& (IS_OBSTRUCTED(lev->typ) || closed_door(dx, dy) || IS_TREE(lev->typ) && (IS_OBSTRUCTED(lev->typ) || closed_door(dx, dy) || IS_TREE(lev->typ)
/* not passes_bars(); engulfer isn't squeezing through */ /* not passes_bars(); engulfer isn't squeezing through */
|| (lev->typ == IRONBARS && !is_whirly(magr->data)))) || (lev->typ == IRONBARS && !is_whirly(magr->data))))
return FALSE; return FALSE;
ax = (magr == u.umonst) ? u.ux : magr->mx; ax = (magr == &gy.youmonst) ? u.ux : magr->mx;
ay = (magr == u.umonst) ? u.uy : magr->my; ay = (magr == &gy.youmonst) ? u.uy : magr->my;
lev = &levl[ax][ay]; lev = &levl[ax][ay];
if (!(uatk ? Passes_walls : passes_walls(magr->data)) if (!(uatk ? Passes_walls : passes_walls(magr->data))
&& (IS_OBSTRUCTED(lev->typ) || closed_door(ax, ay) || IS_TREE(lev->typ) && (IS_OBSTRUCTED(lev->typ) || closed_door(ax, ay) || IS_TREE(lev->typ)
@@ -1124,7 +1124,7 @@ mon_poly(struct monst *magr, struct monst *mdef, int dmg)
static const char freaky[] = " undergoes a freakish metamorphosis"; static const char freaky[] = " undergoes a freakish metamorphosis";
struct permonst *oldform = mdef->data; struct permonst *oldform = mdef->data;
if (mdef == u.umonst) { if (mdef == &gy.youmonst) {
if (Antimagic) { if (Antimagic) {
shieldeff(u.ux, u.uy); shieldeff(u.ux, u.uy);
} else if (Unchanging) { } else if (Unchanging) {
@@ -1166,7 +1166,7 @@ mon_poly(struct monst *magr, struct monst *mdef, int dmg)
mdef->mhp -= dmg; mdef->mhp -= dmg;
dmg = 0; dmg = 0;
if (DEADMONSTER(mdef)) { if (DEADMONSTER(mdef)) {
if (magr == u.umonst) if (magr == &gy.youmonst)
xkilled(mdef, XKILL_GIVEMSG | XKILL_NOCORPSE); xkilled(mdef, XKILL_GIVEMSG | XKILL_NOCORPSE);
else else
monkilled(mdef, "", AD_RBRE); monkilled(mdef, "", AD_RBRE);
@@ -1182,13 +1182,13 @@ mon_poly(struct monst *magr, struct monst *mdef, int dmg)
x_monnam(mdef, ARTICLE_A, (char *) 0, x_monnam(mdef, ARTICLE_A, (char *) 0,
(SUPPRESS_NAME | SUPPRESS_IT (SUPPRESS_NAME | SUPPRESS_IT
| SUPPRESS_INVISIBLE), FALSE)); | SUPPRESS_INVISIBLE), FALSE));
else if (was_seen || magr == u.umonst) else if (was_seen || magr == &gy.youmonst)
pline("%s%s%s.", Before, freaky, pline("%s%s%s.", Before, freaky,
!was_seen ? "" : " and disappears"); !was_seen ? "" : " and disappears");
} }
dmg = 0; dmg = 0;
if (can_teleport(magr->data)) { if (can_teleport(magr->data)) {
if (magr == u.umonst) if (magr == &gy.youmonst)
tele(); tele();
else if (!tele_restrict(magr)) else if (!tele_restrict(magr))
(void) rloc(magr, RLOC_MSG); (void) rloc(magr, RLOC_MSG);
@@ -1200,7 +1200,7 @@ mon_poly(struct monst *magr, struct monst *mdef, int dmg)
} }
/* when a transformation has happened, can't attack again for poly /* when a transformation has happened, can't attack again for poly
effect during next turn or two; not enforced for poly'd hero */ effect during next turn or two; not enforced for poly'd hero */
if (mdef->data != oldform && magr != u.umonst) if (mdef->data != oldform && magr != &gy.youmonst)
magr->mspec_used += rnd(2); magr->mspec_used += rnd(2);
return dmg; return dmg;
@@ -1250,7 +1250,7 @@ void
slept_monst(struct monst *mon) slept_monst(struct monst *mon)
{ {
if (helpless(mon) && mon == u.ustuck if (helpless(mon) && mon == u.ustuck
&& !sticks(u.umonst->data) && !u.uswallow) { && !sticks(gy.youmonst.data) && !u.uswallow) {
pline_mon(mon, "%s grip relaxes.", s_suffix(Monnam(mon))); pline_mon(mon, "%s grip relaxes.", s_suffix(Monnam(mon)));
unstuck(mon); unstuck(mon);
} }
+64 -64
View File
@@ -34,7 +34,7 @@ hitmsg(struct monst *mtmp, struct attack *mattk)
/* Note: if opposite gender, "seductively"; /* Note: if opposite gender, "seductively";
if same gender, "engagingly" for nymph, normal msg for others. */ if same gender, "engagingly" for nymph, normal msg for others. */
if ((compat = could_seduce(mtmp, u.umonst, mattk)) != 0 if ((compat = could_seduce(mtmp, &gy.youmonst, mattk)) != 0
&& !mtmp->mcan && !mtmp->mspec_used) { && !mtmp->mcan && !mtmp->mspec_used) {
pline_mon(mtmp, "%s %s you %s.", Monst_name, pline_mon(mtmp, "%s %s you %s.", Monst_name,
!Blind ? "smiles at" : !Deaf ? "talks to" : "touches", !Blind ? "smiles at" : !Deaf ? "talks to" : "touches",
@@ -45,7 +45,7 @@ hitmsg(struct monst *mtmp, struct attack *mattk)
verb = "bites"; verb = "bites";
break; break;
case AT_KICK: case AT_KICK:
if (thick_skinned(u.umonst->data)) if (thick_skinned(gy.youmonst.data))
punct = "."; punct = ".";
verb = "kicks"; verb = "kicks";
break; break;
@@ -90,7 +90,7 @@ missmu(struct monst *mtmp, boolean nearmiss, struct attack *mattk)
if (!canspotmon(mtmp)) if (!canspotmon(mtmp))
map_invisible(mtmp->mx, mtmp->my); map_invisible(mtmp->mx, mtmp->my);
if (could_seduce(mtmp, u.umonst, mattk) && !mtmp->mcan) if (could_seduce(mtmp, &gy.youmonst, mattk) && !mtmp->mcan)
pline_mon(mtmp, "%s pretends to be friendly.", Monnam(mtmp)); pline_mon(mtmp, "%s pretends to be friendly.", Monnam(mtmp));
else else
pline_mon(mtmp, "%s %smisses!", Monnam(mtmp), pline_mon(mtmp, "%s %smisses!", Monnam(mtmp),
@@ -147,7 +147,7 @@ mpoisons_subj(
struct attack *mattk) struct attack *mattk)
{ {
if (mattk->aatyp == AT_WEAP) { if (mattk->aatyp == AT_WEAP) {
struct obj *mwep = (mtmp == u.umonst) ? uwep : MON_WEP(mtmp); struct obj *mwep = (mtmp == &gy.youmonst) ? uwep : MON_WEP(mtmp);
/* "Foo's attack was poisoned." is pretty lame, but at least /* "Foo's attack was poisoned." is pretty lame, but at least
it's better than "sting" when not a stinging attack... */ it's better than "sting" when not a stinging attack... */
return (!mwep || !mwep->opoisoned) ? "attack" : "weapon"; return (!mwep || !mwep->opoisoned) ? "attack" : "weapon";
@@ -200,7 +200,7 @@ wildmiss(struct monst *mtmp, struct attack *mattk)
/* maybe it's attacking an image around the corner? */ /* maybe it's attacking an image around the corner? */
compat = ((mattk->adtyp == AD_SEDU || mattk->adtyp == AD_SSEX) compat = ((mattk->adtyp == AD_SEDU || mattk->adtyp == AD_SSEX)
? could_seduce(mtmp, u.umonst, mattk) : 0); ? could_seduce(mtmp, &gy.youmonst, mattk) : 0);
Monst_name = Monnam(mtmp); Monst_name = Monnam(mtmp);
set_msg_xy(mtmp->mx, mtmp->my); set_msg_xy(mtmp->mx, mtmp->my);
@@ -314,8 +314,8 @@ getmattk(
{ {
struct permonst *mptr = magr->data; struct permonst *mptr = magr->data;
struct attack *attk = &mptr->mattk[indx]; struct attack *attk = &mptr->mattk[indx];
struct obj *weap = (magr == u.umonst) ? uwep : MON_WEP(magr); struct obj *weap = (magr == &gy.youmonst) ? uwep : MON_WEP(magr);
boolean udefend = mdef == u.umonst; boolean udefend = mdef == &gy.youmonst;
/* honor SEDUCE=0 */ /* honor SEDUCE=0 */
if (!SYSOPT_SEDUCE) { if (!SYSOPT_SEDUCE) {
@@ -396,7 +396,7 @@ getmattk(
if weapon is sufficiently interesting; a few unique creatures if weapon is sufficiently interesting; a few unique creatures
have two weapon attacks where one does physical damage and other have two weapon attacks where one does physical damage and other
doesn't--avoid forcing physical damage for those */ doesn't--avoid forcing physical damage for those */
} else if (indx == 0 && magr != u.umonst } else if (indx == 0 && magr != &gy.youmonst
&& attk->aatyp == AT_WEAP && attk->adtyp != AD_PHYS && attk->aatyp == AT_WEAP && attk->adtyp != AD_PHYS
&& !(mptr->mattk[1].aatyp == AT_WEAP && !(mptr->mattk[1].aatyp == AT_WEAP
&& mptr->mattk[1].adtyp == AD_PHYS) && mptr->mattk[1].adtyp == AD_PHYS)
@@ -468,7 +468,7 @@ mtrapped_in_pit(struct monst *mtmp)
{ {
struct trap *ttmp = 0; struct trap *ttmp = 0;
if (mtmp == u.umonst) if (mtmp == &gy.youmonst)
ttmp = (u.utrap && u.utraptype == TT_PIT) ? t_at(u.ux, u.uy) : 0; ttmp = (u.utrap && u.utraptype == TT_PIT) ? t_at(u.ux, u.uy) : 0;
else else
ttmp = mtmp->mtrapped ? t_at(mtmp->mx, mtmp->my) : 0; ttmp = mtmp->mtrapped ? t_at(mtmp->mx, mtmp->my) : 0;
@@ -552,7 +552,7 @@ mattacku(struct monst *mtmp)
if (!canspotmon(mtmp)) if (!canspotmon(mtmp))
map_invisible(mtmp->mx, mtmp->my); map_invisible(mtmp->mx, mtmp->my);
u.uundetected = 0; u.uundetected = 0;
if (is_hider(u.umonst->data) && u.umonnum != PM_TRAPPER) { if (is_hider(gy.youmonst.data) && u.umonnum != PM_TRAPPER) {
/* ceiling hider */ /* ceiling hider */
coord cc; /* maybe we need a unexto() function? */ coord cc; /* maybe we need a unexto() function? */
struct obj *obj; struct obj *obj;
@@ -562,7 +562,7 @@ mattacku(struct monst *mtmp)
is eligible for placing hero; we assume that a is eligible for placing hero; we assume that a
removed monster remembers its old spot <mx,my> */ removed monster remembers its old spot <mx,my> */
remove_monster(mtmp->mx, mtmp->my); remove_monster(mtmp->mx, mtmp->my);
if (!enexto(&cc, u.ux, u.uy, u.umonst->data) if (!enexto(&cc, u.ux, u.uy, gy.youmonst.data)
/* a fish won't voluntarily swap positions /* a fish won't voluntarily swap positions
when it's in water and hero is over land */ when it's in water and hero is over land */
|| (mtmp->data->mlet == S_EEL || (mtmp->data->mlet == S_EEL
@@ -587,13 +587,13 @@ mattacku(struct monst *mtmp)
/* tail hasn't grown, so if it now occupies <cc.x,.y> /* tail hasn't grown, so if it now occupies <cc.x,.y>
then one of its original spots must be free */ then one of its original spots must be free */
if (m_at(cc.x, cc.y)) if (m_at(cc.x, cc.y))
(void) enexto(&cc, u.ux, u.uy, u.umonst->data); (void) enexto(&cc, u.ux, u.uy, gy.youmonst.data);
} }
teleds(cc.x, cc.y, TELEDS_ALLOW_DRAG); /* move hero */ teleds(cc.x, cc.y, TELEDS_ALLOW_DRAG); /* move hero */
set_apparxy(mtmp); set_apparxy(mtmp);
newsym(u.ux, u.uy); newsym(u.ux, u.uy);
if (u.umonst->data->mlet != S_PIERCER) if (gy.youmonst.data->mlet != S_PIERCER)
return 0; /* lurkers don't attack */ return 0; /* lurkers don't attack */
obj = which_armor(mtmp, WORN_HELMET); obj = which_armor(mtmp, WORN_HELMET);
@@ -625,7 +625,7 @@ mattacku(struct monst *mtmp)
struct obj *obj = svl.level.objects[u.ux][u.uy]; struct obj *obj = svl.level.objects[u.ux][u.uy];
if (obj || u.umonnum == PM_TRAPPER if (obj || u.umonnum == PM_TRAPPER
|| (u.umonst->data->mlet == S_EEL || (gy.youmonst.data->mlet == S_EEL
&& is_pool(u.ux, u.uy))) { && is_pool(u.ux, u.uy))) {
int save_spe = 0; /* suppress warning */ int save_spe = 0; /* suppress warning */
@@ -636,17 +636,17 @@ mattacku(struct monst *mtmp)
} }
/* note that m_monnam() overrides hallucination, which is /* note that m_monnam() overrides hallucination, which is
what we want when message is from mtmp's perspective */ what we want when message is from mtmp's perspective */
if (u.umonst->data->mlet == S_EEL if (gy.youmonst.data->mlet == S_EEL
|| u.umonnum == PM_TRAPPER) || u.umonnum == PM_TRAPPER)
pline( pline(
"Wait, %s! There's a hidden %s named %s there!", "Wait, %s! There's a hidden %s named %s there!",
m_monnam(mtmp), m_monnam(mtmp),
pmname(u.umonst->data, Ugender), svp.plname); pmname(gy.youmonst.data, Ugender), svp.plname);
else else
pline( pline(
"Wait, %s! There's a %s named %s hiding under %s!", "Wait, %s! There's a %s named %s hiding under %s!",
m_monnam(mtmp), m_monnam(mtmp),
pmname(u.umonst->data, Ugender), pmname(gy.youmonst.data, Ugender),
svp.plname, svp.plname,
doname(svl.level.objects[u.ux][u.uy])); doname(svl.level.objects[u.ux][u.uy]));
if (obj) if (obj)
@@ -660,9 +660,9 @@ mattacku(struct monst *mtmp)
} }
/* hero might be a mimic, concealed via #monster */ /* hero might be a mimic, concealed via #monster */
if (u.umonst->data->mlet == S_MIMIC && U_AP_TYPE && !range2 if (gy.youmonst.data->mlet == S_MIMIC && U_AP_TYPE && !range2
&& foundyou && !u.uswallow) { && foundyou && !u.uswallow) {
boolean sticky = sticks(u.umonst->data); boolean sticky = sticks(gy.youmonst.data);
if (!canspotmon(mtmp)) if (!canspotmon(mtmp))
map_invisible(mtmp->mx, mtmp->my); map_invisible(mtmp->mx, mtmp->my);
@@ -670,11 +670,11 @@ mattacku(struct monst *mtmp)
pline("It gets stuck on you."); pline("It gets stuck on you.");
else /* see note about m_monnam() above */ else /* see note about m_monnam() above */
pline("Wait, %s! That's a %s named %s!", m_monnam(mtmp), pline("Wait, %s! That's a %s named %s!", m_monnam(mtmp),
pmname(u.umonst->data, Ugender), svp.plname); pmname(gy.youmonst.data, Ugender), svp.plname);
if (sticky) if (sticky)
set_ustuck(mtmp); set_ustuck(mtmp);
u.umonst->m_ap_type = M_AP_NOTHING; gy.youmonst.m_ap_type = M_AP_NOTHING;
u.umonst->mappearance = 0; gy.youmonst.mappearance = 0;
newsym(u.ux, u.uy); newsym(u.ux, u.uy);
return 0; return 0;
} }
@@ -686,18 +686,18 @@ mattacku(struct monst *mtmp)
if (!youseeit) if (!youseeit)
pline("%s %s!", Something, pline("%s %s!", Something,
(likes_gold(mtmp->data) (likes_gold(mtmp->data)
&& u.umonst->mappearance == GOLD_PIECE) && gy.youmonst.mappearance == GOLD_PIECE)
? "tries to pick you up" ? "tries to pick you up"
: "disturbs you"); : "disturbs you");
else /* see note about m_monnam() above */ else /* see note about m_monnam() above */
pline("Wait, %s! That %s is really %s named %s!", m_monnam(mtmp), pline("Wait, %s! That %s is really %s named %s!", m_monnam(mtmp),
mimic_obj_name(u.umonst), mimic_obj_name(&gy.youmonst),
an(pmname(&mons[u.umonnum], Ugender)), svp.plname); an(pmname(&mons[u.umonnum], Ugender)), svp.plname);
if (gm.multi < 0) { /* this should always be the case */ if (gm.multi < 0) { /* this should always be the case */
char buf[BUFSZ]; char buf[BUFSZ];
Sprintf(buf, "You appear to be %s again.", Sprintf(buf, "You appear to be %s again.",
Upolyd ? (const char *) an(pmname(u.umonst->data, Upolyd ? (const char *) an(pmname(gy.youmonst.data,
flags.female)) flags.female))
: (const char *) "yourself"); : (const char *) "yourself");
unmul(buf); /* immediately stop mimicking */ unmul(buf); /* immediately stop mimicking */
@@ -783,7 +783,7 @@ mattacku(struct monst *mtmp)
continue; continue;
} }
mon_currwep = (struct obj *) 0; mon_currwep = (struct obj *) 0;
mattk = getmattk(mtmp, u.umonst, i, sum, &alt_attk); mattk = getmattk(mtmp, &gy.youmonst, i, sum, &alt_attk);
if ((u.uswallow && mattk->aatyp != AT_ENGL) if ((u.uswallow && mattk->aatyp != AT_ENGL)
|| (skipnonmagc && mattk->aatyp != AT_MAGC) || (skipnonmagc && mattk->aatyp != AT_MAGC)
|| (gs.skipdrin && mattk->aatyp == AT_TENT || (gs.skipdrin && mattk->aatyp == AT_TENT
@@ -801,14 +801,14 @@ mattacku(struct monst *mtmp)
if (mattk->aatyp == AT_KICK && mtrapped_in_pit(mtmp)) if (mattk->aatyp == AT_KICK && mtrapped_in_pit(mtmp))
continue; continue;
if (!range2 && (!MON_WEP(mtmp) || mtmp->mconf || Conflict if (!range2 && (!MON_WEP(mtmp) || mtmp->mconf || Conflict
|| !touch_petrifies(u.umonst->data))) { || !touch_petrifies(gy.youmonst.data))) {
if (foundyou) { if (foundyou) {
if (tmp > (j = rnd(20 + i))) { if (tmp > (j = rnd(20 + i))) {
if (unsolid(u.umonst->data) if (unsolid(gy.youmonst.data)
&& failed_grab(mtmp, u.umonst, mattk)) && failed_grab(mtmp, &gy.youmonst, mattk))
continue; continue;
if (mattk->aatyp != AT_KICK if (mattk->aatyp != AT_KICK
|| !thick_skinned(u.umonst->data)) || !thick_skinned(gy.youmonst.data))
sum[i] = hitmu(mtmp, mattk); sum[i] = hitmu(mtmp, mattk);
} else } else
missmu(mtmp, (tmp == j), mattk); missmu(mtmp, (tmp == j), mattk);
@@ -824,7 +824,7 @@ mattacku(struct monst *mtmp)
/* Note: if displaced, prev attacks never succeeded */ /* Note: if displaced, prev attacks never succeeded */
if ((!range2 && i >= 2 && sum[i - 1] && sum[i - 2]) if ((!range2 && i >= 2 && sum[i - 1] && sum[i - 2])
|| mtmp == u.ustuck) { || mtmp == u.ustuck) {
if (!failed_grab(mtmp, u.umonst, mattk)) if (!failed_grab(mtmp, &gy.youmonst, mattk))
sum[i] = hitmu(mtmp, mattk); sum[i] = hitmu(mtmp, mattk);
} }
break; break;
@@ -905,7 +905,7 @@ mattacku(struct monst *mtmp)
ART_SNICKERSNEE) ART_SNICKERSNEE)
&& m_next2u(mtmp)); && m_next2u(mtmp));
hittmp = hitval(mon_currwep, u.umonst); hittmp = hitval(mon_currwep, &gy.youmonst);
tmp += hittmp; tmp += hittmp;
mswings(mtmp, mon_currwep, bash); mswings(mtmp, mon_currwep, bash);
} }
@@ -1091,7 +1091,7 @@ magic_negation(struct monst *mon)
struct obj *o; struct obj *o;
long wearmask; long wearmask;
int armpro, mc = 0; int armpro, mc = 0;
boolean is_you = (mon == u.umonst), boolean is_you = (mon == &gy.youmonst),
via_amul = FALSE, via_amul = FALSE,
gotprot = is_you ? (EProtection != 0L) gotprot = is_you ? (EProtection != 0L)
/* high priests have innate protection */ /* high priests have innate protection */
@@ -1144,7 +1144,7 @@ staticfn int
hitmu(struct monst *mtmp, struct attack *mattk) hitmu(struct monst *mtmp, struct attack *mattk)
{ {
struct permonst *mdat = mtmp->data; struct permonst *mdat = mtmp->data;
struct permonst *olduasmon = u.umonst->data; struct permonst *olduasmon = gy.youmonst.data;
int res; int res;
struct mhitm_data mhm; struct mhitm_data mhm;
mhm.hitflags = M_ATTK_MISS; mhm.hitflags = M_ATTK_MISS;
@@ -1188,9 +1188,9 @@ hitmu(struct monst *mtmp, struct attack *mattk)
if ((is_undead(mdat) || is_vampshifter(mtmp)) && midnight()) if ((is_undead(mdat) || is_vampshifter(mtmp)) && midnight())
mhm.damage += d((int) mattk->damn, (int) mattk->damd); /* extra dmg */ mhm.damage += d((int) mattk->damn, (int) mattk->damd); /* extra dmg */
mhitm_adtyping(mtmp, mattk, u.umonst, &mhm); mhitm_adtyping(mtmp, mattk, &gy.youmonst, &mhm);
(void) mhitm_knockback(mtmp, u.umonst, mattk, &mhm.hitflags, (void) mhitm_knockback(mtmp, &gy.youmonst, mattk, &mhm.hitflags,
(MON_WEP(mtmp) != 0)); (MON_WEP(mtmp) != 0));
if (mhm.done) if (mhm.done)
@@ -1240,8 +1240,8 @@ hitmu(struct monst *mtmp, struct attack *mattk)
if (Upolyd) { if (Upolyd) {
hpmax_p = &u.mhmax; hpmax_p = &u.mhmax;
/* [can't use u.umonst->m_lev] */ /* [can't use gy.youmonst.m_lev] */
lowerlimit = min((int) u.umonst->data->mlevel, u.ulevel); lowerlimit = min((int) gy.youmonst.data->mlevel, u.ulevel);
} else { } else {
hpmax_p = &u.uhpmax; hpmax_p = &u.uhpmax;
lowerlimit = minuhpmax(1); lowerlimit = minuhpmax(1);
@@ -1276,7 +1276,7 @@ gulp_blnd_check(void)
if (!Blinded && u.uswallow if (!Blinded && u.uswallow
&& (mattk = attacktype_fordmg(u.ustuck->data, AT_ENGL, AD_BLND)) && (mattk = attacktype_fordmg(u.ustuck->data, AT_ENGL, AD_BLND))
&& can_blnd(u.ustuck, u.umonst, mattk->aatyp, (struct obj *) 0)) { && can_blnd(u.ustuck, &gy.youmonst, mattk->aatyp, (struct obj *) 0)) {
++u.uswldtim; /* compensate for gulpmu change */ ++u.uswldtim; /* compensate for gulpmu change */
(void) gulpmu(u.ustuck, mattk); (void) gulpmu(u.ustuck, mattk);
return TRUE; return TRUE;
@@ -1298,11 +1298,11 @@ gulpmu(struct monst *mtmp, struct attack *mattk)
if (!u.uswallow) { /* swallows you */ if (!u.uswallow) { /* swallows you */
int omx = mtmp->mx, omy = mtmp->my; int omx = mtmp->mx, omy = mtmp->my;
if (!engulf_target(mtmp, u.umonst)) if (!engulf_target(mtmp, &gy.youmonst))
return M_ATTK_MISS; return M_ATTK_MISS;
if ((t && is_pit(t->ttyp)) && sobj_at(BOULDER, u.ux, u.uy)) if ((t && is_pit(t->ttyp)) && sobj_at(BOULDER, u.ux, u.uy))
return M_ATTK_MISS; return M_ATTK_MISS;
if (failed_grab(mtmp, u.umonst, mattk)) if (failed_grab(mtmp, &gy.youmonst, mattk))
return M_ATTK_MISS; return M_ATTK_MISS;
if (Punished) if (Punished)
@@ -1354,7 +1354,7 @@ gulpmu(struct monst *mtmp, struct attack *mattk)
unleash_all(); unleash_all();
} }
if (touch_petrifies(u.umonst->data) && !resists_ston(mtmp)) { if (touch_petrifies(gy.youmonst.data) && !resists_ston(mtmp)) {
/* put the attacker back where it started; /* put the attacker back where it started;
the resulting statue will end up there the resulting statue will end up there
[note: if poly'd hero could ride or non-poly'd hero could [note: if poly'd hero could ride or non-poly'd hero could
@@ -1438,13 +1438,13 @@ gulpmu(struct monst *mtmp, struct attack *mattk)
physical_damage = TRUE; physical_damage = TRUE;
if (mtmp->data == &mons[PM_FOG_CLOUD]) { if (mtmp->data == &mons[PM_FOG_CLOUD]) {
You("are laden with moisture and %s", You("are laden with moisture and %s",
flaming(u.umonst->data) flaming(gy.youmonst.data)
? "are smoldering out!" ? "are smoldering out!"
: Breathless ? "find it mildly uncomfortable." : Breathless ? "find it mildly uncomfortable."
: amphibious(u.umonst->data) : amphibious(gy.youmonst.data)
? "feel comforted." ? "feel comforted."
: "can barely breathe!"); : "can barely breathe!");
if ((Amphibious || Breathless) && !flaming(u.umonst->data)) if ((Amphibious || Breathless) && !flaming(gy.youmonst.data))
tmp = 0; tmp = 0;
} else { } else {
You("are %s!", enfolds(mtmp->data) ? "being squashed" You("are %s!", enfolds(mtmp->data) ? "being squashed"
@@ -1469,7 +1469,7 @@ gulpmu(struct monst *mtmp, struct attack *mattk)
} }
break; break;
case AD_BLND: case AD_BLND:
if (can_blnd(mtmp, u.umonst, mattk->aatyp, (struct obj *) 0)) { if (can_blnd(mtmp, &gy.youmonst, mattk->aatyp, (struct obj *) 0)) {
if (!Blind) { if (!Blind) {
long was_blinded = Blinded; long was_blinded = Blinded;
@@ -1564,13 +1564,13 @@ gulpmu(struct monst *mtmp, struct attack *mattk)
if (!u.uswallow) { if (!u.uswallow) {
; /* life-saving has already expelled swallowed hero */ ; /* life-saving has already expelled swallowed hero */
} else if (touch_petrifies(u.umonst->data) && !resists_ston(mtmp)) { } else if (touch_petrifies(gy.youmonst.data) && !resists_ston(mtmp)) {
pline("%s very hurriedly %s you!", Monnam(mtmp), pline("%s very hurriedly %s you!", Monnam(mtmp),
digests(mtmp->data) ? "regurgitates" digests(mtmp->data) ? "regurgitates"
: enfolds(mtmp->data) ? "releases" : enfolds(mtmp->data) ? "releases"
: "expels"); : "expels");
expels(mtmp, mtmp->data, FALSE); expels(mtmp, mtmp->data, FALSE);
} else if (!u.uswldtim || u.umonst->data->msize >= MZ_HUGE) { } else if (!u.uswldtim || gy.youmonst.data->msize >= MZ_HUGE) {
/* As of 3.6.2: u.uswldtim used to be set to 0 by life-saving but it /* As of 3.6.2: u.uswldtim used to be set to 0 by life-saving but it
expels now so the !u.uswldtim case is no longer possible; expels now so the !u.uswldtim case is no longer possible;
however, polymorphing into a huge form while already however, polymorphing into a huge form while already
@@ -1621,7 +1621,7 @@ explmu(
kill_agr = FALSE; /* lifesaving? */ kill_agr = FALSE; /* lifesaving? */
break; break;
case AD_BLND: case AD_BLND:
not_affected = resists_blnd(u.umonst); not_affected = resists_blnd(&gy.youmonst);
if (ufound && !not_affected) { if (ufound && !not_affected) {
/* sometimes you're affected even if it's invisible */ /* sometimes you're affected even if it's invisible */
if (mon_visible(mtmp) || (rnd(tmp /= 2) > u.ulevel)) { if (mon_visible(mtmp) || (rnd(tmp /= 2) > u.ulevel)) {
@@ -1636,7 +1636,7 @@ explmu(
case AD_HALU: case AD_HALU:
not_affected |= Blind || (u.umonnum == PM_BLACK_LIGHT not_affected |= Blind || (u.umonnum == PM_BLACK_LIGHT
|| u.umonnum == PM_VIOLET_FUNGUS || u.umonnum == PM_VIOLET_FUNGUS
|| dmgtype(u.umonst->data, AD_STUN)); || dmgtype(gy.youmonst.data, AD_STUN));
if (ufound && !not_affected) { if (ufound && !not_affected) {
boolean chg; boolean chg;
if (!Hallucination) if (!Hallucination)
@@ -1748,7 +1748,7 @@ gazemu(struct monst *mtmp, struct attack *mattk)
&& !Stone_resistance && !Unaware) { && !Stone_resistance && !Unaware) {
You("meet %s gaze.", s_suffix(mon_nam(mtmp))); You("meet %s gaze.", s_suffix(mon_nam(mtmp)));
stop_occupation(); stop_occupation();
if (poly_when_stoned(u.umonst->data) && polymon(PM_STONE_GOLEM)) if (poly_when_stoned(gy.youmonst.data) && polymon(PM_STONE_GOLEM))
break; break;
urgent_pline("You turn to stone..."); urgent_pline("You turn to stone...");
svk.killer.format = KILLED_BY; svk.killer.format = KILLED_BY;
@@ -1791,7 +1791,7 @@ gazemu(struct monst *mtmp, struct attack *mattk)
} }
break; break;
case AD_BLND: case AD_BLND:
if (canseemon(mtmp) && !resists_blnd(u.umonst) if (canseemon(mtmp) && !resists_blnd(&gy.youmonst)
&& mdistu(mtmp) <= BOLT_LIM * BOLT_LIM) { && mdistu(mtmp) <= BOLT_LIM * BOLT_LIM) {
if (cancelled) { if (cancelled) {
react = rn1(2, 2); /* "puzzled" || "dazzled" */ react = rn1(2, 2); /* "puzzled" || "dazzled" */
@@ -1842,9 +1842,9 @@ gazemu(struct monst *mtmp, struct attack *mattk)
} }
burn_away_slime(); burn_away_slime();
if (lev > rn2(20)) if (lev > rn2(20))
(void) burnarmor(u.umonst); (void) burnarmor(&gy.youmonst);
if (lev > rn2(20)) { if (lev > rn2(20)) {
(void) destroy_items(u.umonst, AD_FIRE, orig_dmg); (void) destroy_items(&gy.youmonst, AD_FIRE, orig_dmg);
ignite_items(gi.invent); ignite_items(gi.invent);
} }
if (dmg) if (dmg)
@@ -1943,8 +1943,8 @@ could_seduce(
if (is_animal(magr->data)) if (is_animal(magr->data))
return 0; return 0;
if (magr == u.umonst) { if (magr == &gy.youmonst) {
pagr = u.umonst->data; pagr = gy.youmonst.data;
agrinvis = (Invis != 0); agrinvis = (Invis != 0);
genagr = poly_gender(); genagr = poly_gender();
} else { } else {
@@ -1952,7 +1952,7 @@ could_seduce(
agrinvis = magr->minvis; agrinvis = magr->minvis;
genagr = gender(magr); genagr = gender(magr);
} }
if (mdef == u.umonst) { if (mdef == &gy.youmonst) {
defperc = (See_invisible != 0); defperc = (See_invisible != 0);
gendef = poly_gender(); gendef = poly_gender();
} else { } else {
@@ -2202,7 +2202,7 @@ doseduce(struct monst *mon)
disp.botl = TRUE; disp.botl = TRUE;
break; break;
case 3: case 3:
if (!resists_drli(u.umonst)) { if (!resists_drli(&gy.youmonst)) {
You_feel("out of shape."); You_feel("out of shape.");
losexp("overexertion"); losexp("overexertion");
} else { } else {
@@ -2541,7 +2541,7 @@ passiveum(
&& (perceives(mtmp->data) || !Invis)) { && (perceives(mtmp->data) || !Invis)) {
if (Blind) { if (Blind) {
pline("As a blind %s, you cannot defend yourself.", pline("As a blind %s, you cannot defend yourself.",
pmname(u.umonst->data, pmname(gy.youmonst.data,
flags.female ? FEMALE : MALE)); flags.female ? FEMALE : MALE));
} else { } else {
if (mon_reflects(mtmp, if (mon_reflects(mtmp,
@@ -2571,8 +2571,8 @@ passiveum(
u.mh += (tmp + rn2(2)) / 2; u.mh += (tmp + rn2(2)) / 2;
if (u.mhmax < u.mh) if (u.mhmax < u.mh)
u.mhmax = u.mh; u.mhmax = u.mh;
if (u.mhmax > (((int) u.umonst->data->mlevel + 1) * 8)) if (u.mhmax > (((int) gy.youmonst.data->mlevel + 1) * 8))
(void) split_mon(u.umonst, mtmp); (void) split_mon(&gy.youmonst, mtmp);
break; break;
case AD_STUN: /* Yellow mold */ case AD_STUN: /* Yellow mold */
if (!mtmp->mstun) { if (!mtmp->mstun) {
@@ -2617,20 +2617,20 @@ struct monst *
cloneu(void) cloneu(void)
{ {
struct monst *mon; struct monst *mon;
int mndx = monsndx(u.umonst->data); int mndx = monsndx(gy.youmonst.data);
if (u.mh <= 1) if (u.mh <= 1)
return (struct monst *) 0; return (struct monst *) 0;
if (svm.mvitals[mndx].mvflags & G_EXTINCT) if (svm.mvitals[mndx].mvflags & G_EXTINCT)
return (struct monst *) 0; return (struct monst *) 0;
mon = makemon(u.umonst->data, u.ux, u.uy, mon = makemon(gy.youmonst.data, u.ux, u.uy,
NO_MINVENT | MM_EDOG | MM_NOMSG); NO_MINVENT | MM_EDOG | MM_NOMSG);
if (!mon) if (!mon)
return NULL; return NULL;
mon->mcloned = 1; mon->mcloned = 1;
mon = christen_monst(mon, svp.plname); mon = christen_monst(mon, svp.plname);
initedog(mon, TRUE); initedog(mon, TRUE);
mon->m_lev = u.umonst->data->mlevel; mon->m_lev = gy.youmonst.data->mlevel;
mon->mhpmax = u.mhmax; mon->mhpmax = u.mhmax;
mon->mhp = u.mh / 2; mon->mhp = u.mh / 2;
u.mh -= mon->mhp; u.mh -= mon->mhp;
+1 -1
View File
@@ -296,7 +296,7 @@ demon_talk(struct monst *mtmp)
} }
newsym(mtmp->mx, mtmp->my); newsym(mtmp->mx, mtmp->my);
} }
if (u.umonst->data->mlet == S_DEMON) { /* Won't blackmail their own. */ if (gy.youmonst.data->mlet == S_DEMON) { /* Won't blackmail their own. */
if (!Deaf) if (!Deaf)
pline("%s says, \"Good hunting, %s.\"", Amonnam(mtmp), pline("%s says, \"Good hunting, %s.\"", Amonnam(mtmp),
flags.female ? "Sister" : "Brother"); flags.female ? "Sister" : "Brother");
+11 -11
View File
@@ -330,7 +330,7 @@ int
m_poisongas_ok(struct monst *mtmp) m_poisongas_ok(struct monst *mtmp)
{ {
int px, py; int px, py;
boolean is_you = (mtmp == u.umonst); boolean is_you = (mtmp == &gy.youmonst);
/* Non living, non breathing, immune monsters are not concerned */ /* Non living, non breathing, immune monsters are not concerned */
if (nonliving(mtmp->data) || is_vampshifter(mtmp) if (nonliving(mtmp->data) || is_vampshifter(mtmp)
@@ -2104,8 +2104,8 @@ mon_allowflags(struct monst *mtmp)
if (passes_bars(mtmp->data) if (passes_bars(mtmp->data)
/* restrict engulfer or holder who might try to pass iron bars while /* restrict engulfer or holder who might try to pass iron bars while
carrying hero; accept small subset for poly'd hero passes_bars() */ carrying hero; accept small subset for poly'd hero passes_bars() */
&& (mtmp != u.ustuck || (unsolid(u.umonst->data) && (mtmp != u.ustuck || (unsolid(gy.youmonst.data)
|| verysmall(u.umonst->data)))) || verysmall(gy.youmonst.data))))
allowflags |= ALLOW_BARS; allowflags |= ALLOW_BARS;
#if 0 /* can't do this here; leave it for mfndpos() */ #if 0 /* can't do this here; leave it for mfndpos() */
if (is_displacer(mtmp->data)) if (is_displacer(mtmp->data))
@@ -3209,7 +3209,7 @@ corpse_chance(
if (was_swallowed && magr) { if (was_swallowed && magr) {
/* mdef is a gas spore (AT_BOOM) that is exploding inside an /* mdef is a gas spore (AT_BOOM) that is exploding inside an
engulfer; suppress usual explosion since it's contained */ engulfer; suppress usual explosion since it's contained */
if (magr == u.umonst) { if (magr == &gy.youmonst) {
There("is an explosion in your %s!", body_part(STOMACH)); There("is an explosion in your %s!", body_part(STOMACH));
Sprintf(svk.killer.name, "%s explosion", Sprintf(svk.killer.name, "%s explosion",
s_suffix(pmname(mdat, Mgender(mon)))); s_suffix(pmname(mdat, Mgender(mon))));
@@ -3617,7 +3617,7 @@ xkilled(
/* corpse--none if hero was inside the monster */ /* corpse--none if hero was inside the monster */
if (!wasinside && corpse_chance(mtmp, (struct monst *) 0, FALSE)) { if (!wasinside && corpse_chance(mtmp, (struct monst *) 0, FALSE)) {
gz.zombify = (!gt.thrownobj && !gs.stoned && !uwep gz.zombify = (!gt.thrownobj && !gs.stoned && !uwep
&& zombie_maker(u.umonst) && zombie_maker(&gy.youmonst)
&& zombie_form(mtmp->data) != NON_PM); && zombie_form(mtmp->data) != NON_PM);
cadaver = make_corpse(mtmp, burycorpse ? CORPSTAT_BURIED cadaver = make_corpse(mtmp, burycorpse ? CORPSTAT_BURIED
: CORPSTAT_NONE); : CORPSTAT_NONE);
@@ -4595,7 +4595,7 @@ get_iter_mons_xy(
int int
healmon(struct monst *mtmp, int amt, int overheal) healmon(struct monst *mtmp, int amt, int overheal)
{ {
if (mtmp == u.umonst) { if (mtmp == &gy.youmonst) {
int oldhp = Upolyd ? u.mh : u.uhp; int oldhp = Upolyd ? u.mh : u.uhp;
healup(amt, 0, 0, 0); healup(amt, 0, 0, 0);
return (Upolyd ? u.mh : u.uhp) - oldhp; return (Upolyd ? u.mh : u.uhp) - oldhp;
@@ -4704,7 +4704,7 @@ maybe_unhide_at(coordxy x, coordxy y)
undetected = mtmp->mundetected; undetected = mtmp->mundetected;
trapped = mtmp->mtrapped; trapped = mtmp->mtrapped;
} else if (u_at(x, y)) { } else if (u_at(x, y)) {
mtmp = u.umonst; mtmp = &gy.youmonst;
undetected = u.uundetected; undetected = u.uundetected;
trapped = u.utrap; trapped = u.utrap;
} else { } else {
@@ -4730,7 +4730,7 @@ hideunder(struct monst *mtmp)
const char *seenmon = (char *) 0, *seenobj = (char *) 0, const char *seenmon = (char *) 0, *seenobj = (char *) 0,
*locomo = (char *) 0; *locomo = (char *) 0;
int seeit = gi.in_mklev ? 0 : canseemon(mtmp); int seeit = gi.in_mklev ? 0 : canseemon(mtmp);
boolean oldundetctd, undetected = FALSE, is_u = (mtmp == u.umonst); boolean oldundetctd, undetected = FALSE, is_u = (mtmp == &gy.youmonst);
coordxy x = is_u ? u.ux : mtmp->mx, y = is_u ? u.uy : mtmp->my; coordxy x = is_u ? u.ux : mtmp->mx, y = is_u ? u.uy : mtmp->my;
if (mtmp == u.ustuck) { if (mtmp == u.ustuck) {
@@ -5437,7 +5437,7 @@ newcham(
/* update swallow glyphs for new monster */ /* update swallow glyphs for new monster */
swallowed(0); swallowed(0);
} }
} else if ((!sticks(mdat) && !sticks(u.umonst->data)) } else if ((!sticks(mdat) && !sticks(gy.youmonst.data))
/* sticky hero can't continue to hold mtmp if it has /* sticky hero can't continue to hold mtmp if it has
turned into a non-solid creature; we don't use turned into a non-solid creature; we don't use
uunstick() for that because its message would be uunstick() for that because its message would be
@@ -5800,7 +5800,7 @@ usmellmon(struct permonst *mdat)
boolean msg_given = FALSE; boolean msg_given = FALSE;
if (mdat) { if (mdat) {
if (!olfaction(u.umonst->data)) if (!olfaction(gy.youmonst.data))
return FALSE; return FALSE;
mndx = monsndx(mdat); mndx = monsndx(mdat);
switch (mndx) { switch (mndx) {
@@ -5895,7 +5895,7 @@ usmellmon(struct permonst *mdat)
msg_given = TRUE; msg_given = TRUE;
break; break;
case S_ORC: case S_ORC:
if (maybe_polyd(is_orc(u.umonst->data), Race_if(PM_ORC))) if (maybe_polyd(is_orc(gy.youmonst.data), Race_if(PM_ORC)))
You("notice an attractive smell."); You("notice an attractive smell.");
else else
pline("A foul stench makes you feel a little nauseated."); pline("A foul stench makes you feel a little nauseated.");
+17 -17
View File
@@ -13,7 +13,7 @@ void
set_mon_data(struct monst *mon, struct permonst *ptr) set_mon_data(struct monst *mon, struct permonst *ptr)
{ {
int new_speed, old_speed = mon->data ? mon->data->mmove : 0; int new_speed, old_speed = mon->data ? mon->data->mmove : 0;
short *movement_p = (mon == u.umonst) ? &u.umovement : &mon->movement; short *movement_p = (mon == &gy.youmonst) ? &u.umovement : &mon->movement;
mon->data = ptr; mon->data = ptr;
mon->mnum = (short) monsndx(ptr); mon->mnum = (short) monsndx(ptr);
@@ -85,14 +85,14 @@ poly_when_stoned(struct permonst *ptr)
/* allow G_EXTINCT */ /* allow G_EXTINCT */
} }
/* is 'mon' (possibly u.umonst) protected against damage type 'adtype' via /* is 'mon' (possibly youmonst) protected against damage type 'adtype' via
wielded weapon or worn dragon scales? [or by virtue of being a dragon?] */ wielded weapon or worn dragon scales? [or by virtue of being a dragon?] */
boolean boolean
defended(struct monst *mon, int adtyp) defended(struct monst *mon, int adtyp)
{ {
struct obj *o, otemp; struct obj *o, otemp;
int mndx; int mndx;
boolean is_you = (mon == u.umonst); boolean is_you = (mon == &gy.youmonst);
/* is 'mon' wielding an artifact that protects against 'adtyp'? */ /* is 'mon' wielding an artifact that protects against 'adtyp'? */
o = is_you ? uwep : MON_WEP(mon); o = is_you ? uwep : MON_WEP(mon);
@@ -130,7 +130,7 @@ Resists_Elem(struct monst *mon, int propindx)
{ {
struct obj *o; struct obj *o;
long slotmask; long slotmask;
boolean is_you = (mon == u.umonst); boolean is_you = (mon == &gy.youmonst);
int u_resist = 0, damgtype = 0, rsstmask = 0; int u_resist = 0, damgtype = 0, rsstmask = 0;
/* /*
@@ -204,7 +204,7 @@ resists_drli(struct monst *mon)
if (is_undead(ptr) || is_demon(ptr) || is_were(ptr) if (is_undead(ptr) || is_demon(ptr) || is_were(ptr)
/* is_were() doesn't handle hero in human form */ /* is_were() doesn't handle hero in human form */
|| (mon == u.umonst && u.ulycn >= LOW_PM) || (mon == &gy.youmonst && u.ulycn >= LOW_PM)
|| ptr == &mons[PM_DEATH] || is_vampshifter(mon)) || ptr == &mons[PM_DEATH] || is_vampshifter(mon))
return TRUE; return TRUE;
return defended(mon, AD_DRLI); return defended(mon, AD_DRLI);
@@ -215,7 +215,7 @@ boolean
resists_magm(struct monst *mon) resists_magm(struct monst *mon)
{ {
struct permonst *ptr = mon->data; struct permonst *ptr = mon->data;
boolean is_you = (mon == u.umonst); boolean is_you = (mon == &gy.youmonst);
long slotmask; long slotmask;
struct obj *o; struct obj *o;
@@ -248,7 +248,7 @@ boolean
resists_blnd(struct monst *mon) resists_blnd(struct monst *mon)
{ {
struct permonst *ptr = mon->data; struct permonst *ptr = mon->data;
boolean is_you = (mon == u.umonst); boolean is_you = (mon == &gy.youmonst);
if (is_you ? (Blind || Unaware) if (is_you ? (Blind || Unaware)
: (mon->mblinded || !mon->mcansee || !haseyes(ptr) : (mon->mblinded || !mon->mcansee || !haseyes(ptr)
@@ -278,7 +278,7 @@ boolean
resists_blnd_by_arti(struct monst *mon) resists_blnd_by_arti(struct monst *mon)
{ {
struct obj *o; struct obj *o;
boolean is_you = (mon == u.umonst); boolean is_you = (mon == &gy.youmonst);
o = is_you ? uwep : MON_WEP(mon); o = is_you ? uwep : MON_WEP(mon);
if (o && o->oartifact && defends(AD_BLND, o)) if (o && o->oartifact && defends(AD_BLND, o))
@@ -308,7 +308,7 @@ can_blnd(
uchar aatyp, uchar aatyp,
struct obj *obj) /* aatyp == AT_WEAP, AT_SPIT */ struct obj *obj) /* aatyp == AT_WEAP, AT_SPIT */
{ {
boolean is_you = (mdef == u.umonst); boolean is_you = (mdef == &gy.youmonst);
boolean check_visor = FALSE; boolean check_visor = FALSE;
struct obj *o; struct obj *o;
@@ -354,7 +354,7 @@ can_blnd(
return TRUE; /* no defense */ return TRUE; /* no defense */
} else } else
return FALSE; /* other objects cannot cause blindness yet */ return FALSE; /* other objects cannot cause blindness yet */
if ((magr == u.umonst) && u.uswallow) if ((magr == &gy.youmonst) && u.uswallow)
return FALSE; /* can't affect eyes while inside monster */ return FALSE; /* can't affect eyes while inside monster */
break; break;
@@ -369,7 +369,7 @@ can_blnd(
/* e.g. raven: all ublindf, including LENSES, protect */ /* e.g. raven: all ublindf, including LENSES, protect */
if (is_you && ublindf) if (is_you && ublindf)
return FALSE; return FALSE;
if ((magr == u.umonst) && u.uswallow) if ((magr == &gy.youmonst) && u.uswallow)
return FALSE; /* can't affect eyes while inside monster */ return FALSE; /* can't affect eyes while inside monster */
check_visor = TRUE; check_visor = TRUE;
break; break;
@@ -387,7 +387,7 @@ can_blnd(
/* check if wearing a visor (only checked if visor might help) */ /* check if wearing a visor (only checked if visor might help) */
if (check_visor) { if (check_visor) {
o = (mdef == u.umonst) ? gi.invent : mdef->minvent; o = (mdef == &gy.youmonst) ? gi.invent : mdef->minvent;
for (; o; o = o->nobj) for (; o; o = o->nobj)
if ((o->owornmask & W_ARMH) if ((o->owornmask & W_ARMH)
&& objdescr_is(o, "visored helmet")) && objdescr_is(o, "visored helmet"))
@@ -570,7 +570,7 @@ can_blow(struct monst *mtmp)
&& (breathless(mtmp->data) || verysmall(mtmp->data) && (breathless(mtmp->data) || verysmall(mtmp->data)
|| !has_head(mtmp->data) || mtmp->data->mlet == S_EEL)) || !has_head(mtmp->data) || mtmp->data->mlet == S_EEL))
return FALSE; return FALSE;
if ((mtmp == u.umonst) && Strangled) if ((mtmp == &gy.youmonst) && Strangled)
return FALSE; return FALSE;
return TRUE; return TRUE;
} }
@@ -579,7 +579,7 @@ can_blow(struct monst *mtmp)
boolean boolean
can_chant(struct monst *mtmp) can_chant(struct monst *mtmp)
{ {
if ((mtmp == u.umonst && Strangled) if ((mtmp == &gy.youmonst && Strangled)
|| is_silent(mtmp->data) || !has_head(mtmp->data) || is_silent(mtmp->data) || !has_head(mtmp->data)
|| mtmp->data->msound == MS_BUZZ || mtmp->data->msound == MS_BURBLE) || mtmp->data->msound == MS_BUZZ || mtmp->data->msound == MS_BURBLE)
return FALSE; return FALSE;
@@ -602,10 +602,10 @@ can_be_strangled(struct monst *mon)
are non-breathing creatures which have higher brain function. */ are non-breathing creatures which have higher brain function. */
if (!has_head(mon->data)) if (!has_head(mon->data))
return FALSE; return FALSE;
if (mon == u.umonst) { if (mon == &gy.youmonst) {
/* hero can't be mindless but poly'ing into mindless form can /* hero can't be mindless but poly'ing into mindless form can
confer strangulation protection */ confer strangulation protection */
nobrainer = mindless(u.umonst->data); nobrainer = mindless(gy.youmonst.data);
nonbreathing = Breathless; nonbreathing = Breathless;
} else { } else {
nobrainer = mindless(mon->data); nobrainer = mindless(mon->data);
@@ -1358,7 +1358,7 @@ big_little_match(int montyp1, int montyp2)
const struct permonst * const struct permonst *
raceptr(struct monst *mtmp) raceptr(struct monst *mtmp)
{ {
if (mtmp == u.umonst && !Upolyd) if (mtmp == &gy.youmonst && !Upolyd)
return &mons[gu.urace.mnum]; return &mons[gu.urace.mnum];
return mtmp->data; return mtmp->data;
} }
+11 -11
View File
@@ -364,7 +364,7 @@ release_hero(struct monst *mon)
if (mon == u.ustuck) { if (mon == u.ustuck) {
if (u.uswallow) { if (u.uswallow) {
expels(mon, mon->data, TRUE); expels(mon, mon->data, TRUE);
} else if (!sticks(u.umonst->data)) { } else if (!sticks(gy.youmonst.data)) {
unstuck(mon); /* let go */ unstuck(mon); /* let go */
You("get released!"); You("get released!");
} }
@@ -608,8 +608,8 @@ mind_blast(struct monst *mtmp)
/* hero has no way to hide as monster but /* hero has no way to hide as monster but
check for that theoretical case anyway */ check for that theoretical case anyway */
&& U_AP_TYPE != M_AP_MONSTER) { && U_AP_TYPE != M_AP_MONSTER) {
u.umonst->m_ap_type = M_AP_NOTHING; gy.youmonst.m_ap_type = M_AP_NOTHING;
u.umonst->mappearance = 0; gy.youmonst.mappearance = 0;
newsym(u.ux, u.uy); newsym(u.ux, u.uy);
} }
pline("It locks on to your %s!", pline("It locks on to your %s!",
@@ -649,7 +649,7 @@ mind_blast(struct monst *mtmp)
void void
m_everyturn_effect(struct monst *mtmp) m_everyturn_effect(struct monst *mtmp)
{ {
boolean is_u = (mtmp == u.umonst) ? TRUE : FALSE; boolean is_u = (mtmp == &gy.youmonst) ? TRUE : FALSE;
coordxy x = is_u ? u.ux : mtmp->mx, coordxy x = is_u ? u.ux : mtmp->mx,
y = is_u ? u.uy : mtmp->my; y = is_u ? u.uy : mtmp->my;
@@ -671,7 +671,7 @@ m_everyturn_effect(struct monst *mtmp)
void void
m_postmove_effect(struct monst *mtmp) m_postmove_effect(struct monst *mtmp)
{ {
boolean is_u = (mtmp == u.umonst) ? TRUE : FALSE; boolean is_u = (mtmp == &gy.youmonst) ? TRUE : FALSE;
coordxy x = is_u ? u.ux0 : mtmp->mx, coordxy x = is_u ? u.ux0 : mtmp->mx,
y = is_u ? u.uy0 : mtmp->my; y = is_u ? u.uy0 : mtmp->my;
@@ -806,7 +806,7 @@ dochug(struct monst *mtmp)
pline("%s whispers at thin air.", pline("%s whispers at thin air.",
cansee(mtmp->mux, mtmp->muy) ? Monnam(mtmp) : "It"); cansee(mtmp->mux, mtmp->muy) ? Monnam(mtmp) : "It");
if (is_demon(u.umonst->data)) { if (is_demon(gy.youmonst.data)) {
/* "Good hunting, brother" */ /* "Good hunting, brother" */
if (!tele_restrict(mtmp)) if (!tele_restrict(mtmp))
(void) rloc(mtmp, RLOC_MSG); (void) rloc(mtmp, RLOC_MSG);
@@ -1052,7 +1052,7 @@ mon_would_consume_item(struct monst *mtmp, struct obj *otmp)
boolean boolean
itsstuck(struct monst *mtmp) itsstuck(struct monst *mtmp)
{ {
if (sticks(u.umonst->data) && mtmp == u.ustuck && !u.uswallow) { if (sticks(gy.youmonst.data) && mtmp == u.ustuck && !u.uswallow) {
pline_mon(mtmp, "%s cannot escape from you!", Monnam(mtmp)); pline_mon(mtmp, "%s cannot escape from you!", Monnam(mtmp));
return TRUE; return TRUE;
} }
@@ -1864,8 +1864,8 @@ m_move(struct monst *mtmp, int after)
if (!mtmp->mcansee if (!mtmp->mcansee
|| (should_see && Invis && !perceives(ptr) && rn2(11)) || (should_see && Invis && !perceives(ptr) && rn2(11))
|| is_obj_mappear(u.umonst, STRANGE_OBJECT) || u.uundetected || is_obj_mappear(&gy.youmonst, STRANGE_OBJECT) || u.uundetected
|| (is_obj_mappear(u.umonst, GOLD_PIECE) && !likes_gold(ptr)) || (is_obj_mappear(&gy.youmonst, GOLD_PIECE) && !likes_gold(ptr))
|| (mtmp->mpeaceful && !mtmp->isshk) /* allow shks to follow */ || (mtmp->mpeaceful && !mtmp->isshk) /* allow shks to follow */
|| ((monsndx(ptr) == PM_STALKER || ptr->mlet == S_BAT || ((monsndx(ptr) == PM_STALKER || ptr->mlet == S_BAT
|| ptr->mlet == S_LIGHT) && !rn2(3))) || ptr->mlet == S_LIGHT) && !rn2(3)))
@@ -1891,7 +1891,7 @@ m_move(struct monst *mtmp, int after)
if ((!mtmp->mpeaceful || !rn2(10)) && (!Is_rogue_level(&u.uz))) { if ((!mtmp->mpeaceful || !rn2(10)) && (!Is_rogue_level(&u.uz))) {
boolean in_line = (lined_up(mtmp) boolean in_line = (lined_up(mtmp)
&& (distmin(mtmp->mx, mtmp->my, mtmp->mux, mtmp->muy) && (distmin(mtmp->mx, mtmp->my, mtmp->mux, mtmp->muy)
<= (throws_rocks(u.umonst->data) ? 20 <= (throws_rocks(gy.youmonst.data) ? 20
: (ACURRSTR / 2 + 1)))); : (ACURRSTR / 2 + 1))));
if (appr != 1 || !in_line) { if (appr != 1 || !in_line) {
@@ -2320,7 +2320,7 @@ stuff_prevents_passage(struct monst *mtmp)
{ {
struct obj *chain, *obj; struct obj *chain, *obj;
if (mtmp == u.umonst) { if (mtmp == &gy.youmonst) {
chain = gi.invent; chain = gi.invent;
} else { } else {
chain = mtmp->minvent; chain = mtmp->minvent;
+20 -20
View File
@@ -124,7 +124,7 @@ thitu(
pline("It doesn't seem to hurt you."); pline("It doesn't seem to hurt you.");
monstseesu(M_SEEN_ACID); monstseesu(M_SEEN_ACID);
} else if (obj && stone_missile(obj) } else if (obj && stone_missile(obj)
&& passes_rocks(u.umonst->data)) { && passes_rocks(gy.youmonst.data)) {
/* use 'named' as an approximation for "hitting from above"; /* use 'named' as an approximation for "hitting from above";
we avoid "passes through you" for horizontal flight path we avoid "passes through you" for horizontal flight path
because missile stops and that wording would suggest that because missile stops and that wording would suggest that
@@ -134,7 +134,7 @@ thitu(
} else if (obj && obj->oclass == POTION_CLASS) { } else if (obj && obj->oclass == POTION_CLASS) {
/* an explosion which scatters objects might hit hero with one /* an explosion which scatters objects might hit hero with one
(potions deliberately thrown at hero are handled by m_throw) */ (potions deliberately thrown at hero are handled by m_throw) */
potionhit(u.umonst, obj, POTHIT_OTHER_THROW); potionhit(&gy.youmonst, obj, POTHIT_OTHER_THROW);
*objp = obj = 0; /* potionhit() uses up the potion */ *objp = obj = 0; /* potionhit() uses up the potion */
} else { } else {
if (obj && objects[obj->otyp].oc_material == SILVER if (obj && objects[obj->otyp].oc_material == SILVER
@@ -184,7 +184,7 @@ drop_throw(
if (!(broken = flooreffects(obj, x, y, "fall"))) { if (!(broken = flooreffects(obj, x, y, "fall"))) {
place_object(obj, x, y); place_object(obj, x, y);
if (!mtmp && u_at(x, y)) if (!mtmp && u_at(x, y))
mtmp = u.umonst; mtmp = &gy.youmonst;
if (mtmp && ohit) if (mtmp && ohit)
passive_obj(mtmp, obj, (struct attack *) 0); passive_obj(mtmp, obj, (struct attack *) 0);
stackobj(obj); stackobj(obj);
@@ -508,7 +508,7 @@ ucatchgem(
struct monst *mon) struct monst *mon)
{ {
/* won't catch rock or gray stone; catch (then drop) worthless glass */ /* won't catch rock or gray stone; catch (then drop) worthless glass */
if (gem->otyp <= LAST_GLASS_GEM && is_unicorn(u.umonst->data)) { if (gem->otyp <= LAST_GLASS_GEM && is_unicorn(gy.youmonst.data)) {
char *gem_xname = xname(gem), char *gem_xname = xname(gem),
*mon_s_name = s_suffix(mon_nam(mon)); *mon_s_name = s_suffix(mon_nam(mon));
@@ -537,7 +537,7 @@ u_catch_thrown_obj(struct obj *otmp)
if (!Blind && !Confusion && !Stunned && !Fumbling if (!Blind && !Confusion && !Stunned && !Fumbling
&& otmp->oclass != VENOM_CLASS && otmp->oclass != VENOM_CLASS
&& !nohands(u.umonst->data) && freehand() && !nohands(gy.youmonst.data) && freehand()
&& calc_capacity(otmp->owt) <= SLT_ENCUMBER && !rn2(catch_chance)) { && calc_capacity(otmp->owt) <= SLT_ENCUMBER && !rn2(catch_chance)) {
char buf[BUFSZ]; char buf[BUFSZ];
@@ -696,7 +696,7 @@ m_throw(
break; break;
if (singleobj->oclass == POTION_CLASS) { if (singleobj->oclass == POTION_CLASS) {
potionhit(u.umonst, singleobj, POTHIT_MONST_THROW); potionhit(&gy.youmonst, singleobj, POTHIT_MONST_THROW);
break; break;
} }
oldumort = u.umortality; oldumort = u.umortality;
@@ -719,7 +719,7 @@ m_throw(
{ {
int dam, hitv; int dam, hitv;
dam = dmgval(singleobj, u.umonst); dam = dmgval(singleobj, &gy.youmonst);
hitv = 3 - distmin(u.ux, u.uy, mon->mx, mon->my); hitv = 3 - distmin(u.ux, u.uy, mon->mx, mon->my);
if (hitv < -4) if (hitv < -4)
hitv = -4; hitv = -4;
@@ -732,7 +732,7 @@ m_throw(
if (singleobj->otyp == ELVEN_ARROW) if (singleobj->otyp == ELVEN_ARROW)
dam++; dam++;
} }
if (bigmonst(u.umonst->data)) if (bigmonst(gy.youmonst.data))
hitv++; hitv++;
hitv += 8 + singleobj->spe; hitv += 8 + singleobj->spe;
if (dam < 1) if (dam < 1)
@@ -752,7 +752,7 @@ m_throw(
poison is limited to attrib loss */ poison is limited to attrib loss */
(u.umortality > oldumort) ? 0 : 10, TRUE); (u.umortality > oldumort) ? 0 : 10, TRUE);
} }
if (hitu && can_blnd((struct monst *) 0, u.umonst, if (hitu && can_blnd((struct monst *) 0, &gy.youmonst,
(uchar) ((singleobj->otyp == BLINDING_VENOM) (uchar) ((singleobj->otyp == BLINDING_VENOM)
? AT_SPIT ? AT_SPIT
: AT_WEAP), : AT_WEAP),
@@ -767,7 +767,7 @@ m_throw(
} else if (singleobj->otyp == BLINDING_VENOM) { } else if (singleobj->otyp == BLINDING_VENOM) {
const char *eyes = body_part(EYE); const char *eyes = body_part(EYE);
if (eyecount(u.umonst->data) != 1) if (eyecount(gy.youmonst.data) != 1)
eyes = makeplural(eyes); eyes = makeplural(eyes);
/* venom in the eyes */ /* venom in the eyes */
if (!Blind) if (!Blind)
@@ -778,7 +778,7 @@ m_throw(
} }
if (hitu && singleobj->otyp == EGG) { if (hitu && singleobj->otyp == EGG) {
if (!Stoned && !Stone_resistance if (!Stoned && !Stone_resistance
&& !(poly_when_stoned(u.umonst->data) && !(poly_when_stoned(gy.youmonst.data)
&& polymon(PM_STONE_GOLEM))) { && polymon(PM_STONE_GOLEM))) {
make_stoned(5L, (char *) 0, KILLED_BY, ""); make_stoned(5L, (char *) 0, KILLED_BY, "");
} }
@@ -1030,7 +1030,7 @@ spitmm(struct monst *mtmp, struct attack *mattk, struct monst *mtarg)
return M_ATTK_MISS; return M_ATTK_MISS;
} }
if (m_lined_up(mtarg, mtmp)) { if (m_lined_up(mtarg, mtmp)) {
boolean utarg = (mtarg == u.umonst); boolean utarg = (mtarg == &gy.youmonst);
coordxy tx = utarg ? mtmp->mux : mtarg->mx; coordxy tx = utarg ? mtmp->mux : mtarg->mx;
coordxy ty = utarg ? mtmp->muy : mtarg->my; coordxy ty = utarg ? mtmp->muy : mtarg->my;
@@ -1093,7 +1093,7 @@ int
breamm(struct monst *mtmp, struct attack *mattk, struct monst *mtarg) breamm(struct monst *mtmp, struct attack *mattk, struct monst *mtarg)
{ {
int typ = get_atkdam_type(mattk->adtyp); int typ = get_atkdam_type(mattk->adtyp);
boolean utarget = (mtarg == u.umonst); boolean utarget = (mtarg == &gy.youmonst);
if (m_lined_up(mtarg, mtmp)) { if (m_lined_up(mtarg, mtmp)) {
if (mtmp->mcan) { if (mtmp->mcan) {
@@ -1225,11 +1225,11 @@ thrwmu(struct monst *mtmp)
obj_is_pname(otmp) ? the(onm) : an(onm)); obj_is_pname(otmp) ? the(onm) : an(onm));
} }
dam = dmgval(otmp, u.umonst); dam = dmgval(otmp, &gy.youmonst);
hitv = 3 - distmin(u.ux, u.uy, mtmp->mx, mtmp->my); hitv = 3 - distmin(u.ux, u.uy, mtmp->mx, mtmp->my);
if (hitv < -4) if (hitv < -4)
hitv = -4; hitv = -4;
if (bigmonst(u.umonst->data)) if (bigmonst(gy.youmonst.data))
hitv++; hitv++;
hitv += 8 + otmp->spe; hitv += 8 + otmp->spe;
if (dam < 1) if (dam < 1)
@@ -1267,14 +1267,14 @@ thrwmu(struct monst *mtmp)
int int
spitmu(struct monst *mtmp, struct attack *mattk) spitmu(struct monst *mtmp, struct attack *mattk)
{ {
return spitmm(mtmp, mattk, u.umonst); return spitmm(mtmp, mattk, &gy.youmonst);
} }
/* monster breathes at you (ranged) */ /* monster breathes at you (ranged) */
int int
breamu(struct monst *mtmp, struct attack *mattk) breamu(struct monst *mtmp, struct attack *mattk)
{ {
return breamm(mtmp, mattk, u.umonst); return breamm(mtmp, mattk, &gy.youmonst);
} }
/* return TRUE if terrain at x,y blocks linedup checks */ /* return TRUE if terrain at x,y blocks linedup checks */
@@ -1375,7 +1375,7 @@ linedup(
staticfn int staticfn int
m_lined_up(struct monst *mtarg, struct monst *mtmp) m_lined_up(struct monst *mtarg, struct monst *mtmp)
{ {
boolean utarget = (mtarg == u.umonst); boolean utarget = (mtarg == &gy.youmonst);
coordxy tx = utarget ? mtmp->mux : mtarg->mx; coordxy tx = utarget ? mtmp->mux : mtarg->mx;
coordxy ty = utarget ? mtmp->muy : mtarg->my; coordxy ty = utarget ? mtmp->muy : mtarg->my;
boolean ignore_boulders = utarget && (throws_rocks(mtmp->data) boolean ignore_boulders = utarget && (throws_rocks(mtmp->data)
@@ -1397,7 +1397,7 @@ m_lined_up(struct monst *mtarg, struct monst *mtmp)
boolean boolean
lined_up(struct monst *mtmp) lined_up(struct monst *mtmp)
{ {
return m_lined_up(u.umonst, mtmp) ? TRUE : FALSE; return m_lined_up(&gy.youmonst, mtmp) ? TRUE : FALSE;
} }
/* check if a monster is carrying an item of a particular type */ /* check if a monster is carrying an item of a particular type */
@@ -1406,7 +1406,7 @@ m_carrying(struct monst *mtmp, int type)
{ {
struct obj *otmp; struct obj *otmp;
for (otmp = (mtmp == u.umonst) ? gi.invent : mtmp->minvent; otmp; for (otmp = (mtmp == &gy.youmonst) ? gi.invent : mtmp->minvent; otmp;
otmp = otmp->nobj) otmp = otmp->nobj)
if (otmp->otyp == type) if (otmp->otyp == type)
break; break;
+7 -7
View File
@@ -252,7 +252,7 @@ mreadmsg(struct monst *mtmp, struct obj *otmp)
pline_mon(mtmp, "%s reads %s!", Monnam(mtmp), onambuf); pline_mon(mtmp, "%s reads %s!", Monnam(mtmp), onambuf);
} else { /* !Deaf, otherwise we wouldn't reach here */ } else { /* !Deaf, otherwise we wouldn't reach here */
char blindbuf[BUFSZ]; char blindbuf[BUFSZ];
boolean similar = same_race(u.umonst->data, mtmp->data), boolean similar = same_race(gy.youmonst.data, mtmp->data),
uniqmon = ((mtmp->data->geno & G_UNIQ) != 0 uniqmon = ((mtmp->data->geno & G_UNIQ) != 0
/* shopkeepers aren't unique monsters but since /* shopkeepers aren't unique monsters but since
they have distinct names, treat them as such */ they have distinct names, treat them as such */
@@ -1565,8 +1565,8 @@ find_offensive(struct monst *mtmp)
} }
nomore(MUSE_CAMERA); nomore(MUSE_CAMERA);
if (obj->otyp == EXPENSIVE_CAMERA if (obj->otyp == EXPENSIVE_CAMERA
&& ((!Blind && !resists_blnd(u.umonst)) && ((!Blind && !resists_blnd(&gy.youmonst))
|| hates_light(u.umonst->data)) || hates_light(gy.youmonst.data))
&& dist2(mtmp->mx, mtmp->my, mtmp->mux, mtmp->muy) <= 2 && dist2(mtmp->mx, mtmp->my, mtmp->mux, mtmp->muy) <= 2
&& obj->spe > 0 && !rn2(6)) { && obj->spe > 0 && !rn2(6)) {
gm.m.offensive = obj; gm.m.offensive = obj;
@@ -1598,7 +1598,7 @@ mbhitm(struct monst *mtmp, struct obj *otmp)
{ {
int tmp; int tmp;
boolean reveal_invis = FALSE, learnit = FALSE, boolean reveal_invis = FALSE, learnit = FALSE,
hits_you = (mtmp == u.umonst); hits_you = (mtmp == &gy.youmonst);
if (!hits_you && otmp->otyp != WAN_UNDEAD_TURNING) { if (!hits_you && otmp->otyp != WAN_UNDEAD_TURNING) {
mtmp->msleeping = 0; mtmp->msleeping = 0;
@@ -1761,7 +1761,7 @@ mbhit(
break; break;
} }
if (u_at(gb.bhitpos.x, gb.bhitpos.y)) { if (u_at(gb.bhitpos.x, gb.bhitpos.y)) {
(*fhitm)(u.umonst, obj); (*fhitm)(&gy.youmonst, obj);
range -= 3; range -= 3;
} else if ((mtmp = m_at(gb.bhitpos.x, gb.bhitpos.y)) != 0) { } else if ((mtmp = m_at(gb.bhitpos.x, gb.bhitpos.y)) != 0) {
if (cansee(gb.bhitpos.x, gb.bhitpos.y) && !canspotmon(mtmp)) if (cansee(gb.bhitpos.x, gb.bhitpos.y) && !canspotmon(mtmp))
@@ -1944,7 +1944,7 @@ use_offensive(struct monst *mtmp)
Monnam(mtmp), an(xname(otmp))); Monnam(mtmp), an(xname(otmp)));
} }
gm.m_using = TRUE; gm.m_using = TRUE;
if (!Blind && !resists_blnd(u.umonst)) { if (!Blind && !resists_blnd(&gy.youmonst)) {
You("are blinded by the flash of light!"); You("are blinded by the flash of light!");
make_blinded(BlindedTimeout + (long) rnd(1 + 50), FALSE); make_blinded(BlindedTimeout + (long) rnd(1 + 50), FALSE);
} }
@@ -2857,7 +2857,7 @@ ureflects(const char *fmt, const char *str)
if (fmt && str) if (fmt && str)
pline(fmt, str, uskin ? "luster" : "armor"); pline(fmt, str, uskin ? "luster" : "armor");
return TRUE; return TRUE;
} else if (u.umonst->data == &mons[PM_SILVER_DRAGON]) { } else if (gy.youmonst.data == &mons[PM_SILVER_DRAGON]) {
if (fmt && str) if (fmt && str)
pline(fmt, str, "scales"); pline(fmt, str, "scales");
return TRUE; return TRUE;
+7 -7
View File
@@ -165,7 +165,7 @@ awaken_soldiers(struct monst *bugler /* monster that played instrument */)
int distance, distm; int distance, distm;
/* distance of affected non-soldier monsters to bugler */ /* distance of affected non-soldier monsters to bugler */
distance = ((bugler == u.umonst) ? u.ulevel distance = ((bugler == &gy.youmonst) ? u.ulevel
: bugler->data->mlevel) * 30; : bugler->data->mlevel) * 30;
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) { for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
@@ -182,7 +182,7 @@ awaken_soldiers(struct monst *bugler /* monster that played instrument */)
else if (!Deaf) else if (!Deaf)
Norep("%s the rattle of battle gear being readied.", Norep("%s the rattle of battle gear being readied.",
"You hear"); /* Deaf-aware */ "You hear"); /* Deaf-aware */
} else if ((distm = ((bugler == u.umonst) } else if ((distm = ((bugler == &gy.youmonst)
? mdistu(mtmp) ? mdistu(mtmp)
: dist2(bugler->mx, bugler->my, mtmp->mx, : dist2(bugler->mx, bugler->my, mtmp->mx,
mtmp->my))) < distance) { mtmp->my))) < distance) {
@@ -301,7 +301,7 @@ do_pit(coordxy x, coordxy y, unsigned tu_pit)
Your("chain breaks!"); Your("chain breaks!");
reset_utrap(TRUE); reset_utrap(TRUE);
} }
if (Levitation || Flying || is_clinger(u.umonst->data)) { if (Levitation || Flying || is_clinger(gy.youmonst.data)) {
if (!tu_pit) { /* no pit here previously */ if (!tu_pit) { /* no pit here previously */
pline("A chasm opens up under you!"); pline("A chasm opens up under you!");
You("don't fall in!"); You("don't fall in!");
@@ -327,8 +327,8 @@ do_pit(coordxy x, coordxy y, unsigned tu_pit)
if (keepfooting) if (keepfooting)
exercise(A_DEX, TRUE); exercise(A_DEX, TRUE);
else else
selftouch((Upolyd && (slithy(u.umonst->data) selftouch((Upolyd && (slithy(gy.youmonst.data)
|| nolimbs(u.umonst->data))) || nolimbs(gy.youmonst.data)))
? "Shaken, you" ? "Shaken, you"
: "Falling down, you"); : "Falling down, you");
} }
@@ -653,7 +653,7 @@ do_improvisation(struct obj *instr)
else else
You("blow into the bugle."); You("blow into the bugle.");
Hero_playnotes(obj_to_instr(&itmp), improvisation, 80); Hero_playnotes(obj_to_instr(&itmp), improvisation, 80);
awaken_soldiers(u.umonst); awaken_soldiers(&gy.youmonst);
exercise(A_WIS, FALSE); exercise(A_WIS, FALSE);
break; break;
case MAGIC_HARP: /* Charm monsters */ case MAGIC_HARP: /* Charm monsters */
@@ -769,7 +769,7 @@ do_play_instrument(struct obj *instr)
} else if ((instr->otyp == WOODEN_FLUTE || instr->otyp == MAGIC_FLUTE } else if ((instr->otyp == WOODEN_FLUTE || instr->otyp == MAGIC_FLUTE
|| instr->otyp == TOOLED_HORN || instr->otyp == FROST_HORN || instr->otyp == TOOLED_HORN || instr->otyp == FROST_HORN
|| instr->otyp == FIRE_HORN || instr->otyp == BUGLE) || instr->otyp == FIRE_HORN || instr->otyp == BUGLE)
&& !can_blow(u.umonst)) { && !can_blow(&gy.youmonst)) {
You("are incapable of playing %s.", thesimpleoname(instr)); You("are incapable of playing %s.", thesimpleoname(instr));
return ECMD_OK; return ECMD_OK;
} }
+4 -4
View File
@@ -121,7 +121,7 @@ self_lookat(char *outbuf)
Sprintf(eos(outbuf), ", mounted on %s", y_monnam(u.usteed)); Sprintf(eos(outbuf), ", mounted on %s", y_monnam(u.usteed));
if (u.uundetected || (Upolyd && U_AP_TYPE) if (u.uundetected || (Upolyd && U_AP_TYPE)
|| visible_region_at(u.ux, u.uy)) || visible_region_at(u.ux, u.uy))
mhidden_description(u.umonst, mhidden_description(&gy.youmonst,
MHID_PREFIX | MHID_ARTICLE | MHID_REGION, MHID_PREFIX | MHID_ARTICLE | MHID_REGION,
eos(outbuf)); eos(outbuf));
if (Punished) if (Punished)
@@ -196,7 +196,7 @@ mhidden_description(
incl_article = (mhid_flags & MHID_ARTICLE) != 0, incl_article = (mhid_flags & MHID_ARTICLE) != 0,
show_altmon = (mhid_flags & MHID_ALTMON) != 0, show_altmon = (mhid_flags & MHID_ALTMON) != 0,
force_region = (mhid_flags & MHID_REGION) != 0; force_region = (mhid_flags & MHID_REGION) != 0;
boolean fakeobj, isyou = (mon == u.umonst); boolean fakeobj, isyou = (mon == &gy.youmonst);
coordxy x = isyou ? u.ux : mon->mx, y = isyou ? u.uy : mon->my; coordxy x = isyou ? u.ux : mon->mx, y = isyou ? u.uy : mon->my;
int glyph = (svl.level.flags.hero_memory && !isyou) ? levl[x][y].glyph int glyph = (svl.level.flags.hero_memory && !isyou) ? levl[x][y].glyph
: glyph_at(x, y); : glyph_at(x, y);
@@ -446,7 +446,7 @@ look_at_monster(
Strcat(buf, digests(mtmp->data) ? ", swallowing you" Strcat(buf, digests(mtmp->data) ? ", swallowing you"
: ", engulfing you"); : ", engulfing you");
else else
Strcat(buf, (Upolyd && sticks(u.umonst->data)) Strcat(buf, (Upolyd && sticks(gy.youmonst.data))
? ", being held" : ", holding you"); ? ", being held" : ", holding you");
} }
/* if mtmp isn't able to move (other than because it is a type of /* if mtmp isn't able to move (other than because it is a type of
@@ -1167,7 +1167,7 @@ add_cmap_descr(
/* grab a scratch buffer we can safely return (via *firstmatch /* grab a scratch buffer we can safely return (via *firstmatch
when applicable) */ when applicable) */
mbuf = mon_nam(u.umonst); mbuf = mon_nam(&gy.youmonst);
if (absidx == S_pool) { if (absidx == S_pool) {
levl[cc.x][cc.y].typ = (idx == S_pool) ? POOL : MOAT; levl[cc.x][cc.y].typ = (idx == S_pool) ? POOL : MOAT;
+15 -15
View File
@@ -287,7 +287,7 @@ fatal_corpse_mistake(struct obj *obj, boolean remotely)
if (u_safe_from_fatal_corpse(obj, st_all) || remotely) if (u_safe_from_fatal_corpse(obj, st_all) || remotely)
return FALSE; return FALSE;
if (poly_when_stoned(u.umonst->data) && polymon(PM_STONE_GOLEM)) { if (poly_when_stoned(gy.youmonst.data) && polymon(PM_STONE_GOLEM)) {
display_nhwindow(WIN_MESSAGE, FALSE); /* --More-- */ display_nhwindow(WIN_MESSAGE, FALSE); /* --More-- */
return FALSE; return FALSE;
} }
@@ -723,9 +723,9 @@ pickup(int what) /* should be a long */
*/ */
if ((gm.multi && !svc.context.run) if ((gm.multi && !svc.context.run)
|| (autopickup && !flags.pickup) || (autopickup && !flags.pickup)
|| notake(u.umonst->data)) { || notake(gy.youmonst.data)) {
check_here(FALSE); check_here(FALSE);
if (notake(u.umonst->data) && OBJ_AT(u.ux, u.uy) if (notake(gy.youmonst.data) && OBJ_AT(u.ux, u.uy)
&& (autopickup || flags.pickup)) && (autopickup || flags.pickup))
You("are physically incapable of picking anything up."); You("are physically incapable of picking anything up.");
return 0; return 0;
@@ -892,8 +892,8 @@ pickup(int what) /* should be a long */
} }
if (!u.uswallow) { if (!u.uswallow) {
if (hides_under(u.umonst->data)) if (hides_under(gy.youmonst.data))
(void) hideunder(u.umonst); (void) hideunder(&gy.youmonst);
/* position may need updating (invisible hero) */ /* position may need updating (invisible hero) */
if (n_picked) if (n_picked)
@@ -1155,7 +1155,7 @@ query_objlist(const char *qstr, /* query string */
fake_hero_object = cg.zeroobj; fake_hero_object = cg.zeroobj;
fake_hero_object.quan = 1L; /* not strictly necessary... */ fake_hero_object.quan = 1L; /* not strictly necessary... */
any.a_obj = &fake_hero_object; any.a_obj = &fake_hero_object;
tmpglyph = mon_to_glyph(u.umonst, rn2_on_display_rng); tmpglyph = mon_to_glyph(&gy.youmonst, rn2_on_display_rng);
map_glyphinfo(0, 0, tmpglyph, 0U, &tmpglyphinfo); map_glyphinfo(0, 0, tmpglyph, 0U, &tmpglyphinfo);
add_menu(win, &tmpglyphinfo, &any, add_menu(win, &tmpglyphinfo, &any,
/* fake inventory letter, no group accelerator */ /* fake inventory letter, no group accelerator */
@@ -1719,7 +1719,7 @@ lift_object(
and for boulder picked up by hero poly'd into a giant; override and for boulder picked up by hero poly'd into a giant; override
availability of open inventory slot iff not already carrying one */ availability of open inventory slot iff not already carrying one */
if (obj->otyp == LOADSTONE if (obj->otyp == LOADSTONE
|| (obj->otyp == BOULDER && throws_rocks(u.umonst->data))) { || (obj->otyp == BOULDER && throws_rocks(gy.youmonst.data))) {
if (inv_cnt(FALSE) < invlet_basic || !carrying(obj->otyp) if (inv_cnt(FALSE) < invlet_basic || !carrying(obj->otyp)
|| merge_choice(gi.invent, obj)) || merge_choice(gi.invent, obj))
return 1; /* lift regardless of current situation */ return 1; /* lift regardless of current situation */
@@ -1823,7 +1823,7 @@ pickup_object(
&& engulfing_u(obj->ocarry)) { && engulfing_u(obj->ocarry)) {
You_cant("pick %s up.", ysimple_name(obj)); You_cant("pick %s up.", ysimple_name(obj));
return 0; return 0;
} else if (obj->oartifact && !touch_artifact(obj, u.umonst)) { } else if (obj->oartifact && !touch_artifact(obj, &gy.youmonst)) {
return 0; return 0;
} else if (obj->otyp == CORPSE) { } else if (obj->otyp == CORPSE) {
if (fatal_corpse_mistake(obj, telekinesis) if (fatal_corpse_mistake(obj, telekinesis)
@@ -1989,7 +1989,7 @@ encumber_msg(void)
break; break;
case 3: case 3:
You("%s under your heavy load. Movement is very hard.", You("%s under your heavy load. Movement is very hard.",
stagger(u.umonst->data, "stagger")); stagger(gy.youmonst.data, "stagger"));
break; break;
default: default:
You("%s move a handspan with this load!", You("%s move a handspan with this load!",
@@ -2010,7 +2010,7 @@ encumber_msg(void)
break; break;
case 3: case 3:
You("%s under your load. Movement is still very hard.", You("%s under your load. Movement is still very hard.",
stagger(u.umonst->data, "stagger")); stagger(gy.youmonst.data, "stagger"));
break; break;
} }
disp.botl = TRUE; disp.botl = TRUE;
@@ -2057,7 +2057,7 @@ able_to_loot(
You("cannot %s things that are deep in the %s.", verb, You("cannot %s things that are deep in the %s.", verb,
hliquid(is_lava(x, y) ? "lava" : "water")); hliquid(is_lava(x, y) ? "lava" : "water"));
return FALSE; return FALSE;
} else if (nolimbs(u.umonst->data)) { } else if (nolimbs(gy.youmonst.data)) {
pline("Without limbs, you cannot %s anything.", verb); pline("Without limbs, you cannot %s anything.", verb);
return FALSE; return FALSE;
} else if (looting && !freehand()) { } else if (looting && !freehand()) {
@@ -2195,7 +2195,7 @@ doloot_core(void)
/* "Can't do that while carrying so much stuff." */ /* "Can't do that while carrying so much stuff." */
return ECMD_OK; return ECMD_OK;
} }
if (nohands(u.umonst->data)) { if (nohands(gy.youmonst.data)) {
You("have no hands!"); /* not `body_part(HAND)' */ You("have no hands!"); /* not `body_part(HAND)' */
return ECMD_OK; return ECMD_OK;
} }
@@ -2446,7 +2446,7 @@ loot_mon(struct monst *mtmp, int *passed_info, boolean *prev_loot)
x_monnam(mtmp, ARTICLE_THE, (char *) 0, x_monnam(mtmp, ARTICLE_THE, (char *) 0,
SUPPRESS_SADDLE, FALSE)); SUPPRESS_SADDLE, FALSE));
if ((c = yn_function(qbuf, ynqchars, 'n', TRUE)) == 'y') { if ((c = yn_function(qbuf, ynqchars, 'n', TRUE)) == 'y') {
if (nolimbs(u.umonst->data)) { if (nolimbs(gy.youmonst.data)) {
You_cant("do that without limbs."); /* not body_part(HAND) */ You_cant("do that without limbs."); /* not body_part(HAND) */
return 0; return 0;
} }
@@ -2738,7 +2738,7 @@ out_container(struct obj *obj)
obj->owt = weight(obj); obj->owt = weight(obj);
} }
if (obj->oartifact && !touch_artifact(obj, u.umonst)) if (obj->oartifact && !touch_artifact(obj, &gy.youmonst))
return 0; return 0;
if (fatal_corpse_mistake(obj, FALSE)) if (fatal_corpse_mistake(obj, FALSE))
@@ -2942,7 +2942,7 @@ explain_container_prompt(boolean more_containers)
boolean boolean
u_handsy(void) u_handsy(void)
{ {
if (nohands(u.umonst->data)) { if (nohands(gy.youmonst.data)) {
You("have no hands!"); /* not `body_part(HAND)' */ You("have no hands!"); /* not `body_part(HAND)' */
return FALSE; return FALSE;
} else if (!freehand()) { } else if (!freehand()) {
+1 -1
View File
@@ -139,7 +139,7 @@ pline_mon(struct monst *mtmp, const char *line, ...)
{ {
va_list the_args; va_list the_args;
if (mtmp == u.umonst) if (mtmp == &gy.youmonst)
set_msg_xy(0, 0); set_msg_xy(0, 0);
else else
set_msg_xy(mtmp->mx, mtmp->my); set_msg_xy(mtmp->mx, mtmp->my);
+85 -85
View File
@@ -5,8 +5,8 @@
/* /*
* Polymorph self routine. * Polymorph self routine.
* *
* Note: the light source handling code assumes that u.umonst->m_id * Note: the light source handling code assumes that gy.youmonst.m_id
* always remains 1 and u.umonst->mx will always remain 0 when it handles * always remains 1 and gy.youmonst.mx will always remain 0 when it handles
* the case of the player polymorphed into a light-emitting monster. * the case of the player polymorphed into a light-emitting monster.
* *
* Transformation sequences: * Transformation sequences:
@@ -33,24 +33,24 @@ staticfn void polysense(void);
static const char no_longer_petrify_resistant[] = static const char no_longer_petrify_resistant[] =
"No longer petrify-resistant, you"; "No longer petrify-resistant, you";
/* update the u.umonst->data structure pointer and intrinsics */ /* update the gy.youmonst.data structure pointer and intrinsics */
void void
set_uasmon(void) set_uasmon(void)
{ {
struct permonst *mdat = &mons[u.umonnum]; struct permonst *mdat = &mons[u.umonnum];
boolean was_vampshifter = valid_vampshiftform(u.umonst->cham, u.umonnum); boolean was_vampshifter = valid_vampshiftform(gy.youmonst.cham, u.umonnum);
set_mon_data(u.umonst, mdat); set_mon_data(&gy.youmonst, mdat);
u.umonst->m_id = 1; gy.youmonst.m_id = 1;
if (Protection_from_shape_changers) if (Protection_from_shape_changers)
u.umonst->cham = NON_PM; gy.youmonst.cham = NON_PM;
else if (is_vampire(u.umonst->data)) else if (is_vampire(gy.youmonst.data))
u.umonst->cham = u.umonst->mnum; gy.youmonst.cham = gy.youmonst.mnum;
/* assume hero-as-chameleon/doppelganger/sandestin doesn't change shape */ /* assume hero-as-chameleon/doppelganger/sandestin doesn't change shape */
else if (!was_vampshifter) else if (!was_vampshifter)
u.umonst->cham = NON_PM; gy.youmonst.cham = NON_PM;
u.mcham = u.umonst->cham; /* for save/restore since u.umonst isn't */ u.mcham = gy.youmonst.cham; /* for save/restore since youmonst isn't */
#define PROPSET(PropIndx, ON) \ #define PROPSET(PropIndx, ON) \
do { \ do { \
@@ -59,7 +59,7 @@ set_uasmon(void)
else \ else \
u.uprops[PropIndx].intrinsic &= ~FROMFORM; \ u.uprops[PropIndx].intrinsic &= ~FROMFORM; \
} while (0) } while (0)
#define resist_from_form(MRtyp) ((u.umonst->data->mresists & (MRtyp)) != 0) #define resist_from_form(MRtyp) ((gy.youmonst.data->mresists & (MRtyp)) != 0)
PROPSET(FIRE_RES, resist_from_form(MR_FIRE)); PROPSET(FIRE_RES, resist_from_form(MR_FIRE));
PROPSET(COLD_RES, resist_from_form( MR_COLD)); PROPSET(COLD_RES, resist_from_form( MR_COLD));
@@ -74,7 +74,7 @@ set_uasmon(void)
struct obj *save_uwep = uwep; struct obj *save_uwep = uwep;
uwep = 0; uwep = 0;
PROPSET(DRAIN_RES, resists_drli(u.umonst)); PROPSET(DRAIN_RES, resists_drli(&gy.youmonst));
uwep = save_uwep; uwep = save_uwep;
} }
/* resists_magm() takes wielded, worn, and carried equipment into /* resists_magm() takes wielded, worn, and carried equipment into
@@ -174,7 +174,7 @@ check_strangling(boolean on)
/* when Strangled is already set, polymorphing from one /* when Strangled is already set, polymorphing from one
vulnerable form into another causes the counter to be reset */ vulnerable form into another causes the counter to be reset */
if (uamul && uamul->otyp == AMULET_OF_STRANGULATION if (uamul && uamul->otyp == AMULET_OF_STRANGULATION
&& can_be_strangled(u.umonst)) { && can_be_strangled(&gy.youmonst)) {
Strangled = 6L; Strangled = 6L;
disp.botl = TRUE; disp.botl = TRUE;
Your("%s %s your %s!", simpleonames(uamul), Your("%s %s your %s!", simpleonames(uamul),
@@ -185,7 +185,7 @@ check_strangling(boolean on)
/* off -- maybe block strangling */ /* off -- maybe block strangling */
} else { } else {
if (Strangled && !can_be_strangled(u.umonst)) { if (Strangled && !can_be_strangled(&gy.youmonst)) {
Strangled = 0L; Strangled = 0L;
disp.botl = TRUE; disp.botl = TRUE;
You("are no longer being strangled."); You("are no longer being strangled.");
@@ -199,7 +199,7 @@ DISABLE_WARNING_FORMAT_NONLITERAL
staticfn void staticfn void
polyman(const char *fmt, const char *arg) polyman(const char *fmt, const char *arg)
{ {
boolean sticking = (sticks(u.umonst->data) && u.ustuck && !u.uswallow), boolean sticking = (sticks(gy.youmonst.data) && u.ustuck && !u.uswallow),
was_mimicking = (U_AP_TYPE != M_AP_NOTHING); was_mimicking = (U_AP_TYPE != M_AP_NOTHING);
boolean was_blind = !!Blind, boolean was_blind = !!Blind,
had_see_invis = !!See_invisible; had_see_invis = !!See_invisible;
@@ -223,8 +223,8 @@ polyman(const char *fmt, const char *arg)
if (was_mimicking) { if (was_mimicking) {
if (gm.multi < 0) if (gm.multi < 0)
unmul(""); unmul("");
u.umonst->m_ap_type = M_AP_NOTHING; gy.youmonst.m_ap_type = M_AP_NOTHING;
u.umonst->mappearance = 0; gy.youmonst.mappearance = 0;
} }
newsym(u.ux, u.uy); newsym(u.ux, u.uy);
@@ -249,7 +249,7 @@ polyman(const char *fmt, const char *arg)
if (!!See_invisible ^ had_see_invis) if (!!See_invisible ^ had_see_invis)
set_mimic_blocking(); /* See_invisible just toggled */ set_mimic_blocking(); /* See_invisible just toggled */
if (u.twoweap && !could_twoweap(u.umonst->data)) if (u.twoweap && !could_twoweap(gy.youmonst.data))
untwoweapon(); untwoweapon();
if (u.utrap && u.utraptype == TT_PIT) { if (u.utrap && u.utraptype == TT_PIT) {
@@ -279,8 +279,8 @@ change_sex(void)
* may be true for certain roles * may be true for certain roles
*/ */
if (!Upolyd if (!Upolyd
|| (!is_male(u.umonst->data) && !is_female(u.umonst->data) || (!is_male(gy.youmonst.data) && !is_female(gy.youmonst.data)
&& !is_neuter(u.umonst->data))) && !is_neuter(gy.youmonst.data)))
flags.female = !flags.female; flags.female = !flags.female;
if (Upolyd) /* poly'd: also change saved sex */ if (Upolyd) /* poly'd: also change saved sex */
u.mfemale = !u.mfemale; u.mfemale = !u.mfemale;
@@ -476,8 +476,8 @@ polyself(int psflags)
formrevert = ((psflags & POLY_REVERT) != 0), formrevert = ((psflags & POLY_REVERT) != 0),
draconian = (uarm && Is_dragon_armor(uarm)), draconian = (uarm && Is_dragon_armor(uarm)),
iswere = (ismnum(u.ulycn)), iswere = (ismnum(u.ulycn)),
isvamp = (is_vampire(u.umonst->data) isvamp = (is_vampire(gy.youmonst.data)
|| is_vampshifter(u.umonst)), || is_vampshifter(&gy.youmonst)),
controllable_poly = Polymorph_control && !(Stunned || Unaware); controllable_poly = Polymorph_control && !(Stunned || Unaware);
if (Unchanging) { if (Unchanging) {
@@ -494,11 +494,11 @@ polyself(int psflags)
return; return;
} }
} }
old_light = emits_light(u.umonst->data); old_light = emits_light(gy.youmonst.data);
mntmp = NON_PM; mntmp = NON_PM;
if (formrevert) { if (formrevert) {
mntmp = u.umonst->cham; mntmp = gy.youmonst.cham;
monsterpoly = TRUE; monsterpoly = TRUE;
controllable_poly = FALSE; controllable_poly = FALSE;
} }
@@ -670,13 +670,13 @@ polyself(int psflags)
} else if (isvamp) { } else if (isvamp) {
do_vampyr: do_vampyr:
if (mntmp < LOW_PM || (mons[mntmp].geno & G_UNIQ)) { if (mntmp < LOW_PM || (mons[mntmp].geno & G_UNIQ)) {
mntmp = (u.umonst->data == &mons[PM_VAMPIRE_LEADER] mntmp = (gy.youmonst.data == &mons[PM_VAMPIRE_LEADER]
&& !rn2(10)) ? PM_WOLF && !rn2(10)) ? PM_WOLF
: !rn2(4) ? PM_FOG_CLOUD : !rn2(4) ? PM_FOG_CLOUD
: PM_VAMPIRE_BAT; : PM_VAMPIRE_BAT;
if (ismnum(u.umonst->cham) if (ismnum(gy.youmonst.cham)
&& !is_vampire(u.umonst->data) && !rn2(2)) && !is_vampire(gy.youmonst.data) && !rn2(2))
mntmp = u.umonst->cham; mntmp = gy.youmonst.cham;
} }
if (controllable_poly) { if (controllable_poly) {
Sprintf(buf, "Become %s?", Sprintf(buf, "Become %s?",
@@ -718,15 +718,15 @@ polyself(int psflags)
gs.sex_change_ok--; /* reset */ gs.sex_change_ok--; /* reset */
made_change: made_change:
new_light = emits_light(u.umonst->data); new_light = emits_light(gy.youmonst.data);
if (old_light != new_light) { if (old_light != new_light) {
if (old_light) if (old_light)
del_light_source(LS_MONSTER, monst_to_any(u.umonst)); del_light_source(LS_MONSTER, monst_to_any(&gy.youmonst));
if (new_light == 1) if (new_light == 1)
++new_light; /* otherwise it's undetectable */ ++new_light; /* otherwise it's undetectable */
if (new_light) if (new_light)
new_light_source(u.ux, u.uy, new_light, LS_MONSTER, new_light_source(u.ux, u.uy, new_light, LS_MONSTER,
monst_to_any(u.umonst)); monst_to_any(&gy.youmonst));
} }
} }
@@ -735,9 +735,9 @@ int
polymon(int mntmp) polymon(int mntmp)
{ {
char buf[BUFSZ], ustuckNam[BUFSZ]; char buf[BUFSZ], ustuckNam[BUFSZ];
boolean sticking = sticks(u.umonst->data) && u.ustuck && !u.uswallow, boolean sticking = sticks(gy.youmonst.data) && u.ustuck && !u.uswallow,
was_blind = !!Blind, dochange = FALSE, was_expelled = FALSE, was_blind = !!Blind, dochange = FALSE, was_expelled = FALSE,
was_hiding_under = u.uundetected && hides_under(u.umonst->data); was_hiding_under = u.uundetected && hides_under(gy.youmonst.data);
int mlvl, newMaxStr; int mlvl, newMaxStr;
if (svm.mvitals[mntmp].mvflags & G_GENOD) { /* allow G_EXTINCT */ if (svm.mvitals[mntmp].mvflags & G_GENOD) { /* allow G_EXTINCT */
@@ -774,13 +774,13 @@ polymon(int mntmp)
/* if stuck mimicking gold, stop immediately */ /* if stuck mimicking gold, stop immediately */
if (gm.multi < 0 && U_AP_TYPE == M_AP_OBJECT if (gm.multi < 0 && U_AP_TYPE == M_AP_OBJECT
&& u.umonst->data->mlet != S_MIMIC) && gy.youmonst.data->mlet != S_MIMIC)
unmul(""); unmul("");
/* if becoming a non-mimic, stop mimicking anything */ /* if becoming a non-mimic, stop mimicking anything */
if (mons[mntmp].mlet != S_MIMIC) { if (mons[mntmp].mlet != S_MIMIC) {
/* as in polyman() */ /* as in polyman() */
u.umonst->m_ap_type = M_AP_NOTHING; gy.youmonst.m_ap_type = M_AP_NOTHING;
u.umonst->mappearance = 0; gy.youmonst.mappearance = 0;
} }
if (is_male(&mons[mntmp])) { if (is_male(&mons[mntmp])) {
if (flags.female) if (flags.female)
@@ -840,7 +840,7 @@ polymon(int mntmp)
You("no longer feel sick."); You("no longer feel sick.");
} }
if (Slimed) { if (Slimed) {
if (flaming(u.umonst->data)) { if (flaming(gy.youmonst.data)) {
make_slimed(0L, "The slime burns away!"); make_slimed(0L, "The slime burns away!");
} else if (mntmp == PM_GREEN_SLIME) { } else if (mntmp == PM_GREEN_SLIME) {
/* do it silently */ /* do it silently */
@@ -848,7 +848,7 @@ polymon(int mntmp)
} }
} }
check_strangling(FALSE); /* maybe stop strangling */ check_strangling(FALSE); /* maybe stop strangling */
if (nohands(u.umonst->data)) if (nohands(gy.youmonst.data))
make_glib(0); make_glib(0);
/* /*
@@ -857,9 +857,9 @@ polymon(int mntmp)
* "experience level of you as a monster" for a polymorphed character. * "experience level of you as a monster" for a polymorphed character.
*/ */
mlvl = (int) mons[mntmp].mlevel; mlvl = (int) mons[mntmp].mlevel;
if (u.umonst->data->mlet == S_DRAGON && mntmp >= PM_GRAY_DRAGON) { if (gy.youmonst.data->mlet == S_DRAGON && mntmp >= PM_GRAY_DRAGON) {
u.mhmax = In_endgame(&u.uz) ? (8 * mlvl) : (4 * mlvl + d(mlvl, 4)); u.mhmax = In_endgame(&u.uz) ? (8 * mlvl) : (4 * mlvl + d(mlvl, 4));
} else if (is_golem(u.umonst->data)) { } else if (is_golem(gy.youmonst.data)) {
u.mhmax = golemhp(mntmp); u.mhmax = golemhp(mntmp);
} else { } else {
if (!mlvl) if (!mlvl)
@@ -891,7 +891,7 @@ polymon(int mntmp)
/* if hiding under something and can't hide anymore, unhide now; /* if hiding under something and can't hide anymore, unhide now;
but don't auto-hide when not already hiding-under */ but don't auto-hide when not already hiding-under */
if (was_hiding_under) if (was_hiding_under)
(void) hideunder(u.umonst); (void) hideunder(&gy.youmonst);
if (u.utrap && u.utraptype == TT_PIT) { if (u.utrap && u.utraptype == TT_PIT) {
set_utrap(rn1(6, 2), TT_PIT); /* time to escape resets */ set_utrap(rn1(6, 2), TT_PIT); /* time to escape resets */
@@ -904,7 +904,7 @@ polymon(int mntmp)
/* you now know what an egg of your type looks like; [moved from /* you now know what an egg of your type looks like; [moved from
below in case expels() -> spoteffects() drops hero onto any eggs] */ below in case expels() -> spoteffects() drops hero onto any eggs] */
if (lays_eggs(u.umonst->data)) { if (lays_eggs(gy.youmonst.data)) {
learn_egg_type(u.umonnum); learn_egg_type(u.umonnum);
/* make queen bees recognize killer bee eggs */ /* make queen bees recognize killer bee eggs */
learn_egg_type(egg_type_from_parent(u.umonnum, TRUE)); learn_egg_type(egg_type_from_parent(u.umonnum, TRUE));
@@ -914,13 +914,13 @@ polymon(int mntmp)
uchar usiz; uchar usiz;
/* if new form can't be swallowed, make engulfer expel hero */ /* if new form can't be swallowed, make engulfer expel hero */
if (unsolid(u.umonst->data) if (unsolid(gy.youmonst.data)
/* subset of engulf_target() */ /* subset of engulf_target() */
|| (usiz = u.umonst->data->msize) >= MZ_HUGE || (usiz = gy.youmonst.data->msize) >= MZ_HUGE
|| (u.ustuck->data->msize < usiz && !is_whirly(u.ustuck->data))) { || (u.ustuck->data->msize < usiz && !is_whirly(u.ustuck->data))) {
boolean expels_mesg = TRUE; boolean expels_mesg = TRUE;
if (unsolid(u.umonst->data)) { if (unsolid(gy.youmonst.data)) {
if (canspotmon(u.ustuck)) /* [see below for explanation] */ if (canspotmon(u.ustuck)) /* [see below for explanation] */
Strcpy(ustuckNam, Monnam(u.ustuck)); Strcpy(ustuckNam, Monnam(u.ustuck));
pline("%s can no longer contain you.", ustuckNam); pline("%s can no longer contain you.", ustuckNam);
@@ -939,7 +939,7 @@ polymon(int mntmp)
/* being held; if now capable of holding, make holder /* being held; if now capable of holding, make holder
release so that hero doesn't automagically start holding release so that hero doesn't automagically start holding
it; or, release if no longer capable of being held */ it; or, release if no longer capable of being held */
&& (sticks(u.umonst->data) || unsolid(u.umonst->data))) { && (sticks(gy.youmonst.data) || unsolid(gy.youmonst.data))) {
/* u.ustuck name was saved above in case we're changing from can-see /* u.ustuck name was saved above in case we're changing from can-see
to can't-see; but might have changed from can't-see to can-see so to can't-see; but might have changed from can't-see to can-see so
override here if hero knows who u.ustuck is */ override here if hero knows who u.ustuck is */
@@ -947,7 +947,7 @@ polymon(int mntmp)
Strcpy(ustuckNam, Monnam(u.ustuck)); Strcpy(ustuckNam, Monnam(u.ustuck));
set_ustuck((struct monst *) 0); set_ustuck((struct monst *) 0);
pline("%s loses its grip on you.", ustuckNam); pline("%s loses its grip on you.", ustuckNam);
} else if (sticking && !sticks(u.umonst->data)) { } else if (sticking && !sticks(gy.youmonst.data)) {
/* was holding onto u.ustuck but no longer capable of that */ /* was holding onto u.ustuck but no longer capable of that */
uunstick(); uunstick();
} }
@@ -982,13 +982,13 @@ polymon(int mntmp)
buried_ball_to_freedom(); buried_ball_to_freedom();
} }
reset_utrap(TRUE); reset_utrap(TRUE);
} else if (likes_lava(u.umonst->data) && u.utrap } else if (likes_lava(gy.youmonst.data) && u.utrap
&& u.utraptype == TT_LAVA) { && u.utraptype == TT_LAVA) {
pline_The("%s now feels soothing.", hliquid("lava")); pline_The("%s now feels soothing.", hliquid("lava"));
reset_utrap(TRUE); reset_utrap(TRUE);
} }
if (amorphous(u.umonst->data) || is_whirly(u.umonst->data) if (amorphous(gy.youmonst.data) || is_whirly(gy.youmonst.data)
|| unsolid(u.umonst->data)) { || unsolid(gy.youmonst.data)) {
if (Punished) { if (Punished) {
You("slip out of the iron chain."); You("slip out of the iron chain.");
unpunish(); unpunish();
@@ -998,16 +998,16 @@ polymon(int mntmp)
} }
} }
if (u.utrap && (u.utraptype == TT_WEB || u.utraptype == TT_BEARTRAP) if (u.utrap && (u.utraptype == TT_WEB || u.utraptype == TT_BEARTRAP)
&& (amorphous(u.umonst->data) || is_whirly(u.umonst->data) && (amorphous(gy.youmonst.data) || is_whirly(gy.youmonst.data)
|| unsolid(u.umonst->data) || unsolid(gy.youmonst.data)
|| (u.umonst->data->msize <= MZ_SMALL || (gy.youmonst.data->msize <= MZ_SMALL
&& u.utraptype == TT_BEARTRAP))) { && u.utraptype == TT_BEARTRAP))) {
You("are no longer stuck in the %s.", You("are no longer stuck in the %s.",
u.utraptype == TT_WEB ? "web" : "bear trap"); u.utraptype == TT_WEB ? "web" : "bear trap");
/* probably should burn webs too if PM_FIRE_ELEMENTAL */ /* probably should burn webs too if PM_FIRE_ELEMENTAL */
reset_utrap(TRUE); reset_utrap(TRUE);
} }
if (webmaker(u.umonst->data) && u.utrap && u.utraptype == TT_WEB) { if (webmaker(gy.youmonst.data) && u.utrap && u.utraptype == TT_WEB) {
You("orient yourself on the web."); You("orient yourself on the web.");
reset_utrap(TRUE); reset_utrap(TRUE);
} }
@@ -1031,7 +1031,7 @@ polymon(int mntmp)
if (flags.verbose) { if (flags.verbose) {
static const char use_thec[] = "Use the command #%s to %s."; static const char use_thec[] = "Use the command #%s to %s.";
static const char monsterc[] = "monster"; static const char monsterc[] = "monster";
struct permonst *uptr = u.umonst->data; struct permonst *uptr = gy.youmonst.data;
boolean might_hide = (is_hider(uptr) || hides_under(uptr)); boolean might_hide = (is_hider(uptr) || hides_under(uptr));
if (can_breathe(uptr)) if (can_breathe(uptr))
@@ -1058,7 +1058,7 @@ polymon(int mntmp)
pline(use_thec, monsterc, "emit a mental blast"); pline(use_thec, monsterc, "emit a mental blast");
if (uptr->msound == MS_SHRIEK) /* worthless, actually */ if (uptr->msound == MS_SHRIEK) /* worthless, actually */
pline(use_thec, monsterc, "shriek"); pline(use_thec, monsterc, "shriek");
if (is_vampire(uptr) || is_vampshifter(u.umonst)) if (is_vampire(uptr) || is_vampshifter(&gy.youmonst))
pline(use_thec, monsterc, "change shape"); pline(use_thec, monsterc, "change shape");
if (lays_eggs(uptr) && flags.female if (lays_eggs(uptr) && flags.female
@@ -1157,7 +1157,7 @@ staticfn void
break_armor(void) break_armor(void)
{ {
struct obj *otmp; struct obj *otmp;
struct permonst *uptr = u.umonst->data; struct permonst *uptr = gy.youmonst.data;
if (breakarm(uptr)) { if (breakarm(uptr)) {
if ((otmp = uarm) != 0) { if ((otmp = uarm) != 0) {
@@ -1196,7 +1196,7 @@ break_armor(void)
useup(uarmu); useup(uarmu);
} }
} else if (sliparm(uptr)) { } else if (sliparm(uptr)) {
if ((otmp = uarm) != 0 && racial_exception(u.umonst, otmp) < 1) { if ((otmp = uarm) != 0 && racial_exception(&gy.youmonst, otmp) < 1) {
if (donning(otmp)) if (donning(otmp))
cancel_don(); cancel_don();
Your("armor falls around you!"); Your("armor falls around you!");
@@ -1313,7 +1313,7 @@ drop_weapon(int alone)
* future it might not be so if there are monsters which cannot * future it might not be so if there are monsters which cannot
* wear gloves but can wield weapons * wear gloves but can wield weapons
*/ */
if (!alone || cantwield(u.umonst->data)) { if (!alone || cantwield(gy.youmonst.data)) {
candropwep = canletgo(uwep, ""); candropwep = canletgo(uwep, "");
candropswapwep = !u.twoweap || canletgo(uswapwep, ""); candropswapwep = !u.twoweap || canletgo(uswapwep, "");
if (alone) { if (alone) {
@@ -1355,7 +1355,7 @@ drop_weapon(int alone)
if (updateinv) if (updateinv)
update_inventory(); update_inventory();
} else if (!could_twoweap(u.umonst->data)) { } else if (!could_twoweap(gy.youmonst.data)) {
untwoweapon(); untwoweapon();
} }
} }
@@ -1390,8 +1390,8 @@ rehumanize(void)
* reverts to human rather than to vampire. * reverts to human rather than to vampire.
*/ */
if (emits_light(u.umonst->data)) if (emits_light(gy.youmonst.data))
del_light_source(LS_MONSTER, monst_to_any(u.umonst)); del_light_source(LS_MONSTER, monst_to_any(&gy.youmonst));
polyman("You return to %s form!", gu.urace.adj); polyman("You return to %s form!", gu.urace.adj);
if (u.uhp < 1) { if (u.uhp < 1) {
@@ -1436,7 +1436,7 @@ dobreathe(void)
if (!getdir((char *) 0)) if (!getdir((char *) 0))
return ECMD_CANCEL; return ECMD_CANCEL;
mattk = attacktype_fordmg(u.umonst->data, AT_BREA, AD_ANY); mattk = attacktype_fordmg(gy.youmonst.data, AT_BREA, AD_ANY);
if (!mattk) if (!mattk)
impossible("bad breath attack?"); /* mouthwash needed... */ impossible("bad breath attack?"); /* mouthwash needed... */
else if (!u.dx && !u.dy && !u.dz) else if (!u.dx && !u.dy && !u.dz)
@@ -1454,7 +1454,7 @@ dospit(void)
if (!getdir((char *) 0)) if (!getdir((char *) 0))
return ECMD_CANCEL; return ECMD_CANCEL;
mattk = attacktype_fordmg(u.umonst->data, AT_SPIT, AD_ANY); mattk = attacktype_fordmg(gy.youmonst.data, AT_SPIT, AD_ANY);
if (!mattk) { if (!mattk) {
impossible("bad spit attack?"); impossible("bad spit attack?");
} else { } else {
@@ -1633,7 +1633,7 @@ dosummon(void)
You("call upon your brethren for help!"); You("call upon your brethren for help!");
exercise(A_WIS, TRUE); exercise(A_WIS, TRUE);
if (!were_summon(u.umonst->data, TRUE, &placeholder, (char *) 0)) if (!were_summon(gy.youmonst.data, TRUE, &placeholder, (char *) 0))
pline("But none arrive."); pline("But none arrive.");
return ECMD_TIME; return ECMD_TIME;
} }
@@ -1648,8 +1648,8 @@ dogaze(void)
uchar adtyp = 0; uchar adtyp = 0;
for (i = 0; i < NATTK; i++) { for (i = 0; i < NATTK; i++) {
if (u.umonst->data->mattk[i].aatyp == AT_GAZE) { if (gy.youmonst.data->mattk[i].aatyp == AT_GAZE) {
adtyp = u.umonst->data->mattk[i].adtyp; adtyp = gy.youmonst.data->mattk[i].adtyp;
break; break;
} }
} }
@@ -1776,8 +1776,8 @@ dogaze(void)
int int
dohide(void) dohide(void)
{ {
boolean ismimic = u.umonst->data->mlet == S_MIMIC, boolean ismimic = gy.youmonst.data->mlet == S_MIMIC,
on_ceiling = is_clinger(u.umonst->data) || Flying; on_ceiling = is_clinger(gy.youmonst.data) || Flying;
/* can't hide while being held (or holding) or while trapped /* can't hide while being held (or holding) or while trapped
(except for floor hiders [trapper or mimic] in pits) */ (except for floor hiders [trapper or mimic] in pits) */
@@ -1786,19 +1786,19 @@ dohide(void)
!u.ustuck ? "trapped" !u.ustuck ? "trapped"
: u.uswallow ? (digests(u.ustuck->data) ? "swallowed" : u.uswallow ? (digests(u.ustuck->data) ? "swallowed"
: "engulfed") : "engulfed")
: !sticks(u.umonst->data) ? "being held" : !sticks(gy.youmonst.data) ? "being held"
: (humanoid(u.ustuck->data) ? "holding someone" : (humanoid(u.ustuck->data) ? "holding someone"
: "holding that creature")); : "holding that creature"));
if (u.uundetected || (ismimic && U_AP_TYPE != M_AP_NOTHING)) { if (u.uundetected || (ismimic && U_AP_TYPE != M_AP_NOTHING)) {
u.uundetected = 0; u.uundetected = 0;
u.umonst->m_ap_type = M_AP_NOTHING; gy.youmonst.m_ap_type = M_AP_NOTHING;
newsym(u.ux, u.uy); newsym(u.ux, u.uy);
} }
return ECMD_OK; return ECMD_OK;
} }
/* note: hero-as-eel handling is incomplete but unnecessary; /* note: hero-as-eel handling is incomplete but unnecessary;
such critters aren't offered the option of hiding via #monster */ such critters aren't offered the option of hiding via #monster */
if (u.umonst->data->mlet == S_EEL && !is_pool(u.ux, u.uy)) { if (gy.youmonst.data->mlet == S_EEL && !is_pool(u.ux, u.uy)) {
if (IS_FOUNTAIN(levl[u.ux][u.uy].typ)) if (IS_FOUNTAIN(levl[u.ux][u.uy].typ))
pline_The("fountain is not deep enough to hide in."); pline_The("fountain is not deep enough to hide in.");
else else
@@ -1806,7 +1806,7 @@ dohide(void)
u.uundetected = 0; u.uundetected = 0;
return ECMD_OK; return ECMD_OK;
} }
if (hides_under(u.umonst->data)) { if (hides_under(gy.youmonst.data)) {
long ct = 0L; long ct = 0L;
struct obj *otmp, *otop = svl.level.objects[u.ux][u.uy]; struct obj *otmp, *otop = svl.level.objects[u.ux][u.uy];
@@ -1847,7 +1847,7 @@ dohide(void)
u.uundetected = 0; u.uundetected = 0;
return ECMD_OK; return ECMD_OK;
} }
if ((is_hider(u.umonst->data) && !Flying) /* floor hider */ if ((is_hider(gy.youmonst.data) && !Flying) /* floor hider */
&& (Is_airlevel(&u.uz) || Is_waterlevel(&u.uz))) { && (Is_airlevel(&u.uz) || Is_waterlevel(&u.uz))) {
There("is nowhere to hide beneath you."); There("is nowhere to hide beneath you.");
u.uundetected = 0; u.uundetected = 0;
@@ -1864,8 +1864,8 @@ dohide(void)
if (ismimic) { if (ismimic) {
/* should bring up a dialog "what would you like to imitate?" */ /* should bring up a dialog "what would you like to imitate?" */
u.umonst->m_ap_type = M_AP_OBJECT; gy.youmonst.m_ap_type = M_AP_OBJECT;
u.umonst->mappearance = STRANGE_OBJECT; gy.youmonst.mappearance = STRANGE_OBJECT;
} else } else
u.uundetected = 1; u.uundetected = 1;
newsym(u.ux, u.uy); newsym(u.ux, u.uy);
@@ -1876,13 +1876,13 @@ dohide(void)
int int
dopoly(void) dopoly(void)
{ {
struct permonst *savedat = u.umonst->data; struct permonst *savedat = gy.youmonst.data;
if (is_vampire(u.umonst->data) || is_vampshifter(u.umonst)) { if (is_vampire(gy.youmonst.data) || is_vampshifter(&gy.youmonst)) {
polyself(POLY_MONSTER); polyself(POLY_MONSTER);
if (savedat != u.umonst->data) { if (savedat != gy.youmonst.data) {
You("transform into %s.", You("transform into %s.",
an(pmname(u.umonst->data, Ugender))); an(pmname(gy.youmonst.data, Ugender)));
newsym(u.ux, u.uy); newsym(u.ux, u.uy);
} }
} }
@@ -2142,7 +2142,7 @@ mbodypart(struct monst *mon, int part)
const char * const char *
body_part(int part) body_part(int part)
{ {
return mbodypart(u.umonst, part); return mbodypart(&gy.youmonst, part);
} }
int int
@@ -2151,7 +2151,7 @@ poly_gender(void)
/* Returns gender of polymorphed player; /* Returns gender of polymorphed player;
* 0/1=same meaning as flags.female, 2=none. * 0/1=same meaning as flags.female, 2=none.
*/ */
if (is_neuter(u.umonst->data) || !humanoid(u.umonst->data)) if (is_neuter(gy.youmonst.data) || !humanoid(gy.youmonst.data))
return 2; return 2;
return flags.female; return flags.female;
} }
@@ -2276,9 +2276,9 @@ udeadinside(void)
seems silly when you're polymorphed into something undead; seems silly when you're polymorphed into something undead;
monkilled() distinguishes between living (killed) and non (destroyed) monkilled() distinguishes between living (killed) and non (destroyed)
for monster death message; we refine the nonliving aspect a bit */ for monster death message; we refine the nonliving aspect a bit */
return !nonliving(u.umonst->data) return !nonliving(gy.youmonst.data)
? "dead" /* living, including demons */ ? "dead" /* living, including demons */
: !weirdnonliving(u.umonst->data) : !weirdnonliving(gy.youmonst.data)
? "condemned" /* undead plus manes */ ? "condemned" /* undead plus manes */
: "empty"; /* golems plus vortices */ : "empty"; /* golems plus vortices */
} }
+24 -24
View File
@@ -121,7 +121,7 @@ make_stunned(long xtime, boolean talk)
if (u.usteed) if (u.usteed)
You("wobble in the saddle."); You("wobble in the saddle.");
else else
You("%s...", stagger(u.umonst->data, "stagger")); You("%s...", stagger(gy.youmonst.data, "stagger"));
} }
} }
if ((!xtime && old) || (xtime && !old)) if ((!xtime && old) || (xtime && !old))
@@ -210,9 +210,9 @@ make_slimed(long xtime, const char *msg)
dealloc_killer(find_delayed_killer(SLIMED)); dealloc_killer(find_delayed_killer(SLIMED));
/* fake appearance is set late in turn-to-slime countdown */ /* fake appearance is set late in turn-to-slime countdown */
if (U_AP_TYPE == M_AP_MONSTER if (U_AP_TYPE == M_AP_MONSTER
&& u.umonst->mappearance == PM_GREEN_SLIME) { && gy.youmonst.mappearance == PM_GREEN_SLIME) {
u.umonst->m_ap_type = M_AP_NOTHING; gy.youmonst.m_ap_type = M_AP_NOTHING;
u.umonst->mappearance = 0; gy.youmonst.mappearance = 0;
} }
} }
} }
@@ -284,11 +284,11 @@ make_blinded(long xtime, boolean talk)
} else if (old && !xtime) { } else if (old && !xtime) {
/* clearing temporary blindness without toggling blindness */ /* clearing temporary blindness without toggling blindness */
if (talk) { if (talk) {
if (!haseyes(u.umonst->data) || PermaBlind) { if (!haseyes(gy.youmonst.data) || PermaBlind) {
strange_feeling((struct obj *) 0, (char *) 0); strange_feeling((struct obj *) 0, (char *) 0);
} else if (Blindfolded) { } else if (Blindfolded) {
eyes = body_part(EYE); eyes = body_part(EYE);
if (eyecount(u.umonst->data) != 1) if (eyecount(gy.youmonst.data) != 1)
eyes = makeplural(eyes); eyes = makeplural(eyes);
Your(eyemsg, eyes, vtense(eyes, "itch")); Your(eyemsg, eyes, vtense(eyes, "itch"));
} else { /* Eyes of the Overworld */ } else { /* Eyes of the Overworld */
@@ -310,11 +310,11 @@ make_blinded(long xtime, boolean talk)
} else if (!old && xtime) { } else if (!old && xtime) {
/* setting temporary blindness without toggling blindness */ /* setting temporary blindness without toggling blindness */
if (talk) { if (talk) {
if (!haseyes(u.umonst->data) || PermaBlind) { if (!haseyes(gy.youmonst.data) || PermaBlind) {
strange_feeling((struct obj *) 0, (char *) 0); strange_feeling((struct obj *) 0, (char *) 0);
} else if (Blindfolded) { } else if (Blindfolded) {
eyes = body_part(EYE); eyes = body_part(EYE);
if (eyecount(u.umonst->data) != 1) if (eyecount(gy.youmonst.data) != 1)
eyes = makeplural(eyes); eyes = makeplural(eyes);
Your(eyemsg, eyes, vtense(eyes, "twitch")); Your(eyemsg, eyes, vtense(eyes, "twitch"));
} else { /* Eyes of the Overworld */ } else { /* Eyes of the Overworld */
@@ -397,12 +397,12 @@ make_hallucinated(
/* clearing temporary hallucination without toggling vision */ /* clearing temporary hallucination without toggling vision */
if (!changed && !HHallucination && old && talk) { if (!changed && !HHallucination && old && talk) {
if (!haseyes(u.umonst->data)) { if (!haseyes(gy.youmonst.data)) {
strange_feeling((struct obj *) 0, (char *) 0); strange_feeling((struct obj *) 0, (char *) 0);
} else if (Blind) { } else if (Blind) {
const char *eyes = body_part(EYE); const char *eyes = body_part(EYE);
if (eyecount(u.umonst->data) != 1) if (eyecount(gy.youmonst.data) != 1)
eyes = makeplural(eyes); eyes = makeplural(eyes);
Your(eyemsg, eyes, vtense(eyes, "itch")); Your(eyemsg, eyes, vtense(eyes, "itch"));
} else { /* Grayswandir */ } else { /* Grayswandir */
@@ -723,7 +723,7 @@ peffect_water(struct obj *otmp)
return; return;
} }
gp.potion_unkn++; gp.potion_unkn++;
if (mon_hates_blessings(u.umonst) /* undead or demon */ if (mon_hates_blessings(&gy.youmonst) /* undead or demon */
|| u.ualign.type == A_CHAOTIC) { || u.ualign.type == A_CHAOTIC) {
if (otmp->blessed) { if (otmp->blessed) {
pline("This burns like %s!", hliquid("acid")); pline("This burns like %s!", hliquid("acid"));
@@ -731,7 +731,7 @@ peffect_water(struct obj *otmp)
if (ismnum(u.ulycn)) { if (ismnum(u.ulycn)) {
Your("affinity to %s disappears!", Your("affinity to %s disappears!",
makeplural(mons[u.ulycn].pmnames[NEUTRAL])); makeplural(mons[u.ulycn].pmnames[NEUTRAL]));
if (u.umonst->data == &mons[u.ulycn]) if (gy.youmonst.data == &mons[u.ulycn])
you_unwere(FALSE); you_unwere(FALSE);
set_ulycn(NON_PM); /* cure lycanthropy */ set_ulycn(NON_PM); /* cure lycanthropy */
} }
@@ -1262,7 +1262,7 @@ peffect_oil(struct obj *otmp)
boolean good_for_you = FALSE, vulnerable; boolean good_for_you = FALSE, vulnerable;
if (otmp->lamplit) { if (otmp->lamplit) {
if (likes_fire(u.umonst->data)) { if (likes_fire(gy.youmonst.data)) {
pline("Ahh, a refreshing drink."); pline("Ahh, a refreshing drink.");
good_for_you = TRUE; good_for_you = TRUE;
} else { } else {
@@ -1620,12 +1620,12 @@ impact_arti_light(
return; return;
} }
/* potion obj hits monster mon, which might be u.umonst; obj always used up */ /* potion obj hits monster mon, which might be youmonst; obj always used up */
void void
potionhit(struct monst *mon, struct obj *obj, int how) potionhit(struct monst *mon, struct obj *obj, int how)
{ {
const char *botlnam = bottlename(); const char *botlnam = bottlename();
boolean isyou = (mon == u.umonst); boolean isyou = (mon == &gy.youmonst);
int distance, tx, ty; int distance, tx, ty;
struct obj *saddle = (struct obj *) 0; struct obj *saddle = (struct obj *) 0;
boolean hit_saddle = FALSE, your_fault = (how <= POTHIT_HERO_THROW); boolean hit_saddle = FALSE, your_fault = (how <= POTHIT_HERO_THROW);
@@ -1905,7 +1905,7 @@ potionhit(struct monst *mon, struct obj *obj, int how)
/* Note: potionbreathe() does its own docall() */ /* Note: potionbreathe() does its own docall() */
if ((distance == 0 || (distance < 3 && !rn2((1+ACURR(A_DEX))/2))) if ((distance == 0 || (distance < 3 && !rn2((1+ACURR(A_DEX))/2)))
&& (!breathless(u.umonst->data) || haseyes(u.umonst->data))) && (!breathless(gy.youmonst.data) || haseyes(gy.youmonst.data)))
potionbreathe(obj); potionbreathe(obj);
else if (obj->dknown && cansee(tx, ty)) else if (obj->dknown && cansee(tx, ty))
trycall(obj); trycall(obj);
@@ -1950,12 +1950,12 @@ potionbreathe(struct obj *obj)
case POT_RESTORE_ABILITY: case POT_RESTORE_ABILITY:
case POT_GAIN_ABILITY: case POT_GAIN_ABILITY:
if (obj->cursed) { if (obj->cursed) {
if (!breathless(u.umonst->data)) { if (!breathless(gy.youmonst.data)) {
pline("Ulch! That potion smells terrible!"); pline("Ulch! That potion smells terrible!");
} else if (haseyes(u.umonst->data)) { } else if (haseyes(gy.youmonst.data)) {
const char *eyes = body_part(EYE); const char *eyes = body_part(EYE);
if (eyecount(u.umonst->data) != 1) if (eyecount(gy.youmonst.data) != 1)
eyes = makeplural(eyes); eyes = makeplural(eyes);
Your("%s %s!", eyes, vtense(eyes, "sting")); Your("%s %s!", eyes, vtense(eyes, "sting"));
} }
@@ -2079,11 +2079,11 @@ potionbreathe(struct obj *obj)
break; break;
case POT_WATER: case POT_WATER:
if (u.umonnum == PM_GREMLIN) { if (u.umonnum == PM_GREMLIN) {
(void) split_mon(u.umonst, (struct monst *) 0); (void) split_mon(&gy.youmonst, (struct monst *) 0);
} else if (ismnum(u.ulycn)) { } else if (ismnum(u.ulycn)) {
/* vapor from [un]holy water will trigger /* vapor from [un]holy water will trigger
transformation but won't cure lycanthropy */ transformation but won't cure lycanthropy */
if (obj->blessed && u.umonst->data == &mons[u.ulycn]) if (obj->blessed && gy.youmonst.data == &mons[u.ulycn])
you_unwere(FALSE); you_unwere(FALSE);
else if (obj->cursed && !Upolyd) else if (obj->cursed && !Upolyd)
you_were(); you_were();
@@ -2427,7 +2427,7 @@ dip_potion_explosion(struct obj *obj, int dmg)
pline("%sThey explode!", !Deaf ? "BOOM! " : ""); pline("%sThey explode!", !Deaf ? "BOOM! " : "");
wake_nearto(u.ux, u.uy, (BOLT_LIM + 1) * (BOLT_LIM + 1)); wake_nearto(u.ux, u.uy, (BOLT_LIM + 1) * (BOLT_LIM + 1));
exercise(A_STR, FALSE); exercise(A_STR, FALSE);
if (!breathless(u.umonst->data) || haseyes(u.umonst->data)) if (!breathless(gy.youmonst.data) || haseyes(gy.youmonst.data))
potionbreathe(obj); potionbreathe(obj);
useupall(obj); useupall(obj);
losehp(dmg, /* not physical damage */ losehp(dmg, /* not physical damage */
@@ -2880,10 +2880,10 @@ split_mon(
reason[0] = '\0'; reason[0] = '\0';
if (mtmp) if (mtmp)
Sprintf(reason, " from %s heat", Sprintf(reason, " from %s heat",
(mtmp == u.umonst) ? the_your[1] (mtmp == &gy.youmonst) ? the_your[1]
: (const char *) s_suffix(mon_nam(mtmp))); : (const char *) s_suffix(mon_nam(mtmp)));
if (mon == u.umonst) { if (mon == &gy.youmonst) {
if (u.mh > u.mhmax) /* sanity precaution */ if (u.mh > u.mhmax) /* sanity precaution */
u.mh = u.mhmax; u.mh = u.mhmax;
mtmp2 = (u.mh > 1) ? cloneu() : (struct monst *) 0; mtmp2 = (u.mh > 1) ? cloneu() : (struct monst *) 0;
+15 -15
View File
@@ -173,7 +173,7 @@ stuck_in_wall(void)
if (!isok(x, y) if (!isok(x, y)
|| (IS_OBSTRUCTED(levl[x][y].typ) || (IS_OBSTRUCTED(levl[x][y].typ)
&& (levl[x][y].typ != SDOOR && levl[x][y].typ != SCORR)) && (levl[x][y].typ != SDOOR && levl[x][y].typ != SCORR))
|| (blocked_boulder(i, j) && !throws_rocks(u.umonst->data))) || (blocked_boulder(i, j) && !throws_rocks(gy.youmonst.data)))
++count; ++count;
} }
} }
@@ -229,13 +229,13 @@ in_trouble(void)
|| stuck_ring(uleft, RIN_LEVITATION) || stuck_ring(uleft, RIN_LEVITATION)
|| stuck_ring(uright, RIN_LEVITATION)) || stuck_ring(uright, RIN_LEVITATION))
return TROUBLE_CURSED_LEVITATION; return TROUBLE_CURSED_LEVITATION;
if (nohands(u.umonst->data) || !freehand()) { if (nohands(gy.youmonst.data) || !freehand()) {
/* for bag/box access [cf use_container()]... /* for bag/box access [cf use_container()]...
make sure it's a case that we know how to handle; make sure it's a case that we know how to handle;
otherwise "fix all troubles" would get stuck in a loop */ otherwise "fix all troubles" would get stuck in a loop */
if (welded(uwep)) if (welded(uwep))
return TROUBLE_UNUSEABLE_HANDS; return TROUBLE_UNUSEABLE_HANDS;
if (Upolyd && nohands(u.umonst->data) if (Upolyd && nohands(gy.youmonst.data)
&& (!Unchanging || ((otmp = unchanger()) != 0 && otmp->cursed))) && (!Unchanging || ((otmp = unchanger()) != 0 && otmp->cursed)))
return TROUBLE_UNUSEABLE_HANDS; return TROUBLE_UNUSEABLE_HANDS;
} }
@@ -494,7 +494,7 @@ fix_worst_trouble(int trouble)
fix_curse_trouble(otmp, what); fix_curse_trouble(otmp, what);
break; break;
} }
if (Upolyd && nohands(u.umonst->data)) { if (Upolyd && nohands(gy.youmonst.data)) {
if (!Unchanging) { if (!Unchanging) {
Your("shape becomes uncertain."); Your("shape becomes uncertain.");
rehumanize(); /* "You return to {normal} form." */ rehumanize(); /* "You return to {normal} form." */
@@ -504,7 +504,7 @@ fix_worst_trouble(int trouble)
break; break;
} }
} }
if (nohands(u.umonst->data) || !freehand()) if (nohands(gy.youmonst.data) || !freehand())
impossible("fix_worst_trouble: couldn't cure hands."); impossible("fix_worst_trouble: couldn't cure hands.");
break; break;
case TROUBLE_CURSED_BLINDFOLD: case TROUBLE_CURSED_BLINDFOLD:
@@ -559,7 +559,7 @@ fix_worst_trouble(int trouble)
msgbuf[0] = '\0'; msgbuf[0] = '\0';
if (Blinded) { if (Blinded) {
if (eyecount(u.umonst->data) != 1) if (eyecount(gy.youmonst.data) != 1)
eyes = makeplural(eyes); eyes = makeplural(eyes);
Sprintf(msgbuf, "Your %s %s better", eyes, vtense(eyes, "feel")); Sprintf(msgbuf, "Your %s %s better", eyes, vtense(eyes, "feel"));
u.ucreamed = 0; u.ucreamed = 0;
@@ -735,7 +735,7 @@ angrygods(aligntyp resp_god)
(ugod_is_angry() && resp_god == u.ualign.type) (ugod_is_angry() && resp_god == u.ualign.type)
? "hast strayed from the path" ? "hast strayed from the path"
: "art arrogant", : "art arrogant",
u.umonst->data->mlet == S_HUMAN ? "mortal" : "creature"); gy.youmonst.data->mlet == S_HUMAN ? "mortal" : "creature");
SetVoice((struct monst *) 0, 0, 80, voice_deity); SetVoice((struct monst *) 0, 0, 80, voice_deity);
verbalize("Thou must relearn thy lessons!"); verbalize("Thou must relearn thy lessons!");
(void) adjattrib(A_WIS, -1, FALSE); (void) adjattrib(A_WIS, -1, FALSE);
@@ -767,7 +767,7 @@ angrygods(aligntyp resp_god)
: "call upon"); : "call upon");
/* [why isn't this using verbalize()?] */ /* [why isn't this using verbalize()?] */
pline("\"Then die, %s!\"", pline("\"Then die, %s!\"",
(u.umonst->data->mlet == S_HUMAN) ? "mortal" : "creature"); (gy.youmonst.data->mlet == S_HUMAN) ? "mortal" : "creature");
summon_minion(resp_god, FALSE); summon_minion(resp_god, FALSE);
break; break;
@@ -1224,7 +1224,7 @@ pleased(aligntyp g_align)
if (u.uevent.uheard_tune < 1) { if (u.uevent.uheard_tune < 1) {
godvoice(g_align, (char *) 0); godvoice(g_align, (char *) 0);
SetVoice((struct monst *) 0, 0, 80, voice_deity); SetVoice((struct monst *) 0, 0, 80, voice_deity);
verbalize("Hark, %s!", is_human(u.umonst->data) verbalize("Hark, %s!", is_human(gy.youmonst.data)
? "mortal" ? "mortal"
: "creature"); : "creature");
SetVoice((struct monst *) 0, 0, 80, voice_deity); SetVoice((struct monst *) 0, 0, 80, voice_deity);
@@ -1702,7 +1702,7 @@ sacrifice_your_race(
{ {
int pm; int pm;
if (is_demon(u.umonst->data)) { if (is_demon(gy.youmonst.data)) {
You("find the idea very satisfying."); You("find the idea very satisfying.");
exercise(A_WIS, TRUE); exercise(A_WIS, TRUE);
} else if (u.ualign.type != A_CHAOTIC) { } else if (u.ualign.type != A_CHAOTIC) {
@@ -2128,7 +2128,7 @@ can_pray(boolean praying) /* false means no messages should be given */
gp.p_aligntyp = on_altar() ? a_align(u.ux, u.uy) : u.ualign.type; gp.p_aligntyp = on_altar() ? a_align(u.ux, u.uy) : u.ualign.type;
gp.p_trouble = in_trouble(); gp.p_trouble = in_trouble();
if (is_demon(u.umonst->data) /* ok if chaotic or none (Moloch) */ if (is_demon(gy.youmonst.data) /* ok if chaotic or none (Moloch) */
&& (gp.p_aligntyp == A_LAWFUL || gp.p_aligntyp != A_NEUTRAL)) { && (gp.p_aligntyp == A_LAWFUL || gp.p_aligntyp != A_NEUTRAL)) {
if (praying) if (praying)
pline_The("very idea of praying to a %s god is repugnant to you.", pline_The("very idea of praying to a %s god is repugnant to you.",
@@ -2161,7 +2161,7 @@ can_pray(boolean praying) /* false means no messages should be given */
gp.p_type = 3; gp.p_type = 3;
} }
if (is_undead(u.umonst->data) && !Inhell if (is_undead(gy.youmonst.data) && !Inhell
&& (gp.p_aligntyp == A_LAWFUL && (gp.p_aligntyp == A_LAWFUL
|| (gp.p_aligntyp == A_NEUTRAL && !rn2(10)))) || (gp.p_aligntyp == A_NEUTRAL && !rn2(10))))
gp.p_type = -1; gp.p_type = -1;
@@ -2429,7 +2429,7 @@ doturn(void)
Gname = halu_gname(u.ualign.type); Gname = halu_gname(u.ualign.type);
/* [What about needing free hands (does #turn involve any gesturing)?] */ /* [What about needing free hands (does #turn involve any gesturing)?] */
if (!can_chant(u.umonst)) { if (!can_chant(&gy.youmonst)) {
/* "evilness": "demons and undead" is too verbose and too precise */ /* "evilness": "demons and undead" is too verbose and too precise */
You("are %s upon %s to turn aside evilness.", You("are %s upon %s to turn aside evilness.",
Strangled ? "not able to call" : "incapable of calling", Gname); Strangled ? "not able to call" : "incapable of calling", Gname);
@@ -2439,8 +2439,8 @@ doturn(void)
return (u.uconduct.gnostic == 1) ? ECMD_TIME : ECMD_OK; return (u.uconduct.gnostic == 1) ? ECMD_TIME : ECMD_OK;
} }
if ((u.ualign.type != A_CHAOTIC if ((u.ualign.type != A_CHAOTIC
&& (is_demon(u.umonst->data) && (is_demon(gy.youmonst.data)
|| is_undead(u.umonst->data) || is_vampshifter(u.umonst))) || is_undead(gy.youmonst.data) || is_vampshifter(&gy.youmonst)))
|| u.ugangr > 6) { /* "Die, mortal!" */ || u.ugangr > 6) { /* "Die, mortal!" */
pline("For some reason, %s seems to ignore you.", Gname); pline("For some reason, %s seems to ignore you.", Gname);
aggravate(); aggravate();
+17 -17
View File
@@ -610,7 +610,7 @@ doread(void)
} }
scroll->in_use = TRUE; /* scroll, not spellbook, now being read */ scroll->in_use = TRUE; /* scroll, not spellbook, now being read */
if (otyp != SCR_BLANK_PAPER) { if (otyp != SCR_BLANK_PAPER) {
boolean silently = !can_chant(u.umonst); boolean silently = !can_chant(&gy.youmonst);
/* a few scroll feedback messages describe something happening /* a few scroll feedback messages describe something happening
to the scroll itself, so avoid "it disappears" for those */ to the scroll itself, so avoid "it disappears" for those */
@@ -1118,7 +1118,7 @@ seffect_enchant_armor(struct obj **sobjp)
schar s; schar s;
boolean special_armor; boolean special_armor;
boolean same_color; boolean same_color;
struct obj *otmp = some_armor(u.umonst); struct obj *otmp = some_armor(&gy.youmonst);
boolean sblessed = sobj->blessed; boolean sblessed = sobj->blessed;
boolean scursed = sobj->cursed; boolean scursed = sobj->cursed;
boolean confused = (Confusion != 0); boolean confused = (Confusion != 0);
@@ -1324,7 +1324,7 @@ staticfn void
seffect_destroy_armor(struct obj **sobjp) seffect_destroy_armor(struct obj **sobjp)
{ {
struct obj *sobj = *sobjp; struct obj *sobj = *sobjp;
struct obj *otmp = some_armor(u.umonst); struct obj *otmp = some_armor(&gy.youmonst);
boolean scursed = sobj->cursed; boolean scursed = sobj->cursed;
boolean confused = (Confusion != 0); boolean confused = (Confusion != 0);
boolean old_erodeproof, new_erodeproof; boolean old_erodeproof, new_erodeproof;
@@ -1405,7 +1405,7 @@ seffect_confuse_monster(struct obj **sobjp)
altfeedback = (Blind || Invisible); altfeedback = (Blind || Invisible);
const char *const hands = makeplural(body_part(HAND)); const char *const hands = makeplural(body_part(HAND));
if (u.umonst->data->mlet != S_HUMAN || scursed) { if (gy.youmonst.data->mlet != S_HUMAN || scursed) {
if (!HConfusion) if (!HConfusion)
You_feel("confused."); You_feel("confused.");
make_confused(HConfusion + rnd(100), FALSE); make_confused(HConfusion + rnd(100), FALSE);
@@ -2311,10 +2311,10 @@ drop_boulder_on_player(
return; return;
otmp2->quan = confused ? rn1(5, 2) : 1; otmp2->quan = confused ? rn1(5, 2) : 1;
otmp2->owt = weight(otmp2); otmp2->owt = weight(otmp2);
if (!amorphous(u.umonst->data) && !Passes_walls if (!amorphous(gy.youmonst.data) && !Passes_walls
&& !noncorporeal(u.umonst->data) && !unsolid(u.umonst->data)) { && !noncorporeal(gy.youmonst.data) && !unsolid(gy.youmonst.data)) {
You("are hit by %s!", doname(otmp2)); You("are hit by %s!", doname(otmp2));
dmg = (int) (dmgval(otmp2, u.umonst) * otmp2->quan); dmg = (int) (dmgval(otmp2, &gy.youmonst) * otmp2->quan);
if (uarmh && helmet_protects) { if (uarmh && helmet_protects) {
if (hard_helmet(uarmh)) { if (hard_helmet(uarmh)) {
pline("Fortunately, you are wearing a hard helmet."); pline("Fortunately, you are wearing a hard helmet.");
@@ -2749,9 +2749,9 @@ do_class_genocide(void)
kill_genocided_monsters(); kill_genocided_monsters();
update_inventory(); /* eggs & tins */ update_inventory(); /* eggs & tins */
pline("Wiped out all %s.", nam); pline("Wiped out all %s.", nam);
if (Upolyd && vampshifted(u.umonst) if (Upolyd && vampshifted(&gy.youmonst)
/* current shifted form or base vampire form */ /* current shifted form or base vampire form */
&& (i == u.umonnum || i == u.umonst->cham)) && (i == u.umonnum || i == gy.youmonst.cham))
polyself(POLY_REVERT); /* vampshifter to vampire */ polyself(POLY_REVERT); /* vampshifter to vampire */
if (Upolyd && i == u.umonnum) { if (Upolyd && i == u.umonnum) {
u.mh = -1; u.mh = -1;
@@ -2895,8 +2895,8 @@ do_genocide(
} }
ptr = &mons[mndx]; ptr = &mons[mndx];
/* first revert if current shifted form or base vampire form */ /* first revert if current shifted form or base vampire form */
if (Upolyd && vampshifted(u.umonst) if (Upolyd && vampshifted(&gy.youmonst)
&& (mndx == u.umonnum || mndx == u.umonst->cham)) && (mndx == u.umonnum || mndx == gy.youmonst.cham))
polyself(POLY_REVERT); /* vampshifter (bat, &c) to vampire */ polyself(POLY_REVERT); /* vampshifter (bat, &c) to vampire */
/* Although "genus" is Latin for race, the hero benefits /* Although "genus" is Latin for race, the hero benefits
* from both race and role; thus genocide affects either. * from both race and role; thus genocide affects either.
@@ -2926,7 +2926,7 @@ do_genocide(
continue; continue;
} }
/* KMH -- Unchanging prevents rehumanization */ /* KMH -- Unchanging prevents rehumanization */
if (Unchanging && ptr == u.umonst->data) if (Unchanging && ptr == gy.youmonst.data)
killplayer++; killplayer++;
break; break;
} }
@@ -2938,7 +2938,7 @@ do_genocide(
if (Hallucination) { if (Hallucination) {
/* hallucinate hero's type */ /* hallucinate hero's type */
if (Upolyd) { if (Upolyd) {
Strcpy(buf, pmname(u.umonst->data, Strcpy(buf, pmname(gy.youmonst.data,
flags.female ? FEMALE : MALE)); flags.female ? FEMALE : MALE));
} else { } else {
Strcpy(buf, (flags.female && gu.urole.name.f) ? gu.urole.name.f Strcpy(buf, (flags.female && gu.urole.name.f) ? gu.urole.name.f
@@ -2981,13 +2981,13 @@ do_genocide(
/* Polymorphed characters will die as soon as they're rehumanized. /* Polymorphed characters will die as soon as they're rehumanized.
KMH -- Unchanging prevents rehumanization. */ KMH -- Unchanging prevents rehumanization. */
if (Upolyd && ptr != u.umonst->data) { if (Upolyd && ptr != gy.youmonst.data) {
delayed_killer(POLYMORPH, svk.killer.format, svk.killer.name); delayed_killer(POLYMORPH, svk.killer.format, svk.killer.name);
You_feel("%s inside.", udeadinside()); You_feel("%s inside.", udeadinside());
} else { } else {
done(GENOCIDED); done(GENOCIDED);
} }
} else if (ptr == u.umonst->data) { } else if (ptr == gy.youmonst.data) {
rehumanize(); rehumanize();
} }
kill_genocided_monsters(); kill_genocided_monsters();
@@ -3033,8 +3033,8 @@ punish(struct obj *sobj)
uball->owt += WT_IRON_BALL_INCR * (1 + cursed_levy); uball->owt += WT_IRON_BALL_INCR * (1 + cursed_levy);
return; return;
} }
if (amorphous(u.umonst->data) || is_whirly(u.umonst->data) if (amorphous(gy.youmonst.data) || is_whirly(gy.youmonst.data)
|| unsolid(u.umonst->data)) { || unsolid(gy.youmonst.data)) {
if (!reuse_ball) { if (!reuse_ball) {
pline("A ball and chain appears, then falls away."); pline("A ball and chain appears, then falls away.");
dropy(mkobj(BALL_CLASS, TRUE)); dropy(mkobj(BALL_CLASS, TRUE));
+5 -5
View File
@@ -1092,7 +1092,7 @@ inside_gas_cloud(genericptr_t p1, genericptr_t p2)
{ {
NhRegion *reg = (NhRegion *) p1; NhRegion *reg = (NhRegion *) p1;
struct monst *mtmp = (struct monst *) p2; struct monst *mtmp = (struct monst *) p2;
struct monst *umon = mtmp ? mtmp : u.umonst; struct monst *umon = mtmp ? mtmp : &gy.youmonst;
int dam = reg->arg.a_int; int dam = reg->arg.a_int;
/* /*
@@ -1107,8 +1107,8 @@ inside_gas_cloud(genericptr_t p1, genericptr_t p2)
if (dam < 1) if (dam < 1)
return FALSE; /* if no damage then there's nothing to do here... */ return FALSE; /* if no damage then there's nothing to do here... */
if (!mtmp) { /* hero is indicated by Null rather than by u.umonst */ if (!mtmp) { /* hero is indicated by Null rather than by &youmonst */
if (m_poisongas_ok(u.umonst) == M_POISONGAS_OK) if (m_poisongas_ok(&gy.youmonst) == M_POISONGAS_OK)
return FALSE; return FALSE;
if (!Blind) { if (!Blind) {
Your("%s sting.", makeplural(body_part(EYE))); Your("%s sting.", makeplural(body_part(EYE)));
@@ -1232,7 +1232,7 @@ create_gas_cloud(
probably a natural cause of being polyed. don't message about it */ probably a natural cause of being polyed. don't message about it */
if (!svc.context.mon_moving && u_at(x, y) && cloudsize == 1 if (!svc.context.mon_moving && u_at(x, y) && cloudsize == 1
&& (!damage && (!damage
|| (damage && m_poisongas_ok(u.umonst) == M_POISONGAS_OK))) || (damage && m_poisongas_ok(&gy.youmonst) == M_POISONGAS_OK)))
inside_cloud = TRUE; inside_cloud = TRUE;
if (cloudsize > MAX_CLOUD_SIZE) { if (cloudsize > MAX_CLOUD_SIZE) {
@@ -1350,7 +1350,7 @@ region_danger(void)
/* the only type of region we understand is gas_cloud */ /* the only type of region we understand is gas_cloud */
if (f_indx == INSIDE_GAS_CLOUD) { if (f_indx == INSIDE_GAS_CLOUD) {
/* completely harmless if you don't need to breathe */ /* completely harmless if you don't need to breathe */
if (nonliving(u.umonst->data) || Breathless) if (nonliving(gy.youmonst.data) || Breathless)
continue; continue;
/* minor inconvenience if you're poison resistant; /* minor inconvenience if you're poison resistant;
not harmful enough to be a prayer-level trouble */ not harmful enough to be a prayer-level trouble */
+29 -45
View File
@@ -22,7 +22,6 @@ staticfn struct fruit *loadfruitchn(NHFILE *);
staticfn void freefruitchn(struct fruit *); staticfn void freefruitchn(struct fruit *);
staticfn void rest_levl(NHFILE *); staticfn void rest_levl(NHFILE *);
staticfn void rest_stairs(NHFILE *); staticfn void rest_stairs(NHFILE *);
staticfn void rest_u(NHFILE *, boolean);
#ifndef SFCTOOL #ifndef SFCTOOL
staticfn void ghostfruit(struct obj *); staticfn void ghostfruit(struct obj *);
staticfn boolean restgamestate(NHFILE *); staticfn boolean restgamestate(NHFILE *);
@@ -528,11 +527,11 @@ restgamestate(NHFILE *nhfp)
int i; int i;
struct flag newgameflags; struct flag newgameflags;
struct context_info newgamecontext; /* all 0, but has some pointers */ struct context_info newgamecontext; /* all 0, but has some pointers */
unsigned long uid = 0;
struct obj *bc_obj; struct obj *bc_obj;
boolean restoring_special = (wizard || discover); char timebuf[15];
unsigned long uid = 0;
#ifndef SFCTOOL #ifndef SFCTOOL
boolean defer_perm_invent; boolean defer_perm_invent, restoring_special;
struct obj *otmp; struct obj *otmp;
#endif #endif
@@ -586,6 +585,7 @@ restgamestate(NHFILE *nhfp)
in the discover case, we don't want to set that for a normal in the discover case, we don't want to set that for a normal
game until after the save file has been removed */ game until after the save file has been removed */
iflags.deferred_X = (newgameflags.explore && !discover); iflags.deferred_X = (newgameflags.explore && !discover);
restoring_special = (wizard || discover);
if (newgameflags.debug) { if (newgameflags.debug) {
/* authorized by startup code; wizard mode exists and is allowed */ /* authorized by startup code; wizard mode exists and is allowed */
wizard = TRUE, discover = iflags.deferred_X = FALSE; wizard = TRUE, discover = iflags.deferred_X = FALSE;
@@ -598,9 +598,31 @@ restgamestate(NHFILE *nhfp)
amii_setpens(amii_numcolors); /* use colors from save file */ amii_setpens(amii_numcolors); /* use colors from save file */
#endif #endif
#endif /* !SFCTOOL */ #endif /* !SFCTOOL */
rest_u(nhfp, restoring_special); Sfi_you(nhfp, &u, "gamestate-you");
gy.youmonst.cham = u.mcham;
#ifndef SFCTOOL #ifndef SFCTOOL
if (restoring_special && iflags.explore_error_flag) {
/* savefile has wizard or explore mode, but player is no longer
authorized to access either; can't downgrade mode any further, so
fail restoration. */
u.uhp = 0;
}
#endif
Sfi_char(nhfp, timebuf, "gamestate-ubirthday", 14);
timebuf[14] = '\0';
ubirthday = time_from_yyyymmddhhmmss(timebuf);
Sfi_long(nhfp, &urealtime.realtime, "gamestate-realtime");
Sfi_char(nhfp, timebuf, "gamestate-start_timing", 14);
timebuf[14] = '\0';
#ifndef SFCTOOL
urealtime.start_timing = time_from_yyyymmddhhmmss(timebuf);
/* current time is the time to use for next urealtime.realtime update */
urealtime.start_timing = getnow();
set_uasmon();
#ifdef CLIPPING #ifdef CLIPPING
cliparound(u.ux, u.uy); cliparound(u.ux, u.uy);
#endif #endif
@@ -618,7 +640,7 @@ restgamestate(NHFILE *nhfp)
iflags.perm_invent = defer_perm_invent; iflags.perm_invent = defer_perm_invent;
flags = newgameflags; flags = newgameflags;
svc.context = newgamecontext; svc.context = newgamecontext;
free((genericptr_t) u.umonst), u.umonst = 0; gy.youmonst = cg.zeromonst;
return FALSE; return FALSE;
} }
/* in case hangup save occurred in midst of level change */ /* in case hangup save occurred in midst of level change */
@@ -643,8 +665,7 @@ restgamestate(NHFILE *nhfp)
setworn(bc_obj, bc_obj->owornmask); setworn(bc_obj, bc_obj->owornmask);
bc_obj = nobj; bc_obj = nobj;
} }
#endif /* !SFCTOOL */ #endif
gm.migrating_objs = restobjchn(nhfp, FALSE); gm.migrating_objs = restobjchn(nhfp, FALSE);
gm.migrating_mons = restmonchn(nhfp); gm.migrating_mons = restmonchn(nhfp);
@@ -712,43 +733,6 @@ restgamestate(NHFILE *nhfp)
return TRUE; return TRUE;
} }
void
rest_u(NHFILE *nhfp, boolean restoring_special)
{
char timebuf[15];
Sfi_you(nhfp, &u, "gamestate-you");
#ifndef SFCTOOL
if (restoring_special && iflags.explore_error_flag) {
/* savefile has wizard or explore mode, but player is no longer
authorized to access either; can't downgrade mode any further, so
fail restoration. */
u.uhp = 0;
}
#endif
Sfi_char(nhfp, timebuf, "gamestate-ubirthday", 14);
timebuf[14] = '\0';
ubirthday = time_from_yyyymmddhhmmss(timebuf);
Sfi_long(nhfp, &urealtime.realtime, "gamestate-realtime");
Sfi_char(nhfp, timebuf, "gamestate-start_timing", 14);
timebuf[14] = '\0';
#ifndef SFCTOOL
urealtime.start_timing = time_from_yyyymmddhhmmss(timebuf);
/* current time is the time to use for next urealtime.realtime update */
urealtime.start_timing = getnow();
u.umonst = newmonst();
*u.umonst = cg.zeromonst;
u.umonst->cham = u.mcham;
set_uasmon();
#else
nhUse(restoring_special);
#endif /* !SFCTOOL */
}
#ifndef SFCTOOL #ifndef SFCTOOL
/* update game state pointers to those valid for the current level (so we /* update game state pointers to those valid for the current level (so we
don't dereference a wild u.ustuck when saving game state, for instance) */ don't dereference a wild u.ustuck when saving game state, for instance) */
+10 -26
View File
@@ -31,7 +31,6 @@ staticfn void save_gamelog(NHFILE *);
staticfn void savegamestate(NHFILE *); staticfn void savegamestate(NHFILE *);
staticfn void savelev_core(NHFILE *, xint8); staticfn void savelev_core(NHFILE *, xint8);
staticfn void save_msghistory(NHFILE *); staticfn void save_msghistory(NHFILE *);
staticfn void save_u(NHFILE *);
staticfn void save_adjust_levelflags(void); staticfn void save_adjust_levelflags(void);
#if defined(HANGUPHANDLING) #if defined(HANGUPHANDLING)
#define HUP if (!program_state.done_hup) #define HUP if (!program_state.done_hup)
@@ -262,27 +261,6 @@ save_gamelog(NHFILE *nhfp)
gg.gamelog = NULL; gg.gamelog = NULL;
} }
staticfn void
save_u(NHFILE *nhfp)
{
struct monst *save_umonst;
urealtime.finish_time = getnow();
urealtime.realtime += timet_delta(urealtime.finish_time,
urealtime.start_timing);
save_umonst = u.umonst;
u.umonst = (struct monst *) 0;
Sfo_you(nhfp, &u, "gamestate-you");
u.umonst = save_umonst;
Sfo_char(nhfp, yyyymmddhhmmss(ubirthday), "gamestate-ubirthday", 14);
Sfo_long(nhfp, &urealtime.realtime, "gamestate-realtime");
Sfo_char(nhfp, yyyymmddhhmmss(urealtime.start_timing), "gamestate-start_timing", 14);
/* this is the value to use for the next update of urealtime.realtime */
urealtime.start_timing = urealtime.finish_time;
}
staticfn void staticfn void
savegamestate(NHFILE *nhfp) savegamestate(NHFILE *nhfp)
{ {
@@ -299,8 +277,17 @@ savegamestate(NHFILE *nhfp)
Sfo_context_info(nhfp, &svc.context, "gamestate-context"); Sfo_context_info(nhfp, &svc.context, "gamestate-context");
relative_time_to_moves(&svc.context.seer_turn); relative_time_to_moves(&svc.context.seer_turn);
relative_time_to_moves(&svc.context.digging.lastdigtime); relative_time_to_moves(&svc.context.digging.lastdigtime);
Sfo_flag(nhfp, &flags, "gamestate-flags"); Sfo_flag(nhfp, &flags, "gamestate-flags");
save_u(nhfp); urealtime.finish_time = getnow();
urealtime.realtime += timet_delta(urealtime.finish_time,
urealtime.start_timing);
Sfo_you(nhfp, &u, "gamestate-you");
Sfo_char(nhfp, yyyymmddhhmmss(ubirthday), "gamestate-ubirthday", 14);
Sfo_long(nhfp, &urealtime.realtime, "gamestate-realtime");
Sfo_char(nhfp, yyyymmddhhmmss(urealtime.start_timing), "gamestate-start_timing", 14);
/* this is the value to use for the next update of urealtime.realtime */
urealtime.start_timing = urealtime.finish_time;
save_killers(nhfp); save_killers(nhfp);
/* must come before gm.migrating_objs and gm.migrating_mons are freed */ /* must come before gm.migrating_objs and gm.migrating_mons are freed */
@@ -1186,9 +1173,6 @@ freedynamicdata(void)
if (options_set_window_colors_flag) if (options_set_window_colors_flag)
options_free_window_colors(); options_free_window_colors();
if (u.umonst)
free((genericptr_t) u.umonst), u.umonst = 0;
if (glyphid_cache_status()) if (glyphid_cache_status())
free_glyphid_cache(); free_glyphid_cache();
+5 -5
View File
@@ -3609,12 +3609,12 @@ append_honorific(char *buf)
}; };
Strcat(buf, honored[rn2(SIZE(honored) - 1) + u.uevent.udemigod]); Strcat(buf, honored[rn2(SIZE(honored) - 1) + u.uevent.udemigod]);
if (is_vampire(u.umonst->data)) if (is_vampire(gy.youmonst.data))
Strcat(buf, (flags.female) ? " dark lady" : " dark lord"); Strcat(buf, (flags.female) ? " dark lady" : " dark lord");
else if (maybe_polyd(is_elf(u.umonst->data), Race_if(PM_ELF))) else if (maybe_polyd(is_elf(gy.youmonst.data), Race_if(PM_ELF)))
Strcat(buf, (flags.female) ? " hiril" : " hir"); Strcat(buf, (flags.female) ? " hiril" : " hir");
else else
Strcat(buf, !is_human(u.umonst->data) ? " creature" Strcat(buf, !is_human(gy.youmonst.data) ? " creature"
: (flags.female) ? " lady" : (flags.female) ? " lady"
: " sir"); : " sir");
} }
@@ -5910,7 +5910,7 @@ cad(
{ {
const char *res = 0; const char *res = 0;
switch (is_demon(u.umonst->data) ? 3 : poly_gender()) { switch (is_demon(gy.youmonst.data) ? 3 : poly_gender()) {
case 0: case 0:
res = "cad"; res = "cad";
break; break;
@@ -5929,7 +5929,7 @@ cad(
break; break;
} }
if (altusage) { if (altusage) {
char *cadbuf = mon_nam(u.umonst); /* snag an output buffer */ char *cadbuf = mon_nam(&gy.youmonst); /* snag an output buffer */
/* alternate usage adds a leading double quote and trailing /* alternate usage adds a leading double quote and trailing
exclamation point plus sentence separating spaces */ exclamation point plus sentence separating spaces */
+17 -17
View File
@@ -157,7 +157,7 @@ throne_sit_effect(void)
if (!Blind) { if (!Blind) {
Your("vision becomes clear."); Your("vision becomes clear.");
} else { } else {
int num_of_eyes = eyecount(u.umonst->data); int num_of_eyes = eyecount(gy.youmonst.data);
const char *eye = body_part(EYE); const char *eye = body_part(EYE);
/* note: 1 eye case won't actually happen--can't /* note: 1 eye case won't actually happen--can't
@@ -208,7 +208,7 @@ throne_sit_effect(void)
break; break;
} }
} else { } else {
if (is_prince(u.umonst->data) || u.uevent.uhand_of_elbereth) if (is_prince(gy.youmonst.data) || u.uevent.uhand_of_elbereth)
You_feel("very comfortable here."); You_feel("very comfortable here.");
else else
You_feel("somehow out of place..."); You_feel("somehow out of place...");
@@ -325,7 +325,7 @@ special_throne_effect(int effect) {
case 11: case 11:
/* polymorph effect (not blocked by magic resistance, but other things /* polymorph effect (not blocked by magic resistance, but other things
that protect from polymorphs work) */ that protect from polymorphs work) */
if (is_vampire(u.umonst->data)) { if (is_vampire(gy.youmonst.data)) {
You_feel("unworthy."); You_feel("unworthy.");
} else { } else {
pline("This throne was not meant for those such as you!"); pline("This throne was not meant for those such as you!");
@@ -368,14 +368,14 @@ lay_an_egg(void)
} else if (u.uhunger < (int) objects[EGG].oc_nutrition) { } else if (u.uhunger < (int) objects[EGG].oc_nutrition) {
You("don't have enough energy to lay an egg."); You("don't have enough energy to lay an egg.");
return ECMD_OK; return ECMD_OK;
} else if (eggs_in_water(u.umonst->data)) { } else if (eggs_in_water(gy.youmonst.data)) {
if (!(Underwater || Is_waterlevel(&u.uz))) { if (!(Underwater || Is_waterlevel(&u.uz))) {
pline("A splash tetra you are not."); pline("A splash tetra you are not.");
return ECMD_OK; return ECMD_OK;
} }
if (Upolyd if (Upolyd
&& (u.umonst->data == &mons[PM_GIANT_EEL] && (gy.youmonst.data == &mons[PM_GIANT_EEL]
|| u.umonst->data == &mons[PM_ELECTRIC_EEL])) { || gy.youmonst.data == &mons[PM_ELECTRIC_EEL])) {
You("yearn for the Sargasso Sea."); You("yearn for the Sargasso Sea.");
return ECMD_OK; return ECMD_OK;
} }
@@ -388,7 +388,7 @@ lay_an_egg(void)
set_corpsenm(uegg, egg_type_from_parent(u.umonnum, FALSE)); set_corpsenm(uegg, egg_type_from_parent(u.umonnum, FALSE));
uegg->known = 1; uegg->known = 1;
observe_object(uegg); observe_object(uegg);
You("%s an egg.", eggs_in_water(u.umonst->data) ? "spawn" : "lay"); You("%s an egg.", eggs_in_water(gy.youmonst.data) ? "spawn" : "lay");
dropy(uegg); dropy(uegg);
stackobj(uegg); stackobj(uegg);
morehungry((int) objects[EGG].oc_nutrition); morehungry((int) objects[EGG].oc_nutrition);
@@ -407,7 +407,7 @@ dosit(void)
You("are already sitting on %s.", mon_nam(u.usteed)); You("are already sitting on %s.", mon_nam(u.usteed));
return ECMD_OK; return ECMD_OK;
} }
if (u.uundetected && is_hider(u.umonst->data) if (u.uundetected && is_hider(gy.youmonst.data)
&& u.umonnum != PM_TRAPPER) /* trapper can stay hidden on floor */ && u.umonnum != PM_TRAPPER) /* trapper can stay hidden on floor */
u.uundetected = 0; /* no longer on the ceiling */ u.uundetected = 0; /* no longer on the ceiling */
@@ -419,7 +419,7 @@ dosit(void)
else else
You("are sitting on air."); You("are sitting on air.");
return ECMD_OK; return ECMD_OK;
} else if (u.ustuck && !sticks(u.umonst->data)) { } else if (u.ustuck && !sticks(gy.youmonst.data)) {
/* holding monster is next to hero rather than beneath, but /* holding monster is next to hero rather than beneath, but
hero is in no condition to actually sit at has/her own spot */ hero is in no condition to actually sit at has/her own spot */
if (humanoid(u.ustuck->data)) if (humanoid(u.ustuck->data))
@@ -440,14 +440,14 @@ dosit(void)
struct obj *obj; struct obj *obj;
obj = svl.level.objects[u.ux][u.uy]; obj = svl.level.objects[u.ux][u.uy];
if (u.umonst->data->mlet == S_DRAGON && obj->oclass == COIN_CLASS) { if (gy.youmonst.data->mlet == S_DRAGON && obj->oclass == COIN_CLASS) {
You("coil up around your %shoard.", You("coil up around your %shoard.",
(obj->quan + money_cnt(gi.invent) < u.ulevel * 1000) (obj->quan + money_cnt(gi.invent) < u.ulevel * 1000)
? "meager " : ""); ? "meager " : "");
} else if (obj->otyp == TOWEL) { } else if (obj->otyp == TOWEL) {
pline("It's probably not a good time for a picnic..."); pline("It's probably not a good time for a picnic...");
} else { } else {
if (slithy(u.umonst->data)) if (slithy(gy.youmonst.data))
You("coil up around %s.", the(xname(obj))); You("coil up around %s.", the(xname(obj)));
else else
You("sit on %s.", the(xname(obj))); You("sit on %s.", the(xname(obj)));
@@ -503,16 +503,16 @@ dosit(void)
dotrap(trap, VIASITTING); dotrap(trap, VIASITTING);
} }
} else if ((Underwater || Is_waterlevel(&u.uz)) } else if ((Underwater || Is_waterlevel(&u.uz))
&& !eggs_in_water(u.umonst->data)) { && !eggs_in_water(gy.youmonst.data)) {
if (Is_waterlevel(&u.uz)) if (Is_waterlevel(&u.uz))
There("are no cushions floating nearby."); There("are no cushions floating nearby.");
else else
You("sit down on the muddy bottom."); You("sit down on the muddy bottom.");
} else if (is_pool(u.ux, u.uy) && !eggs_in_water(u.umonst->data)) { } else if (is_pool(u.ux, u.uy) && !eggs_in_water(gy.youmonst.data)) {
in_water: in_water:
You("sit in the %s.", hliquid("water")); You("sit in the %s.", hliquid("water"));
if (Upolyd && u.umonnum == PM_GREMLIN) { if (Upolyd && u.umonnum == PM_GREMLIN) {
if (split_mon(u.umonst, (struct monst *) 0)) { if (split_mon(&gy.youmonst, (struct monst *) 0)) {
if (levl[u.ux][u.uy].typ == FOUNTAIN) if (levl[u.ux][u.uy].typ == FOUNTAIN)
dryup(u.ux, u.uy, TRUE); dryup(u.ux, u.uy, TRUE);
} }
@@ -526,7 +526,7 @@ dosit(void)
} else if (IS_SINK(typ)) { } else if (IS_SINK(typ)) {
You(sit_message, defsyms[S_sink].explanation); You(sit_message, defsyms[S_sink].explanation);
Your("%s gets wet.", Your("%s gets wet.",
humanoid(u.umonst->data) ? "rump" : "underside"); humanoid(gy.youmonst.data) ? "rump" : "underside");
} else if (IS_ALTAR(typ)) { } else if (IS_ALTAR(typ)) {
You(sit_message, defsyms[S_altar].explanation); You(sit_message, defsyms[S_altar].explanation);
altar_wrath(u.ux, u.uy); altar_wrath(u.ux, u.uy);
@@ -540,7 +540,7 @@ dosit(void)
/* must be WWalking */ /* must be WWalking */
You(sit_message, hliquid("lava")); You(sit_message, hliquid("lava"));
burn_away_slime(); burn_away_slime();
if (likes_lava(u.umonst->data)) { if (likes_lava(gy.youmonst.data)) {
pline_The("%s feels warm.", hliquid("lava")); pline_The("%s feels warm.", hliquid("lava"));
return ECMD_TIME; return ECMD_TIME;
} }
@@ -556,7 +556,7 @@ dosit(void)
} else if (IS_THRONE(typ)) { } else if (IS_THRONE(typ)) {
You(sit_message, defsyms[S_throne].explanation); You(sit_message, defsyms[S_throne].explanation);
throne_sit_effect(); throne_sit_effect();
} else if (lays_eggs(u.umonst->data)) { } else if (lays_eggs(gy.youmonst.data)) {
return lay_an_egg(); return lay_an_egg();
} else { } else {
pline("Having fun sitting on the %s?", surface(u.ux, u.uy)); pline("Having fun sitting on the %s?", surface(u.ux, u.uy));
+9 -9
View File
@@ -591,7 +591,7 @@ maybe_gasp(struct monst *mon)
case MS_VAMPIRE: /* vampire in its own form */ case MS_VAMPIRE: /* vampire in its own form */
case MS_WERE: /* lycanthrope in human form */ case MS_WERE: /* lycanthrope in human form */
case MS_SPELL: /* titan, barrow wight, Nazgul, nalfeshnee */ case MS_SPELL: /* titan, barrow wight, Nazgul, nalfeshnee */
dogasp = (mptr->mlet == u.umonst->data->mlet); dogasp = (mptr->mlet == gy.youmonst.data->mlet);
break; break;
/* capable of speech but don't care if you attack peacefuls */ /* capable of speech but don't care if you attack peacefuls */
case MS_BRIBE: case MS_BRIBE:
@@ -703,7 +703,7 @@ domonnoise(struct monst *mtmp)
msound = MS_SELL; msound = MS_SELL;
/* some normally non-speaking types can/will speak if hero is similar */ /* some normally non-speaking types can/will speak if hero is similar */
else if (msound == MS_ORC else if (msound == MS_ORC
&& ((same_race(ptr, u.umonst->data) /* current form, */ && ((same_race(ptr, gy.youmonst.data) /* current form, */
|| same_race(ptr, &mons[Race_switch])) /* unpoly'd form */ || same_race(ptr, &mons[Race_switch])) /* unpoly'd form */
|| Hallucination)) || Hallucination))
msound = MS_HUMANOID; msound = MS_HUMANOID;
@@ -794,12 +794,12 @@ domonnoise(struct monst *mtmp)
if (kindred) { if (kindred) {
verbl_msg = "This is my hunting ground" verbl_msg = "This is my hunting ground"
" that you dare to prowl!"; " that you dare to prowl!";
} else if (u.umonst->data == &mons[PM_SILVER_DRAGON] } else if (gy.youmonst.data == &mons[PM_SILVER_DRAGON]
|| u.umonst->data == &mons[PM_BABY_SILVER_DRAGON]) { || gy.youmonst.data == &mons[PM_BABY_SILVER_DRAGON]) {
/* Silver dragons are silver in color, not made of silver */ /* Silver dragons are silver in color, not made of silver */
Sprintf(verbuf, Sprintf(verbuf,
"%s! Your silver sheen"" does not frighten me!", "%s! Your silver sheen"" does not frighten me!",
(u.umonst->data == &mons[PM_SILVER_DRAGON]) (gy.youmonst.data == &mons[PM_SILVER_DRAGON])
? "Fool" ? "Fool"
: "Young Fool"); : "Young Fool");
verbl_msg = verbuf; verbl_msg = verbuf;
@@ -1107,7 +1107,7 @@ domonnoise(struct monst *mtmp)
if (SYSOPT_SEDUCE) { if (SYSOPT_SEDUCE) {
if (ptr->mlet != S_NYMPH if (ptr->mlet != S_NYMPH
&& (could_seduce(mtmp, u.umonst, (struct attack *) 0) && (could_seduce(mtmp, &gy.youmonst, (struct attack *) 0)
== 1)) { == 1)) {
(void) doseduce(mtmp); (void) doseduce(mtmp);
break; break;
@@ -1260,9 +1260,9 @@ dochat(void)
int tx, ty; int tx, ty;
struct obj *otmp; struct obj *otmp;
if (is_silent(u.umonst->data)) { if (is_silent(gy.youmonst.data)) {
pline("As %s, you cannot speak.", pline("As %s, you cannot speak.",
an(pmname(u.umonst->data, flags.female ? FEMALE : MALE))); an(pmname(gy.youmonst.data, flags.female ? FEMALE : MALE)));
return ECMD_OK; return ECMD_OK;
} }
if (Strangled) { if (Strangled) {
@@ -1395,7 +1395,7 @@ dochat(void)
return ECMD_OK; return ECMD_OK;
} }
if (Deaf) { if (Deaf) {
const char *xresponse = humanoid(u.umonst->data) const char *xresponse = humanoid(gy.youmonst.data)
? "falls on deaf ears" ? "falls on deaf ears"
: "is inaudible"; : "is inaudible";
+3 -3
View File
@@ -316,7 +316,7 @@ deadbook(struct obj *book2)
set_malign(mtmp); set_malign(mtmp);
} }
/* next handle the affect on things you're carrying */ /* next handle the affect on things you're carrying */
(void) unturn_dead(u.umonst); (void) unturn_dead(&gy.youmonst);
/* last place some monsters around you */ /* last place some monsters around you */
mm.x = u.ux; mm.x = u.ux;
mm.y = u.uy; mm.y = u.uy;
@@ -483,7 +483,7 @@ study_book(struct obj *spellbook)
if (dullbook > 0) { if (dullbook > 0) {
eyes = body_part(EYE); eyes = body_part(EYE);
if (eyecount(u.umonst->data) > 1) if (eyecount(gy.youmonst.data) > 1)
eyes = makeplural(eyes); eyes = makeplural(eyes);
pline("This book is so dull that you can't keep your %s open.", pline("This book is so dull that you can't keep your %s open.",
eyes); eyes);
@@ -690,7 +690,7 @@ rejectcasting(void)
if (Stunned) { if (Stunned) {
You("are too impaired to cast a spell."); You("are too impaired to cast a spell.");
return TRUE; return TRUE;
} else if (!can_chant(u.umonst)) { } else if (!can_chant(&gy.youmonst)) {
You("are unable to chant the incantation."); You("are unable to chant the incantation.");
return TRUE; return TRUE;
} else if (!freehand() && !(uwep && uwep->otyp == QUARTERSTAFF)) { } else if (!freehand() && !(uwep && uwep->otyp == QUARTERSTAFF)) {
+2 -2
View File
@@ -79,7 +79,7 @@ stealgold(struct monst *mtmp)
whose = s_suffix(y_monnam(who)); whose = s_suffix(y_monnam(who));
what = makeplural(mbodypart(who, FOOT)); what = makeplural(mbodypart(who, FOOT));
} else { } else {
who = u.umonst; who = &gy.youmonst;
whose = "your"; whose = "your";
what = makeplural(body_part(FOOT)); what = makeplural(body_part(FOOT));
} }
@@ -387,7 +387,7 @@ steal(struct monst *mtmp, char *objnambuf)
/* buried ball is not tracked via 'uball' and there is no chain /* buried ball is not tracked via 'uball' and there is no chain
at all (hence no uchain to take off) */ at all (hence no uchain to take off) */
pline("%s takes off your unseen chain.", Monnambuf); pline("%s takes off your unseen chain.", Monnambuf);
(void) openholdingtrap(u.umonst, &dummy); (void) openholdingtrap(&gy.youmonst, &dummy);
} else if (Blind) { } else if (Blind) {
pline("Somebody tries to rob you, but finds nothing to steal."); pline("Somebody tries to rob you, but finds nothing to steal.");
} else if (inv_cnt(TRUE) > inv_cnt(FALSE)) { } else if (inv_cnt(TRUE) > inv_cnt(FALSE)) {
+9 -9
View File
@@ -68,7 +68,7 @@ use_saddle(struct obj *otmp)
char kbuf[BUFSZ]; char kbuf[BUFSZ];
You("touch %s.", mon_nam(mtmp)); You("touch %s.", mon_nam(mtmp));
if (!(poly_when_stoned(u.umonst->data) && polymon(PM_STONE_GOLEM))) { if (!(poly_when_stoned(gy.youmonst.data) && polymon(PM_STONE_GOLEM))) {
Sprintf(kbuf, "attempting to saddle %s", Sprintf(kbuf, "attempting to saddle %s",
an(pmname(mtmp->data, Mgender(mtmp)))); an(pmname(mtmp->data, Mgender(mtmp))));
instapetrify(kbuf); instapetrify(kbuf);
@@ -168,8 +168,8 @@ put_saddle_on_mon(struct obj *saddle, struct monst *mtmp)
boolean boolean
can_ride(struct monst *mtmp) can_ride(struct monst *mtmp)
{ {
return (mtmp->mtame && humanoid(u.umonst->data) return (mtmp->mtame && humanoid(gy.youmonst.data)
&& !verysmall(u.umonst->data) && !bigmonst(u.umonst->data) && !verysmall(gy.youmonst.data) && !bigmonst(gy.youmonst.data)
&& (!Underwater || is_swimmer(mtmp->data))); && (!Underwater || is_swimmer(mtmp->data)));
} }
@@ -238,10 +238,10 @@ mount_steed(
return (FALSE); return (FALSE);
} }
if (Upolyd && (!humanoid(u.umonst->data) if (Upolyd && (!humanoid(gy.youmonst.data)
|| verysmall(u.umonst->data) || verysmall(gy.youmonst.data)
|| bigmonst(u.umonst->data) || bigmonst(gy.youmonst.data)
|| slithy(u.umonst->data))) { || slithy(gy.youmonst.data))) {
You("won't fit on a saddle."); You("won't fit on a saddle.");
return (FALSE); return (FALSE);
} }
@@ -545,7 +545,7 @@ landing_spot(
kn_trap = i == 0 && ((t = t_at(x, y)) != 0 && t->tseen kn_trap = i == 0 && ((t = t_at(x, y)) != 0 && t->tseen
&& t->ttyp != VIBRATING_SQUARE); && t->ttyp != VIBRATING_SQUARE);
boulder = i <= 1 && (sobj_at(BOULDER, x, y) boulder = i <= 1 && (sobj_at(BOULDER, x, y)
&& !throws_rocks(u.umonst->data)); && !throws_rocks(gy.youmonst.data));
if (!kn_trap && !boulder) { if (!kn_trap && !boulder) {
spot->x = x; spot->x = x;
spot->y = y; spot->y = y;
@@ -566,7 +566,7 @@ landing_spot(
/* If we didn't find a good spot and forceit is on, try enexto(). */ /* If we didn't find a good spot and forceit is on, try enexto(). */
if (forceit && !found) if (forceit && !found)
found = enexto(spot, u.ux, u.uy, u.umonst->data); found = enexto(spot, u.ux, u.uy, gy.youmonst.data);
return found; return found;
} }
+12 -12
View File
@@ -105,7 +105,7 @@ goodpos(
* oh well. * oh well.
*/ */
if (!allow_u) { if (!allow_u) {
if (u_at(x, y) && mtmp != u.umonst if (u_at(x, y) && mtmp != &gy.youmonst
&& (mtmp != u.ustuck || !u.uswallow) && (mtmp != u.ustuck || !u.uswallow)
&& (!u.usteed || mtmp != u.usteed)) && (!u.usteed || mtmp != u.usteed))
return FALSE; return FALSE;
@@ -133,7 +133,7 @@ goodpos(
mdat = mtmp->data; mdat = mtmp->data;
if (is_pool(x, y) && !ignorewater) { if (is_pool(x, y) && !ignorewater) {
/* [what about Breathless?] */ /* [what about Breathless?] */
if (mtmp == u.umonst) if (mtmp == &gy.youmonst)
return (Swimming || Amphibious return (Swimming || Amphibious
|| (!Is_waterlevel(&u.uz) || (!Is_waterlevel(&u.uz)
&& !is_waterwall(x, y) && !is_waterwall(x, y)
@@ -152,11 +152,11 @@ goodpos(
that due the effect of the heat causing it to dry out */ that due the effect of the heat causing it to dry out */
if (mdat == &mons[PM_FLOATING_EYE]) if (mdat == &mons[PM_FLOATING_EYE])
return FALSE; return FALSE;
else if (mtmp == u.umonst) else if (mtmp == &gy.youmonst)
return (Levitation || Flying return (Levitation || Flying
|| (Fire_resistance && Wwalking && uarmf || (Fire_resistance && Wwalking && uarmf
&& uarmf->oerodeproof) && uarmf->oerodeproof)
|| (Upolyd && likes_lava(u.umonst->data))); || (Upolyd && likes_lava(gy.youmonst.data)));
else else
return (m_in_air(mtmp) || likes_lava(mdat)); return (m_in_air(mtmp) || likes_lava(mdat));
} }
@@ -435,7 +435,7 @@ teleok(coordxy x, coordxy y, boolean trapok)
if (!trapok) if (!trapok)
return FALSE; return FALSE;
} }
if (!goodpos(x, y, u.umonst, 0)) if (!goodpos(x, y, &gy.youmonst, 0))
return FALSE; return FALSE;
if (!tele_jump_ok(u.ux, u.uy, x, y)) if (!tele_jump_ok(u.ux, u.uy, x, y))
return FALSE; return FALSE;
@@ -490,9 +490,9 @@ teleds(coordxy nux, coordxy nuy, int teleds_flags)
u.ux0 = u.ux; u.ux0 = u.ux;
u.uy0 = u.uy; u.uy0 = u.uy;
if (!hideunder(u.umonst) && u.umonst->data->mlet == S_MIMIC) { if (!hideunder(&gy.youmonst) && gy.youmonst.data->mlet == S_MIMIC) {
/* mimics stop being unnoticed */ /* mimics stop being unnoticed */
u.umonst->m_ap_type = M_AP_NOTHING; gy.youmonst.m_ap_type = M_AP_NOTHING;
} }
if (was_swallowed) { if (was_swallowed) {
@@ -816,7 +816,7 @@ tele_to_rnd_pet(void)
struct monst *mtmp, *pet = (struct monst *) 0; struct monst *mtmp, *pet = (struct monst *) 0;
int cnt = 0; int cnt = 0;
if (noteleport_level(u.umonst)) { if (noteleport_level(&gy.youmonst)) {
impossible("%s", "attempt to teleport hero to be near a pet" impossible("%s", "attempt to teleport hero to be near a pet"
" on no-teleport level"); " on no-teleport level");
return; return;
@@ -851,7 +851,7 @@ scrolltele(struct obj *scroll)
coord cc; coord cc;
/* Disable teleportation in stronghold && Vlad's Tower */ /* Disable teleportation in stronghold && Vlad's Tower */
if (noteleport_level(u.umonst) && !wizard) { if (noteleport_level(&gy.youmonst) && !wizard) {
pline("A mysterious force prevents you from teleporting!"); pline("A mysterious force prevents you from teleporting!");
if (scroll) if (scroll)
learnscroll(scroll); /* this is obviously a teleport scroll */ learnscroll(scroll); /* this is obviously a teleport scroll */
@@ -1072,7 +1072,7 @@ dotele(
int energy = 0; int energy = 0;
if (!Teleportation || (u.ulevel < (Role_if(PM_WIZARD) ? 8 : 12) if (!Teleportation || (u.ulevel < (Role_if(PM_WIZARD) ? 8 : 12)
&& !can_teleport(u.umonst->data))) { && !can_teleport(gy.youmonst.data))) {
/* Try to use teleport away spell. */ /* Try to use teleport away spell. */
int knownsp = known_spell(SPE_TELEPORT_AWAY); int knownsp = known_spell(SPE_TELEPORT_AWAY);
@@ -1257,7 +1257,7 @@ level_tele(void)
if (ynq("Go to Nowhere. Are you sure?") != 'y') if (ynq("Go to Nowhere. Are you sure?") != 'y')
return; return;
You("%s in agony as your body begins to warp...", You("%s in agony as your body begins to warp...",
is_silent(u.umonst->data) ? "writhe" : "scream"); is_silent(gy.youmonst.data) ? "writhe" : "scream");
display_nhwindow(WIN_MESSAGE, FALSE); display_nhwindow(WIN_MESSAGE, FALSE);
You("cease to exist."); You("cease to exist.");
if (gi.invent) if (gi.invent)
@@ -1499,7 +1499,7 @@ tele_trap(struct trap *trap)
return; return;
in_tele_trap = TRUE; in_tele_trap = TRUE;
if (In_endgame(&u.uz) || Antimagic || noteleport_level(u.umonst)) { if (In_endgame(&u.uz) || Antimagic || noteleport_level(&gy.youmonst)) {
if (Antimagic) if (Antimagic)
shieldeff(u.ux, u.uy); shieldeff(u.ux, u.uy);
You_feel("a wrenching sensation."); You_feel("a wrenching sensation.");
+14 -14
View File
@@ -142,7 +142,7 @@ stoned_dialogue(void)
char buf[BUFSZ]; char buf[BUFSZ];
Strcpy(buf, stoned_texts[SIZE(stoned_texts) - i]); Strcpy(buf, stoned_texts[SIZE(stoned_texts) - i]);
if (nolimbs(u.umonst->data) && strstri(buf, "limbs")) if (nolimbs(gy.youmonst.data) && strstri(buf, "limbs"))
(void) strsubst(buf, "limbs", "extremities"); (void) strsubst(buf, "limbs", "extremities");
urgent_pline("%s", buf); urgent_pline("%s", buf);
} }
@@ -232,7 +232,7 @@ vomiting_dialogue(void)
break; break;
case 2: case 2:
txt = vomiting_texts[4]; txt = vomiting_texts[4];
if (cantvomit(u.umonst->data)) if (cantvomit(gy.youmonst.data))
txt = "gag uncontrollably."; txt = "gag uncontrollably.";
else if (Hallucination) else if (Hallucination)
/* "hurl" is short for "hurl chunks" which is slang for /* "hurl" is short for "hurl chunks" which is slang for
@@ -241,7 +241,7 @@ vomiting_dialogue(void)
break; break;
case 0: case 0:
stop_occupation(); stop_occupation();
if (!cantvomit(u.umonst->data)) { if (!cantvomit(gy.youmonst.data)) {
morehungry(20); morehungry(20);
/* case 2 used to be "You suddenly vomit!" but it wasn't sudden /* case 2 used to be "You suddenly vomit!" but it wasn't sudden
since you've just been through the earlier messages of the since you've just been through the earlier messages of the
@@ -332,8 +332,8 @@ sickness_dialogue(void)
if ((u.usick_type & SICK_NONVOMITABLE) == 0) if ((u.usick_type & SICK_NONVOMITABLE) == 0)
(void) strsubst(buf, "illness", "sickness"); (void) strsubst(buf, "illness", "sickness");
if (Hallucination && strstri(buf, "Death's door")) { if (Hallucination && strstri(buf, "Death's door")) {
/* u.umonst: for Hallucination, mhe()'s mon argument isn't used */ /* youmonst: for Hallucination, mhe()'s mon argument isn't used */
Strcpy(pronounbuf, mhe(u.umonst)); Strcpy(pronounbuf, mhe(&gy.youmonst));
Sprintf(eos(buf), " %s %s inviting you in.", Sprintf(eos(buf), " %s %s inviting you in.",
/* upstart() modifies its argument but vtense() doesn't /* upstart() modifies its argument but vtense() doesn't
care whether or not that has already happened */ care whether or not that has already happened */
@@ -394,8 +394,8 @@ slime_dialogue(void)
/* display as green slime during "You have become green slime." /* display as green slime during "You have become green slime."
but don't worry about not being able to see self; if already but don't worry about not being able to see self; if already
mimicking something else at the time, implicitly be revealed */ mimicking something else at the time, implicitly be revealed */
u.umonst->m_ap_type = M_AP_MONSTER; gy.youmonst.m_ap_type = M_AP_MONSTER;
u.umonst->mappearance = PM_GREEN_SLIME; gy.youmonst.mappearance = PM_GREEN_SLIME;
/* no message given when 't' is odd, so no automatic update of /* no message given when 't' is odd, so no automatic update of
self; force one */ self; force one */
newsym(u.ux, u.uy); newsym(u.ux, u.uy);
@@ -405,7 +405,7 @@ slime_dialogue(void)
char buf[BUFSZ]; char buf[BUFSZ];
Strcpy(buf, slime_texts[SIZE(slime_texts) - i - 1L]); Strcpy(buf, slime_texts[SIZE(slime_texts) - i - 1L]);
if (nolimbs(u.umonst->data) && strstri(buf, "limbs")) if (nolimbs(gy.youmonst.data) && strstri(buf, "limbs"))
(void) strsubst(buf, "limbs", "extremities"); (void) strsubst(buf, "limbs", "extremities");
if (strchr(buf, '%')) { if (strchr(buf, '%')) {
@@ -459,7 +459,7 @@ slimed_to_death(struct kinfo *kptr)
uchar save_mvflags; uchar save_mvflags;
/* redundant: polymon() cures sliming when polying into green slime */ /* redundant: polymon() cures sliming when polying into green slime */
if (Upolyd && u.umonst->data == &mons[PM_GREEN_SLIME]) { if (Upolyd && gy.youmonst.data == &mons[PM_GREEN_SLIME]) {
dealloc_killer(kptr); dealloc_killer(kptr);
return; return;
} }
@@ -485,11 +485,11 @@ slimed_to_death(struct kinfo *kptr)
* [formerly implicit] change of form; polymon() takes care of that. * [formerly implicit] change of form; polymon() takes care of that.
* Temporarily ungenocide if necessary. * Temporarily ungenocide if necessary.
*/ */
if (emits_light(u.umonst->data)) if (emits_light(gy.youmonst.data))
del_light_source(LS_MONSTER, monst_to_any(u.umonst)); del_light_source(LS_MONSTER, monst_to_any(&gy.youmonst));
save_mvflags = svm.mvitals[PM_GREEN_SLIME].mvflags; save_mvflags = svm.mvitals[PM_GREEN_SLIME].mvflags;
svm.mvitals[PM_GREEN_SLIME].mvflags = save_mvflags & ~G_GENOD; svm.mvitals[PM_GREEN_SLIME].mvflags = save_mvflags & ~G_GENOD;
/* become a green slime; also resets u.umonst.m_ap_type+.mappearance */ /* become a green slime; also resets youmonst.m_ap_type+.mappearance */
(void) polymon(PM_GREEN_SLIME); (void) polymon(PM_GREEN_SLIME);
svm.mvitals[PM_GREEN_SLIME].mvflags = save_mvflags; svm.mvitals[PM_GREEN_SLIME].mvflags = save_mvflags;
done_timeout(TURNED_SLIME, SLIMED); done_timeout(TURNED_SLIME, SLIMED);
@@ -640,8 +640,8 @@ nh_timeout(void)
sleep_dialogue(); sleep_dialogue();
if (u.mtimedone && !--u.mtimedone) { if (u.mtimedone && !--u.mtimedone) {
if (Unchanging) if (Unchanging)
u.mtimedone = rnd(100 * u.umonst->data->mlevel + 1); u.mtimedone = rnd(100 * gy.youmonst.data->mlevel + 1);
else if (is_were(u.umonst->data)) else if (is_were(gy.youmonst.data))
you_unwere(FALSE); /* if polycontrl, asks whether to rehumanize */ you_unwere(FALSE); /* if polycontrl, asks whether to rehumanize */
else else
rehumanize(); rehumanize();
+94 -94
View File
@@ -94,7 +94,7 @@ burnarmor(struct monst *victim)
if (!victim) if (!victim)
return 0; return 0;
hitting_u = (victim == u.umonst); hitting_u = (victim == &gy.youmonst);
/* burning damage may dry wet towel */ /* burning damage may dry wet towel */
item = hitting_u ? carrying(TOWEL) : m_carrying(victim, TOWEL); item = hitting_u ? carrying(TOWEL) : m_carrying(victim, TOWEL);
@@ -190,11 +190,11 @@ erode_obj(
if (!otmp) if (!otmp)
return ER_NOTHING; return ER_NOTHING;
victim = carried(otmp) ? u.umonst victim = carried(otmp) ? &gy.youmonst
: mcarried(otmp) ? otmp->ocarry : mcarried(otmp) ? otmp->ocarry
: (struct monst *) 0; : (struct monst *) 0;
uvictim = (victim == u.umonst); uvictim = (victim == &gy.youmonst);
vismon = victim && (victim != u.umonst) && canseemon(victim); vismon = victim && (victim != &gy.youmonst) && canseemon(victim);
/* Is gb.bhitpos correct here? Ugh. */ /* Is gb.bhitpos correct here? Ugh. */
visobj = (!victim && cansee(gb.bhitpos.x, gb.bhitpos.y) visobj = (!victim && cansee(gb.bhitpos.x, gb.bhitpos.y)
&& (!is_pool(gb.bhitpos.x, gb.bhitpos.y) && (!is_pool(gb.bhitpos.x, gb.bhitpos.y)
@@ -269,7 +269,7 @@ erode_obj(
*/ */
if (otmp->oerodeproof) { if (otmp->oerodeproof) {
otmp->rknown = TRUE; otmp->rknown = TRUE;
if (victim == u.umonst) if (victim == &gy.youmonst)
update_inventory(); update_inventory();
} }
@@ -294,7 +294,7 @@ erode_obj(
else else
otmp->oeroded2++; otmp->oeroded2++;
if (victim == u.umonst) if (victim == &gy.youmonst)
update_inventory(); update_inventory();
return ER_DAMAGED; return ER_DAMAGED;
@@ -363,15 +363,15 @@ grease_protect(
struct monst *victim) struct monst *victim)
{ {
static const char txt[] = "protected by the layer of grease!"; static const char txt[] = "protected by the layer of grease!";
boolean vismon = victim && (victim != u.umonst) && canseemon(victim); boolean vismon = victim && (victim != &gy.youmonst) && canseemon(victim);
if (ostr) { if (ostr) {
if (victim == u.umonst) if (victim == &gy.youmonst)
Your("%s %s %s", ostr, vtense(ostr, "are"), txt); Your("%s %s %s", ostr, vtense(ostr, "are"), txt);
else if (vismon) else if (vismon)
pline("%s's %s %s %s", Monnam(victim), pline("%s's %s %s %s", Monnam(victim),
ostr, vtense(ostr, "are"), txt); ostr, vtense(ostr, "are"), txt);
} else if (victim == u.umonst || vismon) { } else if (victim == &gy.youmonst || vismon) {
pline("%s %s", Yobjnam2(otmp, "are"), txt); pline("%s %s", Yobjnam2(otmp, "are"), txt);
} }
if (!rn2(2)) { if (!rn2(2)) {
@@ -634,11 +634,11 @@ fall_through(
; /* KMH -- You can't escape the Sokoban level traps */ ; /* KMH -- You can't escape the Sokoban level traps */
} else if (Levitation || u.ustuck } else if (Levitation || u.ustuck
|| (!Can_fall_thru(&u.uz) && !levl[u.ux][u.uy].candig) || (!Can_fall_thru(&u.uz) && !levl[u.ux][u.uy].candig)
|| ((Flying || is_clinger(u.umonst->data) || ((Flying || is_clinger(gy.youmonst.data)
|| (ceiling_hider(u.umonst->data) && u.uundetected)) || (ceiling_hider(gy.youmonst.data) && u.uundetected))
&& !(ftflags & TOOKPLUNGE))) { && !(ftflags & TOOKPLUNGE))) {
dont_fall = "don't fall in."; dont_fall = "don't fall in.";
} else if (u.umonst->data->msize >= MZ_HUGE) { } else if (gy.youmonst.data->msize >= MZ_HUGE) {
dont_fall = "don't fit through."; dont_fall = "don't fit through.";
} else if (!next_to_u()) { } else if (!next_to_u()) {
dont_fall = "are jerked back by your pet!"; dont_fall = "are jerked back by your pet!";
@@ -653,7 +653,7 @@ fall_through(
} }
return; return;
} }
if ((Flying || is_clinger(u.umonst->data)) if ((Flying || is_clinger(gy.youmonst.data))
&& (ftflags & TOOKPLUNGE) && td && t) { && (ftflags & TOOKPLUNGE) && td && t) {
if (Flying) if (Flying)
controlled_flight = TRUE; controlled_flight = TRUE;
@@ -890,7 +890,7 @@ animate_statue(
delobj(statue); delobj(statue);
/* avoid hiding under nothing */ /* avoid hiding under nothing */
if (u_at(x, y) && Upolyd && hides_under(u.umonst->data) if (u_at(x, y) && Upolyd && hides_under(gy.youmonst.data)
&& !OBJ_AT(x, y)) && !OBJ_AT(x, y))
u.uundetected = 0; u.uundetected = 0;
@@ -974,7 +974,7 @@ mu_maybe_destroy_web(
boolean domsg, boolean domsg,
struct trap *trap) struct trap *trap)
{ {
boolean isyou = (mtmp == u.umonst); boolean isyou = (mtmp == &gy.youmonst);
struct permonst *mptr = mtmp->data; struct permonst *mptr = mtmp->data;
if (amorphous(mptr) || is_whirly(mptr) || flaming(mptr) if (amorphous(mptr) || is_whirly(mptr) || flaming(mptr)
@@ -1085,7 +1085,7 @@ floor_trigger(int ttyp)
staticfn boolean staticfn boolean
check_in_air(struct monst *mtmp, unsigned trflags) check_in_air(struct monst *mtmp, unsigned trflags)
{ {
boolean is_you = mtmp == u.umonst, boolean is_you = mtmp == &gy.youmonst,
plunged = (trflags & (TOOKPLUNGE | VIASITTING)) != 0; plunged = (trflags & (TOOKPLUNGE | VIASITTING)) != 0;
return ((trflags & HURTLING) != 0 return ((trflags & HURTLING) != 0
@@ -1195,7 +1195,7 @@ trapeffect_arrow_trap(
struct obj *otmp; struct obj *otmp;
int dam; int dam;
if (mtmp == u.umonst) { if (mtmp == &gy.youmonst) {
if (trap->once && trap->tseen && !rn2(15)) { if (trap->once && trap->tseen && !rn2(15)) {
Soundeffect(se_loud_click, 100); Soundeffect(se_loud_click, 100);
You_hear("a loud click!"); You_hear("a loud click!");
@@ -1207,7 +1207,7 @@ trapeffect_arrow_trap(
seetrap(trap); seetrap(trap);
pline("An arrow shoots out at you!"); pline("An arrow shoots out at you!");
otmp = t_missile(ARROW, trap); otmp = t_missile(ARROW, trap);
dam = dmgval(otmp, u.umonst); dam = dmgval(otmp, &gy.youmonst);
if (u.usteed && !rn2(2) && steedintrap(trap, otmp)) { if (u.usteed && !rn2(2) && steedintrap(trap, otmp)) {
; /* nothing */ ; /* nothing */
} else if (thitu(8, Maybe_Half_Phys(dam), &otmp, "arrow")) { } else if (thitu(8, Maybe_Half_Phys(dam), &otmp, "arrow")) {
@@ -1256,7 +1256,7 @@ trapeffect_dart_trap(
struct obj *otmp; struct obj *otmp;
int dam; int dam;
if (mtmp == u.umonst) { if (mtmp == &gy.youmonst) {
int oldumort = u.umortality; int oldumort = u.umortality;
if (trap->once && trap->tseen && !rn2(15)) { if (trap->once && trap->tseen && !rn2(15)) {
@@ -1272,7 +1272,7 @@ trapeffect_dart_trap(
otmp = t_missile(DART, trap); otmp = t_missile(DART, trap);
if (!rn2(6)) if (!rn2(6))
otmp->opoisoned = 1; otmp->opoisoned = 1;
dam = dmgval(otmp, u.umonst); dam = dmgval(otmp, &gy.youmonst);
if (u.usteed && !rn2(2) && steedintrap(trap, otmp)) { if (u.usteed && !rn2(2) && steedintrap(trap, otmp)) {
; /* nothing */ ; /* nothing */
} else if (thitu(7, Maybe_Half_Phys(dam), &otmp, "little dart")) { } else if (thitu(7, Maybe_Half_Phys(dam), &otmp, "little dart")) {
@@ -1329,7 +1329,7 @@ trapeffect_rocktrap(
struct obj *otmp; struct obj *otmp;
boolean harmless = FALSE; boolean harmless = FALSE;
if (mtmp == u.umonst) { if (mtmp == &gy.youmonst) {
if (trap->once && trap->tseen && !rn2(15)) { if (trap->once && trap->tseen && !rn2(15)) {
pline("A trap door in %s opens, but nothing falls out!", pline("A trap door in %s opens, but nothing falls out!",
the(ceiling(u.ux, u.uy))); the(ceiling(u.ux, u.uy)));
@@ -1348,7 +1348,7 @@ trapeffect_rocktrap(
if (uarmh) { if (uarmh) {
/* normally passes_rocks() would protect against a falling /* normally passes_rocks() would protect against a falling
rock, but not when wearing a helmet */ rock, but not when wearing a helmet */
if (passes_rocks(u.umonst->data)) { if (passes_rocks(gy.youmonst.data)) {
pline("Unfortunately, you are wearing %s.", pline("Unfortunately, you are wearing %s.",
an(helm_simple_name(uarmh))); /* helm or hat */ an(helm_simple_name(uarmh))); /* helm or hat */
dmg = 2; dmg = 2;
@@ -1358,7 +1358,7 @@ trapeffect_rocktrap(
} else if (flags.verbose) { } else if (flags.verbose) {
pline("%s does not protect you.", Yname2(uarmh)); pline("%s does not protect you.", Yname2(uarmh));
} }
} else if (passes_rocks(u.umonst->data)) { } else if (passes_rocks(gy.youmonst.data)) {
pline("It passes harmlessly through you."); pline("It passes harmlessly through you.");
harmless = TRUE; harmless = TRUE;
} }
@@ -1415,7 +1415,7 @@ trapeffect_sqky_board(
|| (trflags & FAILEDUNTRAP) != 0 || (trflags & FAILEDUNTRAP) != 0
|| (Flying && (trflags & VIASITTING) != 0)); || (Flying && (trflags & VIASITTING) != 0));
if (mtmp == u.umonst) { if (mtmp == &gy.youmonst) {
if ((Levitation || Flying) && !forcetrap) { if ((Levitation || Flying) && !forcetrap) {
if (!Blind) { if (!Blind) {
seetrap(trap); seetrap(trap);
@@ -1481,7 +1481,7 @@ trapeffect_bear_trap(
struct trap *trap, struct trap *trap,
unsigned trflags) unsigned trflags)
{ {
boolean is_you = mtmp == u.umonst, boolean is_you = mtmp == &gy.youmonst,
forcetrap = ((trflags & FORCETRAP) != 0 forcetrap = ((trflags & FORCETRAP) != 0
|| (trflags & FAILEDUNTRAP) != 0 || (trflags & FAILEDUNTRAP) != 0
|| (is_you && (trflags & VIASITTING) != 0)); || (is_you && (trflags & VIASITTING) != 0));
@@ -1492,13 +1492,13 @@ trapeffect_bear_trap(
if ((Levitation || Flying) && !forcetrap) if ((Levitation || Flying) && !forcetrap)
return Trap_Effect_Finished; return Trap_Effect_Finished;
feeltrap(trap); feeltrap(trap);
if (amorphous(u.umonst->data) || is_whirly(u.umonst->data) if (amorphous(gy.youmonst.data) || is_whirly(gy.youmonst.data)
|| unsolid(u.umonst->data)) { || unsolid(gy.youmonst.data)) {
pline("%s bear trap closes harmlessly through you.", pline("%s bear trap closes harmlessly through you.",
A_Your[trap->madeby_u]); A_Your[trap->madeby_u]);
return Trap_Effect_Finished; return Trap_Effect_Finished;
} }
if (!u.usteed && u.umonst->data->msize <= MZ_SMALL) { if (!u.usteed && gy.youmonst.data->msize <= MZ_SMALL) {
pline("%s bear trap closes harmlessly over you.", pline("%s bear trap closes harmlessly over you.",
A_Your[trap->madeby_u]); A_Your[trap->madeby_u]);
return Trap_Effect_Finished; return Trap_Effect_Finished;
@@ -1565,9 +1565,9 @@ trapeffect_slp_gas_trap(
struct trap *trap, struct trap *trap,
unsigned int trflags UNUSED) unsigned int trflags UNUSED)
{ {
if (mtmp == u.umonst) { if (mtmp == &gy.youmonst) {
seetrap(trap); seetrap(trap);
if (Sleep_resistance || breathless(u.umonst->data)) { if (Sleep_resistance || breathless(gy.youmonst.data)) {
You("are enveloped in a cloud of gas!"); You("are enveloped in a cloud of gas!");
monstseesu(M_SEEN_SLEEP); monstseesu(M_SEEN_SLEEP);
} else { } else {
@@ -1599,7 +1599,7 @@ trapeffect_rust_trap(
{ {
struct obj *otmp, *nextobj; struct obj *otmp, *nextobj;
if (mtmp == u.umonst) { if (mtmp == &gy.youmonst) {
seetrap(trap); seetrap(trap);
/* Unlike monsters, traps cannot aim their rust attacks at /* Unlike monsters, traps cannot aim their rust attacks at
@@ -1650,7 +1650,7 @@ trapeffect_rust_trap(
You("are covered with rust!"); You("are covered with rust!");
losehp(Maybe_Half_Phys(dam), "rusting away", KILLED_BY); losehp(Maybe_Half_Phys(dam), "rusting away", KILLED_BY);
} else if (u.umonnum == PM_GREMLIN && rn2(3)) { } else if (u.umonnum == PM_GREMLIN && rn2(3)) {
(void) split_mon(u.umonst, (struct monst *) 0); (void) split_mon(&gy.youmonst, (struct monst *) 0);
} }
} else { } else {
boolean in_sight = canseemon(mtmp) || (mtmp == u.usteed); boolean in_sight = canseemon(mtmp) || (mtmp == u.usteed);
@@ -1732,7 +1732,7 @@ trapeffect_fire_trap(
struct trap *trap, struct trap *trap,
unsigned int trflags UNUSED) unsigned int trflags UNUSED)
{ {
if (mtmp == u.umonst) { if (mtmp == &gy.youmonst) {
seetrap(trap); seetrap(trap);
dofiretrap((struct obj *) 0); dofiretrap((struct obj *) 0);
} else { } else {
@@ -1832,7 +1832,7 @@ trapeffect_pit(
set to false if the spikes are found to not be relevant */ set to false if the spikes are found to not be relevant */
boolean relevant_spikes = ttype == SPIKED_PIT; boolean relevant_spikes = ttype == SPIKED_PIT;
if (mtmp == u.umonst) { if (mtmp == &gy.youmonst) {
boolean plunged = (trflags & TOOKPLUNGE) != 0; boolean plunged = (trflags & TOOKPLUNGE) != 0;
boolean viasitting = (trflags & VIASITTING) != 0; boolean viasitting = (trflags & VIASITTING) != 0;
boolean conj_pit = conjoined_pits(trap, t_at(u.ux0, u.uy0), TRUE); boolean conj_pit = conjoined_pits(trap, t_at(u.ux0, u.uy0), TRUE);
@@ -1850,7 +1850,7 @@ trapeffect_pit(
if (!Sokoban && (Levitation || (Flying && !plunged && !viasitting))) if (!Sokoban && (Levitation || (Flying && !plunged && !viasitting)))
return Trap_Effect_Finished; return Trap_Effect_Finished;
feeltrap(trap); feeltrap(trap);
if (!Sokoban && is_clinger(u.umonst->data) && !plunged) { if (!Sokoban && is_clinger(gy.youmonst.data) && !plunged) {
if (already_known) { if (already_known) {
You_see("%s %spit below you.", a_your[trap->madeby_u], You_see("%s %spit below you.", a_your[trap->madeby_u],
ttype == SPIKED_PIT ? "spiked " : ""); ttype == SPIKED_PIT ? "spiked " : "");
@@ -1946,7 +1946,7 @@ trapeffect_pit(
} else { } else {
/* plunging flyers take spike damage but not pit damage */ /* plunging flyers take spike damage but not pit damage */
if (!conj_pit && !deliberate if (!conj_pit && !deliberate
&& !(plunged && (Flying || is_clinger(u.umonst->data)))) && !(plunged && (Flying || is_clinger(gy.youmonst.data))))
losehp(Maybe_Half_Phys(rnd(adj_pit ? 3 : 6)), losehp(Maybe_Half_Phys(rnd(adj_pit ? 3 : 6)),
plunged ? "deliberately plunged into a pit" plunged ? "deliberately plunged into a pit"
: "fell into a pit", : "fell into a pit",
@@ -2015,7 +2015,7 @@ trapeffect_hole(
struct trap *trap, struct trap *trap,
unsigned int trflags) unsigned int trflags)
{ {
if (mtmp == u.umonst) { if (mtmp == &gy.youmonst) {
if (!Can_fall_thru(&u.uz)) { if (!Can_fall_thru(&u.uz)) {
seetrap(trap); /* normally done in fall_through */ seetrap(trap); /* normally done in fall_through */
impossible("dotrap: %ss cannot exist on this level.", impossible("dotrap: %ss cannot exist on this level.",
@@ -2072,7 +2072,7 @@ trapeffect_telep_trap(
struct trap *trap, struct trap *trap,
unsigned int trflags UNUSED) unsigned int trflags UNUSED)
{ {
if (mtmp == u.umonst) { if (mtmp == &gy.youmonst) {
seetrap(trap); seetrap(trap);
tele_trap(trap); tele_trap(trap);
} else { } else {
@@ -2090,7 +2090,7 @@ trapeffect_level_telep(
struct trap *trap, struct trap *trap,
unsigned int trflags) unsigned int trflags)
{ {
if (mtmp == u.umonst) { if (mtmp == &gy.youmonst) {
seetrap(trap); seetrap(trap);
level_tele_trap(trap, trflags); level_tele_trap(trap, trflags);
} else { } else {
@@ -2108,7 +2108,7 @@ trapeffect_web(
struct trap *trap, struct trap *trap,
unsigned int trflags) unsigned int trflags)
{ {
if (mtmp == u.umonst) { if (mtmp == &gy.youmonst) {
boolean webmsgok = (trflags & NOWEBMSG) == 0; boolean webmsgok = (trflags & NOWEBMSG) == 0;
boolean forcetrap = ((trflags & FORCETRAP) != 0 boolean forcetrap = ((trflags & FORCETRAP) != 0
|| (trflags & FAILEDUNTRAP) != 0); || (trflags & FAILEDUNTRAP) != 0);
@@ -2121,9 +2121,9 @@ trapeffect_web(
steed_article = ARTICLE_NONE; steed_article = ARTICLE_NONE;
feeltrap(trap); feeltrap(trap);
if (mu_maybe_destroy_web(u.umonst, webmsgok, trap)) if (mu_maybe_destroy_web(&gy.youmonst, webmsgok, trap))
return Trap_Effect_Finished; return Trap_Effect_Finished;
if (webmaker(u.umonst->data)) { if (webmaker(gy.youmonst.data)) {
if (webmsgok) if (webmsgok)
pline(trap->madeby_u ? "You take a walk on your web." pline(trap->madeby_u ? "You take a walk on your web."
: "There is a spider web here."); : "There is a spider web here.");
@@ -2281,7 +2281,7 @@ trapeffect_statue_trap(
struct trap *trap, struct trap *trap,
unsigned int trflags UNUSED) unsigned int trflags UNUSED)
{ {
if (mtmp == u.umonst) { if (mtmp == &gy.youmonst) {
(void) activate_statue_trap(trap, u.ux, u.uy, FALSE); (void) activate_statue_trap(trap, u.ux, u.uy, FALSE);
} else { } else {
/* monsters don't trigger statue traps */ /* monsters don't trigger statue traps */
@@ -2295,7 +2295,7 @@ trapeffect_magic_trap(
struct trap *trap, struct trap *trap,
unsigned int trflags) unsigned int trflags)
{ {
if (mtmp == u.umonst) { if (mtmp == &gy.youmonst) {
seetrap(trap); seetrap(trap);
if (!rn2(30)) { if (!rn2(30)) {
deltrap(trap); deltrap(trap);
@@ -2332,7 +2332,7 @@ trapeffect_anti_magic(
rather than the wearer */ rather than the wearer */
if (shoes->spe > 0) { if (shoes->spe > 0) {
/* no message if a monster does this, it isn't visible enough */ /* no message if a monster does this, it isn't visible enough */
if (mtmp == u.umonst) { if (mtmp == &gy.youmonst) {
seetrap(trap); seetrap(trap);
pline("A lethargic aura surrounds %s.", yname(shoes)); pline("A lethargic aura surrounds %s.", yname(shoes));
costly_alteration(shoes, COST_DECHNT); costly_alteration(shoes, COST_DECHNT);
@@ -2343,7 +2343,7 @@ trapeffect_anti_magic(
} }
} }
if (mtmp == u.umonst) { if (mtmp == &gy.youmonst) {
int drain, halfd; int drain, halfd;
boolean exclaim_it = FALSE; boolean exclaim_it = FALSE;
@@ -2455,7 +2455,7 @@ trapeffect_poly_trap(
struct trap *trap, struct trap *trap,
unsigned int trflags) unsigned int trflags)
{ {
if (mtmp == u.umonst) { if (mtmp == &gy.youmonst) {
boolean viasitting = (trflags & VIASITTING) != 0; boolean viasitting = (trflags & VIASITTING) != 0;
int steed_article = ARTICLE_THE; int steed_article = ARTICLE_THE;
char verbbuf[BUFSZ]; char verbbuf[BUFSZ];
@@ -2537,7 +2537,7 @@ trapeffect_landmine(
if (wearing_iron_shoes(mtmp)) if (wearing_iron_shoes(mtmp))
damage = (damage + 3) / 4; damage = (damage + 3) / 4;
if (mtmp == u.umonst) { if (mtmp == &gy.youmonst) {
boolean already_seen = trap->tseen; boolean already_seen = trap->tseen;
boolean forcetrap = ((trflags & FORCETRAP) != 0 boolean forcetrap = ((trflags & FORCETRAP) != 0
|| (trflags & FAILEDUNTRAP) != 0); || (trflags & FAILEDUNTRAP) != 0);
@@ -2663,7 +2663,7 @@ trapeffect_rolling_boulder_trap(
struct trap *trap, struct trap *trap,
unsigned int trflags UNUSED) unsigned int trflags UNUSED)
{ {
if (mtmp == u.umonst) { if (mtmp == &gy.youmonst) {
int style = ROLL | (trap->tseen ? LAUNCH_KNOWN : 0); int style = ROLL | (trap->tseen ? LAUNCH_KNOWN : 0);
feeltrap(trap); feeltrap(trap);
@@ -2712,7 +2712,7 @@ trapeffect_magic_portal(
struct trap *trap, struct trap *trap,
unsigned int trflags) unsigned int trflags)
{ {
if (mtmp == u.umonst) { if (mtmp == &gy.youmonst) {
feeltrap(trap); feeltrap(trap);
domagicportal(trap); domagicportal(trap);
} else { } else {
@@ -2727,7 +2727,7 @@ trapeffect_vibrating_square(
struct trap *trap, struct trap *trap,
unsigned int trflags UNUSED) unsigned int trflags UNUSED)
{ {
if (mtmp == u.umonst) { if (mtmp == &gy.youmonst) {
feeltrap(trap); feeltrap(trap);
/* messages handled elsewhere; the trap symbol is merely to mark the /* messages handled elsewhere; the trap symbol is merely to mark the
square for future reference */ square for future reference */
@@ -2791,7 +2791,7 @@ immune_to_trap(struct monst *mon, unsigned ttype)
return TRAP_NOT_IMMUNE; return TRAP_NOT_IMMUNE;
} }
pm = mon->data; pm = mon->data;
is_you = (mon == u.umonst); is_you = (mon == &gy.youmonst);
switch (ttype) { switch (ttype) {
case ARROW_TRAP: case ARROW_TRAP:
@@ -2986,7 +2986,7 @@ trapeffect_selector(
return trapeffect_vibrating_square(mtmp, trap, trflags); return trapeffect_vibrating_square(mtmp, trap, trflags);
default: default:
impossible("%s encountered a strange trap of type %d.", impossible("%s encountered a strange trap of type %d.",
(mtmp == u.umonst) ? "You" : "Some monster", (mtmp == &gy.youmonst) ? "You" : "Some monster",
trap->ttyp); trap->ttyp);
} }
return Trap_Effect_Finished; return Trap_Effect_Finished;
@@ -3023,7 +3023,7 @@ dotrap(struct trap *trap, unsigned trflags)
trapname(ttype, TRUE)); /* do force "pit" while hallucinating */ trapname(ttype, TRUE)); /* do force "pit" while hallucinating */
/* then proceed to normal trap effect */ /* then proceed to normal trap effect */
} else if (!forcetrap) { } else if (!forcetrap) {
if (floor_trigger(ttype) && check_in_air(u.umonst, trflags)) { if (floor_trigger(ttype) && check_in_air(&gy.youmonst, trflags)) {
if (already_seen) { if (already_seen) {
You("%s over %s %s.", u_locomotion("step"), You("%s over %s %s.", u_locomotion("step"),
(ttype == ARROW_TRAP && !trap->madeby_u) (ttype == ARROW_TRAP && !trap->madeby_u)
@@ -3035,7 +3035,7 @@ dotrap(struct trap *trap, unsigned trflags)
if (already_seen && !Fumbling && !undestroyable_trap(ttype) if (already_seen && !Fumbling && !undestroyable_trap(ttype)
&& ttype != ANTI_MAGIC && !forcebungle && !plunged && ttype != ANTI_MAGIC && !forcebungle && !plunged
&& !conj_pit && !adj_pit && !conj_pit && !adj_pit
&& (!rn2(5) || (is_pit(ttype) && is_clinger(u.umonst->data)))) { && (!rn2(5) || (is_pit(ttype) && is_clinger(gy.youmonst.data)))) {
You("escape %s %s.", (ttype == ARROW_TRAP && !trap->madeby_u) You("escape %s %s.", (ttype == ARROW_TRAP && !trap->madeby_u)
? "an" ? "an"
: a_your[trap->madeby_u], : a_your[trap->madeby_u],
@@ -3056,7 +3056,7 @@ dotrap(struct trap *trap, unsigned trflags)
* would be somewhat harsh for what's usually a minor impairment. * would be somewhat harsh for what's usually a minor impairment.
*/ */
(void) trapeffect_selector(u.umonst, trap, trflags); (void) trapeffect_selector(&gy.youmonst, trap, trflags);
} }
staticfn char * staticfn char *
@@ -3412,7 +3412,7 @@ launch_obj(
break; break;
} }
} else if (u_at(x, y)) { } else if (u_at(x, y)) {
int dam = dmgval(singleobj, u.umonst); int dam = dmgval(singleobj, &gy.youmonst);
if (gm.multi) if (gm.multi)
nomul(0); nomul(0);
@@ -3845,7 +3845,7 @@ instapetrify(const char *str)
{ {
if (Stone_resistance) if (Stone_resistance)
return; return;
if (poly_when_stoned(u.umonst->data) && polymon(PM_STONE_GOLEM)) if (poly_when_stoned(gy.youmonst.data) && polymon(PM_STONE_GOLEM))
return; return;
urgent_pline("You turn to stone..."); urgent_pline("You turn to stone...");
svk.killer.format = KILLED_BY; svk.killer.format = KILLED_BY;
@@ -4085,7 +4085,7 @@ float_down(
/* check for falling into pool - added by GAN 10/20/86 */ /* check for falling into pool - added by GAN 10/20/86 */
if (!Flying) { if (!Flying) {
if (!u.uswallow && u.ustuck) { if (!u.uswallow && u.ustuck) {
if (sticks(u.umonst->data)) if (sticks(gy.youmonst.data))
You("aren't able to maintain your hold on %s.", You("aren't able to maintain your hold on %s.",
mon_nam(u.ustuck)); mon_nam(u.ustuck));
else else
@@ -4199,14 +4199,14 @@ climb_pit(void)
display_nhwindow(WIN_MESSAGE, FALSE); display_nhwindow(WIN_MESSAGE, FALSE);
clear_nhwindow(WIN_MESSAGE); clear_nhwindow(WIN_MESSAGE);
You("free your %s.", body_part(LEG)); You("free your %s.", body_part(LEG));
} else if ((Flying || is_clinger(u.umonst->data)) && !Sokoban) { } else if ((Flying || is_clinger(gy.youmonst.data)) && !Sokoban) {
/* eg fell in pit, then poly'd to a flying monster; /* eg fell in pit, then poly'd to a flying monster;
or used '>' to deliberately enter it */ or used '>' to deliberately enter it */
You("%s from the %s.", u_locomotion("climb"), pitname); You("%s from the %s.", u_locomotion("climb"), pitname);
reset_utrap(FALSE); reset_utrap(FALSE);
fill_pit(u.ux, u.uy); fill_pit(u.ux, u.uy);
gv.vision_full_recalc = 1; /* vision limits change */ gv.vision_full_recalc = 1; /* vision limits change */
} else if (!(--u.utrap) || m_easy_escape_pit(u.umonst)) { } else if (!(--u.utrap) || m_easy_escape_pit(&gy.youmonst)) {
reset_utrap(FALSE); reset_utrap(FALSE);
You("%s to the edge of the %s.", You("%s to the edge of the %s.",
(Sokoban && Levitation) (Sokoban && Levitation)
@@ -4303,8 +4303,8 @@ dofiretrap(
losehp(num, tower_of_flame, KILLED_BY_AN); /* fire damage */ losehp(num, tower_of_flame, KILLED_BY_AN); /* fire damage */
burn_away_slime(); burn_away_slime();
if (burnarmor(u.umonst) || rn2(3)) { if (burnarmor(&gy.youmonst) || rn2(3)) {
(void) destroy_items(u.umonst, AD_FIRE, orig_dmg); (void) destroy_items(&gy.youmonst, AD_FIRE, orig_dmg);
ignite_items(gi.invent); ignite_items(gi.invent);
} }
if (!box && burn_floor_objects(u.ux, u.uy, see_it, TRUE) && !see_it) if (!box && burn_floor_objects(u.ux, u.uy, see_it, TRUE) && !see_it)
@@ -4325,7 +4325,7 @@ domagictrap(void)
int cnt = rnd(4); int cnt = rnd(4);
/* blindness effects */ /* blindness effects */
if (!resists_blnd(u.umonst)) { if (!resists_blnd(&gy.youmonst)) {
You("are momentarily blinded by a flash of light!"); You("are momentarily blinded by a flash of light!");
make_blinded((long) rn1(5, 10), FALSE); make_blinded((long) rn1(5, 10), FALSE);
if (!Blind) if (!Blind)
@@ -4362,7 +4362,7 @@ domagictrap(void)
if (!Invis) { if (!Invis) {
if (!Blind) if (!Blind)
self_invis_message(); self_invis_message();
} else if (!EInvis && !pm_invisible(u.umonst->data)) { } else if (!EInvis && !pm_invisible(gy.youmonst.data)) {
if (!Blind) { if (!Blind) {
if (!See_invisible) if (!See_invisible)
You("can see yourself again!"); You("can see yourself again!");
@@ -4393,7 +4393,7 @@ domagictrap(void)
if (on_level(&u.uz, &qstart_level)) if (on_level(&u.uz, &qstart_level))
You_feel( You_feel(
"%slike the prodigal son.", "%slike the prodigal son.",
(flags.female || (Upolyd && is_neuter(u.umonst->data))) (flags.female || (Upolyd && is_neuter(gy.youmonst.data)))
? "oddly " ? "oddly "
: ""); : "");
else else
@@ -4624,10 +4624,10 @@ acid_damage(struct obj *obj)
if (!obj) if (!obj)
return; return;
victim = carried(obj) ? u.umonst : mcarried(obj) ? obj->ocarry : NULL; victim = carried(obj) ? &gy.youmonst : mcarried(obj) ? obj->ocarry : NULL;
vismon = victim && (victim != u.umonst) && canseemon(victim); vismon = victim && (victim != &gy.youmonst) && canseemon(victim);
if (victim == u.umonst && inventory_resistance_check(AD_ACID)) if (victim == &gy.youmonst && inventory_resistance_check(AD_ACID))
return; return;
if (obj->greased) { if (obj->greased) {
@@ -4639,7 +4639,7 @@ acid_damage(struct obj *obj)
#endif #endif
) { ) {
if (!Blind) { if (!Blind) {
if (victim == u.umonst) if (victim == &gy.youmonst)
Your("%s.", aobjnam(obj, "fade")); Your("%s.", aobjnam(obj, "fade"));
else if (vismon) else if (vismon)
pline("%s %s.", s_suffix(Monnam(victim)), pline("%s %s.", s_suffix(Monnam(victim)),
@@ -4941,13 +4941,13 @@ emergency_disrobe(boolean *lostsome)
} }
/* pick a random goodpos() next to x,y for monster mtmp. /* pick a random goodpos() next to x,y for monster mtmp.
mtmp could be u.umonst, uses then crawl_destination(). mtmp could be &gy.youmonst, uses then crawl_destination().
returns TRUE if any good position found, with the coord in x,y */ returns TRUE if any good position found, with the coord in x,y */
boolean boolean
rnd_nextto_goodpos(coordxy *x, coordxy *y, struct monst *mtmp) rnd_nextto_goodpos(coordxy *x, coordxy *y, struct monst *mtmp)
{ {
int i, j; int i, j;
boolean is_u = (mtmp == u.umonst); boolean is_u = (mtmp == &gy.youmonst);
coordxy nx, ny, k, dirs[N_DIRS]; coordxy nx, ny, k, dirs[N_DIRS];
for (i = 0; i < N_DIRS; ++i) for (i = 0; i < N_DIRS; ++i)
@@ -5086,7 +5086,7 @@ drown(void)
water_damage_chain(gi.invent, FALSE); water_damage_chain(gi.invent, FALSE);
if (u.umonnum == PM_GREMLIN && rn2(3)) { if (u.umonnum == PM_GREMLIN && rn2(3)) {
(void) split_mon(u.umonst, (struct monst *) 0); (void) split_mon(&gy.youmonst, (struct monst *) 0);
} else if (u.umonnum == PM_IRON_GOLEM) { } else if (u.umonnum == PM_IRON_GOLEM) {
You("rust!"); You("rust!");
i = Maybe_Half_Phys(d(2, 6)); i = Maybe_Half_Phys(d(2, 6));
@@ -5124,10 +5124,10 @@ drown(void)
gv.vision_full_recalc = 1; gv.vision_full_recalc = 1;
return FALSE; return FALSE;
} }
if ((Teleportation || can_teleport(u.umonst->data)) && !Unaware if ((Teleportation || can_teleport(gy.youmonst.data)) && !Unaware
&& (Teleport_control || rn2(3) < Luck + 2)) { && (Teleport_control || rn2(3) < Luck + 2)) {
You("attempt a teleport spell."); /* utcsri!carroll */ You("attempt a teleport spell."); /* utcsri!carroll */
if (!noteleport_level(u.umonst)) { if (!noteleport_level(&gy.youmonst)) {
(void) dotele(FALSE); (void) dotele(FALSE);
if (!is_pool(u.ux, u.uy)) if (!is_pool(u.ux, u.uy))
return TRUE; return TRUE;
@@ -5150,8 +5150,8 @@ drown(void)
x = u.ux, y = u.uy; x = u.ux, y = u.uy;
/* have to be able to move in order to crawl */ /* have to be able to move in order to crawl */
if (gm.multi >= 0 && u.umonst->data->mmove if (gm.multi >= 0 && gy.youmonst.data->mmove
&& rnd_nextto_goodpos(&x, &y, u.umonst)) { && rnd_nextto_goodpos(&x, &y, &gy.youmonst)) {
boolean lost = FALSE; boolean lost = FALSE;
/* time to do some strip-tease... */ /* time to do some strip-tease... */
boolean succ = Is_waterlevel(&u.uz) ? TRUE : emergency_disrobe(&lost); boolean succ = Is_waterlevel(&u.uz) ? TRUE : emergency_disrobe(&lost);
@@ -5262,10 +5262,10 @@ could_untrap(boolean verbosely, boolean check_floor)
buf[0] = '\0'; buf[0] = '\0';
if (near_capacity() >= HVY_ENCUMBER) { if (near_capacity() >= HVY_ENCUMBER) {
Strcpy(buf, "You're too strained to do that."); Strcpy(buf, "You're too strained to do that.");
} else if ((nohands(u.umonst->data) && !webmaker(u.umonst->data)) } else if ((nohands(gy.youmonst.data) && !webmaker(gy.youmonst.data))
|| !u.umonst->data->mmove) { || !gy.youmonst.data->mmove) {
Strcpy(buf, "And just how do you expect to do that?"); Strcpy(buf, "And just how do you expect to do that?");
} else if (u.ustuck && sticks(u.umonst->data)) { } else if (u.ustuck && sticks(gy.youmonst.data)) {
Sprintf(buf, "You'll have to let go of %s first.", mon_nam(u.ustuck)); Sprintf(buf, "You'll have to let go of %s first.", mon_nam(u.ustuck));
} else if (u.ustuck || (welded(uwep) && bimanual(uwep))) { } else if (u.ustuck || (welded(uwep) && bimanual(uwep))) {
Sprintf(buf, "Your %s seem to be too busy for that.", Sprintf(buf, "Your %s seem to be too busy for that.",
@@ -5307,7 +5307,7 @@ untrap_prob(
if (u_wield_art(ART_STING) || attacks(AD_FIRE, wep)) if (u_wield_art(ART_STING) || attacks(AD_FIRE, wep))
chance = 1; chance = 1;
/* else chance stays 3 */ /* else chance stays 3 */
} else if (!webmaker(u.umonst->data)) { } else if (!webmaker(gy.youmonst.data)) {
chance = 7; /* 5.0: used to be 30 */ chance = 7; /* 5.0: used to be 30 */
} }
} }
@@ -5458,10 +5458,10 @@ try_disarm(
return 0; return 0;
} }
/* duplicate tight-space checks from test_move */ /* duplicate tight-space checks from test_move */
if (u.dx && u.dy && bad_rock(u.umonst->data, u.ux, ttmp->ty) if (u.dx && u.dy && bad_rock(gy.youmonst.data, u.ux, ttmp->ty)
&& bad_rock(u.umonst->data, ttmp->tx, u.uy)) { && bad_rock(gy.youmonst.data, ttmp->tx, u.uy)) {
if ((gi.invent && (inv_weight() + weight_cap() > WT_TOOMUCH_DIAGONAL)) if ((gi.invent && (inv_weight() + weight_cap() > WT_TOOMUCH_DIAGONAL))
|| bigmonst(u.umonst->data)) { || bigmonst(gy.youmonst.data)) {
/* don't allow untrap if they can't get thru to it */ /* don't allow untrap if they can't get thru to it */
You("are unable to reach the %s!", trapname(ttype, FALSE)); You("are unable to reach the %s!", trapname(ttype, FALSE));
return 0; return 0;
@@ -5490,7 +5490,7 @@ try_disarm(
} else if (ttype == WEB) { } else if (ttype == WEB) {
struct trap *ttmp2 = t_at(u.ux, u.uy); struct trap *ttmp2 = t_at(u.ux, u.uy);
if (!webmaker(u.umonst->data) if (!webmaker(gy.youmonst.data)
/* don't always try to spread the web */ /* don't always try to spread the web */
&& !rn2(3) && !rn2(3)
/* is there already a trap at hero's spot? /* is there already a trap at hero's spot?
@@ -5736,7 +5736,7 @@ help_monster_out(
You("grab the trapped %s using your bare %s.", You("grab the trapped %s using your bare %s.",
mtmp_pmname, makeplural(body_part(HAND))); mtmp_pmname, makeplural(body_part(HAND)));
if (poly_when_stoned(u.umonst->data) && polymon(PM_STONE_GOLEM)) { if (poly_when_stoned(gy.youmonst.data) && polymon(PM_STONE_GOLEM)) {
display_nhwindow(WIN_MESSAGE, FALSE); display_nhwindow(WIN_MESSAGE, FALSE);
} else { } else {
char kbuf[BUFSZ]; char kbuf[BUFSZ];
@@ -5864,7 +5864,7 @@ untrap(
/* 'force' is true for #invoke; if carrying MKoT, make it be true /* 'force' is true for #invoke; if carrying MKoT, make it be true
for #untrap or autounlock */ for #untrap or autounlock */
if (!force && has_magic_key(u.umonst)) if (!force && has_magic_key(&gy.youmonst))
force = TRUE; force = TRUE;
if (!rx && !container) { if (!rx && !container) {
@@ -6106,7 +6106,7 @@ openholdingtrap(
struct trap *t, tdummy; struct trap *t, tdummy;
char buf[BUFSZ], whichbuf[20]; char buf[BUFSZ], whichbuf[20];
const char *trapdescr = 0, *which = 0; const char *trapdescr = 0, *which = 0;
boolean ishero = (mon == u.umonst); boolean ishero = (mon == &gy.youmonst);
if (!mon) if (!mon)
return FALSE; return FALSE;
@@ -6214,7 +6214,7 @@ closeholdingtrap(
{ {
struct trap *t; struct trap *t;
unsigned dotrapflags; unsigned dotrapflags;
boolean ishero = (mon == u.umonst), result; boolean ishero = (mon == &gy.youmonst), result;
if (!mon) if (!mon)
return FALSE; return FALSE;
@@ -6255,7 +6255,7 @@ openfallingtrap(
boolean *noticed) /* set to true iff hero notices the effect; */ boolean *noticed) /* set to true iff hero notices the effect; */
{ /* otherwise left with its previous value intact */ { /* otherwise left with its previous value intact */
struct trap *t; struct trap *t;
boolean ishero = (mon == u.umonst), result; boolean ishero = (mon == &gy.youmonst), result;
if (!mon) if (!mon)
return FALSE; return FALSE;
@@ -6451,7 +6451,7 @@ chest_trap(
} else { } else {
monstunseesu(M_SEEN_ELEC); monstunseesu(M_SEEN_ELEC);
} }
(void) destroy_items(u.umonst, AD_ELEC, orig_dmg); (void) destroy_items(&gy.youmonst, AD_ELEC, orig_dmg);
if (dmg) if (dmg)
losehp(dmg, "electric shock", KILLED_BY_AN); losehp(dmg, "electric shock", KILLED_BY_AN);
break; break;
@@ -6478,7 +6478,7 @@ chest_trap(
if (Hallucination) if (Hallucination)
pline("What a groovy feeling!"); pline("What a groovy feeling!");
else else
You("%s%s...", stagger(u.umonst->data, "stagger"), You("%s%s...", stagger(gy.youmonst.data, "stagger"),
Halluc_resistance ? "" Halluc_resistance ? ""
: Blind ? " and get dizzy" : Blind ? " and get dizzy"
: " and your vision blurs"); : " and your vision blurs");
@@ -6805,7 +6805,7 @@ lava_effects(void)
} }
feel_newsym(u.ux, u.uy); /* in case Blind, map the lava here */ feel_newsym(u.ux, u.uy); /* in case Blind, map the lava here */
burn_away_slime(); burn_away_slime();
if (likes_lava(u.umonst->data)) if (likes_lava(gy.youmonst.data))
return FALSE; return FALSE;
usurvive = Fire_resistance || (Wwalking && dmg < u.uhp); usurvive = Fire_resistance || (Wwalking && dmg < u.uhp);
@@ -6981,7 +6981,7 @@ lava_effects(void)
} }
burn_stuff: burn_stuff:
(void) destroy_items(u.umonst, AD_FIRE, dmg); (void) destroy_items(&gy.youmonst, AD_FIRE, dmg);
ignite_items(gi.invent); ignite_items(gi.invent);
return FALSE; return FALSE;
} }
-3
View File
@@ -956,9 +956,6 @@ u_init_misc(void)
(void) memset((genericptr_t) &ubirthday, 0, sizeof(ubirthday)); (void) memset((genericptr_t) &ubirthday, 0, sizeof(ubirthday));
(void) memset((genericptr_t) &urealtime, 0, sizeof(urealtime)); (void) memset((genericptr_t) &urealtime, 0, sizeof(urealtime));
u.umonst = newmonst();
*u.umonst = cg.zeromonst;
u.umonst->cham = u.mcham = NON_PM;
u.uroleplay = tmpuroleplay; /* restore options set via rcfile */ u.uroleplay = tmpuroleplay; /* restore options set via rcfile */
#if 0 /* documentation of more zero values as desirable */ #if 0 /* documentation of more zero values as desirable */
+153 -153
View File
File diff suppressed because it is too large Load Diff
+4 -4
View File
@@ -466,18 +466,18 @@ invault(void)
} }
if (U_AP_TYPE == M_AP_OBJECT || u.uundetected) { if (U_AP_TYPE == M_AP_OBJECT || u.uundetected) {
if (U_AP_TYPE == M_AP_OBJECT if (U_AP_TYPE == M_AP_OBJECT
&& u.umonst->mappearance != GOLD_PIECE) && gy.youmonst.mappearance != GOLD_PIECE)
if (!Deaf) { if (!Deaf) {
SetVoice(guard, 0, 80, 0); SetVoice(guard, 0, 80, 0);
verbalize("Hey! Who left that %s in here?", verbalize("Hey! Who left that %s in here?",
mimic_obj_name(u.umonst)); mimic_obj_name(&gy.youmonst));
} }
/* You're mimicking some object or you're hidden. */ /* You're mimicking some object or you're hidden. */
pline("Puzzled, %s turns around and leaves.", mhe(guard)); pline("Puzzled, %s turns around and leaves.", mhe(guard));
mongone(guard); mongone(guard);
return; return;
} }
if (Strangled || is_silent(u.umonst->data) || gm.multi < 0) { if (Strangled || is_silent(gy.youmonst.data) || gm.multi < 0) {
/* [we ought to record whether this message has already /* [we ought to record whether this message has already
been given in order to vary it upon repeat visits, but been given in order to vary it upon repeat visits, but
discarding the monster and its egd data renders that hard] */ discarding the monster and its egd data renders that hard] */
@@ -1065,7 +1065,7 @@ gd_move(struct monst *grd)
} }
if (um_dist(grd->mx, grd->my, 1) || egrd->gddone) { if (um_dist(grd->mx, grd->my, 1) || egrd->gddone) {
if (!egrd->gddone && !rn2(10) && !Deaf && !u.uswallow if (!egrd->gddone && !rn2(10) && !Deaf && !u.uswallow
&& !(u.ustuck && !sticks(u.umonst->data))) { && !(u.ustuck && !sticks(gy.youmonst.data))) {
SetVoice(grd, 0, 80, 0); SetVoice(grd, 0, 80, 0);
verbalize("Move along!"); verbalize("Move along!");
} }
+1 -1
View File
@@ -405,7 +405,7 @@ special_dmgval(
} }
/* when no gloves we check for silver rings (blessed rings ignored) */ /* when no gloves we check for silver rings (blessed rings ignored) */
} else if ((left_ring || right_ring) && magr == u.umonst) { } else if ((left_ring || right_ring) && magr == &gy.youmonst) {
if (left_ring && uleft) { if (left_ring && uleft) {
if (objects[uleft->otyp].oc_material == SILVER if (objects[uleft->otyp].oc_material == SILVER
&& mon_hates_silver(mdef)) { && mon_hates_silver(mdef)) {
+2 -2
View File
@@ -218,12 +218,12 @@ you_unwere(boolean purify)
You_feel("purified."); You_feel("purified.");
set_ulycn(NON_PM); /* cure lycanthropy */ set_ulycn(NON_PM); /* cure lycanthropy */
} }
if (!Unchanging && is_were(u.umonst->data) if (!Unchanging && is_were(gy.youmonst.data)
&& !monster_nearby() && !monster_nearby()
&& (!controllable_poly && (!controllable_poly
|| !paranoid_query(ParanoidWerechange, "Remain in beast form?"))) || !paranoid_query(ParanoidWerechange, "Remain in beast form?")))
rehumanize(); rehumanize();
else if (is_were(u.umonst->data) && !u.mtimedone) else if (is_were(gy.youmonst.data) && !u.mtimedone)
u.mtimedone = rn1(200, 200); /* 40% of initial were change */ u.mtimedone = rn1(200, 200); /* 40% of initial were change */
} }
+5 -5
View File
@@ -158,7 +158,7 @@ const char *
empty_handed(void) empty_handed(void)
{ {
return uarmg ? "empty handed" /* gloves imply hands */ return uarmg ? "empty handed" /* gloves imply hands */
: humanoid(u.umonst->data) : humanoid(gy.youmonst.data)
/* hands but no weapon and no gloves */ /* hands but no weapon and no gloves */
? "bare handed" ? "bare handed"
/* alternate phrasing for paws or lack of hands */ /* alternate phrasing for paws or lack of hands */
@@ -360,7 +360,7 @@ dowield(void)
/* May we attempt this? */ /* May we attempt this? */
gm.multi = 0; gm.multi = 0;
if (cantwield(u.umonst->data)) { if (cantwield(gy.youmonst.data)) {
pline("Don't be ridiculous!"); pline("Don't be ridiculous!");
return ECMD_FAIL; return ECMD_FAIL;
} }
@@ -465,7 +465,7 @@ doswapweapon(void)
/* May we attempt this? */ /* May we attempt this? */
gm.multi = 0; gm.multi = 0;
if (cantwield(u.umonst->data)) { if (cantwield(gy.youmonst.data)) {
pline("Don't be ridiculous!"); pline("Don't be ridiculous!");
return ECMD_FAIL; return ECMD_FAIL;
} }
@@ -716,7 +716,7 @@ wield_tool(struct obj *obj,
} }
return FALSE; return FALSE;
} }
if (cantwield(u.umonst->data)) { if (cantwield(gy.youmonst.data)) {
You_cant("hold %s strongly enough.", more_than_1 ? "them" : "it"); You_cant("hold %s strongly enough.", more_than_1 ? "them" : "it");
return FALSE; return FALSE;
} }
@@ -762,7 +762,7 @@ can_twoweapon(void)
{ {
struct obj *otmp; struct obj *otmp;
if (!could_twoweap(u.umonst->data)) { if (!could_twoweap(gy.youmonst.data)) {
if (Upolyd) if (Upolyd)
You_cant("use two weapons in your current form."); You_cant("use two weapons in your current form.");
else else
+2 -2
View File
@@ -892,7 +892,7 @@ wiz_smell(void)
cc.x = u.ux; cc.x = u.ux;
cc.y = u.uy; cc.y = u.uy;
if (!olfaction(u.umonst->data)) { if (!olfaction(gy.youmonst.data)) {
You("are incapable of detecting odors in your present form."); You("are incapable of detecting odors in your present form.");
return ECMD_OK; return ECMD_OK;
} }
@@ -909,7 +909,7 @@ wiz_smell(void)
if (u.usteed) { if (u.usteed) {
mptr = u.usteed->data; mptr = u.usteed->data;
} else { } else {
mptr = u.umonst->data; mptr = gy.youmonst.data;
is_you = TRUE; is_you = TRUE;
} }
} else if ((mtmp = m_at(cc.x, cc.y)) != (struct monst *) 0) { } else if ((mtmp = m_at(cc.x, cc.y)) != (struct monst *) 0) {
+2 -2
View File
@@ -459,7 +459,7 @@ check_wornmask_slots(void)
why = "uswapwep is not a melee weapon"; why = "uswapwep is not a melee weapon";
else if (bimanual(uswapwep)) else if (bimanual(uswapwep))
why = "uswapwep is two-handed"; why = "uswapwep is two-handed";
else if (!could_twoweap(u.umonst->data)) else if (!could_twoweap(gy.youmonst.data))
why = "without two weapon attacks"; why = "without two weapon attacks";
if (why) if (why)
@@ -1005,7 +1005,7 @@ m_dowear_type(
struct obj * struct obj *
which_armor(struct monst *mon, long flag) which_armor(struct monst *mon, long flag)
{ {
if (mon == u.umonst) { if (mon == &gy.youmonst) {
switch (flag) { switch (flag) {
case W_ARM: case W_ARM:
return uarm; return uarm;
+1 -1
View File
@@ -84,7 +84,7 @@ dowrite(struct obj *pen)
const char *typeword; const char *typeword;
int spell_knowledge; int spell_knowledge;
if (nohands(u.umonst->data)) { if (nohands(gy.youmonst.data)) {
You("need hands to be able to write!"); You("need hands to be able to write!");
return ECMD_OK; return ECMD_OK;
} else if (Glib) { } else if (Glib) {
+43 -43
View File
@@ -590,7 +590,7 @@ release_hold(void)
} }
/* gives "you get regurgitated" or "you get expelled from <mon>" */ /* gives "you get regurgitated" or "you get expelled from <mon>" */
expels(mtmp, mtmp->data, TRUE); expels(mtmp, mtmp->data, TRUE);
} else if (sticks(u.umonst->data)) { } else if (sticks(gy.youmonst.data)) {
/* order matters if 'holding' status condition is enabled; /* order matters if 'holding' status condition is enabled;
set_ustuck() will set flag for botl update, You() pline will set_ustuck() will set flag for botl update, You() pline will
trigger a status update with "UHold" removed */ trigger a status update with "UHold" removed */
@@ -694,7 +694,7 @@ get_mon_location(
coordxy *xp, coordxy *yp, coordxy *xp, coordxy *yp,
int locflags) /* non-zero means get location even if monster is buried */ int locflags) /* non-zero means get location even if monster is buried */
{ {
if (mon == u.umonst || (u.usteed && mon == u.usteed)) { if (mon == &gy.youmonst || (u.usteed && mon == u.usteed)) {
*xp = u.ux; *xp = u.ux;
*yp = u.uy; *yp = u.uy;
return TRUE; return TRUE;
@@ -1159,7 +1159,7 @@ unturn_dead(struct monst *mon)
struct monst *mtmp2; struct monst *mtmp2;
char owner[BUFSZ], corpse[BUFSZ]; char owner[BUFSZ], corpse[BUFSZ];
unsigned save_norevive; unsigned save_norevive;
boolean youseeit, different_type, is_u = (mon == u.umonst); boolean youseeit, different_type, is_u = (mon == &gy.youmonst);
int corpsenm, res = 0; int corpsenm, res = 0;
youseeit = is_u ? TRUE : canseemon(mon); youseeit = is_u ? TRUE : canseemon(mon);
@@ -1224,9 +1224,9 @@ unturn_dead(struct monst *mon)
void void
unturn_you(void) unturn_you(void)
{ {
(void) unturn_dead(u.umonst); /* hit carried corpses and eggs */ (void) unturn_dead(&gy.youmonst); /* hit carried corpses and eggs */
if (is_undead(u.umonst->data)) { if (is_undead(gy.youmonst.data)) {
You_feel("frightened and %sstunned.", Stunned ? "even more " : ""); You_feel("frightened and %sstunned.", Stunned ? "even more " : "");
make_stunned((HStun & TIMEOUT) + (long) rnd(30), FALSE); make_stunned((HStun & TIMEOUT) + (long) rnd(30), FALSE);
} else { } else {
@@ -2102,7 +2102,7 @@ stone_to_flesh_obj(struct obj *obj) /* nonnull */
non-omnivorous form, regardless of whether it's herbivorous, non-omnivorous form, regardless of whether it's herbivorous,
non-eating, or something stranger) */ non-eating, or something stranger) */
if (Role_if(PM_MONK) || !u.uconduct.unvegetarian if (Role_if(PM_MONK) || !u.uconduct.unvegetarian
|| !carnivorous(u.umonst->data)) || !carnivorous(gy.youmonst.data))
Norep("You smell the odor of meat."); Norep("You smell the odor of meat.");
else else
Norep("You smell a delicious smell."); Norep("You smell a delicious smell.");
@@ -2206,14 +2206,14 @@ bhito(struct obj *obj, struct obj *otmp)
if (obj_shudders(obj)) { if (obj_shudders(obj)) {
boolean cover = ((obj == svl.level.objects[u.ux][u.uy]) boolean cover = ((obj == svl.level.objects[u.ux][u.uy])
&& u.uundetected && u.uundetected
&& hides_under(u.umonst->data)); && hides_under(gy.youmonst.data));
if (cansee(obj->ox, obj->oy)) if (cansee(obj->ox, obj->oy))
learn_it = TRUE; learn_it = TRUE;
do_osshock(obj); do_osshock(obj);
/* eek - your cover might have been blown */ /* eek - your cover might have been blown */
if (cover) if (cover)
(void) hideunder(u.umonst); (void) hideunder(&gy.youmonst);
break; break;
} }
obj = poly_obj(obj, STRANGE_OBJECT); obj = poly_obj(obj, STRANGE_OBJECT);
@@ -2440,7 +2440,7 @@ bhitpile(
/* if hiding underneath an object and zapping up or down, the top item /* if hiding underneath an object and zapping up or down, the top item
is either the only thing hit (up) or is skipped (down) */ is either the only thing hit (up) or is skipped (down) */
hidingunder = (zz != 0 && u.uundetected && hides_under(u.umonst->data)); hidingunder = (zz != 0 && u.uundetected && hides_under(gy.youmonst.data));
first = TRUE; first = TRUE;
if (obj->otyp == SPE_FORCE_BOLT || obj->otyp == WAN_STRIKING) { if (obj->otyp == SPE_FORCE_BOLT || obj->otyp == WAN_STRIKING) {
@@ -2629,7 +2629,7 @@ dozap(void)
struct obj *obj; struct obj *obj;
int damage, need_dir; int damage, need_dir;
if (nohands(u.umonst->data)) { if (nohands(gy.youmonst.data)) {
You("aren't able to zap anything in your current form."); You("aren't able to zap anything in your current form.");
return ECMD_OK; return ECMD_OK;
} }
@@ -2741,7 +2741,7 @@ zapyourself(struct obj *obj, boolean ordinary)
monstseesu(M_SEEN_ELEC); monstseesu(M_SEEN_ELEC);
ugolemeffects(AD_ELEC, orig_dmg); ugolemeffects(AD_ELEC, orig_dmg);
} }
(void) destroy_items(u.umonst, AD_ELEC, orig_dmg); (void) destroy_items(&gy.youmonst, AD_ELEC, orig_dmg);
(void) flashburn((long) rnd(100), TRUE); (void) flashburn((long) rnd(100), TRUE);
break; break;
@@ -2764,8 +2764,8 @@ zapyourself(struct obj *obj, boolean ordinary)
monstunseesu(M_SEEN_FIRE); monstunseesu(M_SEEN_FIRE);
} }
burn_away_slime(); burn_away_slime();
(void) burnarmor(u.umonst); (void) burnarmor(&gy.youmonst);
(void) destroy_items(u.umonst, AD_FIRE, orig_dmg); (void) destroy_items(&gy.youmonst, AD_FIRE, orig_dmg);
ignite_items(gi.invent); ignite_items(gi.invent);
break; break;
@@ -2784,7 +2784,7 @@ zapyourself(struct obj *obj, boolean ordinary)
damage = orig_dmg; damage = orig_dmg;
monstunseesu(M_SEEN_COLD); monstunseesu(M_SEEN_COLD);
} }
(void) destroy_items(u.umonst, AD_COLD, orig_dmg); (void) destroy_items(&gy.youmonst, AD_COLD, orig_dmg);
break; break;
case WAN_MAGIC_MISSILE: case WAN_MAGIC_MISSILE:
@@ -2811,7 +2811,7 @@ zapyourself(struct obj *obj, boolean ordinary)
case WAN_CANCELLATION: case WAN_CANCELLATION:
case SPE_CANCELLATION: case SPE_CANCELLATION:
(void) cancel_monst(u.umonst, obj, TRUE, TRUE, TRUE); (void) cancel_monst(&gy.youmonst, obj, TRUE, TRUE, TRUE);
break; break;
case SPE_DRAIN_LIFE: case SPE_DRAIN_LIFE:
@@ -2884,7 +2884,7 @@ zapyourself(struct obj *obj, boolean ordinary)
case WAN_DEATH: case WAN_DEATH:
case SPE_FINGER_OF_DEATH: case SPE_FINGER_OF_DEATH:
if (nonliving(u.umonst->data) || is_demon(u.umonst->data)) { if (nonliving(gy.youmonst.data) || is_demon(gy.youmonst.data)) {
pline((obj->otyp == WAN_DEATH) pline((obj->otyp == WAN_DEATH)
? "The wand shoots an apparently harmless beam at you." ? "The wand shoots an apparently harmless beam at you."
: "You seem no deader than before."); : "You seem no deader than before.");
@@ -2939,16 +2939,16 @@ zapyourself(struct obj *obj, boolean ordinary)
unpunish(); unpunish();
} }
/* invent is hit iff hero doesn't escape from a trap */ /* invent is hit iff hero doesn't escape from a trap */
if (!u.utrap || !openholdingtrap(u.umonst, &learn_it)) { if (!u.utrap || !openholdingtrap(&gy.youmonst, &learn_it)) {
boxlock_invent(obj); boxlock_invent(obj);
/* trigger previously escaped trapdoor */ /* trigger previously escaped trapdoor */
(void) openfallingtrap(u.umonst, TRUE, &learn_it); (void) openfallingtrap(&gy.youmonst, TRUE, &learn_it);
} }
break; break;
case WAN_LOCKING: case WAN_LOCKING:
case SPE_WIZARD_LOCK: case SPE_WIZARD_LOCK:
/* similar logic to opening; invent is hit iff no trap triggered */ /* similar logic to opening; invent is hit iff no trap triggered */
if (u.utrap || !closeholdingtrap(u.umonst, &learn_it)) { if (u.utrap || !closeholdingtrap(&gy.youmonst, &learn_it)) {
boxlock_invent(obj); boxlock_invent(obj);
} }
break; break;
@@ -3032,7 +3032,7 @@ lightdamage(
const char *how; const char *how;
int dmg = amt; int dmg = amt;
if (dmg && u.umonst->data == &mons[PM_GREMLIN]) { if (dmg && gy.youmonst.data == &mons[PM_GREMLIN]) {
/* reduce high values (from destruction of wand with many charges) */ /* reduce high values (from destruction of wand with many charges) */
dmg = rnd(dmg); dmg = rnd(dmg);
if (dmg > 10) if (dmg > 10)
@@ -3059,7 +3059,7 @@ lightdamage(
boolean boolean
flashburn(long duration, boolean via_lightning) flashburn(long duration, boolean via_lightning)
{ {
if (!resists_blnd(u.umonst)) { if (!resists_blnd(&gy.youmonst)) {
You(are_blinded_by_the_flash); You(are_blinded_by_the_flash);
make_blinded(duration, FALSE); make_blinded(duration, FALSE);
if (!Blind) if (!Blind)
@@ -3072,7 +3072,7 @@ flashburn(long duration, boolean via_lightning)
if hero is both lightning resistant and blindness resistant, or if hero is both lightning resistant and blindness resistant, or
worse, have a single sparkle where the player confuses blindness worse, have a single sparkle where the player confuses blindness
resistance for lightning resistance */ resistance for lightning resistance */
if (!via_lightning && resists_blnd_by_arti(u.umonst)) { if (!via_lightning && resists_blnd_by_arti(&gy.youmonst)) {
shieldeff(u.ux, u.uy); shieldeff(u.ux, u.uy);
return TRUE; return TRUE;
} }
@@ -3153,7 +3153,7 @@ cancel_monst(struct monst *mdef, struct obj *obj, boolean youattack,
static const char static const char
writing_vanishes[] = "Some writing vanishes from %s head!", writing_vanishes[] = "Some writing vanishes from %s head!",
your[] = "your"; /* should be extern */ your[] = "your"; /* should be extern */
boolean youdefend = (mdef == u.umonst); boolean youdefend = (mdef == &gy.youmonst);
if (youdefend ? (!youattack && Antimagic) if (youdefend ? (!youattack && Antimagic)
: resist(mdef, obj->oclass, 0, NOTELL)) : resist(mdef, obj->oclass, 0, NOTELL))
@@ -3281,10 +3281,10 @@ zap_updown(struct obj *obj) /* wand or spell, nonnull */
} }
/* down will release you from bear trap or web */ /* down will release you from bear trap or web */
if (u.dz > 0 && u.utrap) { if (u.dz > 0 && u.utrap) {
(void) openholdingtrap(u.umonst, &disclose); (void) openholdingtrap(&gy.youmonst, &disclose);
/* down will trigger trapdoor, hole, or [spiked-] pit */ /* down will trigger trapdoor, hole, or [spiked-] pit */
} else if (u.dz > 0 && !u.utrap) { } else if (u.dz > 0 && !u.utrap) {
(void) openfallingtrap(u.umonst, FALSE, &disclose); (void) openfallingtrap(&gy.youmonst, FALSE, &disclose);
} }
break; break;
case WAN_STRIKING: case WAN_STRIKING:
@@ -3319,7 +3319,7 @@ zap_updown(struct obj *obj) /* wand or spell, nonnull */
} }
newsym(x, y); newsym(x, y);
} else if (u.dz > 0 && ttmp) { } else if (u.dz > 0 && ttmp) {
if (!striking && closeholdingtrap(u.umonst, &disclose)) { if (!striking && closeholdingtrap(&gy.youmonst, &disclose)) {
; /* now stuck in web or bear trap */ ; /* now stuck in web or bear trap */
} else if (striking && ttmp->ttyp == TRAPDOOR) { } else if (striking && ttmp->ttyp == TRAPDOOR) {
/* striking transforms trapdoor into hole */ /* striking transforms trapdoor into hole */
@@ -3394,14 +3394,14 @@ zap_updown(struct obj *obj) /* wand or spell, nonnull */
/* game flavor: if you're hiding under "something" /* game flavor: if you're hiding under "something"
* a zap upward should hit that "something". * a zap upward should hit that "something".
*/ */
if (u.uundetected && hides_under(u.umonst->data)) { if (u.uundetected && hides_under(gy.youmonst.data)) {
int hitit = 0; int hitit = 0;
otmp = svl.level.objects[u.ux][u.uy]; otmp = svl.level.objects[u.ux][u.uy];
if (otmp) if (otmp)
hitit = bhito(otmp, obj); hitit = bhito(otmp, obj);
if (hitit) { if (hitit) {
(void) hideunder(u.umonst); (void) hideunder(&gy.youmonst);
disclose = TRUE; disclose = TRUE;
} }
} }
@@ -3558,7 +3558,7 @@ hit(
struct monst *mtmp, /* target; for missile, might be hero */ struct monst *mtmp, /* target; for missile, might be hero */
const char *force) /* usually either "." or "!" via exclam() */ const char *force) /* usually either "." or "!" via exclam() */
{ {
boolean verbosely = (mtmp == u.umonst boolean verbosely = (mtmp == &gy.youmonst
|| (flags.verbose || (flags.verbose
&& (cansee(gb.bhitpos.x, gb.bhitpos.y) && (cansee(gb.bhitpos.x, gb.bhitpos.y)
|| canspotmon(mtmp) || engulfing_u(mtmp)))); || canspotmon(mtmp) || engulfing_u(mtmp))));
@@ -3982,7 +3982,7 @@ bhit(
they will be aiming at the monster */ they will be aiming at the monster */
xyglyph = glyph_at(x, y); xyglyph = glyph_at(x, y);
if (mtmp && (((weapon == THROWN_WEAPON || weapon == KICKED_WEAPON) if (mtmp && (((weapon == THROWN_WEAPON || weapon == KICKED_WEAPON)
&& (shade_miss(u.umonst, mtmp, obj, TRUE, TRUE) && (shade_miss(&gy.youmonst, mtmp, obj, TRUE, TRUE)
|| (M_AP_TYPE(mtmp) == M_AP_OBJECT || (M_AP_TYPE(mtmp) == M_AP_OBJECT
&& !glyph_is_monster(xyglyph) && !glyph_is_monster(xyglyph)
&& !glyph_is_warning(xyglyph) && !glyph_is_warning(xyglyph)
@@ -4201,7 +4201,7 @@ boomhit(struct obj *obj, int dx, int dy)
} }
if (u_at(gb.bhitpos.x, gb.bhitpos.y)) { /* ct == 9 */ if (u_at(gb.bhitpos.x, gb.bhitpos.y)) { /* ct == 9 */
if (Fumbling || rn2(20) >= ACURR(A_DEX)) { if (Fumbling || rn2(20) >= ACURR(A_DEX)) {
int dam = dmgval(obj, u.umonst); int dam = dmgval(obj, &gy.youmonst);
/* we hit ourselves */ /* we hit ourselves */
(void) thitu(10 + obj->spe, Maybe_Half_Phys(dam), &obj, (void) thitu(10 + obj->spe, Maybe_Half_Phys(dam), &obj,
@@ -4211,7 +4211,7 @@ boomhit(struct obj *obj, int dx, int dy)
} else { /* we catch it */ } else { /* we catch it */
tmp_at(DISP_END, 0); tmp_at(DISP_END, 0);
You("skillfully catch the boomerang."); You("skillfully catch the boomerang.");
return u.umonst; return &gy.youmonst;
} }
} }
tmp_at(gb.bhitpos.x, gb.bhitpos.y); tmp_at(gb.bhitpos.x, gb.bhitpos.y);
@@ -4430,9 +4430,9 @@ zhitu(
monstunseesu(M_SEEN_FIRE); monstunseesu(M_SEEN_FIRE);
} }
burn_away_slime(); burn_away_slime();
if (burnarmor(u.umonst)) { /* "body hit" */ if (burnarmor(&gy.youmonst)) { /* "body hit" */
if (!rn2(3)) if (!rn2(3))
(void) destroy_items(u.umonst, AD_FIRE, orig_dam); (void) destroy_items(&gy.youmonst, AD_FIRE, orig_dam);
if (!rn2(3)) if (!rn2(3))
ignite_items(gi.invent); ignite_items(gi.invent);
} }
@@ -4449,7 +4449,7 @@ zhitu(
monstunseesu(M_SEEN_COLD); monstunseesu(M_SEEN_COLD);
} }
if (!rn2(3)) if (!rn2(3))
(void) destroy_items(u.umonst, AD_COLD, orig_dam); (void) destroy_items(&gy.youmonst, AD_COLD, orig_dam);
break; break;
case ZT_SLEEP: case ZT_SLEEP:
if (Sleep_resistance) { if (Sleep_resistance) {
@@ -4490,7 +4490,7 @@ zhitu(
(void) disintegrate_arm(uarmc); (void) disintegrate_arm(uarmc);
if (uarmu) if (uarmu)
(void) disintegrate_arm(uarmu); (void) disintegrate_arm(uarmu);
} else if (nonliving(u.umonst->data) || is_demon(u.umonst->data)) { } else if (nonliving(gy.youmonst.data) || is_demon(gy.youmonst.data)) {
shieldeff(sx, sy); shieldeff(sx, sy);
You("seem unaffected."); You("seem unaffected.");
break; break;
@@ -4520,7 +4520,7 @@ zhitu(
monstunseesu(M_SEEN_ELEC); monstunseesu(M_SEEN_ELEC);
} }
if (!rn2(3)) if (!rn2(3))
(void) destroy_items(u.umonst, AD_ELEC, orig_dam); (void) destroy_items(&gy.youmonst, AD_ELEC, orig_dam);
break; break;
case ZT_POISON_GAS: case ZT_POISON_GAS:
poisoned("blast", A_DEX, "poisoned blast", 15, FALSE); poisoned("blast", A_DEX, "poisoned blast", 15, FALSE);
@@ -4542,7 +4542,7 @@ zhitu(
if (u.twoweap && !rn2(3)) if (u.twoweap && !rn2(3))
acid_damage(uswapwep); acid_damage(uswapwep);
if (!rn2(6)) if (!rn2(6))
erode_armor(u.umonst, ERODE_CORRODE); erode_armor(&gy.youmonst, ERODE_CORRODE);
break; break;
} }
@@ -4891,7 +4891,7 @@ dobuzz(
pline("%s disintegrates.", Monnam(mon)); pline("%s disintegrates.", Monnam(mon));
pline("%s body reintegrates before your %s!", pline("%s body reintegrates before your %s!",
s_suffix(Monnam(mon)), s_suffix(Monnam(mon)),
(eyecount(u.umonst->data) == 1) (eyecount(gy.youmonst.data) == 1)
? body_part(EYE) ? body_part(EYE)
: makeplural(body_part(EYE))); : makeplural(body_part(EYE)));
pline("%s resurrects!", Monnam(mon)); pline("%s resurrects!", Monnam(mon));
@@ -5803,7 +5803,7 @@ maybe_destroy_item(
long i, cnt, quan; long i, cnt, quan;
int dmg, xresist, skip, dindx; int dmg, xresist, skip, dindx;
const char *mult; const char *mult;
boolean u_carry = (carrier == u.umonst); boolean u_carry = (carrier == &gy.youmonst);
boolean vis = !u_carry && canseemon(carrier); boolean vis = !u_carry && canseemon(carrier);
boolean chargeit = FALSE; boolean chargeit = FALSE;
@@ -5912,8 +5912,8 @@ maybe_destroy_item(
} }
if (u_carry) { /* effects that happen only to the player */ if (u_carry) { /* effects that happen only to the player */
if (osym == POTION_CLASS && dmgtyp != AD_COLD if (osym == POTION_CLASS && dmgtyp != AD_COLD
&& (!breathless(u.umonst->data) && (!breathless(gy.youmonst.data)
|| haseyes(u.umonst->data))) { || haseyes(gy.youmonst.data))) {
potionbreathe(obj); potionbreathe(obj);
} }
if (obj->owornmask) { /* m_useup handles these for monster */ if (obj->owornmask) { /* m_useup handles these for monster */
@@ -5977,7 +5977,7 @@ destroy_items(
boolean deferred; boolean deferred;
} items_to_destroy[MAX_ITEMS_DESTROYED]; } items_to_destroy[MAX_ITEMS_DESTROYED];
int elig_stacks = 0; /* number of destroyable objects found so far */ int elig_stacks = 0; /* number of destroyable objects found so far */
boolean u_carry = (mon == u.umonst); boolean u_carry = (mon == &gy.youmonst);
/* this is a struct obj** because we might destroy the first item in it */ /* this is a struct obj** because we might destroy the first item in it */
struct obj **objchn = u_carry ? &gi.invent : &mon->minvent; struct obj **objchn = u_carry ? &gi.invent : &mon->minvent;
int dmg_out = 0; /* damage caused by items getting destroyed */ int dmg_out = 0; /* damage caused by items getting destroyed */