intrinsics revamp (trunk only)

Simplify many of the intrinsics macros from
  #define xxx_resistance (Hxxx || Exxx || resists_xxx(&youmonst))
down to
  #define xxx_resistance (Hxxx || Exxx)
by setting or clearing an extra bit in Hxxx during polymorph so that the
resists_xxx() check becomes implicit.

     Unfornately there were lots of places in the code that treat Hxxx
as a timeout number--primarily for Stunned, Confused, and Hallucination;
Stunned happens to be one of the revised macros--rather than as a bit
mask, so this patch needed a lot more changes than originally antipated.
This commit is contained in:
nethack.rankin
2011-10-01 00:25:57 +00:00
parent cd8eefb622
commit 84f02bd336
24 changed files with 231 additions and 191 deletions
+1 -1
View File
@@ -13,7 +13,7 @@
* Incrementing EDITLEVEL can be used to force invalidation of old bones * Incrementing EDITLEVEL can be used to force invalidation of old bones
* and save files. * and save files.
*/ */
#define EDITLEVEL 48 #define EDITLEVEL 49
#define COPYRIGHT_BANNER_A \ #define COPYRIGHT_BANNER_A \
"NetHack, Copyright 1985-2011" "NetHack, Copyright 1985-2011"
+2 -1
View File
@@ -132,7 +132,8 @@ struct prop {
# define FROMOUTSIDE 0x04000000L /* By corpses, prayer, thrones, etc. */ # define FROMOUTSIDE 0x04000000L /* By corpses, prayer, thrones, etc. */
# define INTRINSIC (FROMOUTSIDE|FROMRACE|FROMEXPER) # define INTRINSIC (FROMOUTSIDE|FROMRACE|FROMEXPER)
/* Control flags */ /* Control flags */
# define I_SPECIAL 0x10000000L /* Property is controllable */ # define FROMFORM 0x10000000L /* Polyd; conferred by monster form */
# define I_SPECIAL 0x20000000L /* Property is controllable */
}; };
/*** Definitions for backwards compatibility ***/ /*** Definitions for backwards compatibility ***/
+45 -62
View File
@@ -17,6 +17,8 @@
* EXxx refers to extrinsic bitfields from worn objects. * EXxx refers to extrinsic bitfields from worn objects.
* BXxx refers to the cause of the property being blocked. * BXxx refers to the cause of the property being blocked.
* Xxx refers to any source, including polymorph forms. * Xxx refers to any source, including polymorph forms.
* [Post-3.4.3: HXxx now includes a FROMFORM bit to handle
* intrinsic conferred by being polymorphed.]
*/ */
@@ -27,68 +29,60 @@
/* With intrinsics and extrinsics */ /* With intrinsics and extrinsics */
#define HFire_resistance u.uprops[FIRE_RES].intrinsic #define HFire_resistance u.uprops[FIRE_RES].intrinsic
#define EFire_resistance u.uprops[FIRE_RES].extrinsic #define EFire_resistance u.uprops[FIRE_RES].extrinsic
#define Fire_resistance (HFire_resistance || EFire_resistance || \ #define Fire_resistance (HFire_resistance || EFire_resistance)
resists_fire(&youmonst))
#define HCold_resistance u.uprops[COLD_RES].intrinsic #define HCold_resistance u.uprops[COLD_RES].intrinsic
#define ECold_resistance u.uprops[COLD_RES].extrinsic #define ECold_resistance u.uprops[COLD_RES].extrinsic
#define Cold_resistance (HCold_resistance || ECold_resistance || \ #define Cold_resistance (HCold_resistance || ECold_resistance)
resists_cold(&youmonst))
#define HSleep_resistance u.uprops[SLEEP_RES].intrinsic #define HSleep_resistance u.uprops[SLEEP_RES].intrinsic
#define ESleep_resistance u.uprops[SLEEP_RES].extrinsic #define ESleep_resistance u.uprops[SLEEP_RES].extrinsic
#define Sleep_resistance (HSleep_resistance || ESleep_resistance || \ #define Sleep_resistance (HSleep_resistance || ESleep_resistance)
resists_sleep(&youmonst))
#define HDisint_resistance u.uprops[DISINT_RES].intrinsic #define HDisint_resistance u.uprops[DISINT_RES].intrinsic
#define EDisint_resistance u.uprops[DISINT_RES].extrinsic #define EDisint_resistance u.uprops[DISINT_RES].extrinsic
#define Disint_resistance (HDisint_resistance || EDisint_resistance || \ #define Disint_resistance (HDisint_resistance || EDisint_resistance)
resists_disint(&youmonst))
#define HShock_resistance u.uprops[SHOCK_RES].intrinsic #define HShock_resistance u.uprops[SHOCK_RES].intrinsic
#define EShock_resistance u.uprops[SHOCK_RES].extrinsic #define EShock_resistance u.uprops[SHOCK_RES].extrinsic
#define Shock_resistance (HShock_resistance || EShock_resistance || \ #define Shock_resistance (HShock_resistance || EShock_resistance)
resists_elec(&youmonst))
#define HPoison_resistance u.uprops[POISON_RES].intrinsic #define HPoison_resistance u.uprops[POISON_RES].intrinsic
#define EPoison_resistance u.uprops[POISON_RES].extrinsic #define EPoison_resistance u.uprops[POISON_RES].extrinsic
#define Poison_resistance (HPoison_resistance || EPoison_resistance || \ #define Poison_resistance (HPoison_resistance || EPoison_resistance)
resists_poison(&youmonst))
#define HDrain_resistance u.uprops[DRAIN_RES].intrinsic #define HDrain_resistance u.uprops[DRAIN_RES].intrinsic
#define EDrain_resistance u.uprops[DRAIN_RES].extrinsic #define EDrain_resistance u.uprops[DRAIN_RES].extrinsic
#define Drain_resistance (HDrain_resistance || EDrain_resistance || \ #define Drain_resistance (HDrain_resistance || EDrain_resistance)
resists_drli(&youmonst))
/* Hxxx due to FROMFORM only */
#define HAntimagic u.uprops[ANTIMAGIC].intrinsic
#define EAntimagic u.uprops[ANTIMAGIC].extrinsic
#define Antimagic (HAntimagic || EAntimagic)
#define HAcid_resistance u.uprops[ACID_RES].intrinsic
#define EAcid_resistance u.uprops[ACID_RES].extrinsic
#define Acid_resistance (HAcid_resistance || EAcid_resistance)
#define HStone_resistance u.uprops[STONE_RES].intrinsic
#define EStone_resistance u.uprops[STONE_RES].extrinsic
#define Stone_resistance (HStone_resistance || EStone_resistance)
/* Intrinsics only */ /* Intrinsics only */
#define HSick_resistance u.uprops[SICK_RES].intrinsic #define HSick_resistance u.uprops[SICK_RES].intrinsic
#define Sick_resistance (HSick_resistance || \ #define Sick_resistance (HSick_resistance || \
youmonst.data->mlet == S_FUNGUS || \
youmonst.data == &mons[PM_GHOUL] || \
defends(AD_DISE,uwep)) defends(AD_DISE,uwep))
#define Invulnerable u.uprops[INVULNERABLE].intrinsic /* [Tom] */ #define Invulnerable u.uprops[INVULNERABLE].intrinsic /* [Tom] */
/* Extrinsics only */
#define EAntimagic u.uprops[ANTIMAGIC].extrinsic
#define Antimagic (EAntimagic || \
(Upolyd && resists_magm(&youmonst)))
#define EAcid_resistance u.uprops[ACID_RES].extrinsic
#define Acid_resistance (EAcid_resistance || resists_acid(&youmonst))
#define EStone_resistance u.uprops[STONE_RES].extrinsic
#define Stone_resistance (EStone_resistance || resists_ston(&youmonst))
/*** Troubles ***/ /*** Troubles ***/
/* Pseudo-property */ /* Pseudo-property */
#define Punished (uball) #define Punished (uball != 0)
/* Those implemented solely as timeouts (we use just intrinsic) */ /* Those implemented solely as timeouts (we use just intrinsic) */
#define HStun u.uprops[STUNNED].intrinsic #define HStun u.uprops[STUNNED].intrinsic
#define Stunned (HStun || u.umonnum == PM_STALKER || \ #define Stunned HStun
youmonst.data->mlet == S_BAT)
/* Note: birds will also be stunned */
#define HConfusion u.uprops[CONFUSION].intrinsic #define HConfusion u.uprops[CONFUSION].intrinsic
#define Confusion HConfusion #define Confusion HConfusion
@@ -111,11 +105,11 @@
#define Glib u.uprops[GLIB].intrinsic #define Glib u.uprops[GLIB].intrinsic
#define Slimed u.uprops[SLIMED].intrinsic /* [Tom] */ #define Slimed u.uprops[SLIMED].intrinsic /* [Tom] */
/* Hallucination is solely a timeout; its resistance is extrinsic */ /* Hallucination is solely a timeout */
#define HHallucination u.uprops[HALLUC].intrinsic #define HHallucination u.uprops[HALLUC].intrinsic
#define HHalluc_resistance u.uprops[HALLUC_RES].intrinsic
#define EHalluc_resistance u.uprops[HALLUC_RES].extrinsic #define EHalluc_resistance u.uprops[HALLUC_RES].extrinsic
#define Halluc_resistance (EHalluc_resistance || \ #define Halluc_resistance (HHalluc_resistance || EHalluc_resistance)
(Upolyd && dmgtype(youmonst.data, AD_HALU)))
#define Hallucination (HHallucination && !Halluc_resistance) #define Hallucination (HHallucination && !Halluc_resistance)
/* Timeout, plus a worn mask */ /* Timeout, plus a worn mask */
@@ -143,13 +137,11 @@
/*** Vision and senses ***/ /*** Vision and senses ***/
#define HSee_invisible u.uprops[SEE_INVIS].intrinsic #define HSee_invisible u.uprops[SEE_INVIS].intrinsic
#define ESee_invisible u.uprops[SEE_INVIS].extrinsic #define ESee_invisible u.uprops[SEE_INVIS].extrinsic
#define See_invisible (HSee_invisible || ESee_invisible || \ #define See_invisible (HSee_invisible || ESee_invisible)
perceives(youmonst.data))
#define HTelepat u.uprops[TELEPAT].intrinsic #define HTelepat u.uprops[TELEPAT].intrinsic
#define ETelepat u.uprops[TELEPAT].extrinsic #define ETelepat u.uprops[TELEPAT].extrinsic
#define Blind_telepat (HTelepat || ETelepat || \ #define Blind_telepat (HTelepat || ETelepat)
telepathic(youmonst.data))
#define Unblind_telepat (ETelepat) #define Unblind_telepat (ETelepat)
#define HWarning u.uprops[WARNING].intrinsic #define HWarning u.uprops[WARNING].intrinsic
@@ -171,13 +163,12 @@
#define HClairvoyant u.uprops[CLAIRVOYANT].intrinsic #define HClairvoyant u.uprops[CLAIRVOYANT].intrinsic
#define EClairvoyant u.uprops[CLAIRVOYANT].extrinsic #define EClairvoyant u.uprops[CLAIRVOYANT].extrinsic
#define BClairvoyant u.uprops[CLAIRVOYANT].blocked #define BClairvoyant u.uprops[CLAIRVOYANT].blocked
#define Clairvoyant ((HClairvoyant || EClairvoyant) &&\ #define Clairvoyant ((HClairvoyant || EClairvoyant) && \
!BClairvoyant) !BClairvoyant)
#define HInfravision u.uprops[INFRAVISION].intrinsic #define HInfravision u.uprops[INFRAVISION].intrinsic
#define EInfravision u.uprops[INFRAVISION].extrinsic #define EInfravision u.uprops[INFRAVISION].extrinsic
#define Infravision (HInfravision || EInfravision || \ #define Infravision (HInfravision || EInfravision)
infravision(youmonst.data))
#define HDetect_monsters u.uprops[DETECT_MONSTERS].intrinsic #define HDetect_monsters u.uprops[DETECT_MONSTERS].intrinsic
#define EDetect_monsters u.uprops[DETECT_MONSTERS].extrinsic #define EDetect_monsters u.uprops[DETECT_MONSTERS].extrinsic
@@ -190,8 +181,7 @@
#define HInvis u.uprops[INVIS].intrinsic #define HInvis u.uprops[INVIS].intrinsic
#define EInvis u.uprops[INVIS].extrinsic #define EInvis u.uprops[INVIS].extrinsic
#define BInvis u.uprops[INVIS].blocked #define BInvis u.uprops[INVIS].blocked
#define Invis ((HInvis || EInvis || \ #define Invis ((HInvis || EInvis) && !BInvis)
pm_invisible(youmonst.data)) && !BInvis)
#define Invisible (Invis && !See_invisible) #define Invisible (Invis && !See_invisible)
/* Note: invisibility also hides inventory and steed */ /* Note: invisibility also hides inventory and steed */
@@ -219,31 +209,28 @@
#define HTeleportation u.uprops[TELEPORT].intrinsic #define HTeleportation u.uprops[TELEPORT].intrinsic
#define ETeleportation u.uprops[TELEPORT].extrinsic #define ETeleportation u.uprops[TELEPORT].extrinsic
#define Teleportation (HTeleportation || ETeleportation || \ #define Teleportation (HTeleportation || ETeleportation)
can_teleport(youmonst.data))
#define HTeleport_control u.uprops[TELEPORT_CONTROL].intrinsic #define HTeleport_control u.uprops[TELEPORT_CONTROL].intrinsic
#define ETeleport_control u.uprops[TELEPORT_CONTROL].extrinsic #define ETeleport_control u.uprops[TELEPORT_CONTROL].extrinsic
#define Teleport_control (HTeleport_control || ETeleport_control || \ #define Teleport_control (HTeleport_control || ETeleport_control)
control_teleport(youmonst.data))
#define HLevitation u.uprops[LEVITATION].intrinsic #define HLevitation u.uprops[LEVITATION].intrinsic
#define ELevitation u.uprops[LEVITATION].extrinsic #define ELevitation u.uprops[LEVITATION].extrinsic
#define Levitation (HLevitation || ELevitation || \ #define Levitation (HLevitation || ELevitation)
is_floater(youmonst.data))
/* Can't touch surface, can't go under water; overrides all others */ /* Can't touch surface, can't go under water; overrides all others */
#define Lev_at_will (((HLevitation & I_SPECIAL) != 0L || \ #define Lev_at_will (((HLevitation & I_SPECIAL) != 0L || \
(ELevitation & W_ARTI) != 0L) && \ (ELevitation & W_ARTI) != 0L) && \
(HLevitation & ~(I_SPECIAL|TIMEOUT)) == 0L && \ (HLevitation & ~(I_SPECIAL|TIMEOUT)) == 0L && \
(ELevitation & ~W_ARTI) == 0L && \ (ELevitation & ~W_ARTI) == 0L)
!is_floater(youmonst.data))
#define HFlying u.uprops[FLYING].intrinsic
#define EFlying u.uprops[FLYING].extrinsic #define EFlying u.uprops[FLYING].extrinsic
#ifdef STEED #ifdef STEED
# define Flying (EFlying || is_flyer(youmonst.data) || \ # define Flying (HFlying || EFlying || \
(u.usteed && is_flyer(u.usteed->data))) (u.usteed && is_flyer(u.usteed->data)))
#else #else
# define Flying (EFlying || is_flyer(youmonst.data)) # define Flying (HFlying || EFlying)
#endif #endif
/* May touch surface; does not override any others */ /* May touch surface; does not override any others */
@@ -256,11 +243,9 @@
#define ESwimming u.uprops[SWIMMING].extrinsic /* [Tom] */ #define ESwimming u.uprops[SWIMMING].extrinsic /* [Tom] */
#ifdef STEED #ifdef STEED
# define Swimming (HSwimming || ESwimming || \ # define Swimming (HSwimming || ESwimming || \
is_swimmer(youmonst.data) || \
(u.usteed && is_swimmer(u.usteed->data))) (u.usteed && is_swimmer(u.usteed->data)))
#else #else
# define Swimming (HSwimming || ESwimming || \ # define Swimming (HSwimming || ESwimming)
is_swimmer(youmonst.data))
#endif #endif
/* Get wet, don't go under water unless if amphibious */ /* Get wet, don't go under water unless if amphibious */
@@ -280,8 +265,7 @@
#define HPasses_walls u.uprops[PASSES_WALLS].intrinsic #define HPasses_walls u.uprops[PASSES_WALLS].intrinsic
#define EPasses_walls u.uprops[PASSES_WALLS].extrinsic #define EPasses_walls u.uprops[PASSES_WALLS].extrinsic
#define Passes_walls (HPasses_walls || EPasses_walls || \ #define Passes_walls (HPasses_walls || EPasses_walls)
passes_walls(youmonst.data))
/*** Physical attributes ***/ /*** Physical attributes ***/
@@ -313,8 +297,7 @@
#define HRegeneration u.uprops[REGENERATION].intrinsic #define HRegeneration u.uprops[REGENERATION].intrinsic
#define ERegeneration u.uprops[REGENERATION].extrinsic #define ERegeneration u.uprops[REGENERATION].extrinsic
#define Regeneration (HRegeneration || ERegeneration || \ #define Regeneration (HRegeneration || ERegeneration)
regenerates(youmonst.data))
#define HEnergy_regeneration u.uprops[ENERGY_REGENERATION].intrinsic #define HEnergy_regeneration u.uprops[ENERGY_REGENERATION].intrinsic
#define EEnergy_regeneration u.uprops[ENERGY_REGENERATION].extrinsic #define EEnergy_regeneration u.uprops[ENERGY_REGENERATION].extrinsic
@@ -349,9 +332,9 @@
#define Fast (HFast || EFast) #define Fast (HFast || EFast)
#define Very_fast ((HFast & ~INTRINSIC) || EFast) #define Very_fast ((HFast & ~INTRINSIC) || EFast)
#define HReflecting u.uprops[REFLECTING].intrinsic
#define EReflecting u.uprops[REFLECTING].extrinsic #define EReflecting u.uprops[REFLECTING].extrinsic
#define Reflecting (EReflecting || \ #define Reflecting (HReflecting || EReflecting)
(youmonst.data == &mons[PM_SILVER_DRAGON]))
#define Free_action u.uprops[FREE_ACTION].extrinsic /* [Tom] */ #define Free_action u.uprops[FREE_ACTION].extrinsic /* [Tom] */
+24 -23
View File
@@ -102,7 +102,7 @@ use_towel(obj)
switch (rn2(3)) { switch (rn2(3)) {
case 2: case 2:
old = Glib; old = Glib;
Glib += rn1(10, 3); incr_itimeout(&Glib, rn1(10, 3));
Your("%s %s!", makeplural(body_part(HAND)), Your("%s %s!", makeplural(body_part(HAND)),
(old ? "are filthier than ever" : "get slimy")); (old ? "are filthier than ever" : "get slimy"));
return 1; return 1;
@@ -1628,21 +1628,23 @@ struct obj *obj;
long lcount = (long) rnd(100); long lcount = (long) rnd(100);
switch (rn2(6)) { switch (rn2(6)) {
case 0: make_sick(Sick ? Sick/3L + 1L : (long)rn1(ACURR(A_CON),20), case 0: make_sick((Sick & TIMEOUT) ? (Sick & TIMEOUT) / 3L + 1L :
xname(obj), TRUE, SICK_NONVOMITABLE); (long)rn1(ACURR(A_CON),20),
xname(obj), TRUE, SICK_NONVOMITABLE);
break; break;
case 1: make_blinded(Blinded + lcount, TRUE); case 1: make_blinded((Blinded & TIMEOUT) + lcount, TRUE);
break; break;
case 2: if (!Confusion) case 2: if (!Confusion)
You("suddenly feel %s.", You("suddenly feel %s.",
Hallucination ? "trippy" : "confused"); Hallucination ? "trippy" : "confused");
make_confused(HConfusion + lcount, TRUE); make_confused((HConfusion & TIMEOUT) + lcount, TRUE);
break; break;
case 3: make_stunned(HStun + lcount, TRUE); case 3: make_stunned((HStun & TIMEOUT) + lcount, TRUE);
break; break;
case 4: (void) adjattrib(rn2(A_MAX), -1, FALSE); case 4: (void) adjattrib(rn2(A_MAX), -1, FALSE);
break; break;
case 5: (void) make_hallucinated(HHallucination + lcount, TRUE, 0L); case 5: (void) make_hallucinated((HHallucination & TIMEOUT)
+ lcount, TRUE, 0L);
break; break;
} }
return; return;
@@ -1655,19 +1657,20 @@ struct obj *obj;
#define attr2trbl(Y) (Y) #define attr2trbl(Y) (Y)
#define prop_trouble(X) trouble_list[trouble_count++] = prop2trbl(X) #define prop_trouble(X) trouble_list[trouble_count++] = prop2trbl(X)
#define attr_trouble(Y) trouble_list[trouble_count++] = attr2trbl(Y) #define attr_trouble(Y) trouble_list[trouble_count++] = attr2trbl(Y)
#define TimedTrouble(P) (((P) && !((P) & ~TIMEOUT)) ? ((P) & TIMEOUT) : 0L)
trouble_count = unfixable_trbl = did_prop = did_attr = 0; trouble_count = unfixable_trbl = did_prop = did_attr = 0;
/* collect property troubles */ /* collect property troubles */
if (Sick) prop_trouble(SICK); if (TimedTrouble(Sick)) prop_trouble(SICK);
if (Blinded > (long)u.ucreamed && if (TimedTrouble(Blinded) > (long)u.ucreamed &&
!(u.uswallow && !(u.uswallow &&
attacktype_fordmg(u.ustuck->data, AT_ENGL, AD_BLND))) attacktype_fordmg(u.ustuck->data, AT_ENGL, AD_BLND)))
prop_trouble(BLINDED); prop_trouble(BLINDED);
if (HHallucination) prop_trouble(HALLUC); if (TimedTrouble(HHallucination)) prop_trouble(HALLUC);
if (Vomiting) prop_trouble(VOMITING); if (TimedTrouble(Vomiting)) prop_trouble(VOMITING);
if (HConfusion) prop_trouble(CONFUSION); if (TimedTrouble(HConfusion)) prop_trouble(CONFUSION);
if (HStun) prop_trouble(STUNNED); if (TimedTrouble(HStun)) prop_trouble(STUNNED);
unfixable_trbl = unfixable_trouble_count(TRUE); unfixable_trbl = unfixable_trouble_count(TRUE);
@@ -1768,6 +1771,7 @@ struct obj *obj;
#undef attr2trbl #undef attr2trbl
#undef prop_trouble #undef prop_trouble
#undef attr_trouble #undef attr_trouble
#undef TimedTrouble
} }
/* /*
@@ -2001,7 +2005,7 @@ struct obj *obj;
makeplural(body_part(HAND))); makeplural(body_part(HAND)));
} }
} else { } else {
Glib += rnd(15); incr_itimeout(&Glib, rnd(15));
You("coat your %s with grease.", You("coat your %s with grease.",
makeplural(body_part(FINGER))); makeplural(body_part(FINGER)));
} }
@@ -3316,15 +3320,12 @@ unfixable_trouble_count(is_horn)
/* lycanthropy is not desirable, but it doesn't actually make you feel /* lycanthropy is not desirable, but it doesn't actually make you feel
bad */ bad */
/* we'll assume that intrinsic stunning from being a bat/stalker if (!is_horn || (Confusion & ~TIMEOUT)) unfixable_trbl++;
doesn't make you feel bad */ if (!is_horn || (Sick & ~TIMEOUT)) unfixable_trbl++;
if (!is_horn) { if (!is_horn || (HHallucination & ~TIMEOUT)) unfixable_trbl++;
if (Confusion) unfixable_trbl++; if (!is_horn || (Vomiting & ~TIMEOUT)) unfixable_trbl++;
if (Sick) unfixable_trbl++; if (!is_horn || (HStun & ~TIMEOUT)) unfixable_trbl++;
if (HHallucination) unfixable_trbl++;
if (Vomiting) unfixable_trbl++;
if (HStun) unfixable_trbl++;
}
return unfixable_trbl; return unfixable_trbl;
} }
+2 -2
View File
@@ -1013,7 +1013,7 @@ char *hittee; /* target's name: "you" or mon_nam(mdef) */
/* stun if that was selected and a worse effect didn't occur */ /* stun if that was selected and a worse effect didn't occur */
if (do_stun) { if (do_stun) {
if (youdefend) if (youdefend)
make_stunned((HStun + 3), FALSE); make_stunned(((HStun & TIMEOUT) + 3L), FALSE);
else else
mdef->mstun = 1; mdef->mstun = 1;
/* avoid extra stun message below if we used mb_verb["stun"] above */ /* avoid extra stun message below if we used mb_verb["stun"] above */
@@ -1023,7 +1023,7 @@ char *hittee; /* target's name: "you" or mon_nam(mdef) */
do_confuse = !rn2(12); do_confuse = !rn2(12);
if (do_confuse) { if (do_confuse) {
if (youdefend) if (youdefend)
make_confused(HConfusion + 4, FALSE); make_confused((HConfusion & TIMEOUT) + 4L, FALSE);
else else
mdef->mconf = 1; mdef->mconf = 1;
} }
+16 -19
View File
@@ -627,7 +627,7 @@ check_innate_abil(ability, frommask)
long *ability; long *ability;
long frommask; long frommask;
{ {
const struct innate *abil; const struct innate *abil = 0;
if (frommask == FROMEXPER) if (frommask == FROMEXPER)
switch (Role_switch) { switch (Role_switch) {
@@ -646,7 +646,7 @@ long frommask;
#endif #endif
case PM_VALKYRIE: abil = val_abil; break; case PM_VALKYRIE: abil = val_abil; break;
case PM_WIZARD: abil = wiz_abil; break; case PM_WIZARD: abil = wiz_abil; break;
default: abil = 0; break; default: break;
} }
else if (frommask == FROMRACE) else if (frommask == FROMRACE)
switch (Race_switch) { switch (Race_switch) {
@@ -655,7 +655,7 @@ long frommask;
case PM_HUMAN: case PM_HUMAN:
case PM_DWARF: case PM_DWARF:
case PM_GNOME: case PM_GNOME:
default: abil = 0; break; default: break;
} }
while (abil && abil->ability) { while (abil && abil->ability) {
@@ -676,12 +676,11 @@ innately(ability)
long *ability; long *ability;
{ {
const struct innate *iptr; const struct innate *iptr;
if ((iptr=check_innate_abil(ability, FROMRACE)))
if ((iptr = check_innate_abil(ability, FROMRACE)) != 0)
return 1; return 1;
else if ((iptr=check_innate_abil(ability, FROMEXPER))) { else if ((iptr = check_innate_abil(ability, FROMEXPER)) != 0)
if (iptr->ulevel == 1) return 1; return (iptr->ulevel == 1) ? 1 : 2;
return 2;
}
return 0; return 0;
} }
@@ -759,8 +758,7 @@ adjabil(oldlevel,newlevel)
int oldlevel, newlevel; int oldlevel, newlevel;
{ {
register const struct innate *abil, *rabil; register const struct innate *abil, *rabil;
long mask = FROMEXPER; long prevabil, mask = FROMEXPER;
switch (Role_switch) { switch (Role_switch) {
case PM_ARCHEOLOGIST: abil = arc_abil; break; case PM_ARCHEOLOGIST: abil = arc_abil; break;
@@ -791,15 +789,14 @@ int oldlevel, newlevel;
} }
while (abil || rabil) { while (abil || rabil) {
long prevabil; /* Have we finished with the intrinsics list? */
/* Have we finished with the intrinsics list? */ if (!abil || !abil->ability) {
if (!abil || !abil->ability) { /* Try the race intrinsics */
/* Try the race intrinsics */ if (!rabil || !rabil->ability) break;
if (!rabil || !rabil->ability) break; abil = rabil;
abil = rabil; rabil = 0;
rabil = 0; mask = FROMRACE;
mask = FROMRACE; }
}
prevabil = *(abil->ability); prevabil = *(abil->ability);
if(oldlevel < abil->ulevel && newlevel >= abil->ulevel) { if(oldlevel < abil->ulevel && newlevel >= abil->ulevel) {
/* Abilities gained at level 1 can never be lost /* Abilities gained at level 1 can never be lost
+3 -1
View File
@@ -1748,7 +1748,7 @@ int final;
else if (Invis) you_are("invisible to others",from_what(INVIS)); else if (Invis) you_are("invisible to others",from_what(INVIS));
/* ordinarily "visible" is redundant; this is a special case for /* ordinarily "visible" is redundant; this is a special case for
the situation when invisibility would be an expected attribute */ the situation when invisibility would be an expected attribute */
else if ((HInvis || EInvis || pm_invisible(youmonst.data)) && BInvis) else if ((HInvis || EInvis) && BInvis)
you_are("visible", from_what(-INVIS)); you_are("visible", from_what(-INVIS));
if (Displaced) you_are("displaced",from_what(DISPLACED)); if (Displaced) you_are("displaced",from_what(DISPLACED));
if (Stealth) you_are("stealthy",from_what(STEALTH)); if (Stealth) you_are("stealthy",from_what(STEALTH));
@@ -1821,6 +1821,8 @@ int final;
if (wizard) Sprintf(eos(buf), " (%d)", u.mtimedone); if (wizard) Sprintf(eos(buf), " (%d)", u.mtimedone);
#endif #endif
you_are(buf,""); you_are(buf,"");
if (lays_eggs(youmonst.data) && flags.female)
you_can("lay eggs", "");
} }
if (Unchanging) you_can("not change from your current form", if (Unchanging) you_can("not change from your current form",
from_what(UNCHANGING)); from_what(UNCHANGING));
+4 -3
View File
@@ -862,11 +862,11 @@ struct obj *obj;
case 1 : pline("%s too much to comprehend!", Tobjnam(obj, "are")); case 1 : pline("%s too much to comprehend!", Tobjnam(obj, "are"));
break; break;
case 2 : pline("%s you!", Tobjnam(obj, "confuse")); case 2 : pline("%s you!", Tobjnam(obj, "confuse"));
make_confused(HConfusion + rnd(100),FALSE); make_confused((HConfusion & TIMEOUT) + (long)rnd(100), FALSE);
break; break;
case 3 : if (!resists_blnd(&youmonst)) { case 3 : if (!resists_blnd(&youmonst)) {
pline("%s your vision!", Tobjnam(obj, "damage")); pline("%s your vision!", Tobjnam(obj, "damage"));
make_blinded(Blinded + rnd(100),FALSE); make_blinded((Blinded & TIMEOUT) + (long)rnd(100), FALSE);
if (!Blind) Your(vision_clears); if (!Blind) Your(vision_clears);
} else { } else {
pline("%s your vision.", Tobjnam(obj, "assault")); pline("%s your vision.", Tobjnam(obj, "assault"));
@@ -874,7 +874,8 @@ struct obj *obj;
} }
break; break;
case 4 : pline("%s your mind!", Tobjnam(obj, "zap")); case 4 : pline("%s your mind!", Tobjnam(obj, "zap"));
(void) make_hallucinated(HHallucination + rnd(100),FALSE,0L); (void) make_hallucinated((HHallucination & TIMEOUT) +
(long)rnd(100), FALSE, 0L);
break; break;
case 5 : pline("%s!", Tobjnam(obj, "explode")); case 5 : pline("%s!", Tobjnam(obj, "explode"));
useup(obj); useup(obj);
+2 -3
View File
@@ -282,7 +282,7 @@ Cloak_on(VOID_ARGS)
break; break;
case MUMMY_WRAPPING: case MUMMY_WRAPPING:
/* Note: it's already being worn, so we have to cheat here. */ /* Note: it's already being worn, so we have to cheat here. */
if ((HInvis || EInvis || pm_invisible(youmonst.data)) && !Blind) { if ((HInvis || EInvis) && !Blind) {
newsym(u.ux,u.uy); newsym(u.ux,u.uy);
You("can %s!", You("can %s!",
See_invisible ? "no longer see through yourself" See_invisible ? "no longer see through yourself"
@@ -861,8 +861,7 @@ register struct obj *obj;
see_objects(); see_objects();
#endif #endif
if (Invis && !oldprop && !HSee_invisible && if (Invis && !oldprop && !HSee_invisible && !Blind) {
!perceives(youmonst.data) && !Blind) {
newsym(u.ux,u.uy); newsym(u.ux,u.uy);
pline("Suddenly you are transparent, but there!"); pline("Suddenly you are transparent, but there!");
learnring(obj, TRUE); learnring(obj, TRUE);
+10 -10
View File
@@ -997,10 +997,10 @@ register int pm;
case PM_YELLOW_LIGHT: case PM_YELLOW_LIGHT:
/* fall into next case */ /* fall into next case */
case PM_GIANT_BAT: case PM_GIANT_BAT:
make_stunned(HStun + 30,FALSE); make_stunned((HStun & TIMEOUT) + 30L, FALSE);
/* fall into next case */ /* fall into next case */
case PM_BAT: case PM_BAT:
make_stunned(HStun + 30,FALSE); make_stunned((HStun & TIMEOUT) + 30L, FALSE);
break; break;
case PM_GIANT_MIMIC: case PM_GIANT_MIMIC:
tmp += 10; tmp += 10;
@@ -1048,8 +1048,8 @@ register int pm;
} }
break; break;
case PM_LIZARD: case PM_LIZARD:
if (HStun > 2) make_stunned(2L,FALSE); if ((HStun & TIMEOUT) > 2) make_stunned(2L, FALSE);
if (HConfusion > 2) make_confused(2L,FALSE); if ((HConfusion & TIMEOUT) > 2) make_confused(2L, FALSE);
break; break;
case PM_CHAMELEON: case PM_CHAMELEON:
case PM_DOPPELGANGER: case PM_DOPPELGANGER:
@@ -1090,7 +1090,8 @@ register int pm;
if (dmgtype(ptr, AD_STUN) || dmgtype(ptr, AD_HALU) || if (dmgtype(ptr, AD_STUN) || dmgtype(ptr, AD_HALU) ||
pm == PM_VIOLET_FUNGUS) { pm == PM_VIOLET_FUNGUS) {
pline("Oh wow! Great stuff!"); pline("Oh wow! Great stuff!");
(void)make_hallucinated(HHallucination + 200L, FALSE, 0L); (void)make_hallucinated((HHallucination & TIMEOUT) + 200L,
FALSE, 0L);
} }
/* Check the monster for all of the intrinsics. If this /* Check the monster for all of the intrinsics. If this
@@ -1785,7 +1786,7 @@ struct obj *otmp;
#endif #endif
if (otmp->otyp == EGG && stale_egg(otmp)) { if (otmp->otyp == EGG && stale_egg(otmp)) {
pline("Ugh. Rotten egg."); /* perhaps others like it */ pline("Ugh. Rotten egg."); /* perhaps others like it */
make_vomiting(Vomiting+d(10,4), TRUE); make_vomiting((Vomiting & TIMEOUT) + (long)d(10,4), TRUE);
} else } else
give_feedback: give_feedback:
pline("This %s is %s", singular(otmp, xname), pline("This %s is %s", singular(otmp, xname),
@@ -2356,7 +2357,7 @@ doeat() /* generic "eat" command funtion (see cmd.c) */
pline("Ulch - that %s was rustproofed!", xname(otmp)); pline("Ulch - that %s was rustproofed!", xname(otmp));
/* The regurgitated object's rustproofing is gone now */ /* The regurgitated object's rustproofing is gone now */
otmp->oerodeproof = 0; otmp->oerodeproof = 0;
make_stunned(HStun + rn2(10), TRUE); make_stunned((HStun & TIMEOUT) + (long)rn2(10), TRUE);
You("spit %s out onto the %s.", the(xname(otmp)), You("spit %s out onto the %s.", the(xname(otmp)),
surface(u.ux, u.uy)); surface(u.ux, u.uy));
if (carried(otmp)) { if (carried(otmp)) {
@@ -2587,9 +2588,8 @@ gethungry() /* as time goes by - called by moveloop() and domove() */
if (moves % 2) { /* odd turns */ if (moves % 2) { /* odd turns */
/* Regeneration uses up food, unless due to an artifact */ /* Regeneration uses up food, unless due to an artifact */
if (HRegeneration || ((ERegeneration & (~W_ART)) && if ((HRegeneration & ~FROMFORM) ||
(ERegeneration != W_WEP || !uwep->oartifact))) (ERegeneration & ~(W_ARTI|W_WEP))) u.uhunger--;
u.uhunger--;
if (near_capacity() > SLT_ENCUMBER) u.uhunger--; if (near_capacity() > SLT_ENCUMBER) u.uhunger--;
} else { /* even turns */ } else { /* even turns */
if (Hunger) u.uhunger--; if (Hunger) u.uhunger--;
+2 -2
View File
@@ -686,9 +686,9 @@ int how;
newuhs(FALSE); newuhs(FALSE);
} }
/* cure impending doom of sickness hero won't have time to fix */ /* cure impending doom of sickness hero won't have time to fix */
if ((Sick & TIMEOUT) == 1) { if ((Sick & TIMEOUT) == 1L) {
u.usick_type = 0; u.usick_type = 0;
Sick = 0; set_itimeout(&Sick, 0L);
} }
if (how == CHOKING) init_uhunger(); if (how == CHOKING) init_uhunger();
nomovemsg = "You survived that attempt on your life."; nomovemsg = "You survived that attempt on your life.";
+4 -3
View File
@@ -497,7 +497,7 @@ dosinkfall()
register struct obj *obj; register struct obj *obj;
int dmg; int dmg;
if (is_floater(youmonst.data) || (HLevitation & FROMOUTSIDE)) { if (HLevitation & (FROMOUTSIDE|FROMFORM)) {
You("wobble unsteadily for a moment."); You("wobble unsteadily for a moment.");
} else { } else {
long save_ELev = ELevitation, save_HLev = HLevitation; long save_ELev = ELevitation, save_HLev = HLevitation;
@@ -1755,9 +1755,10 @@ boolean pick;
turn, allowing it to do so could give the perception turn, allowing it to do so could give the perception
that a trap here is being triggered twice, so adjust that a trap here is being triggered twice, so adjust
the timeout to prevent that */ the timeout to prevent that */
if (trap && (HLevitation & TIMEOUT) == 1L) { if (trap && (HLevitation & TIMEOUT) == 1L &&
!ELevitation && !(HLevitation & ~TIMEOUT)) {
if (rn2(2)) { /* defer timeout */ if (rn2(2)) { /* defer timeout */
HLevitation += 1L; incr_itimeout(&HLevitation, 1L);
} else { /* timeout early */ } else { /* timeout early */
if (float_down(I_SPECIAL|TIMEOUT, 0L)) { if (float_down(I_SPECIAL|TIMEOUT, 0L)) {
/* levitation has ended; we've already triggered /* levitation has ended; we've already triggered
+1 -1
View File
@@ -441,7 +441,7 @@ int spellnum;
You(Stunned ? "struggle to keep your balance." : "reel..."); You(Stunned ? "struggle to keep your balance." : "reel...");
dmg = d(ACURR(A_DEX) < 12 ? 6 : 4, 4); dmg = d(ACURR(A_DEX) < 12 ? 6 : 4, 4);
if (Half_spell_damage) dmg = (dmg + 1) / 2; if (Half_spell_damage) dmg = (dmg + 1) / 2;
make_stunned(HStun + dmg, FALSE); make_stunned((HStun & TIMEOUT) + (long)dmg, FALSE);
} }
dmg = 0; dmg = 0;
break; break;
+2 -2
View File
@@ -1446,7 +1446,7 @@ dopois:
case AD_STUN: case AD_STUN:
hitmsg(mtmp, mattk); hitmsg(mtmp, mattk);
if(!mtmp->mcan && !rn2(4)) { if(!mtmp->mcan && !rn2(4)) {
make_stunned(HStun + dmg, TRUE); make_stunned((HStun & TIMEOUT) + (long)dmg, TRUE);
dmg /= 2; dmg /= 2;
} }
break; break;
@@ -2053,7 +2053,7 @@ gazemu(mtmp, mattk) /* monster gazes at you */
mtmp->mspec_used = mtmp->mspec_used + (stun + rn2(6)); mtmp->mspec_used = mtmp->mspec_used + (stun + rn2(6));
pline("%s stares piercingly at you!", Monnam(mtmp)); pline("%s stares piercingly at you!", Monnam(mtmp));
make_stunned(HStun + stun, TRUE); make_stunned((HStun & TIMEOUT) + (long)stun, TRUE);
stop_occupation(); stop_occupation();
} }
} }
+51 -2
View File
@@ -37,11 +37,60 @@ STATIC_VAR const char no_longer_petrify_resistant[] =
change sex (ought to be an arg to polymon() and newman() instead) */ change sex (ought to be an arg to polymon() and newman() instead) */
STATIC_VAR int sex_change_ok = 0; STATIC_VAR int sex_change_ok = 0;
/* update the youmonst.data structure pointer */ /* update the youmonst.data structure pointer and intrinsics */
void void
set_uasmon() set_uasmon()
{ {
set_mon_data(&youmonst, &mons[u.umonnum], 0); struct permonst *mdat = &mons[u.umonnum];
set_mon_data(&youmonst, mdat, 0);
#define PROPSET(PropIndx, ON) do { \
if (ON) u.uprops[PropIndx].intrinsic |= FROMFORM; \
else u.uprops[PropIndx].intrinsic &= ~FROMFORM; } while (0)
PROPSET(FIRE_RES, resists_fire(&youmonst));
PROPSET(COLD_RES, resists_cold(&youmonst));
PROPSET(SLEEP_RES, resists_sleep(&youmonst));
PROPSET(DISINT_RES, resists_disint(&youmonst));
PROPSET(SHOCK_RES, resists_elec(&youmonst));
PROPSET(POISON_RES, resists_poison(&youmonst));
PROPSET(ACID_RES, resists_acid(&youmonst));
PROPSET(STONE_RES, resists_ston(&youmonst));
{
/* resists_drli() takes wielded weapon into account; suppress it */
struct obj *save_uwep = uwep;
uwep = 0;
PROPSET(DRAIN_RES, resists_drli(&youmonst));
uwep = save_uwep;
}
/* resists_magm() takes wielded, worn, and carried equipment into
into account; cheat and duplicate its monster-specific part */
PROPSET(ANTIMAGIC, (dmgtype(mdat, AD_MAGM) ||
mdat == &mons[PM_BABY_GRAY_DRAGON] ||
dmgtype(mdat, AD_RBRE)));
PROPSET(SICK_RES, (mdat->mlet == S_FUNGUS || mdat == &mons[PM_GHOUL]));
PROPSET(STUNNED, (mdat == &mons[PM_STALKER] || is_bat(mdat)));
PROPSET(HALLUC_RES, dmgtype(mdat, AD_HALU));
PROPSET(SEE_INVIS, perceives(mdat));
PROPSET(TELEPAT, telepathic(mdat));
PROPSET(INFRAVISION, infravision(mdat));
PROPSET(INVIS, pm_invisible(mdat));
PROPSET(TELEPORT, can_teleport(mdat));
PROPSET(TELEPORT_CONTROL, control_teleport(mdat));
PROPSET(LEVITATION, is_floater(mdat));
PROPSET(FLYING, is_flyer(mdat));
PROPSET(SWIMMING, is_swimmer(mdat));
/* [don't touch MAGICAL_BREATHING here; both Amphibious and Breathless
key off of it but include different monster forms...] */
PROPSET(PASSES_WALLS, passes_walls(mdat));
PROPSET(REGENERATION, regenerates(mdat));
PROPSET(REFLECTING, (mdat == &mons[PM_SILVER_DRAGON]));
#undef PROPSET
#ifdef STATUS_VIA_WINDOWPORT #ifdef STATUS_VIA_WINDOWPORT
status_initialize(REASSESS_ONLY); status_initialize(REASSESS_ONLY);
#endif #endif
+3 -3
View File
@@ -703,7 +703,7 @@ peffects(otmp)
if (Detect_monsters) nothing++; if (Detect_monsters) nothing++;
unkn++; unkn++;
/* after a while, repeated uses become less effective */ /* after a while, repeated uses become less effective */
if (HDetect_monsters >= 300L) if ((HDetect_monsters & TIMEOUT) >= 300L)
i = 1; i = 1;
else else
i = rn1(40,21); i = rn1(40,21);
@@ -906,10 +906,10 @@ peffects(otmp)
if (otmp->cursed) HLevitation &= ~I_SPECIAL; if (otmp->cursed) HLevitation &= ~I_SPECIAL;
if(!Levitation) { if(!Levitation) {
/* kludge to ensure proper operation of float_up() */ /* kludge to ensure proper operation of float_up() */
HLevitation = 1; set_itimeout(&HLevitation, 1L);
float_up(); float_up();
/* reverse kludge */ /* reverse kludge */
HLevitation = 0; set_itimeout(&HLevitation, 0L);
if (otmp->cursed && !Is_waterlevel(&u.uz)) { if (otmp->cursed && !Is_waterlevel(&u.uz)) {
if((u.ux != xupstair || u.uy != yupstair) if((u.ux != xupstair || u.uy != yupstair)
&& (u.ux != sstairs.sx || u.uy != sstairs.sy || !sstairs.up) && (u.ux != sstairs.sx || u.uy != sstairs.sy || !sstairs.up)
+7 -5
View File
@@ -224,10 +224,10 @@ in_trouble()
&& !u.usteed && !u.usteed
#endif #endif
) return (TROUBLE_WOUNDED_LEGS); ) return (TROUBLE_WOUNDED_LEGS);
if(u.uhs >= HUNGRY) return(TROUBLE_HUNGRY); if (u.uhs >= HUNGRY) return TROUBLE_HUNGRY;
if(HStun) return (TROUBLE_STUNNED); if (HStun & TIMEOUT) return TROUBLE_STUNNED;
if(HConfusion) return (TROUBLE_CONFUSED); if (HConfusion & TIMEOUT) return TROUBLE_CONFUSED;
if(Hallucination) return(TROUBLE_HALLUCINATION); if (HHallucination & TIMEOUT) return TROUBLE_HALLUCINATION;
return(0); return(0);
} }
@@ -1019,7 +1019,9 @@ pleased(g_align)
break; break;
} }
case 5: { case 5: {
const char *msg="\"and thus I grant thee the gift of %s!\""; static NEARDATA const char
msg[] = "\"and thus I grant thee the gift of %s!\"";
godvoice(u.ualign.type, "Thou hast pleased me with thy progress,"); godvoice(u.ualign.type, "Thou hast pleased me with thy progress,");
if (!(HTelepat & INTRINSIC)) { if (!(HTelepat & INTRINSIC)) {
HTelepat |= FROMOUTSIDE; HTelepat |= FROMOUTSIDE;
+1 -1
View File
@@ -900,7 +900,7 @@ struct obj *sobj; /* scroll, or fake spellbook object for scroll-like spell */
otmp->spe += -1; otmp->spe += -1;
adj_abon(otmp, -1); adj_abon(otmp, -1);
} }
make_stunned(HStun + rn1(10, 10), TRUE); make_stunned((HStun & TIMEOUT) + (long)rn1(10, 10), TRUE);
} }
} }
break; break;
+13 -17
View File
@@ -1,5 +1,4 @@
/* NetHack 3.5 sit.c $Date$ $Revision$ */ /* NetHack 3.5 sit.c $Date$ $Revision$ */
/* SCCS Id: @(#)sit.c 3.5 2006/03/15 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -236,13 +235,12 @@ dosit()
case 10: case 10:
if (Luck < 0 || (HSee_invisible & INTRINSIC)) { if (Luck < 0 || (HSee_invisible & INTRINSIC)) {
if (level.flags.nommap) { if (level.flags.nommap) {
pline( pline("A terrible drone fills your head!");
"A terrible drone fills your head!"); make_confused((HConfusion & TIMEOUT) +
make_confused(HConfusion + rnd(30), (long)rnd(30), FALSE);
FALSE);
} else { } else {
pline("An image forms in your mind."); pline("An image forms in your mind.");
do_mapping(); do_mapping();
} }
} else { } else {
Your("vision becomes clear."); Your("vision becomes clear.");
@@ -269,7 +267,8 @@ dosit()
break; break;
case 13: case 13:
Your("mind turns into a pretzel!"); Your("mind turns into a pretzel!");
make_confused(HConfusion + rn1(7,16),FALSE); make_confused((HConfusion & TIMEOUT) + (long)rn1(7,16),
FALSE);
break; break;
default: impossible("throne effect"); default: impossible("throne effect");
break; break;
@@ -292,16 +291,13 @@ dosit()
struct obj *uegg; struct obj *uegg;
if (!flags.female) { if (!flags.female) {
if(Hallucination) pline(Hallucination ?
pline("You may think you are a platypus but a male still can't lay eggs!"); "You may think you are a platypus but a male still can't lay eggs!" :
else "Males can't lay eggs!");
pline("Males can't lay eggs!"); return 0;
} else if (u.uhunger < (int)objects[EGG].oc_nutrition) {
You("don't have enough energy to lay an egg.");
return 0; return 0;
}
if (u.uhunger < (int)objects[EGG].oc_nutrition) {
You("don't have enough energy to lay an egg.");
return 0;
} }
uegg = mksobj(EGG, FALSE, FALSE); uegg = mksobj(EGG, FALSE, FALSE);
+11 -6
View File
@@ -63,17 +63,22 @@ unsigned gpflags;
mdat = mtmp->data; mdat = mtmp->data;
if (is_pool(x,y) && !ignorewater) { if (is_pool(x,y) && !ignorewater) {
if (mtmp == &youmonst) if (mtmp == &youmonst)
return !!(HLevitation || Flying || Wwalking || return (Levitation || Flying || Wwalking ||
Swimming || Amphibious); Swimming || Amphibious);
else return (is_flyer(mdat) || is_swimmer(mdat) || else
is_clinger(mdat)); return (is_floater(mdat) || is_flyer(mdat) ||
is_swimmer(mdat) || is_clinger(mdat));
} else if (mdat->mlet == S_EEL && rn2(13) && !ignorewater) { } else if (mdat->mlet == S_EEL && rn2(13) && !ignorewater) {
return FALSE; return FALSE;
} else if (is_lava(x,y)) { } else if (is_lava(x,y)) {
if (mtmp == &youmonst) if (mtmp == &youmonst)
return !!HLevitation; return (Levitation || Flying ||
(Fire_resistance && Wwalking &&
uarmf && uarmf->oerodeproof) ||
(Upolyd && likes_lava(youmonst.data)));
else else
return (is_flyer(mdat) || likes_lava(mdat)); return (is_floater(mdat) || is_flyer(mdat) ||
likes_lava(mdat));
} }
if (passes_walls(mdat) && may_passwall(x,y)) return TRUE; if (passes_walls(mdat) && may_passwall(x,y)) return TRUE;
if (amorphous(mdat) && closed_door(x,y)) return TRUE; if (amorphous(mdat) && closed_door(x,y)) return TRUE;
+19 -17
View File
@@ -73,11 +73,11 @@ vomiting_dialogue()
case 14: txt = vomiting_texts[0]; break; case 14: txt = vomiting_texts[0]; break;
case 11: txt = vomiting_texts[1]; break; case 11: txt = vomiting_texts[1]; break;
case 6: case 6:
make_stunned(HStun + d(2,4), FALSE); make_stunned((HStun & TIMEOUT) + (long)d(2,4), FALSE);
if (!Popeye(VOMITING)) stop_occupation(); if (!Popeye(VOMITING)) stop_occupation();
/*FALLTHRU*/ /*FALLTHRU*/
case 9: case 9:
make_confused(HConfusion + d(2,4), FALSE); make_confused((HConfusion & TIMEOUT) + (long)d(2,4), FALSE);
if (multi > 0) nomul(0); if (multi > 0) nomul(0);
break; break;
case 8: txt = vomiting_texts[2]; break; case 8: txt = vomiting_texts[2]; break;
@@ -293,24 +293,26 @@ nh_timeout()
Fast ? " a bit" : ""); Fast ? " a bit" : "");
break; break;
case CONFUSION: case CONFUSION:
HConfusion = 1; /* So make_confused works properly */ /* So make_confused works properly */
set_itimeout(&HConfusion, 1L);
make_confused(0L, TRUE); make_confused(0L, TRUE);
stop_occupation(); if (!Confusion) stop_occupation();
break; break;
case STUNNED: case STUNNED:
HStun = 1; set_itimeout(&HStun, 1L);
make_stunned(0L, TRUE); make_stunned(0L, TRUE);
stop_occupation(); if (!Stunned) stop_occupation();
break; break;
case BLINDED: case BLINDED:
Blinded = 1; set_itimeout(&Blinded, 1L);
make_blinded(0L, TRUE); make_blinded(0L, TRUE);
stop_occupation(); if (!Blind) stop_occupation();
break; break;
case DEAF: case DEAF:
if (!Deaf) if (!Deaf) {
You("can hear again."); You("can hear again.");
stop_occupation(); stop_occupation();
}
break; break;
case INVIS: case INVIS:
newsym(u.ux,u.uy); newsym(u.ux,u.uy);
@@ -332,18 +334,18 @@ nh_timeout()
stop_occupation(); stop_occupation();
break; break;
case HALLUC: case HALLUC:
HHallucination = 1; set_itimeout(&HHallucination, 1L);
(void) make_hallucinated(0L, TRUE, 0L); (void) make_hallucinated(0L, TRUE, 0L);
stop_occupation(); if (!Hallucination) stop_occupation();
break; break;
case SLEEPY: case SLEEPY:
if (unconscious() || Sleep_resistance) if (unconscious() || Sleep_resistance) {
HSleepy += rnd(100); incr_itimeout(&HSleepy, rnd(100));
else if (Sleepy) { } else if (Sleepy) {
You("fall asleep."); You("fall asleep.");
sleeptime = rnd(20); sleeptime = rnd(20);
fall_asleep(-sleeptime, TRUE); fall_asleep(-sleeptime, TRUE);
HSleepy += sleeptime + rnd(100); incr_itimeout(&HSleepy, sleeptime + rnd(100));
} }
break; break;
case LEVITATION: case LEVITATION:
@@ -381,7 +383,7 @@ nh_timeout()
counter if that's the only fumble reason */ counter if that's the only fumble reason */
HFumbling &= ~FROMOUTSIDE; HFumbling &= ~FROMOUTSIDE;
if (Fumbling) if (Fumbling)
HFumbling += rnd(20); incr_itimeout(&HFumbling, rnd(20));
break; break;
case DETECT_MONSTERS: case DETECT_MONSTERS:
see_monsters(); see_monsters();
+5 -3
View File
@@ -4407,8 +4407,10 @@ boolean disarm;
Blind ? " and get dizzy" : Blind ? " and get dizzy" :
" and your vision blurs"); " and your vision blurs");
} }
make_stunned(HStun + rn1(7, 16),FALSE); make_stunned((HStun & TIMEOUT) + (long)rn1(7, 16),
(void) make_hallucinated(HHallucination + rn1(5, 16),FALSE,0L); FALSE);
(void) make_hallucinated((HHallucination & TIMEOUT)
+ (long)rn1(5, 16), FALSE, 0L);
break; break;
default: impossible("bad chest trap"); default: impossible("bad chest trap");
break; break;
@@ -4587,7 +4589,7 @@ register int bodypart;
losehp(Maybe_Half_Phys(dmg), "explosion", KILLED_BY_AN); losehp(Maybe_Half_Phys(dmg), "explosion", KILLED_BY_AN);
exercise(A_STR, FALSE); exercise(A_STR, FALSE);
if (bodypart) exercise(A_CON, FALSE); if (bodypart) exercise(A_CON, FALSE);
make_stunned(HStun + dmg, TRUE); make_stunned((HStun & TIMEOUT) + (long)dmg, TRUE);
} }
/* Monster is hit by trap. */ /* Monster is hit by trap. */
+1 -2
View File
@@ -1,5 +1,4 @@
/* NetHack 3.5 u_init.c $Date$ $Revision$ */ /* NetHack 3.5 u_init.c $Date$ $Revision$ */
/* SCCS Id: @(#)u_init.c 3.5 2006/12/13 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -563,6 +562,7 @@ u_init()
u.umonnum = u.umonster = (flags.female && u.umonnum = u.umonster = (flags.female &&
urole.femalenum != NON_PM) ? urole.femalenum : urole.femalenum != NON_PM) ? urole.femalenum :
urole.malenum; urole.malenum;
u.ulycn = NON_PM;
set_uasmon(); set_uasmon();
u.ulevel = 0; /* set up some of the initial attributes */ u.ulevel = 0; /* set up some of the initial attributes */
@@ -577,7 +577,6 @@ u_init()
u.ublesscnt = 300; /* no prayers just yet */ u.ublesscnt = 300; /* no prayers just yet */
u.ualignbase[A_CURRENT] = u.ualignbase[A_ORIGINAL] = u.ualign.type = u.ualignbase[A_CURRENT] = u.ualignbase[A_ORIGINAL] = u.ualign.type =
aligns[flags.initalign].value; aligns[flags.initalign].value;
u.ulycn = NON_PM;
#if defined(BSD) && !defined(POSIX_TYPES) #if defined(BSD) && !defined(POSIX_TYPES)
(void) time((long *)&ubirthday); (void) time((long *)&ubirthday);
+2 -2
View File
@@ -2187,7 +2187,7 @@ boolean ordinary;
if (ordinary || !rn2(10)) { /* permanent */ if (ordinary || !rn2(10)) { /* permanent */
HInvis |= FROMOUTSIDE; HInvis |= FROMOUTSIDE;
} else { /* temporary */ } else { /* temporary */
incr_itimeout(&HInvis, d(obj->spe, 250)); incr_itimeout(&HInvis, d(obj->spe, 250));
} }
if (msg) { if (msg) {
learn_it = TRUE; learn_it = TRUE;
@@ -2262,7 +2262,7 @@ boolean ordinary;
if (is_undead(youmonst.data)) { if (is_undead(youmonst.data)) {
You_feel("frightened and %sstunned.", You_feel("frightened and %sstunned.",
Stunned ? "even more " : ""); Stunned ? "even more " : "");
make_stunned(HStun + rnd(30), FALSE); make_stunned((HStun & TIMEOUT) + (long)rnd(30), FALSE);
} else } else
You("shudder in dread."); You("shudder in dread.");
break; break;