1
0

castSpell.qsrc 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. if $ARGS[i] = '':
  19. $SpellArgs += ", <<ARGS[i]>>"
  20. else
  21. $SpellArgs += ", '<<$ARGS[i]>>'"
  22. end
  23. i += 1
  24. jump 'ArgLoop'
  25. end
  26. killvar 'i'
  27. if spellKnown[$SpellID] = 1:
  28. !Make a Skill Check to see if the Spell succeeds
  29. spellRoll = pcs_splcstng - spellDiff[$SpellID] - (pcs_horny/5) + rand(1,100)
  30. if spellRoll > 50:
  31. !Critical Success
  32. spellSuccess = 2
  33. splcstng_exp += rand(1,spellDiff[$SpellID]) + rand(0,5)
  34. elseif spellRoll > 10:
  35. !Success
  36. spellSuccess = 1
  37. splcstng_exp += rand(1,spellDiff[$SpellID])
  38. elseif spellRoll > -20:
  39. !Failure
  40. spellSuccess = 0
  41. splcstng_exp += rand(1,spellDiff[$SpellID]) / 2
  42. else
  43. !Critical Failure
  44. spellSuccess = -1
  45. splcstng_exp += rand(1,spellDiff[$SpellID]) / 2
  46. end
  47. killvar 'spellRoll'
  48. !Incur the costs of casting the spell
  49. if spellSuccess = 2:
  50. manaCost = spellMana[$SpellID] / 2
  51. elseif spellSuccess = -1:
  52. manaCost = spellMana[$SpellID] * 2
  53. else
  54. manaCost = spellMana[$SpellID]
  55. end
  56. if pcs_mana >= manaCost:
  57. pcs_mana -= manaCost
  58. !pcs_willpwr -= spellWill[$SpellID]
  59. arouseVal = manaCost / 50
  60. gs 'arousal', 'voyeur', arouseVal
  61. minut -= arouseVal
  62. killvar 'arouseVal'
  63. killvar 'manaCost'
  64. minut += spellTime[$SpellID]
  65. gs 'stat'
  66. $SpellExec = "gs 'spell', '<<$SpellID>>', '<<spellSuccess>>'<<$SpellArgs>>"
  67. dynamic $SpellExec
  68. else
  69. *pl "You realize you don''t have enough mana for this spell."
  70. end
  71. end
  72. killvar '$SpellID'
  73. killvar '$SpellArgs'
  74. killvar '$SpellExec'
  75. killvar 'spellSuccess'
  76. killvar 'arouseVal'
  77. killvar 'manaCost'
  78. --- castSpell ---------------------------------