# castSpell ! Used to cast a spell. Use as a function. Returns 1 OR 0 for Success or Failure. ! ! ARGS[0] is the spell being cast ! Valid Spells are listed below ! teleport ! ARGS[1-n] are any parameters that need to be passed to the Spell ! ! Example: ! gs 'castSpell', 'teleport', 'CentralPark' gs 'spellList' spellSuccess = 0 $SpellName = $ARGS[0] $SpellArgs = "" i=1 :ArgLoop if i < arrsize('$ARGS'): i += 1 $SpellArgs = $SpellArgs + ", '<<$ARGS[i - 1]>>'" jump 'ArgLoop' end killvar 'i' if spellKnown[$SpellName] = 1: !Make a Skill Check to see if the Spell succeeds spellRoll = pcs_splcstng - spellDiff[$SpellName] - (pcs_horny/5) + rand(1,100) if spellRoll > 50: !Critical Success spellSuccess = 2 splcstng_exp += rand(1,spellDiff[$SpellName]) + rand(0,5) elseif spellRoll > 10: !Success spellSuccess = 1 splcstng_exp += rand(1,spellDiff[$SpellName]) elseif spellRoll > -20: !Failure spellSuccess = 0 splcstng_exp += rand(1,spellDiff[$SpellName]) / 2 else !Critical Failure spellSuccess = -1 splcstng_exp += rand(1,spellDiff[$SpellName]) / 2 end killvar 'spellRoll' !Incur the costs of casting the spell if spellSuccess = 2: manaCost = spellMana[$SpellName] / 2 elseif spellSuccess = -1: manaCost = spellMana[$SpellName] * 2 else manaCost = spellMana[$SpellName] end pcs_manna -= manaCost !pcs_willpwr -= spellWill[$SpellName] arouseVal = manaCost / 50 gs 'arousal', 'voyeur', arouseVal minut -= arouseVal killvar 'arouseVal' killvar 'manaCost' end minut += spellTime[$SpellName] gs 'stat' $SpellExec = "gs 'spell_<<$SpellName>>', '<>'<<$SpellArgs>>" result = dyneval($SpellExec) killvar '$SpellName' killvar '$SpellArgs' killvar '$SpellExec' --- castSpell ---------------------------------