Advertisement
Rhopy2

Resistance Roll Calculator

Apr 26th, 2018
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. \ https://pastebin.com/14fyEGYx \
  2. \ Resistance Roll Calculator. Use with http://topps.diku.dk/torbenm/troll.msp \
  3.  
  4. attackerSL:= 10
  5. \ Put the attacker's effective SL here. Default is 10. \
  6. ;
  7. defenderSL:= 10
  8. \ Put the defender's target number here. Default is 10. \
  9. ;
  10. usesRuleOfNumber:= 1
  11. \ If it's a supernatural attack that uses the Rule of 16 (or some other number, entered below), then leave as 1 here (default). Otherwise, change to 0. \
  12. ;
  13. ruleOf:= 16
  14. \ Enter 16 for Rule of 16, which is the default. Replace with the appropriate number if you're using a different Rule. \
  15. ;
  16. attackerCritWins:= 1
  17. \ Leave as 1 if the attacker automatically wins the contest on a critical success. Change to 0 if this is not the case.
  18. ;
  19.  
  20. \---End of user input! The rest below is the code.---\
  21.  
  22. skillX:= if {usesRuleOfNumber =/= 1} then attackerSL else
  23. if {defenderSL > ruleOf} then attackerSL else min{ruleOf,attackerSL};
  24. skillY:= defenderSL;
  25. rollX:= sum{1d6+1d6+1d6};
  26. rollY:= sum{1d6+1d6+1d6};
  27. resultX:= sum{skillX-rollX};
  28. resultY:= sum{skillY-rollY};
  29.  
  30. critThresholdX:=
  31. {
  32. if {skillX >= 16}
  33. then 6
  34. else
  35. if {skillX = 15}
  36. then 5
  37. else 4
  38. };
  39.  
  40. critYes:=
  41. {
  42. if rollX <= critThresholdX
  43. then 1
  44. else 0
  45. };
  46.  
  47.  
  48. \---End of setting variables. Below determines the output.---\
  49.  
  50. if {attackerCritWins = 1} then
  51. if {critYes = 1} then "WIN" else
  52. if {resultX < 0} then "LOSE" else
  53. if {resultX <= resultY} then "LOSE" else "WIN"
  54. else
  55. if {resultX < 0} then "LOSE" else
  56. if {resultX <= resultY} then "LOSE" else "WIN"
  57.  
  58. \ Last updated: 2018-04-27
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement