Scroll Thief — 59 of 138

Daniel M. Stelzer

Release 2

Section B - Making Casting Easier

The selected scroll is an object that varies.

To decide if the player can cast (xyzzy - a spell) from the scroll excluding (item - an object):

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

if the inscribed spell of the page is xyzzy and the page is not the item:

now the selected scroll is the page;

yes;

repeat with the page running through touchable spell scrolls: [Check carried first, so those scrolls are preferred]

if the inscribed spell of the page is xyzzy and the page is not the item:

now the selected scroll is the page;

yes;

no.

To decide if the player can cast (xyzzy - a spell) from memory:

if the memory count of xyzzy >= 1, yes;

no.

The selected spell book is an object that varies.

To implicitly memorize (xyzzy - a spell): [This should really be an activity, but I don't use it for anything complicated.]

initialize the implicit action;

if the selected spell book is not carried:

carry out the implicitly taking activity with the selected spell book; [This is called within the other implicit action to make it print properly.]

silently try memorizing xyzzy;

finish the implicit action with participle "memorizing" infinitive "memorize" object "[xyzzy]" and condition (whether or not the player can cast xyzzy from memory).

To decide if the player can cast (xyzzy - a spell) from the book:

if in darkness, no;

now the selected spell book is nothing;

if the player carries an undamaged spell book (called the item) which bears xyzzy:

now the selected spell book is the item;

otherwise:

if the player can touch an undamaged spell book (called the item) which bears xyzzy:

now the selected spell book is the item;

if the selected spell book is nothing, no;

yes.

Definition: a spell is book-visible rather than non-book-visible if the player can cast it from the book.

Definition: a spell is scroll-visible rather than non-scroll-visible if the player can cast it from the scroll excluding nothing.

To decide if the player can cast (xyzzy - a spell) at (item - an object):

if the player can cast xyzzy from the book and xyzzy is not listed in the player's memory:

implicitly memorize xyzzy;

if the player can cast xyzzy from memory: [This bit needs to come after the previous bit, so that it will be checked after the player tries to implicitly memorize the spell.]

forget one instance of xyzzy;

yes;

if the player can cast xyzzy from the scroll excluding the item: [You can't gnusto the scroll you have gnusto on.]

if the selected scroll is not carried:

carry out the implicitly taking activity with the selected scroll;

if the selected scroll is not carried:

say "You begin reading out the incantation from [the selected scroll], but something feels wrong and you stop before it concludes. Perhaps if you had it in your hand?";

no;

say "As you cast the spell, [the selected scroll] vanishes.";

remove the selected scroll from play;

yes;

say "You do not know that spell[if in darkness], and there is not sufficient light for you to read a spellbook[end if].";

if xyzzy is inscribed in a known undamaged on-stage spell book (called the selected tome) and the location of the selected tome is not the location:

try remembering the selected tome;

no.

Check casting (this is the can't cast what you don't know rule):

unless the player can cast the spell understood at the second noun, rule fails.

The modification counter is initially 0.

Understand "lleps" as "[lleps]". [The parser always matches literals before tokens, so "lleps [text]" would be preferred over "[spell]" for casting. But if I make [lleps] a token as well it will try both of them.]

Inverted casting is an action applying to one topic. Understand "[lleps] [text]" as inverted casting.

Carry out inverted casting:

record the outcome of casting lleps at the location;

if the action succeeded:

now the modification counter is 2;

silently execute the command "[topic understood]".

Should the game suggest inverted casting: it is a bad suggestion.

Understand "yonk" as "[yonk]".

Empowered casting is an action applying to one topic. Understand "[yonk] [text]" as empowered casting.

Carry out empowered casting:

record the outcome of casting yonk at the location;

if the action succeeded:

now the modification counter is 2;

silently execute the command "[topic understood]".

Should the game suggest empowered casting: it is a bad suggestion.

Definition: a spell is metamagic rather than non-metamagic if it is yonk or it is lleps.

To decide whether the command is not metamagic:

if the saved command matches the text "lleps", no;

if the saved command matches the text "yonk", no;

yes.

Definition: a spell is mistaken if it is non-metamagic and it is not zifmia. [Allow ZIFMIA FROB, assuming some random unrelated object, but not FROTZ FROB.]

Every turn when the modification counter is not 0:

decrement the modification counter;

if the modification counter is 0 and the player is not unmodified:

say "(You release the metamagic, letting it fade from your mind.)[ccb]";

now the player is unmodified.

Understand "[mistaken spell] [text]" as a mistake ("You can't see any such thing."). [Since there's no verb in the command, the usual error would be "That's not a verb I recognize." This is more useful to the player.]