Commit Graph

84 Commits

Author SHA1 Message Date
nhmall
ac9ba38449 file header bump from "NetHack 3.6" to "NetHack 3.7" 2020-08-03 22:07:36 -04:00
PatR
97cc689553 tin identification
Tin handling code used tin->cknown to indicate that the variety
(soup, deep fried, pureed, &c) was known, but neither object
identification nor end of game disclosure was setting cknown for
that type of object.

^I behaves as if cknown is set, so the problem was hidden during
times when anyone was likely to be paying attention.
2020-07-31 13:14:09 -07:00
nhmall
e524fc4fc8 clarify what was meant by "special" in a comment 2020-07-31 10:57:20 -04:00
nhmall
8b2750ab60 lower the code upkeep for mextra and oextra pointer additions 2020-07-31 09:42:17 -04:00
nhmall
f153c1f0d1 typo fix in include/obj.h comment 2020-07-31 08:42:40 -04:00
nhmall
6b7979fa72 add note to zero out new mextra and oextra fields
Closes #375
2020-07-31 08:31:09 -04:00
PatR
c64049306d candy bar wrappers
Adopt the suggestion that candy bar stacks which get split should
keep the same wrapper text for both halves of the stack.  The patch
stuck with using obj->o_id to manage the wrapper which prior to the
patch wasn't a factor in merging and splitting.  Switch to obj->spe
instead, comparable to tin varities, so mergability is already
taken care of.

End of game disclosure tacks on T-shirt text to formatted items.
Do the same for candy bar wrappers.
2020-07-30 19:25:57 -07:00
PatR
e9f53ab7f6 fix #K1139 - corpse removed from ice box by monst
Rot and revive timers are turned off when a corpse gets put inside
an ice box.  They get turned back on when taken out of the ice box
by the hero but were being left off if taken out by a monster.
That resulted in corpses of arbitrary type behaving like lizard
corpses and never rotting away.

This fixes that.  It also changes troll corpse behavior.  Once put
in an ice box, a troll corpse will not get a new revive timer when
taken out, just an ordinary rot timer.
2020-05-30 13:33:16 -07:00
PatR
7817e69c41 two new monsters from slash'em
Adds two monsters originally from slash'em.  I used the slash'em
tiles this time, also its code as a starting point but made various
revisions.  Both the tiles could benefit from some touch-ups.

displacer beast:  blue 'f'.  Attempting a melee hit (ie, trying to
  move to its spot) has a 50:50 chance for it to swap places with you.
  Fairly tough monster to begin with, then half your ordinary attacks
  effectively miss and if you try to face a mob by retreating to a
  corridor or backing into a corner you can end up being drawn back
  into the open.  I added bargethrough capability, and also it won't
  be fooled about hero's location by Displacement.  [It only swaps
  places during combat when contact is initiated by the hero, not
  when attacked by another monster or when attacking.]

genetic engineer:  green 'Q'.  Its attack causes the target to be
  polymorphed unless that target resists.  Hero will almost always
  have magic resistance by the time this monster is encountered, but
  it can make conflict become risky by hitting and polymorphing other
  monsters.  Slash'em flagged it hell-only but I took that flag off;
  I also took away its ability to teleport.  Slash'em polymorphs the
  hero if a genetic engineer corpse is eaten; that's included and I
  introduced that for monsters too.

I added both of these to the list of candidates for monster spell
'summon nasties' and for post-Wizard harassment.

I also gave all the 'f's infravision.  Probably only matters if the
hero polymorphs into a feline.

Displacer beast is originally from AD&D which depicts it as a six-
legged cougar with a pair of tentacles; it has Displacement rather
be able to affect an attacker's location.  I think genetic engineer
is original to slash'em where it expands Q class but seems mainly to
be the base monster for Dr.Frankenstein (a unique monster with a
one-level side-branch lair in slash'em's incarnation of Gehennom).
2020-05-03 14:13:08 -07:00
PatR
e63fed627c obj->oextra->{omid,olong}
Change obj->oextra->omid from a usually-Null pointer field in
oextra to a simple 'unsigned' that doesn't need any allocation
beyond obj->oextra itself.  Value 0 means that it is not in use;
it is used to hold a monst.m_id and those are always non-zero.

Delete unused obj->oextra->olong.  'olong' used to be the last
field in struct obj, put there to force alignment of anything
which followed it back when obj structures were over-allocated to
append extra information.  It had a comment about being used for
temporary gold but whatever that was, temporary gold was gone long
before obj->oextra got introduced.

Bump EDITLEVEL since this invalidates existing 3.7 save files.

Remove a bunch of tabs from obj.h and save.c.
2020-04-24 09:29:52 -07:00
PatR
206e9668f1 achievement tracking oversight
obj->record_achieve_special (overlay of obj->corpsenm) is no longer
used.
2020-01-26 02:58:18 -08:00
PatR
0166239a22 simplify achievement tracking for special objects
This turned out to be a lot more work than I anticipated, but it is
definitely simpler (other than having #wizmakemap take achievements
away if you replace the level that contains the 'prize', which wasn't
handled before).

I cheated and made Mine's End into a no-bones level because the new
flagging scheme for luckstone, bag, and amulet can't carry over from
one game to another.  It probably should have been no-bones all along.
Sokoban didn't have this issue because it's already no-bones.

Existing save files are invalidated.
2020-01-24 13:54:23 -08:00
Pasi Kallinen
7e07cef197 Lua struct obj improvements
If the core frees the obj struct referred by lua, don't free it,
just mark it as OBJ_LUAFREE - lua will free it in gc once all
the references to it are gone.
2020-01-01 13:25:59 +02:00
Pasi Kallinen
6d8d3a9557 Add lua object references
Whenever a lua script references a core struct obj, increment a counter
in the obj struct. Core code will not free the obj, if there are any
lua references pointing to it, just makes it free-floating.
When lua script ends, the lua gc will free the free-floating objects.

Also exposes u.inventory to lua.

Breaks save and bones compat.
2019-12-26 19:15:24 +02:00
Bart House
90547edb83 moves, monstermoves, wailmsg, migrating_objs and billobjs moved to g. 2018-12-24 20:22:33 -08:00
keni
d8c49ec9d1 Add updated copyright lines, part 1. 2018-04-25 15:00:13 -04:00
PatR
58477b33f4 more fix for #H5056 - achievement tracking
The followup message about the fix for #5056 was trapped by the spam
filter so didn't reach us for a while.

xlogfile has an extra field to track various achievements made during
the game it logs, two of which are fully exploring the gnomish mines
and fully exploring sokoban.  Those are accomplished by finding the
special 'prize' item on the final level of their branch:  luckstone
for mines and bag of holding or amulet of reflecition for sokoban.
3.6.0 had a bug where any item of the target type found anywhere in
the dungeon resulted in achieving the relevant goal.  A post-3.6.1 fix
for that required that the item be found on the end level of the branch
and attempted to require that it an item explicitly placed there by the
special level loader, but the latter aspect had a bug which meant that
random items of the appropriate type placed on final level would count
as the prize.  Chance of extra luckstones on mines' end is fairly high,
so potential for false completion of the achievement was also high.

The second complaint was that since the achievement was only recorded
if the special prize item was found on final level, then if a monster
took it to another level then the achievement became impossible.  (Not
true, the player could take it back, drop it, and pick it up again, but
that is admittedly a pretty silly hoop to jump through.)  On the other
hand, if a monster removed the item before the hero found it, then a
case could be made that the hero hadn't really fully explored the
level.  However, this fix records the achievement no matter where the
hero picks up the item.  The final level must be entered--otherwise no
monster could possibly acquire and transport the item--but it isn't
guaranteed to have been fully explored.  Big deal....

