Advertisement
Guest User

Rubybotcode

a guest
Oct 29th, 2015
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.05 KB | None | 0 0
  1. #!/usr/bin/env ruby
  2. class Plasmahandgun
  3. attr_accessor :size
  4. attr_accessor :emitter
  5. attr_accessor :wattage
  6. attr_accessor :heat
  7. attr_accessor :range
  8. attr_accessor :upgradepoints
  9. attr_accessor :standardequipment
  10. @size = nil
  11. @emitter = nil
  12. @wattaage = nil
  13. @heat = 0
  14. @range = nil
  15. @upgradepoints = nil
  16. @standardequipment = nil
  17. def initialize
  18. @size = get_size
  19. @emitter = get_emitter
  20. @wattage = get_wattage
  21. @heat = get_heat
  22. @range = get_range
  23. @upgradepoints = get_upgradepoints
  24. @standardequipment = get_standardequipment
  25. end
  26. def inspect
  27. "I made a #{@size} sized plasma handgun that has a #{@emitter} emmitter(s), in the #{@wattage} range with a #{@heat} heat rating. It has a #{@range} range increment. It has upgrade points on the #{@upgradepoints}. The plasarm arrives #{@standardequipment}"
  28.  
  29. end
  30.  
  31. private
  32.  
  33. def get_wattage
  34. if @size == "Tiny"
  35. x = rand(1..100)
  36. if x.between?(1,35)
  37. "10 kW(1d8-2)"
  38. elsif x.between?(36,55)
  39. "15 kW(1d8)"
  40. elsif x.between?(56,70)
  41. "25 kW(1d8+1)"
  42. @heat = @heat - 3
  43. elsif x.between?(71,95)
  44. "35 kW(2d8)"
  45. @heat = @heat - 6
  46. else
  47. "40 kW(2d8+1)"
  48. @heat = @heat - 9
  49. end
  50. elsif @size == "Small"
  51. x = rand(1..100)
  52. if x.between?(1,35)
  53. "10 kW(1d8-2)"
  54. elsif x.between?(36,50)
  55. "15 kW(1d8)"
  56. elsif x.between?(51,75)
  57. "25 kW(1d8+1)"
  58. @heat = @heat - 2
  59. elsif x.between?(76,95)
  60. "35 kW(2d8)"
  61. @heat = @heat - 4
  62. else
  63. "40 kW(2d8+1)"
  64. @heat = @heat - 8
  65. end
  66. else
  67. x = rand(1..100)
  68. if x.between?(1,35)
  69. "10 kW(1d8-2)"
  70. elsif x.between?(36,50)
  71. "15 kW(1d8)"
  72. elsif x.between?(51,75)
  73. "25 kW(1d8+1)"
  74. @heat = @heat - 1
  75. elsif x.between?(76,95)
  76. "35 kW(2d8)"
  77. @heat = @heat - 3
  78. else
  79. "40 kW(2d8+1)"
  80. @heat = @heat - 5
  81. end
  82. end
  83. end
  84.  
  85. def get_emitter
  86. if @size == "Tiny"
  87. x = rand(1..100)
  88. if x.between?(1,45)
  89. "Standard"
  90. elsif x.between?(46,75)
  91. "Standard/Stun"
  92. elsif x.between?(76,95)
  93. "Standard/Charge"
  94. else
  95. "Standard/Stun/Charge"
  96. end
  97. else
  98. x = rand(1..100)
  99. if x.between?(1,20)
  100. "Standard"
  101. elsif x.between?(21,29)
  102. "Standard/Charge"
  103. elsif x.between?(30,38)
  104. "Standard/Stun"
  105. elsif x.between?(39,47)
  106. "Standard/Pulse"
  107. elsif x.between?(48,56)
  108. "Standard/Bounce"
  109. elsif x.between?(56,65)
  110. "Standard/Bounce/Stun"
  111. elsif x.between?(66,74)
  112. "Standard/Charge/Bounce"
  113. elsif x.between?(75,83)
  114. "Standard/Charge/Stun"
  115. elsif x.between?(84,92)
  116. "Standard/Pulse/Bounce"
  117. elsif x.between?(93,99)
  118. "Standard/Pulse/Stun"
  119. else
  120. "Standard/Charge/Pulse"
  121. end
  122. end
  123. end
  124. def get_heat
  125. if @size == "Tiny"
  126. x = rand(1..100)
  127. if x.between?(1,45)
  128. 10
  129. elsif x.between?(46,75)
  130. 12
  131. elsif x.between?(76,95)
  132. 14
  133. else
  134. 16
  135. end
  136. elsif @size == "Small"
  137. x = rand(1..100)
  138. if x.between?(1,30)
  139. 12
  140. elsif x.between?(31,50)
  141. 14
  142. elsif x.between?(51,70)
  143. 16
  144. elsif x.between?(71,90)
  145. 20
  146. else
  147. 25
  148. end
  149. else
  150. x = rand(1..100)
  151. if x.between?(1,30)
  152. 15
  153. elsif x.between?(31,50)
  154. 18
  155. elsif x.between?(51,70)
  156. 20
  157. elsif x.between?(71,90)
  158. 25
  159. else
  160. 30
  161. end
  162. end
  163.  
  164. end
  165.  
  166. def get_size
  167.  
  168. x = rand(1..100)
  169. if x.between?(1,25)
  170. "Tiny"
  171. elsif x.between?(26,75)
  172. "Small"
  173. else
  174. "Medium"
  175. end
  176.  
  177.  
  178. end
  179. def get_range
  180. if @size == "Tiny"
  181. x = rand(1..100)
  182. if x.between?(1,5)
  183. "10 Feet"
  184. elsif x.between?(6,15)
  185. "15 Feet"
  186. elsif x.between?(16,30)
  187. "20 Feet"
  188. elsif x.between?(31,70)
  189. "25 Feet"
  190. elsif x.between?(71,85)
  191. "30 Feet"
  192. elsif x.between?(86,95)
  193. "35 Feet"
  194. else
  195. "40 Feet"
  196. end
  197. elsif @size == "Small"
  198. x = rand(1..100)
  199. if x.between?(1,5)
  200. "15 Feet"
  201. elsif x.between?(6,15)
  202. "20 Feet"
  203. elsif x.between?(16,30)
  204. "25 Feet"
  205. elsif x.between?(31,70)
  206. "30 Feet"
  207. elsif x.between?(71,85)
  208. "35 Feet"
  209. elsif x.between?(86,95)
  210. "40 Feet"
  211. else
  212. "45 Feet"
  213. end
  214. else
  215. x = rand(1..100)
  216. if x.between?(1,5)
  217. "20 Feet"
  218. elsif x.between?(6,15)
  219. "25 Feet"
  220. elsif x.between?(16,30)
  221. "30 Feet"
  222. elsif x.between?(31,70)
  223. "35 Feet"
  224. elsif x.between?(71,85)
  225. "40 Feet"
  226. elsif x.between?(86,95)
  227. "45 Feet"
  228. else
  229. "50 Feet"
  230. end
  231.  
  232. end
  233. end
  234.  
  235.  
  236. def get_upgradepoints
  237. x = rand(1..100)
  238. if x.between?(1,30)
  239. "Frame and Emitter"
  240. elsif x.between?(31,60)
  241. "Frame, Emitter and 1 Tactical"
  242. elsif x.between?(61,70)
  243. "Frame, Emitter and Optics"
  244. elsif x.between?(71,75)
  245. "Frame, Emitter, Optics and 1 Tactical"
  246. elsif x.between?(76,85)
  247. "Frame, Emitter, Optics and 2 Tactical"
  248. elsif x.between?(86,95)
  249. "Frame, Emitter, Optics and 3 Tactical"
  250. else
  251. "Frame, Emitter, Optics and 4 Tactical"
  252. end
  253.  
  254. end
  255. def get_standardequipment
  256. x = rand(1..100)
  257. if x.between?(1,20)
  258. "with Nothing."
  259. elsif x.between?(21,40)
  260. "with 1 Standard Coolant Pack."
  261. elsif x.between?(41,60)
  262. "with 2 Standard Coolant Packs."
  263. elsif x.between?(61,80)
  264. "with 3 Standard Coolant Packs."
  265. else
  266. "with 4 Standard Coolant Packs."
  267. end
  268.  
  269. end
  270.  
  271. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement