Commit Graph

109 Commits

Author SHA1 Message Date
PatR
c57b32f5fe status updating: a*.c
I went through the places that set context.botl/botlx in src/a*.c to
see whether I could find any unnecessary status updates.  I didn't
find anything interesting, mostly some minor sequencing issues plus
a couple of redundant sets (call foo() which includes setting botl,
then explicitly set botl after it returns).  If you issue pline first
and then set context.botl, bottom lines won't be updated until the
next message or next pass through moveloop.  If you order those the
other way around, status will be updated as the message describing
the reason for the update is being delivered.
2019-03-23 10:50:26 -07:00
PatR
7bc36ddef4 fix #H6942 - dropx vs hold_another_object
Dropping an existing fragile item while levitating will usually
break it.  Getting a new wished-for fragile item and dropping it
because of fumbling or overfull inventory never would.

Some callers of hold_another_object() held on to its return value,
others discarded that.  That return value was unsafe if the item
was dropped and fell down a hole (or broke [after this change]).
Return Null if we can't be sure of the value, and make sure all
callers are prepared to deal with Null.
2018-12-23 12:37:26 -08:00
PatR
26a3a53786 Sting revisited
Replace recent "(light blue aura)" with
"(flickering light blue)" if there are 1..4 orcs,
"(glimmering light blue)" if 5..12, or
"(gleaming light blue)" if there are 13 or more, and move its place
in the formatted name.
_3.6.1_: Sting (weapon in hand) (glowing light blue)
_recent: Sting (weapon in hand) (light blue aura)
_now___: Sting (weapon in hand, flickering light blue)

The thresholds for intensity may need to be tweaked.  The start
message has been changed from "glows" to "flickers/glimmers/gleams"
and is given when the intensity changes (up or down) as well as when
first glowing.  Stop message will usually be "stops flickering" but
some form of mass kill (genocide for sure, maybe explosion, probably
not wand zap) might result in stopping directly from higher intensity.

It still "quivers" if hero is blind when there are orcs on the level,
but no name augmentation shows in inventory for that situation;
describing it as "(weapon in hand, quivering)" would be too silly.
Also, the quiver or glow intermediate message if blindness is toggled
while Sting is active only worked for make_blinded(), not for putting
on and taking off a blindfold.  Now fixed.  I think becoming blind due
to polymorphing into an eyeless form is still not handled, but there
are no eyeless creatures capable of wielding weapons so that can wait.
Polymorphing from eyeless to sighted is handled but moot for Sting.
2018-12-02 02:09:22 -08:00
Pasi Kallinen
d7c042eb80 Make Mjollnir lightning noisy 2018-11-02 20:49:11 +02:00
keni
d8c49ec9d1 Add updated copyright lines, part 1. 2018-04-25 15:00:13 -04:00
Pasi Kallinen
9b7e146807 Use more enums 2018-03-31 08:57:22 +03:00
PatR
c59b7bf11b fix #H6391 - artifact #invoke for charging
Latent bug:  if a non-role-specific artifact which could be invoked
for charging existed, it would never work as if blessed because the
test for no-role was wrong.  Caused when 3.3.0 changed the Role_if()
predicate and artilist[] array to use monster index numbers (PM_foo)
instead of role letters; the non-role value changed from '\0' to
NON_PM (-1) but the test for non-role didn't.

No fixes36.1 entry; there aren't any artifacts which were affected.
2017-11-04 16:04:46 -07:00
PatR
5c77360023 still more Master Key of Thievery
Make #untrap while carrying the non-cursed (for rogues) or blessed
(for non-rogues) Key work the same as #invoke has been doing (without
regard to its bless/curse state):  when used on trapped door or chest,
that trap will always be found and disarming it will always succeed.