The prize could also be acquired in bones data.  Before the second
portion of this fix, that wouldn't have mattered.  But now it does, so
clear the prize indicator when saving bones unless it happens to be the
same level where that item is created (impossible for sokoban, where no
bones are left; not sure offhand about mines' end).  The former prize
stone or bag or amulet becomes an ordinary one of its type.

This can all be done in a much cleaner fashion once we give up on the
current save file compatability.  Putting obj->o_id values into new
context.mines_prize and context.soko_prize, plus a hack to mkobj() to
not reuse those two values if the o_id counter ever wraps back to 0,
would cover most of the details.  Adding an achievement tracking flag
to lev_comp's object handling for use by the special level loader
would cover most of the rest.
2017-10-24 00:37:21 -07:00
PatR
26dd891038 candelabrum weight and burn out
Adjust the Candelabrum of Invocation's weight when it has candles
attached.  This has been a known issue ever since the candelabrum and
candles were introduced.

When the candelabrum burns out, update persistent inventory window to
show that it no longer has candles.
2017-09-25 13:20:30 -07:00
PatR
719af503e7 fix #H6104 - no potion handling in thitu()
thitu() is mostly used for arrows and darts "thrown" by traps, but
scatter() uses it on items launched by a land mine explosion.  Traps
had no need for potion handling, but scattering does.  Changing thitu()
to call potionhit() required that more information be passed to the
latter in case killer reason was needed, and thitu()'s callers needed
to be updated since it now might use up its missile (only when that's
a potion, so scatter() is only caller which actually needed to care).

Quite a bit of work--especially the testing--for something which will
never be noticed in actual play.  In hindsight, it would have been
much simpler just to make scatter destroy all potions rather than
allow the 1% chance of remaining intact (via obj_resists()), or else
leave any intact ones at the explosion spot instead of launching them.
2017-09-25 10:42:43 -07:00
Pasi Kallinen
76d7044872 Fix #H5056/bz1086: Bug in Achievement Recording
Bug report was:

> "Completed sokoban" achievement was logged when picking up
> a randomly generated bag of holding in the gnomish mines.

The picking-up code was missing checks for the branches, so
you could get the achievements outside the correct branches.
2017-02-06 16:52:40 +02:00
PatR
6632c380f3 fix #H4457 - grammar nitpick
"Your pair of speed boots glow silver for a moment." should be
"Your pair of speed boots glows silver for a moment.".  The fix
reverses a post-3.6.0 change to is_plural().  Also, add new
pair_of() to test for object formatted as "pair of Bars".  For verb
usage, that's definitely singular, but for pronoun usage, sometimes
plural seems better (although it might actually be incorrect).

I fixed up the formatting of a block comment in obj.h, but it is
still a candidate for tab cleanup.
2016-07-30 01:19:44 -07:00
PatR
862d37c77a more recovered bits
Some worthwhile stuff from abandoned 'git stash':
 is_plural() macro wasn't comprehensive;
 a couple of return values where writing with a magic marker was
   causing time to elapse even though nothing happened;
 comment formatting for saddle being left in shop by dying steed.
2016-03-25 17:26:37 -07:00
PatR
b3b4953020 'sortloot' revamp
Change the sortloot option to use qsort() instead of naive insertion
sort.  After sorting, it reorders the linked list into the sorted
order, so might have some subtle change(s) in behavior since that
wasn't done before.

pickup.c includes some formatting cleanup.

modified:
  include/extern.h, hack.h, obj.h
  src/do.c, do_wear.c, end.c, invent.c, pickup.c
2016-03-13 16:23:38 -07:00
PatR
850ed0cba6 address #H4247 & #4248 - theft of quest artifact
Two different reports complaining that having the Wizard steal the
hero's quest artifact is a bad thing.  This doesn't change that,
but it does make all quest artifacts become equal targets so that
wishing for other roles' artifacts doesn't offer such a safe way to
have whichever special attributes they provide.

Quest artifacts are actually higher priority targets for theft than
the Amulet.  I suspect that probably wasn't originally intended,
but I left things that way.  Taking quest artifacts leaves the hero
more vulnerable to future thefts, and once they're gone the Amulet
has priority over the invocation tools.
2016-02-27 16:23:24 -08:00
Pasi Kallinen
e29c21f367 Tiny formatting fix 2015-12-30 17:29:44 +02:00
nhmall
fa092f5fe9 housekeeping for 3.6.1
Changes to be committed:
	modified:   Files
	modified:   README
	modified:   dat/history
	modified:   doc/Guidebook.mn
	modified:   doc/Guidebook.tex
	modified:   include/global.h
	modified:   include/obj.h
	modified:   include/patchlevel.h
	modified:   src/invent.c
	modified:   src/objnam.c
	modified:   src/shknam.c
	modified:   src/sounds.c
	modified:   src/spell.c
	modified:   sys/winnt/Install.nt
	modified:   sys/winnt/nethack.def
	modified:   win/macosx/NetHackGuidebook.applescript
	modified:   win/macosx/NetHackTerm.applescript
	modified:   win/win32/mswproc.c
2015-12-16 17:52:34 -05:00
PatR
4b8db661dd wet towel enhancements
Flesh out wet towels a bit:
1) wielding a wet towel--or a dry one which becomes wet--won't give a
   "you begin bashing with your wet towel" message when attacking;
