Dwarf Fortress Bug Tracker - Dwarf Fortress
View Issue Details
0011901Dwarf FortressCreaturespublic2022-08-16 14:092022-08-25 11:41
Quietust 
 
normalminoralways
newopen 
amd64Windows8.1
0.47.05 
 
0011901: Cave Adaptation completely resets when dwarves step outside
Whenever a dwarf spends time underground, its CAVE_ADAPT counter increases by 1 every game tick to a maximum amount of 800000.

If a sufficiently-adapted dwarf steps outside while the weather is clear (i.e. the sun is out), there is a 1/1000 chance per game tick that the dwarf will experience negative effects (i.e. being Irritated or Nauseated by the sun, depending on how heavily they are adapted).

In older versions, it would then decrease the dwarf's adaptation by 10 and to a minimum of zero, but in version 0.47.05 the "decrement and check" are both missing, causing it to immediately reset adaptation to zero the instant the dwarf sets foot outside.

As a result, dwarves only have a 1/1000 chance to ever suffer from negative effects (or even experience negative thoughts) from cave adaptation, and that will only happen if they spend at least a year without ever going outside.
1. Put a dwarf underground and wait at least a year and a half (or just initialize its cave adaptation to a sufficiently large value)
2. Have it step outside
3. Observe that its cave adaptation is now completely gone and it likely hasn't suffered from it.
Prior to version 0.40.13, cave adaptation was partially broken in that it did not inflict the Pain+Dizziness+Nausea effects - this was fixed by 0006512, but it's unclear exactly when this specific bug was introduced.
No tags attached.
Issue History
2022-08-16 14:09QuietustNew Issue
2022-08-16 14:56QuietustNote Added: 0041293
2022-08-25 11:41QuietustNote Added: 0041298
2022-08-25 11:43QuietustNote Edited: 0041298bug_revision_view_page.php?bugnote_id=0041298#r16821
2022-08-25 11:47QuietustNote Edited: 0041298bug_revision_view_page.php?bugnote_id=0041298#r16822
2022-08-25 11:48QuietustNote Edited: 0041298bug_revision_view_page.php?bugnote_id=0041298#r16823
2022-08-26 07:41QuietustNote Edited: 0041298bug_revision_view_page.php?bugnote_id=0041298#r16824
2022-08-26 07:43QuietustNote Edited: 0041293bug_revision_view_page.php?bugnote_id=0041293#r16826
2022-08-26 07:43QuietustNote Edited: 0041293bug_revision_view_page.php?bugnote_id=0041293#r16827
2022-08-26 07:49QuietustNote Edited: 0041298bug_revision_view_page.php?bugnote_id=0041298#r16828

Notes
(0041293)
Quietust   
2022-08-16 14:56   
(edited on: 2022-08-26 07:43)
A few other minor bugs I've spotted:
* In older versions, "nauseated" applied 50-99 ticks of Dizziness while "irritated" only applied 25-49 ticks; in the current version, "irritated" also applies 50-99 ticks.
* The "irritated" case checks if the creature can suffer Nausea, even though it never actually applies it - as a result, if the creature has [NOPAIN] and [NO_DIZZINESS] but not [NONAUSEA], light cave adaptation will apply a "wound" with no effects.

(0041298)
Quietust   
2022-08-25 11:41   
(edited on: 2022-08-26 07:49)
It appears that this was introduced in version 0.47.05 - looking at a disassembly of version 0.47.04, the "decrement and check" code was present, but in 0.47.05 it was absent.

The release notes for that version claim "Made cave adaption negative effects less frequent", but instead it seems to have eliminated them entirely. Maybe the intent was to only cure them after they suffered negative effects?

Some random ideas/suggestions for alternative fixes:
* When a creature is "nauseated" by the sun, immediately subtract 2 months (so they only vomit a few times)
* When a creature is "irritated" by the sun, immediately subtract 1 month (so they get stunned maybe 6 times)
* Still have it slowly decay by 10 per tick (so that negative effects still have a chance of happening at all)
* Maybe reduce the chance per tick (e.g. to 1/2000) so that negative effects are spread out over time