It should work when carried by monsters too:  if they try to open a
trapped door while carrying the Key (must be blessed since they're
not rogues) the trap will be automatically disarmed.  (Caveat:  that
hasn't been adequately tested.)

TODO (maybe...):  change the #invoke property to detect unseen/secret
door detection instead of #untrap.  The latter isn't completely
redundant; it works when the Key is cursed.  But quest artifacts
strongly resist becoming cursed so that isn't a particularly useful
distinction.

Also, trap hints when wielding the Key without gloves didn't notice
adjacent door and chest traps.  Now it does.  And the behavior is
slightly different:  known traps covered by objects or monsters are
treated like unknown traps as far as the hot/cold hints go.
2017-10-08 03:29:16 -07:00
Pasi Kallinen
22ad104318 Master Key of Thievery warns about undetected traps
If the key is wielded and touching skin (that is, you're not
wearing gloves), it will give heat-related messages like
minesweeper, counting the undetected traps around player.
2017-10-06 01:21:06 +03:00
Pasi Kallinen
b4e4d70008 Fix couple static code analyzer warnings 2017-08-02 19:48:44 +03:00
PatR
fe4583fc88 some artifact.c formatting
I managed to separate these bits from the touch/retouch fix.
I almost threw then away, but one's a spelling fix in a comment.
2017-07-12 18:02:52 -07:00
PatR
c0bb25b388 fix commit ebd6bb62f5 : #H4383 - blasted twice
by Excalibur.  Noticed on Reddit by Alex, the attempt to fix being
blasted twice by wielded artifact weapon when changing alignment
ended up preventing wielding other role's quest weapons.  At the
moment I can't even see how it prevented the double-blast....

This backs out that change and fixes the double-blasting correctly.
When uwep and uswapwep are tested in advance of the rest of invent,
mark them as already processed before entering the loop that checks
all not-yet-processed inventory.
2017-07-12 17:53:04 -07:00
PatR
ebd6bb62f5 fix #H4383 - blasted twice by Excalibur
...when alignment was toggled by helm of opposite alignment.  The
touch/retouch code is quite convoluted, but I think this simple
change is the right fix.
2016-06-09 11:42:34 -07:00
PatR
6f595dabcc fix #H4142 - resistance from Excalibur
Enlightenment and end of game disclosure didn't report level-drain
resistance if that was obtained via wielding Excalibur (or Stormbringer
or Staff of Aesculapius).  Drain_resistance wasn't one of the attributes
set for intrinsics/extrinsics when wielding or unwielding weapon or
wearing/unwearing other equipment.  loseexp() checks resists_drli()
which does check for items in use, so level drain would be aborted,
possibly after messages claimed that it was taming place.  I didn't try
to untangle any of that, just changed set_artifact_intrinsic to include
a test for DRAIN_RES.
2015-12-25 14:13:05 -08:00
Pasi Kallinen
dc09a991fe Fix some warnings from clang's static code analyzer 2015-11-18 22:54:28 +02:00
Pasi Kallinen
9181f06dab Fix crystal ball use after being destroyed
Crystal ball can be destroyed when used, so pass the object parameter
back as null in that case.
2015-11-01 18:49:43 +02:00
PatR
a9eb5b2ca8 yet more formatting
Reformat some trailing &&, || operators followed by end-of-line comment,
missed by the earlier continuation formating.

An
  #if 0
    something {
  #else
    something_else {
  #endif
construct in rhack(cmd.c) confused the automated reformatter, resulting
in some code from inside a function ending up in column 1.
2015-11-01 01:17:54 -08:00
PatR
3986546325 formatting: src/a*.c - d*.c continuation lines
Mostly && and || at end of the first half of a continued line rather
than at the start of the second half.  The automated reformat got
confused by comments in the midst of such lines.
  foo ||
  bar
was converted to
  foo
  || bar
but
  foo ||
  /* comment */
  bar
stayed as is.

Some excluded code [#if 0] was also manually reformatted, but this is
mainly stuff that can be found via regexp '[&|?:][ \t]*$' (with a lot
of false hits for labels whose colon ends their line).
2015-10-19 17:32:21 -07:00
Pasi Kallinen
66dd87454b Comment typofixes, pt 3 2015-10-17 13:47:25 +03:00
Pasi Kallinen
f8b48490aa Comment typofixes 2015-10-17 12:28:52 +03:00
PatR
791c41e6b4 branch traversal via W quest artifact
Require the hero to pass the next_to_u() check when using the Eye of the
Aethiopica to portal to another dungeon branch.  Even though the reported
exploit of having a steed which is carrying the Amulet bring it along had
already been prevented, this changes the temporary portal behavior to be
like level teleport.  A steed carrying the Amulet or a non-adjacent pet
on a cursed leash will inhibit the attempted change of location.
2015-08-14 19:18:12 -07:00
PatR
3a5304c49e last? Sting
If Sting is glowing when blindness gets toggled, give a new "glowing"
message.

So instead of
  Sting glows blue! [...] You can't see! [...] Sting stops quivering.
if you're still blind when the last orc goes away, or
  Sting quivers slightly. [...] You can see again. [...] Sting stops
  glowing.
if you were blind when the first orc arrived, now you'll get an
intermediate message between the second and third ones.  'Sting is
quivering' for the first case, 'Sting is glowing' for the second.
No matter how many times blindness toggles back and forth, the final
"stops glowing" or "stops quivering" will be consistent with the most
recent "is glowing" or "is quivering".
2015-05-31 01:24:19 -07:00
PatR
0171345aad more Sting,&c
Add "(glowing light blue)" to the formatted object description when
Sting or Orcrist is glowing due to presence of orcs or "(glowing red)"
if Grimtooth is glowing due to elves.  Use "(glowing)" if blind;
assumes that some aspect of the glow (perhaps warmth or vibration) can
be noticed via touch.

Make enlightenment's "you are warned about <monster class> because of
<artifact>" catch up with Orcrist and Grimtooth.  It was attributing
Orcrist's warning against orcs to Sting, and Grimtooth's warning was
against "something" rather than elves.

The glow color is now a new field in artilist[], so the biggest part
of this patch is adding an extra value to each artifact's definition.
2015-05-30 22:41:30 -07:00
PatR
37763d030e add warning glow for Orcrist & Grimtooth
Make Orcrist glow light blue when orcs are present, just like Sting.
(Sting supposedly glowed because it was made by the elves of Gondolin
rather than any particular attribute built into it, and Orcrist was
made there too.  I think it also glowed in the Hobbit; that was how
Bilbo recognized what the situation was when he first saw Sting glow.
Maybe it was the other sword rather than Orcrist, but they were treated
as being functionally equivalent.)

Also make Grimtooth glow red when elves are present.  That's from thin
air, to give it some novelty.  Unlike Sting, whose double-damage bonus
is restricted to orc targets, Grimtooth's weak 1d6 bonus still applies
to all targets.
2015-05-29 17:42:15 -07:00
PatR
29617ada12 Sting's glow while blind
Give an alternate message if Sting starts or stops glowing while the
hero can't see.  It probably ought to give an immediate message when
blindness toggles but that looks like it could get messy.

Having an 'o' die or migrate off level should probably also redo the
Sting message immediately, otherwise we see things like:
  The little dog kills the goblin.
  The little dog eats a goblin corpse.
  Sting stops glowing.
(There could be lots of additional intervening messages depending on
other monster activity at the time.)  Calling see_monsters() in the
relevant places--probably m_detach() and migrate_to_level()--would
address this but won't do because that could result in hallucinating
monsters changing appearance mid-turn.
2015-05-28 18:36:51 -07:00
Sean Hunt
1c081b1647 Remove stale version control lines. 2015-05-25 09:21:31 +09:00
Sean Hunt
97d6fade74 Reformat all C files.
I'll push a formatting guide at some point. There may still be
outstanding changes, but please feel free to resolve those as you arrive
a them.

To the best of my knowledge, there is no changes to the actual code
content, but the formatter does have the occasional bug. If you run into
an issue, please fix it!
2015-05-09 13:43:16 -04:00
karnov
2a907f894e Version number increment 2015-05-06 22:04:27 -04:00
Pasi Kallinen
411ee58593 Add more explicit helpless reasons
Instead of just "while helpless", the death reason will tell
more explicitly why the player was helpless.  For example:
"while frozen by a monster's gaze"
2015-03-29 22:12:19 +03:00
Sean Hunt
260f7ea860 Make TOURIST unconditional. 2015-02-27 19:33:12 -05:00
Sean Hunt
9e65758947 Make STEED unconditional. 2015-02-27 19:33:01 -05:00
keni
03140969ee Bulk recovery of file CVS headers and addition of NHDT- headers. 2015-02-26 09:19:03 -05:00
nethack.rankin
5cc7f32044 retouch_equipment() bypass handling
Simplify retouch_equipment (post-3.4.3.code, called when hero
changes alignment or turns into a silver-hating critter; inventory
traversal must cope with the possibility of losing object->nobj when
processing object) by switching to recently added object->bypass code.
2013-11-07 01:03:16 +00:00
nethack.rankin
c9fc8fcc09 Magicbane grammar
After newsgroup discussion of C343-162, I noticed that it had fixed
the verb usage in the message for confused and/or stunned, but not in the
one for resisting.  (If a monster name ends in 's', or it has been named
"you", 3.4.3 used the wrong verb because vtense() was fooled about plural
or second person.)  No new fixes entry needed....
2013-03-17 00:17:18 +00:00
nethack.rankin
ac1707b5e6 lint bit: protects(artifact.c) (trunk only)
Rename 'is_worn' argument; that's also the name of a function.
2012-01-12 09:51:05 +00:00
keni
03b4813be3 can we do two files? artifact.c cmd.c 2011-12-29 22:46:25 +00:00
nethack.rankin
84f02bd336 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.
2011-10-01 00:25:57 +00:00
nethack.rankin
16e81690e3 new command '`' to show discoveries for one class (trunk only)
Use the grave accent (back tick) character as the keystroke for a
new command which prompts for an object class and then shows a subset of
the discovered objects list covering just the selected class.  Similar
to the 'I' variant of 'i' for viewing inventory, and mainly useful once
the '\' discoveries list has grown long.
2011-09-15 04:16:29 +00:00
nethack.rankin
aa382329dd typo/thinko fix (trunk only) 2011-04-08 02:20:56 +00:00
nethack.rankin
33d9b71311 Protection groundwork/artifact tweaks (trunk only)
This is mostly groundwork prior to making the Protection intrinsic
become more meaningful.  The Mitre of Holiness (priest quest artifact)
and the Tsurugi of Muramasa (samurai quest artifact) will now confer
Protection when worn/wielded (though at present that effectively does
nothing).  While in there, this also changes the Eye of the Aethiopica
(wizard quest artifact), the Eyes of the Overworld (monk quest artifact),
and the Sceptre of Might (caveman quest artifact) so that they need to
be worn/wielded rather than just carried in order for them to confer
magic resistance.  That way they're a little less attractive for wishing
by other roles and a little more likely to be actively used by their own
roles (not an issues for the Eyes, I'm sure).  This change actually works
to the player's advantage, since it means that monsters who successfully
steal those items won't instantly obtain magic resistance in the process.

     This adds protects() as a predicate routine to check an item for
conferring Protection.  In order to do that, it renames the existing
protects() routine to defends_when_carried(), because that predicate is
actually a variant of defends() for items which aren't worn or wielded.
2011-04-07 18:10:47 +00:00
keni
9ae93d8b71 new and fixed messages
2 fixed messages and 2 new silly messages
2010-01-07 17:51:35 +00:00
keni
df20791e59 Add RCS version lines 2009-05-06 10:45:32 +00:00
nethack.rankin
e053cb3447 first divine gift artifact (trunk only)
From the newsgroup:  if no co-aligned artifacts are available when
attempting to give the first divine gift for an offered corpse, nothing
would be given.  Since the gift counter stayed at 0, subsequent attempts
to select one would still treat it as first gift and always fail again.

     The first divine gift from offering corpses must match the hero's
alignment; after that, nonaligned artifacts (Frost Brand, Giant Slayer, &c)
are added to the pool of choices for further divine gifts.  It's pretty
easy for a chaotic character to use up the co-aligned artifacts before
getting any divine gift.  There aren't many chaotic ones and some are
inelgible due to being race-specific items.  Wishing for Stormbringer--or
loading a bones file which contains it--and creating Sting and Orcrist
via naming will do the trick for an elven hero.

     This patch expands the pool of candidates to include nonaligned
artifacts during first gift selection if no co-aligned ones are available.
2008-07-07 03:01:30 +00:00
nethack.rankin
ac63f2bb6f more lint (trunk only)
The one `anything any' that was triggering a warning was shadowing
another `anything any' in the same function; no need to rename it, just
remove the unnecessary declaration.  Also, mark the couple of arrays with
initializers that I'd noticed as static instead of letting them default
to auto.  The abil_to_spfx()::abil2spfx[] one might need to be redone in
code as a switch if some compilers/linkers have trouble initializing it.
2008-02-20 01:26:13 +00:00
nethack.rankin
33c14ba523 enlightenment revamp, part I (trunk only)
Groundwork for re-doing ^X so that it'll be more integrated with
enlightenment and display bottom line information without abbreviations
or long-line truncation.  `mode' doesn't do anything yet so may provoke
lint complaints.
2008-01-21 16:40:56 +00:00
nethack.rankin
66f95ef37c Heart of Ahriman hack (trunk only)
From a four year old news posting:  hero was levitating via #invoke
on the Heart of Ahriman, then dropping that artifact yielded:
  You drop a gray stone named The Heart of Ahriman.
  You float gently to the floor.
  A gray stone named The Heart of Ahriman hits the floor.
That might be strictly correct, assuming that both hero and stone fall at
the same speed; if the stone was dropped from perhaps waist height then
the hero's feet would touch first.  But it looks strange, like a cartoon
where something hangs in midair until someone notices that it should fall.

     Removing the artifact from inventory causes the #invoke property to
toggle off.  Unfortunately it has to be done here before the object can
be placed at its destination.  Modifying message order seemed unviable;
this fix fiddles with the Levitation property in order to defer hero's
descent until after object handling is finished.  Now same setup gives:
  You drop a gray stone named The Heart of Ahriman.
  A gray stone named The Heart of Ahriman hits the floor.
  You float gently to the floor.
  You see here a gray stone named The Heart of Ahriman.
2007-06-03 01:05:43 +00:00
nethack.rankin
174182f0e4 Sunsword vs shades, take II (trunk only)
From the newsgroup:  Sunsword is ineffective against shades.  It
gets a special bonus of double damage vs undead, but since it's not made
of silver it was only doing 1 point of damage against shades.  Make the
bonus-vs-undead attribute override the silver-required criterion.  (No
comparable handling for flimsy weapons against thick-skinned critters
this time.)
2007-05-10 03:03:46 +00:00
cohrs
338e8b0a19 gcc compilation bit, missing type 2007-03-20 19:21:38 +00:00
nethack.rankin
2bd1f86cff worn gear after polymorph alignment change [2 of 2] (trunk only)
Extend rotouch_equipment() to cover all items in use, worn/carried/
invoked in addition to wielded.  Done when you change alignment, change
shape, or catch lycanthropy.  No-longer-touchable items inflict modest
damage; worn/wielded ones will be unworn/unwielded.  For the shape change
and lycanthropy cases, unwieled weapons are also dropped.  Other unworn
stuff stays in inventory, as do weapons for the alignment change case.

     It ought to force off gloves if worn silver--or hypothetical
artifact--ring has become untouchable and gets unworn.  Instead it just
curses the gloves, if necessary, so that there's some plausibility to
having the ring come off.
2007-03-20 04:38:29 +00:00
nethack.rankin
c86f9ff008 worn gear after polymorph alignment change [1 of 2] (trunk only)
Make polymorphing or changing alignment perform a touch check (as is
done when catching lycanthropy) on wielded weapon(s) to see whether the
hero can still use them in his new form.  Part [2 of 2] will update
retouch_equipment() to check all items in use rather than just weapon(s).
(A comment or two in part 1 already refers to expected behavior of part 2.)
2007-03-20 03:58:27 +00:00