castSpell.tw 2.6 KB

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