1
0

castSpell.qsrc 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. # castSpell
  2. ! Used to cast a spell.
  3. !
  4. ! ARGS[0] is the spell being cast
  5. ! Valid Spells are listed below
  6. ! teleport
  7. ! ARGS[1-n] are any parameters that need to be passed to the Spell
  8. !
  9. ! Example:
  10. ! gs 'castSpell', 'teleport', 'CentralPark'
  11. gs 'spellList'
  12. spellSuccess = 0
  13. $SpellID = $ARGS[0]
  14. $SpellArgs = ""
  15. i=1
  16. :ArgLoop
  17. if i < arrsize('$ARGS'):
  18. i += 1
  19. $SpellArgs = $SpellArgs + ", '<<$ARGS[i - 1]>>'"
  20. jump 'ArgLoop'
  21. end
  22. killvar 'i'
  23. if spellKnown[$SpellID] = 1:
  24. !Make a Skill Check to see if the Spell succeeds
  25. spellRoll = pcs_splcstng - spellDiff[$SpellID] - (pcs_horny/5) + rand(1,100)
  26. if spellRoll > 50:
  27. !Critical Success
  28. spellSuccess = 2
  29. splcstng_exp += rand(1,spellDiff[$SpellID]) + rand(0,5)
  30. elseif spellRoll > 10:
  31. !Success
  32. spellSuccess = 1
  33. splcstng_exp += rand(1,spellDiff[$SpellID])
  34. elseif spellRoll > -20:
  35. !Failure
  36. spellSuccess = 0
  37. splcstng_exp += rand(1,spellDiff[$SpellID]) / 2
  38. else
  39. !Critical Failure
  40. spellSuccess = -1
  41. splcstng_exp += rand(1,spellDiff[$SpellID]) / 2
  42. end
  43. killvar 'spellRoll'
  44. !Incur the costs of casting the spell
  45. if spellSuccess = 2:
  46. manaCost = spellMana[$SpellID] / 2
  47. elseif spellSuccess = -1:
  48. manaCost = spellMana[$SpellID] * 2
  49. else
  50. manaCost = spellMana[$SpellID]
  51. end
  52. if pcs_mana >= manaCost:
  53. pcs_mana -= manaCost
  54. !pcs_willpwr -= spellWill[$SpellID]
  55. arouseVal = manaCost / 50
  56. gs 'arousal', 'voyeur', arouseVal
  57. minut -= arouseVal
  58. killvar 'arouseVal'
  59. killvar 'manaCost'
  60. minut += spellTime[$SpellID]
  61. gs 'stat'
  62. $SpellExec = "gs 'spell', '<<$SpellID>>', '<<spellSuccess>>'<<$SpellArgs>>"
  63. dynamic $SpellExec
  64. else
  65. *pl "You realize you don''t have enough mana for this spell."
  66. end
  67. end
  68. killvar '$SpellID'
  69. killvar '$SpellArgs'
  70. killvar '$SpellExec'
  71. killvar 'spellSuccess'
  72. killvar 'arouseVal'
  73. killvar 'manaCost'
  74. --- castSpell ---------------------------------