Scroll Thief — 55 of 138

Daniel M. Stelzer

Release 2

Section C - Memorizing Spells

The player's memory is a list of spells that varies. The player's mental capacity is initially 5. [1]

To decide which number is the memory count of (xyzzy - a spell): [Just a few convenience functions.]

let the count be zero;

repeat with N running from one to the number of entries in the player's memory:

if entry N of the player's memory is xyzzy:

increment the count;

decide on the count.

To decide whether (xyzzy - a spell) is multiply-memorized:

if the memory count of xyzzy is greater than one, yes;

no.

Memorizing is an action applying to one spell requiring light. Understand "memorize [spell]" or "learn [spell]" or "prepare [spell]" as memorizing. Understand the command "memorise" as "memorize". [For British players.]

Check someone memorizing (this is the NPCs can't memorize rule):

if the player can see the actor, say "[The actor] [don't] [if the actor is magical]seem inclined to cast spells at the moment[else]have much magical potential[end if].";

stop the action.

Check memorizing (this is the can't memorize without a book rule):

if the player does not enclose an undamaged spell book:

say "How do you expect to memorize a spell without a spell book?" instead.

Check memorizing (this is the can't memorize what you don't have rule):

repeat with tome running through undamaged spell books carried by the player:

if the spell understood is inscribed in the tome, make no decision;

repeat with tome running through visible undamaged spell books:

if the spell understood is inscribed in the tome:

carry out the implicitly taking activity with the tome;

if the tome is carried, make no decision;

repeat with the page running through spell scrolls carried by the player:

if the inscribed spell of the page is the spell understood:

say "Unfortunately, you cannot memorize a spell from a scroll. It needs to be copied into a book first." instead;

say "You don't have that spell written down anywhere." instead.

Carry out memorizing:

add the spell understood to the player's memory.

Last carry out memorizing a spell when the action is not silent: [Not a report rule because it needs to run before the after rules.]

say "Using your best study habits, you learn the [i][spell understood][/i] spell[if the spell understood is multiply-memorized] yet again[end if]."

After memorizing a spell (this is the mental capacity rule):

if the number of entries in the player's memory is greater than the player's mental capacity:

if the action is not silent, say "You have so much buzzing around in your head, though, that it's likely that something may have been forgotten in the shuffle.";

truncate the player's memory to the last (player's mental capacity) entries;

make no decision.

Incorrectly memorizing is an action applying to a topic. Understand "memorize [text]" or "learn [text]" or "prepare [text]" as incorrectly memorizing. [This just redirects LEARN ASDFG to a more useful error message.]

Check incorrectly memorizing a topic:

say "You don't have that spell written down anywhere." instead.

Note

[1]. It might seem more idiomatic to Inform 7 to use a relation, but that would only let you memorize each spell once. In the original games you could memorize a spell as many times as you wanted.