castSpell.qsrc 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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 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. pcs_manna -= manaCost
  53. !pcs_willpwr -= spellWill[$SpellID]
  54. arouseVal = manaCost / 50
  55. gs 'arousal', 'voyeur', arouseVal
  56. minut -= arouseVal
  57. killvar 'arouseVal'
  58. killvar 'manaCost'
  59. end
  60. minut += spellTime[$SpellID]
  61. gs 'stat'
  62. $SpellExec = "gs 'spell', '<<$SpellID>>', '<<spellSuccess>>'<<$SpellArgs>>"
  63. dynamic $SpellExec
  64. killvar '$SpellID'
  65. killvar '$SpellArgs'
  66. killvar '$SpellExec'
  67. --- castSpell ---------------------------------