castSpell.qsrc 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. # castSpell
  2. ! Used to cast a spell. Use as a function. Returns 1 OR 0 for Success or Failure.
  3. !
  4. ! ARGS[0] is the spell being cast
  5. ! Valid Spells are
  6. ! teleport
  7. !teleport
  8. spellMana['teleport'] = 1000
  9. spellTime['teleport'] = 20
  10. spellWill['teleport'] = 20
  11. spellDiff['teleport'] = 20
  12. !glamour
  13. spellMana['glamour'] = 500
  14. spellTime['glamour'] = 1
  15. spellWill['glamour'] = 15
  16. spellDiff['glamour'] = 30
  17. spellSuccess = 0
  18. if spellKnown[$ARGS[0]] = 1:
  19. !Make a Skill Check to see if the Spell succeeds
  20. spellRoll = pcs_splcstng - spellDiff[$ARGS[0]] - (pcs_horny/5) + rand(1,100)
  21. if spellRoll > 50:
  22. !Critical Success
  23. spellSuccess = 2
  24. splcstng_exp += rand(1,spellDiff[$ARGS[0]]) + rand(0,5)
  25. elseif spellRoll > 10:
  26. !Success
  27. spellSuccess = 1
  28. splcstng_exp += rand(1,spellDiff[$ARGS[0]])
  29. elseif spellRoll > -20:
  30. !Failure
  31. spellSuccess = 0
  32. splcstng_exp += rand(1,spellDiff[$ARGS[0]]) / 2
  33. else:
  34. !Critical Failure
  35. spellSuccess = -1
  36. splcstng_exp += rand(1,spellDiff[$ARGS[0]]) / 2
  37. end
  38. killvar 'spellRoll'
  39. !Incur the costs of casting the spell
  40. if spellSuccess = 2:
  41. manaCost = spellMana[$ARGS[0]] / 2
  42. elseif spellSuccess = -1:
  43. manaCost = spellMana[$ARGS[0]] * 2
  44. else:
  45. manaCost = spellMana[$ARGS[0]]
  46. end
  47. pcs_manna -= manaCost
  48. !pcs_willpwr -= spellWill[$ARGS[0]]
  49. arouseVal = manaCost / 50
  50. gs 'arousal', 'voyeur', arouseVal
  51. minut -= arouseVal
  52. killvar 'arouseVal'
  53. killvar 'manaCost'
  54. end
  55. minut += spellTime[$ARGS[0]]
  56. gs 'stat'
  57. result = spellSuccess
  58. --- castSpell ---------------------------------