I’ve developed a couple of spells for my combat extension but I’m having trouble making it so the player cast them. I’ve been experimenting for a while but I can’t make it work. What I want to have is a simple system where the player or any NPC can pick a target and cast a spell they know at them. What I’m trying to get it to do is this:
-
Player clicks a hyperlink called “cast spell at goblin”
-
player gets a menu to choose the spell
-
player clicks the spell and it fires at the target
But at the moment the process I’m trying for is it, doesn’t work too well. Has anyone got any ideas?
[code]Target is a thing that varies.
Casting is an action applying to one visible thing. Understand “Cast [something]” or “Magic [something]” or “Enchant [something]” and “Cast at [something]” or “Magic on [something]” or “Cast Spell at [something]” as Casting.
Sorcery is an action applying to nothing. Understand “Magic” and “cast spell” and “cast magic” as Sorcery.
Check Casting: [Cast a spell AT something]
If the player is not Mage:
Say “You don’t know magic yet!”;
reject the player’s command;
Check Sorcery: [Cast a directionless spell]
If the player is not Mage:
Say “You don’t know magic yet!”;
reject the player’s command;
A thing can be MagicKnown. A thing is usually NOT MagicKnown.
Sparking-Missile-Known is a truth state that varies. Sparking-Missile-Known is true.
Carry out Casting:
Now the noun is Target;
Say “[paragraph break]-------------------------------------------------------------[line break]”;
If Sparking-Missile-Known is true:
Say “[o]Sparking Missile[x] (Ranged attack spell - normal damage)”;
Sparking Missile is an action applying to nothing. Understand “Sparking Missile” as Sparking Missile.
Check Sparking Missile: [Cast a spell AT something]
If the player is not Mage or Sparking-Missile-Known is false:
Say “You don’t know that magic yet!”;
reject the player’s command;
Carry out Sparking Missile:
Say “WOOSH!”;[/code]