Spellcasting
version 2 by Jim Aikin
Section 3 - New Actions
Zapping is an action applying to two things. Understand "[magic-spell] [something]" as zapping.
Carry out zapping:
try casting the noun at the second noun instead.
Casting is an action applying to one thing. Understand "[magic-spell]" and "cast [something]" as casting.
Check casting:
let found-it be a truth state;
let found-it be false;
let its-learned be a truth state;
let its-learned be false;
repeat with N running from 1 to the number of rows in the Table of Spells:
if the spell in row N of the Table of Spells is the noun:
now found-it is true;
if the noun is learned:
now its-learned is true;
if found-it is true:
if its-learned is false:
say "[unlearned-spell]";
stop the action;
otherwise:
continue the action;
otherwise:
say "[not-a-spell]";
stop the action.
Carry out casting:
repeat with N running from 1 to the number of rows in the Table of Spells:
if the spell in row N of the Table of Spells is the noun:
say "[output in row N of the Table of Spells][line break]".
Casting it at is an action applying to two things. Understand "cast [something] at [something]" as casting it at.
Check casting it at:
let found-it be a truth state;
let found-it be false;
let its-learned be a truth state;
let its-learned be false;
repeat with N running from 1 to the number of rows in the Table of Spells:
if the spell in row N of the Table of Spells is the noun:
now found-it is true;
if the noun is learned:
now its-learned is true;
if found-it is true:
if its-learned is false:
say "[unlearned-spell]";
stop the action;
otherwise:
continue the action;
otherwise:
say "[not-a-spell]";
stop the action.
Carry out casting it at:
repeat with N running from 1 to the number of rows in the Table of Spells:
if the spell in row N of the Table of Spells is the noun:
say "[directed output in row N of the Table of Spells][line break]".