Resting
The party · Resting: special cases · Camp menu · Memorizing and praying
In brief
Resting, from the camp menu, passes time in steps; six steps make an hour. While the party rests, each character recovers its used spells one at a time, healers may cast their cure spells on the most injured character, poison hurts every hour, and every eight hours wounds close by one hit point. Monsters nearby forbid resting and end it. The rest goes on while there is something to recover, and ends with "All characters are fully rested." when nobody is injured.
Resting
The rest command of the camp menu passes time in steps; six steps make one hour on its "Hours rested" counter. While the party rests, each character recovers its used spells one at a time, healers may cast their cure spells, poison and hunger hurt, and wounds slowly close. The rest goes on while there is something to recover and ends when monsters come near, when the player presses a key or answers no to one of its questions.1
In this section, a living character is present, above −10 hit points
and not turned to stone, the PRESENT and NOT_DEAD tests of
CharacterEligibilityMask. A
character is injured when it is living and below its maximum hit points;
the most injured is the one with the fewest hit points, the first in
slot order on a tie. A healer is a character with a cleric or paladin
class, carrying an ITEM_TYPE_HOLY_SYMBOL anywhere in its inventory.
Whether the party can rest
Before the first step, in this order:1
- When the level's scripts forbid resting (
SCRIPT_FLAG_TARGET_REST_ALLOWED), the game prints "You do not feel it is safe to rest here." - The monsters move: five rounds, each running monster update groups 0
and 1 (see monster update cadence) and
advancing every flying object once, with the sounds muted. Then, when
any monster that is not
MONSTER_MODE_PEACEFULstands less than two blocks away, the game prints "You can't rest here, monsters are near." The distance is the larger of the column and row differences plus half the smaller, rounded down, so the test covers the party's block and the eight around it; walls and doors do not matter. - On level 3, a dream sequence plays instead of the rest: a dialogue text
over the
DREAMpicture, then an animation of 13 frames that show the four quarters ofDREAMin turn, about 6.4 seconds (116 ticks) in all, then a second text with an "ok" button. - When a present character is poisoned, the game asks "Poisoned party members may die! Rest anyway?"; no ends the command.
- When someone is injured, the game looks for the first healer that is present, conscious, neither paralyzed nor turned to stone, and has a Cure Light Wounds, Cure Serious Wounds or Cure Critical Wounds slot, used or not. If there is one, it asks once "Will your healers heal the party?".
The game then shows "Resting party." and the hour counter, and sets one recovery counter per party slot to 0. The most injured character becomes the target of healing.
A step of rest
Each step, every slot recovers at most one spell;2 then, if the player accepted the healers, they heal the target:3
for each party slot s:
counter[s] += 1 # even when s cannot recover
if s.food == 0: continue
if not (PRESENT and CONSCIOUS): continue
if s carries ITEM_TYPE_HOLY_SYMBOL:
recover_one(s, s.cleric_spell_slots, 10) # "s gained spell."
if s carries ITEM_TYPE_SPELLBOOK:
recover_one(s, s.mage_spell_slots, 6) # "s memorized spell."
recover_one(s, slots, group_size):
for i in 0 .. 79:
group = i / group_size # integer division
if 48 + group >= counter[s]: return
if slots[i] < 0: # a used spell
slots[i] = -slots[i]
counter[s] = 48
print the message
return
The first spell comes back at step 49, just after the eighth hour. After each recovered spell the counter starts again from 48, so a used slot of group g, counted from 0, takes g + 1 more steps, and the slots are taken in order. The counter is shared: a character with both kinds recovers a cleric spell first and no mage spell in the same step. The test looks only at the item carried, not at the class. Mage slots are grouped by six, not ten; see the anomaly below.
if healers accepted and target:
for each party slot h, in order:
if h is not a healer: continue
if counter[h] >= 48 and h has a used cure spell:
stop healing for this step # healers after h wait too
for each cleric slot of h:
Cure Light Wounds -> roll 1d8
Cure Serious Wounds -> roll 2d8 + 1
Cure Critical Wounds -> roll 3d8 + 3
other spells -> next slot
mark the slot used; counter[h] = 0
print "h casts healing on target."
add roll to target.hit_points, up to hit_points_max
So in one step every ready cure spell of every healer goes to the same target, even past its maximum. The target is chosen again only every eight hours; meanwhile nothing checks its hit points or its condition. After casting, a healer waits until all its cure spells are back: its counter restarts from 0, and once it reaches 48 the healing stops at that healer while one of its cure spells is still used. The healer's own condition is not tested in this step; see the anomaly below.
Every hour and every eight hours
At the sixth step, the hour counter advances, the shared time counter gains 32 760 ticks, and every present, poisoned character takes 10 points of damage, with the usual consequences: unconscious at 0 hit points, dead at −10.4
Every eight hours, in slot order:4
- every character of class PALADIN, whatever its condition, gets Lay on Hands back in its first ten cleric slots: a used one is restored, otherwise it is written in the first empty slot;
- every living character with food regains 1 hit point, up to its maximum;
- every living character without food loses 1 hit point once every 24 hours; the game then asks "Your party is starving. Do you wish to continue resting?", and no ends the rest;
- the target of healing is chosen again.
Resting does not consume food; see the anomaly below.
When the rest ends
Spells are left to recover when a living character with food has a used cleric slot, with a cleric or paladin class and a holy symbol, or a used mage slot, with a mage class and a spellbook. An unconscious caster counts, although it recovers nothing until it wakes. After each step, in this order:4
- With no spell left to recover, someone injured, and "rest until healed" not yet chosen, the game asks "Someone is still injured. Rest until healed?"; no ends the rest.
- A key or a click ends the rest.
- Five monster rounds run, as before the first step; a monster near ends the rest with "You can't rest here, monsters are near." When no character can act any more — the test of the defeat sequence — the rest ends too.
- With no spell left to recover, the rest ends when nobody is injured, or when nobody chose to let the healers heal or to rest until healed.
- A key or a click ends the rest.
At the end, when nobody is injured and neither monsters nor a defeat stopped it, the game shows "All characters are fully rested." Answering no to the starving question clears the target, so that message appears then too. After a rest of more than four hours without such an interruption, Insal may leave; see below.
The rest moves the time counter forward without running the other timed updates. On the next pass of the game loop, each update whose deadline has passed runs once, so food drops by one point at most, and the character timers of lasting spells whose time has run out end at their next check.
Sources
Locations refer to the game executable reference; comparative sources are listed in the technical references.