2) if a formerly wet towel dries out completely while wielded, *do* give
   "you begin bashing with your towel" on the next attack;
3) successfully hitting with a wet towel no longer always loses wetness;
4) water damage to dry towel always confers at least 1 point of wetness;
5) taking fire damage (via burnarmor() which is used for most types of
   fire damage) has a chance to partially or fully dry a wet towel
   (regardless of whether it's wielded at the time; applies to monsters
   as well as hero; each towel being carried is checked until one is
   affected, then any others escape drying.

Not done:
-) attacking with a wielded wet towel perhaps ought to be treated as a
   weapon attack using whip skill rather than an augmented arbitrary-
   junk-by-weight attack;
-) throwing a wet towel should probably ignore wetness--it's just a wet
   piece of cloth when not finishing with a whip snap; right now, it
   loses a point of wetness when thrown and usually--#3 above--another
   point if it hits...;
-) hitting burning creatures is no different than hitting anything else;
-) likewise for hitting wet creatures.
2015-10-17 17:00:53 -07:00
Sean Hunt
1c081b1647 Remove stale version control lines. 2015-05-25 09:21:31 +09:00
Sean Hunt
8b57d96fd2 Reformat .h files.
I did my best to exempt some of the bigger aligned blocks from the reformatting
using the /* clang-format off */ and /* clang-format on */ tags. Probably some
that shouldn't have been formatted were anyway; if you encounter them, please
fix.

The clang-format tags were left in on the basis that it's much easier to prune
those out later than to put them back in, and it means that, modulo my custom
version of clang-format, I should be able to run clang-format on the source tree
again without changing anything, now that Pat has fixed the VA_DECL issues.
2015-05-25 09:21:15 +09:00
karnov
2a907f894e Version number increment 2015-05-06 22:04:27 -04:00
nhmall
11560933cc Merge branch 'master' into nhmall-booktribute
Conflicts:
	doc/fixes35.0
	include/extern.h
	src/mkobj.c
	src/mon.c
	src/objnam.c
	win/share/objects.txt
2015-04-12 10:02:17 -04:00
nhmall
c43e8f9d31 Merge branch 'master' into nhmall-booktribute
Conflicts:
	include/context.h
2015-04-02 19:19:50 -04:00
Derek S. Ray
af5ed436b8 Merge branch 'master' into derek-farming
* master: (160 commits)
  Add doors correctly
  bug fixes for nhsub
  Generate oracle monsters after subroom
  Generate minetown guards after subrooms
  ...

Conflicts:
	src/do.c
	src/files.c
	src/hack.c
	src/mon.c
	src/vision.c
2015-04-01 17:40:25 -04:00
Pasi Kallinen
323b8b4038 Merge branch 'master' of https://rodney.nethack.org:20040/git/NHsource into paxed-new_lev_comp
Conflicts:
	src/trap.c
	sys/winnt/Makefile.msc
2015-04-01 16:09:53 +03:00
Derek S. Ray
ca60cac105 Merge branch 'master' into derek-farming
* master: (41 commits)
  Add more explicit helpless reasons
  add data.base suggestion for whistle
  Use existing function to count containers
  ...

Conflicts:
	src/do.c
	src/hack.c
	src/invent.c
	src/mon.c
	src/objnam.c
2015-03-29 17:32:12 -04:00
Pasi Kallinen
870b124f14 Allow reading many more items
You can now also read alchemy smocks, credit cards, cans of grease,
magic markers, gold, the Orb of Fate, and candy bars.
2015-03-27 21:04:18 +02:00
Derek S. Ray
335c7fc003 Merge branch 'master' into derek-farming
* master: (49 commits)
  Fix 'fetch' syntax, include sparkly 'git log' trick
  Show object symbols in menu headings
  Fix a memory leak on termination.
  ...

Conflicts:
	include/obj.h
	src/do.c
	src/files.c
	src/hack.c
	src/invent.c
	src/mkobj.c
	src/mon.c
	src/objnam.c
2015-03-25 17:23:59 -04:00
Derek S. Ray
5ccae41702 add glob merging for obvious cases
flooreffects() covers most dropped/thrown/etc. cases, and the hooks in
invent and mon handle "deathdrops" along with picking up items.
still need to check putting into/removing from containers
2015-03-23 23:13:53 -04:00
Pasi Kallinen
2649cb385c Merge branch 'master' into paxed-new_lev_comp
Conflicts:
	.gitignore
	doc/fixes35.0
	include/obj.h
	include/patchlevel.h
	src/dig.c
	src/mklev.c
	src/rumors.c
	src/save.c
	src/topten.c
	src/trap.c
	sys/winnt/Makefile.msc
	util/makedefs.c
	win/win32/levstuff.mak
2015-03-21 19:39:48 +02:00
nhmall
f2a132adca more book tribute - store index right in obj 2015-03-21 11:02:52 -04:00
nhmall
e3eb74166f obj change to support some upcoming work
This is an enabling patch for upcoming work. It breaks
save/bones so editlevel is incremented.

I'd like to a second overloadable int field in struct obj,
instead of just the one that is typically overloaded - corpsenm.

The second one can be used for things that are being tallied
up as opposed to a static one time assignment for reference/linkage
purposes.

The differentiation will allow both uses to co-exist for the
same object.
2015-03-21 10:46:11 -04:00
Sean Hunt
b98fd27f9d Merge fire-based erosion to common codepaths.
This finally eliminates all direct increases of `oeroded` and `oeroded2`
and moves them all to go via `erode_obj()`. They are still manipulated
directly in a few places, but not to erode objects.

This now merges the `fire_damage()` function to a common codepath, used
for items on lava and burning oil, but fire needs more work. There is
still a duplication between `destroy_item()` and `fire_damage()`; the
two codepaths should eventually be merged in some manner so that there
is only one codepath to say "an object was affected by fire". This path
might require some parameters, such as whether the fire will just erode
objects or burn them outright, but that can happen another day.
2015-03-17 18:47:10 +02:00
Sean Hunt
5532600f1a Cover a couple of corner cases with rust_dmg(). 2015-03-17 18:47:00 +02:00
Derek S. Ray
66289b13ab remove and transfer INVISIBLE_OBJECTS to branch 2015-03-17 18:46:49 +02:00
Sean Hunt
161070ce56 Make KOPS unconditional. 2015-03-17 18:45:56 +02:00
keni
25cd007c48 Bulk recovery of file CVS headers and addition of NHDT- headers. 2015-03-17 18:45:12 +02:00
Derek S. Ray
68b8931918 further ongoing changes
Swap out single object for four separate ones to support tiles
rename to 'glob' to avoid confusion with acid/quivering blobs
2015-03-15 21:46:26 -04:00
Pasi Kallinen
f8aced5480 Add Extended Logfile 2015-03-12 21:35:04 +02:00
Sean Hunt
777328bd5c Merge fire-based erosion to common codepaths.
This finally eliminates all direct increases of `oeroded` and `oeroded2`
and moves them all to go via `erode_obj()`. They are still manipulated
directly in a few places, but not to erode objects.

This now merges the `fire_damage()` function to a common codepath, used
for items on lava and burning oil, but fire needs more work. There is
still a duplication between `destroy_item()` and `fire_damage()`; the
two codepaths should eventually be merged in some manner so that there
is only one codepath to say "an object was affected by fire". This path
might require some parameters, such as whether the fire will just erode
objects or burn them outright, but that can happen another day.
2015-03-02 12:50:03 -05:00
Sean Hunt
d588210a77 Cover a couple of corner cases with rust_dmg(). 2015-03-02 12:49:57 -05:00