Advertisement
Guest User

Untitled

a guest
Dec 15th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.08 KB | None | 0 0
  1. local PLUGIN = PLUGIN
  2. PLUGIN.name = "Combat"
  3. PLUGIN.author = "Chancer"
  4. PLUGIN.desc = "A combat system based off of stats and rolling. Inspired by CWPNP."
  5.  
  6. local CHATCOLOR_MELEE = Color(155, 130, 130)
  7. local CHATCOLOR_RANGED = Color(130, 130, 150)
  8. local CHATCOLOR_REACT = Color(130, 150, 130)
  9. local CHATCOLOR_RESIST = Color(160, 150, 130)
  10.  
  11. bParts = {}
  12. bParts[1] = "Skull"
  13. bParts[2] = "Head Glance"
  14. bParts[3] = "Left Eye"
  15. bParts[4] = "Nose"
  16. bParts[5] = "Mouth"
  17. bParts[6] = "Neck Flesh"
  18. bParts[7] = "Neck"
  19. bParts[8] = "Larynx"
  20. bParts[9] = "Neck Spine"
  21. bParts[10] = "Base of Neck"
  22. bParts[11] = "Left Shoulder"
  23. bParts[12] = "Right Shoulder"
  24. bParts[13] = "Left Shoulder Socket"
  25. bParts[14] = "Right Shoulder Socket"
  26. bParts[15] = "Left Shoulder Glance"
  27. bParts[16] = "Right Shoulder Glance"
  28. bParts[17] = "Left Upper Arm Bone"
  29. bParts[18] = "Right Upper Arm Bone"
  30. bParts[19] = "Left Upper Arm Flesh"
  31. bParts[20] = "Right Upper Arm Flesh"
  32. bParts[21] = "Left Arm Glance"
  33. bParts[22] = "Right Arm Glance"
  34. bParts[23] = "Left Elbow"
  35. bParts[24] = "Right Elbow"
  36. bParts[25] = "Left Forearm Flesh"
  37. bParts[26] = "Right Forearm Flesh"
  38. bParts[27] = "Left Forearm Bone"
  39. bParts[28] = "Right Forearm Bone"
  40. bParts[29] = "Left Hand"
  41. bParts[30] = "Right Hand"
  42. bParts[31] = "Left Scapula"
  43. bParts[32] = "Right Scapula"
  44. bParts[33] = "Heart"
  45. bParts[34] = "Left Lung"
  46. bParts[35] = "Right Lung"
  47. bParts[36] = "Upper Chest Spine"
  48. bParts[37] = "Lower Chest Spine"
  49. bParts[38] = "Abdomen Spine"
  50. bParts[39] = "Left Upper Chest Rib"
  51. bParts[40] = "Right Upper Chest Rib"
  52. bParts[41] = "Left Lower Chest Rib"
  53. bParts[42] = "Right Lower Chest Rib"
  54. bParts[43] = "Liver"
  55. bParts[44] = "Kidney"
  56. bParts[45] = "Stomach"
  57. bParts[46] = "Spleen"
  58. bParts[47] = "Large Intestine"
  59. bParts[48] = "Small Intestine"
  60. bParts[49] = "Left Pelvis"
  61. bParts[50] = "Center Pelvis"
  62. bParts[51] = "Right Pelvis"
  63. bParts[52] = "Torso Glance"
  64. bParts[53] = "Left Hip"
  65. bParts[54] = "Right Hip"
  66. bParts[55] = "Left Hip Socket"
  67. bParts[56] = "Right Hip Socket"
  68. bParts[57] = "Left Upper Leg Flesh"
  69. bParts[58] = "Right Upper Leg Flesh"
  70. bParts[59] = "Left Upper Leg Femur"
  71. bParts[60] = "Right Upper Leg Femur"
  72. bParts[61] = "Left Leg Glance"
  73. bParts[62] = "Right Leg Glance"
  74. bParts[63] = "Left Knee"
  75. bParts[64] = "Right Knee"
  76. bParts[65] = "Left Shin Flesh"
  77. bParts[66] = "Right Shin Flesh"
  78. bParts[67] = "Left Tibia"
  79. bParts[68] = "Right Tibia"
  80. bParts[69] = "Left Ankle"
  81. bParts[70] = "Right Ankle"
  82. bParts[71] = "Left Foot"
  83. bParts[72] = "Right Foot"
  84. bParts[73] = "Right Eye"
  85. bParts[74] = "Groin"
  86. bParts[75] = "Left Ear"
  87. bParts[76] = "Right Ear"
  88. bParts[77] = "Weapon"
  89.  
  90. nut.chat.register("reflexes", {
  91. format = "%s has rolled %s for reflexes.",
  92. color = CHATCOLOR_REACT,
  93. filter = "actions",
  94. font = "nutChatFontItalics",
  95. onCanHear = nut.config.get("chatRange", 280) * 2,
  96. deadCanChat = true
  97. })
  98.  
  99. nut.chat.register("flee", {
  100. format = "%s has rolled %s for a flee attempt.",
  101. color = CHATCOLOR_REACT,
  102. filter = "actions",
  103. font = "nutChatFontItalics",
  104. onCanHear = nut.config.get("chatRange", 280) * 2,
  105. deadCanChat = true
  106. })
  107.  
  108. nut.chat.register("dodge", {
  109. format = "%s has rolled %s for a dodge or miss.",
  110. color = CHATCOLOR_REACT,
  111. filter = "actions",
  112. font = "nutChatFontItalics",
  113. onCanHear = nut.config.get("chatRange", 280) * 2,
  114. deadCanChat = true
  115. })
  116.  
  117. nut.chat.register("block", {
  118. format = "%s has rolled %s for a block.",
  119. color = CHATCOLOR_REACT,
  120. filter = "actions",
  121. font = "nutChatFontItalics",
  122. onCanHear = nut.config.get("chatRange", 280) * 2,
  123. deadCanChat = true
  124. })
  125.  
  126. nut.chat.register("defend", {
  127. format = "%s has rolled %s for a defend.",
  128. color = CHATCOLOR_REACT,
  129. filter = "actions",
  130. font = "nutChatFontItalics",
  131. onCanHear = nut.config.get("chatRange", 280) * 2,
  132. deadCanChat = true
  133. })
  134.  
  135. nut.chat.register("firearms", {
  136. format = "%s has rolled %s for a shot.",
  137. color = CHATCOLOR_RANGED,
  138. filter = "actions",
  139. font = "nutChatFontItalics",
  140. onCanHear = nut.config.get("chatRange", 280) * 2,
  141. deadCanChat = true
  142. })
  143.  
  144. nut.chat.register("firearmsaimed", {
  145. format = "%s has rolled %s for an aimed shot.",
  146. color = CHATCOLOR_RANGED,
  147. filter = "actions",
  148. font = "nutChatFontItalics",
  149. onCanHear = nut.config.get("chatRange", 280) * 2,
  150. deadCanChat = true
  151. })
  152.  
  153. nut.chat.register("throw", {
  154. format = "%s has rolled %s for a throw.",
  155. color = CHATCOLOR_RANGED,
  156. filter = "actions",
  157. font = "nutChatFontItalics",
  158. onCanHear = nut.config.get("chatRange", 280) * 2,
  159. deadCanChat = true
  160. })
  161.  
  162. nut.chat.register("akimbo", {
  163. format = "%s has rolled %s for an akimbo shot.",
  164. color = CHATCOLOR_RANGED,
  165. filter = "actions",
  166. font = "nutChatFontItalics",
  167. onCanHear = nut.config.get("chatRange", 280) * 2,
  168. deadCanChat = true
  169. })
  170.  
  171. nut.chat.register("firearmsburst", {
  172. format = "%s has rolled %s for a burst fire shot.",
  173. color = CHATCOLOR_RANGED,
  174. filter = "actions",
  175. font = "nutChatFontItalics",
  176. onCanHear = nut.config.get("chatRange", 280) * 2,
  177. deadCanChat = true
  178. })
  179.  
  180. nut.chat.register("firearmsburstaimed", {
  181. format = "%s has rolled %s for an aimed burst fire shot.",
  182. color = CHATCOLOR_RANGED,
  183. filter = "actions",
  184. font = "nutChatFontItalics",
  185. onCanHear = nut.config.get("chatRange", 280) * 2,
  186. deadCanChat = true
  187. })
  188.  
  189. nut.chat.register("part", {
  190. format = "%s's projectile flies at the target's %s.",
  191. color = CHATCOLOR_RANGED,
  192. filter = "actions",
  193. font = "nutChatFontItalics",
  194. onCanHear = nut.config.get("chatRange", 280) * 2,
  195. deadCanChat = true
  196. })
  197.  
  198. nut.chat.register("partb", {
  199. format = "%s's burst shot flies at the target's %s.",
  200. color = CHATCOLOR_RANGED,
  201. filter = "actions",
  202. font = "nutChatFontItalics",
  203. onCanHear = nut.config.get("chatRange", 280) * 2,
  204. deadCanChat = true
  205. })
  206.  
  207. nut.chat.register("melee", {
  208. format = "%s has rolled %s for a melee attack.",
  209. color = CHATCOLOR_MELEE,
  210. filter = "actions",
  211. font = "nutChatFontItalics",
  212. onCanHear = nut.config.get("chatRange", 280) * 2,
  213. deadCanChat = true
  214. })
  215.  
  216. nut.chat.register("flail", {
  217. format = "%s has rolled %s for a flailing melee attack.",
  218. color = CHATCOLOR_MELEE,
  219. filter = "actions",
  220. font = "nutChatFontItalics",
  221. onCanHear = nut.config.get("chatRange", 280) * 2,
  222. deadCanChat = true
  223. })
  224.  
  225. nut.chat.register("parry", {
  226. format = "%s has rolled %s for a parry.",
  227. color = CHATCOLOR_REACT,
  228. filter = "actions",
  229. font = "nutChatFontItalics",
  230. onCanHear = nut.config.get("chatRange", 280) * 2,
  231. deadCanChat = true
  232. })
  233.  
  234. nut.chat.register("suppress", {
  235. format = "%s has rolled %s for suppressing fire.",
  236. color = CHATCOLOR_RANGED,
  237. filter = "actions",
  238. font = "nutChatFontItalics",
  239. onCanHear = nut.config.get("chatRange", 280) * 2,
  240. deadCanChat = true
  241. })
  242.  
  243. nut.chat.register("grapple", {
  244. format = "%s has rolled %s for a grapple.",
  245. color = CHATCOLOR_MELEE,
  246. filter = "actions",
  247. font = "nutChatFontItalics",
  248. onCanHear = nut.config.get("chatRange", 280) * 2,
  249. deadCanChat = true
  250. })
  251.  
  252. nut.chat.register("sneak", {
  253. format = "%s has rolled %s for sneaking.",
  254. color = CHATCOLOR_REACT,
  255. filter = "actions",
  256. font = "nutChatFontItalics",
  257. onCanHear = nut.config.get("chatRange", 280) * 2,
  258. deadCanChat = true
  259. })
  260.  
  261. nut.chat.register("perception", {
  262. format = "%s has rolled %s for perception.",
  263. color = CHATCOLOR_REACT,
  264. filter = "actions",
  265. font = "nutChatFontItalics",
  266. onCanHear = nut.config.get("chatRange", 280) * 2,
  267. deadCanChat = true
  268. })
  269.  
  270. nut.chat.register("scavenge", {
  271. format = "%s has rolled %s for scavenging.",
  272. color = CHATCOLOR_REACT,
  273. filter = "actions",
  274. font = "nutChatFontItalics",
  275. onCanHear = nut.config.get("chatRange", 280) * 2,
  276. deadCanChat = true
  277. })
  278.  
  279. nut.chat.register("fortitude", {
  280. format = "%s has rolled %s for fortitude.",
  281. color = CHATCOLOR_RESIST,
  282. filter = "actions",
  283. font = "nutChatFontItalics",
  284. onCanHear = nut.config.get("chatRange", 280) * 2,
  285. deadCanChat = true
  286. })
  287.  
  288. nut.chat.register("endure", {
  289. format = "%s has rolled %s for enduring.",
  290. color = CHATCOLOR_RESIST,
  291. filter = "actions",
  292. font = "nutChatFontItalics",
  293. onCanHear = nut.config.get("chatRange", 280) * 2,
  294. deadCanChat = true
  295. })
  296.  
  297. nut.chat.register("will", {
  298. format = "%s has rolled %s for willpower.",
  299. color = CHATCOLOR_RESIST,
  300. filter = "actions",
  301. font = "nutChatFontItalics",
  302. onCanHear = nut.config.get("chatRange", 280) * 2,
  303. deadCanChat = true
  304. })
  305.  
  306. nut.command.add("reflexes", {
  307. onRun = function(client, arguments)
  308. local char = client:getChar()
  309. local crit = math.random(1, 1000)
  310. local critmsg = ""
  311. if (crit <= (char:getAttrib("luck") + 10)) then
  312. crit = (1.5 + char:getAttrib("luck")/25)
  313. critmsg = " (Crit!)"
  314. else
  315. crit = 1
  316. end
  317. local rolled = (math.random(0, 20) * (char:getAttrib("stm")/100) + math.random(0, 10)) * crit
  318. nut.log.add(client:Name().." rolled \""..rolled.."\"")
  319. nut.chat.send(client, "reflexes", rolled .. critmsg)
  320. end
  321. })
  322.  
  323. nut.command.add("flee", {
  324. onRun = function(client, arguments)
  325. local char = client:getChar()
  326. local crit = math.random(1, 1000)
  327. local critmsg = ""
  328. if (crit <= (char:getAttrib("luck") + 10)) then
  329. crit = (1.5 + char:getAttrib("luck")/25)
  330. critmsg = " (Crit!)"
  331. else
  332. crit = 1
  333. end
  334. local rolled = (math.random(0, 20) * (char:getAttrib("stm")/100) + math.random(0, 10)) * crit
  335. nut.log.add(client:Name().." rolled \""..rolled.."\"")
  336. nut.chat.send(client, "flee", rolled .. critmsg)
  337. end
  338. })
  339.  
  340. nut.command.add("dodge", {
  341. onRun = function(client, arguments)
  342. local char = client:getChar()
  343. local crit = math.random(1, 1000)
  344. local critmsg = ""
  345. if (crit <= (char:getAttrib("luck") + 10)) then
  346. crit = (1.5 + char:getAttrib("luck")/25)
  347. critmsg = " (Crit!)"
  348. else
  349. crit = 1
  350. end
  351. local rolled = (math.random(0, 20) * (char:getAttrib("stm") * 0.014) + math.random(0, 9)) * crit
  352. nut.log.add(client:Name().." rolled \""..rolled.."\"")
  353. nut.chat.send(client, "dodge", rolled .. critmsg)
  354. end
  355. })
  356.  
  357. nut.command.add("block", {
  358. onRun = function(client, arguments)
  359. local char = client:getChar()
  360. local crit = math.random(1, 1000)
  361. local critmsg = ""
  362. if (crit <= (char:getAttrib("luck") + 10)) then
  363. crit = (1.5 + char:getAttrib("luck")/25)
  364. critmsg = " (Crit!)"
  365. else
  366. crit = 1
  367. end
  368. local rolled = (math.random(0, 20) * ((char:getAttrib("str") * 0.010) + (char:getAttrib("accuracy") * 0.005)) + math.random(0, 9)) * crit
  369. nut.log.add(client:Name().." rolled \""..rolled.."\"")
  370. nut.chat.send(client, "block", rolled .. critmsg)
  371. end
  372. })
  373.  
  374. nut.command.add("defend", {
  375. onRun = function(client, arguments)
  376. local char = client:getChar()
  377. local crit = math.random(1, 1000)
  378. local critmsg = ""
  379. if (crit <= (char:getAttrib("luck") + 10)) then
  380. crit = (1.5 + char:getAttrib("luck")/25)
  381. critmsg = " (Crit!)"
  382. else
  383. crit = 1
  384. end
  385. local rolled = (math.random(0, 20) * ((char:getAttrib("str") * 0.005) + (char:getAttrib("accuracy") * 0.005) + (char:getAttrib("stm") * 0.004)) + math.random(0, 9)) * crit
  386. nut.log.add(client:Name().." rolled \""..rolled.."\"")
  387. nut.chat.send(client, "defend", rolled .. critmsg)
  388. end
  389. })
  390.  
  391. nut.command.add("firearms", {
  392. onRun = function(client, arguments)
  393. local char = client:getChar()
  394. local crit = math.random(1, 1000)
  395. local critmsg = ""
  396. if (crit <= (char:getAttrib("luck") + 10)) then
  397. crit = (1.5 + char:getAttrib("luck")/25)
  398. critmsg = " (Crit!)"
  399. else
  400. crit = 1
  401. end
  402. local rolled = (math.random(0, 20) * ((char:getAttrib("accuracy") * 0.018) + (char:getAttrib("str") * 0.002)) + math.random(0, 10)) * crit
  403. local part = bParts[math.random(1, 77)]
  404.  
  405. nut.log.add(client:Name().." rolled \""..rolled.. " " .. part .. "\"")
  406. nut.chat.send(client, "firearms", rolled .. critmsg)
  407. nut.chat.send(client, "part", part)
  408. end
  409. })
  410.  
  411. nut.command.add("quickdraw", {
  412. onRun = function(client, arguments)
  413. local char = client:getChar()
  414. local crit = math.random(1, 1000)
  415. local critmsg = ""
  416. if (crit <= (char:getAttrib("luck") + 10)) then
  417. crit = (1.5 + char:getAttrib("luck")/25)
  418. critmsg = " (Crit!)"
  419. else
  420. crit = 1
  421. end
  422. local rolled = (math.random(0, 20) * ((char:getAttrib("accuracy") * 0.009) + (char:getAttrib("stm") * 0.009)) + math.random(0, 10)) * crit * (.3) --30% penalty
  423. local part = bParts[math.random(1, 77)]
  424.  
  425. nut.log.add(client:Name().." rolled \""..rolled.. " " .. part .. "\"")
  426. nut.chat.send(client, "firearms", rolled .. critmsg)
  427. nut.chat.send(client, "part", part)
  428. end
  429. })
  430.  
  431. nut.command.add("firearmsaimed", {
  432. onRun = function(client, arguments)
  433. local char = client:getChar()
  434. local crit = math.random(1, 1000)
  435. local critmsg = ""
  436. if (crit <= (char:getAttrib("luck") + 10)) then
  437. crit = (1.5 + char:getAttrib("luck")/25)
  438. critmsg = " (Crit!)"
  439. else
  440. crit = 1
  441. end
  442. local rolled = ((math.random(0, 20) * ((char:getAttrib("accuracy") * 0.019) + (char:getAttrib("str") * 0.001)) + math.random(0, 10)) + 2) * crit
  443.  
  444. nut.log.add(client:Name().." rolled \""..rolled.."\"")
  445. nut.chat.send(client, "firearmsaimed", rolled .. critmsg)
  446. end
  447. })
  448.  
  449. nut.command.add("throw", {
  450. onRun = function(client, arguments)
  451. local char = client:getChar()
  452. local crit = math.random(1, 1000)
  453. local critmsg = ""
  454. if (crit <= (char:getAttrib("luck") + 10)) then
  455. crit = (1.5 + char:getAttrib("luck")/25)
  456. critmsg = " (Crit!)"
  457. else
  458. crit = 1
  459. end
  460. local rolled = (math.random(0, 20) * ((char:getAttrib("accuracy") * 0.01) + (char:getAttrib("str") * 0.01)) + math.random(0, 10)) * crit
  461. local part = bParts[math.random(1, 77)]
  462.  
  463. nut.log.add(client:Name().." rolled \""..rolled.. " " .. part .. "\"")
  464. nut.chat.send(client, "throw", rolled .. critmsg)
  465. nut.chat.send(client, "part", part)
  466. end
  467. })
  468.  
  469. nut.command.add("akimbo", {
  470. onRun = function(client, arguments)
  471. local char = client:getChar()
  472. local crit = math.random(1, 1000)
  473. local critmsg = ""
  474. if (crit <= (char:getAttrib("luck") + 10)) then
  475. crit = (1.5 + char:getAttrib("luck")/25)
  476. critmsg = " (Crit!)"
  477. else
  478. crit = 1
  479. end
  480. local rolled = (math.random(0, 16) * ((char:getAttrib("accuracy") * 0.009) + (char:getAttrib("str") * 0.009)) + math.random(0, 8)) * crit
  481. local part = bParts[math.random(1, 77)]
  482.  
  483. nut.log.add(client:Name().." rolled \""..rolled.. " " .. part .. "\"")
  484. nut.chat.send(client, "akimbo", rolled .. critmsg)
  485. nut.chat.send(client, "part", part)
  486.  
  487. rolled = (math.random(0, 20) * ((char:getAttrib("accuracy") * 0.009) + (char:getAttrib("str") * 0.004)) + math.random(0, 10)) * crit * (.4) --40% penalty
  488. part = bParts[math.random(1, 77)]
  489.  
  490. nut.log.add(client:Name().." rolled \""..rolled.. " " .. part .. "\"")
  491. nut.chat.send(client, "akimbo", rolled .. critmsg)
  492. nut.chat.send(client, "part", part)
  493. end
  494. })
  495.  
  496. nut.command.add("firearmsburst", {
  497. onRun = function(client, arguments)
  498. local char = client:getChar()
  499. local crit = math.random(1, 1000)
  500. local critmsg = ""
  501. if (crit <= (char:getAttrib("luck") + 10)) then
  502. crit = (1.5 + char:getAttrib("luck")/25)
  503. critmsg = " (Crit!)"
  504. else
  505. crit = 1
  506. end
  507. local rolled = (math.random(0, 20) * (char:getAttrib("accuracy") * 0.016) + math.random(0, 8)) * crit
  508. local part = bParts[math.random(1, 77)]
  509. nut.log.add(client:Name().." rolled \""..rolled.. " " .. part .. "\"")
  510. nut.chat.send(client, "firearmsburst", rolled .. critmsg)
  511. nut.chat.send(client, "partb", part)
  512.  
  513. rolled = rolled * (0.6 + ((char:getAttrib("str") * 4) / 1000))
  514. part = bParts[math.random(1, 77)]
  515. nut.log.add(client:Name().." rolled \""..rolled.. " " .. part .. "\"")
  516. nut.chat.send(client, "firearmsburst", rolled)
  517. nut.chat.send(client, "partb", part)
  518.  
  519. rolled = rolled * (0.4 + ((char:getAttrib("str") * 6) / 1000))
  520. part = bParts[math.random(1, 77)]
  521. nut.log.add(client:Name().." rolled \""..rolled.. " " .. part .. "\"")
  522. nut.chat.send(client, "firearmsburst", rolled)
  523. nut.chat.send(client, "partb", part)
  524. end
  525. })
  526.  
  527. nut.command.add("firearmsburstaimed", {
  528. onRun = function(client, arguments)
  529. local char = client:getChar()
  530. local crit = math.random(1, 1000)
  531. local critmsg = ""
  532. if (crit <= (char:getAttrib("luck") + 10)) then
  533. crit = (1.5 + char:getAttrib("luck")/25)
  534. critmsg = " (Crit!)"
  535. else
  536. crit = 1
  537. end
  538. local rolled = (math.random(0, 20) * (char:getAttrib("accuracy") * 0.016) + math.random(0, 8)) * crit
  539. nut.log.add(client:Name().." rolled \""..rolled.."\"")
  540. nut.chat.send(client, "firearmsburst", rolled .. critmsg)
  541.  
  542. rolled = rolled * (0.6 + ((char:getAttrib("str") * 4) / 1000))
  543. nut.log.add(client:Name().." rolled \""..rolled.."\"")
  544. nut.chat.send(client, "firearmsburst", rolled)
  545.  
  546. rolled = rolled * (0.4 + ((char:getAttrib("str") * 6) / 1000))
  547. nut.log.add(client:Name().." rolled \""..rolled.."\"")
  548. nut.chat.send(client, "firearmsburst", rolled)
  549. end
  550. })
  551.  
  552. nut.command.add("melee", {
  553. onRun = function(client, arguments)
  554. local char = client:getChar()
  555. local crit = math.random(1, 1000)
  556. local critmsg = ""
  557. if (crit <= (char:getAttrib("luck") + 10)) then
  558. crit = (1.5 + char:getAttrib("luck")/25)
  559. critmsg = " (Crit!)"
  560. else
  561. crit = 1
  562. end
  563. local rolled = (math.random(0, 20) * ((char:getAttrib("str") * 0.014) + (char:getAttrib("accuracy") * 0.006)) + math.random(0, 10)) * crit
  564. nut.log.add(client:Name().." rolled \""..rolled.."\"")
  565. nut.chat.send(client, "melee", rolled .. critmsg)
  566. end
  567. })
  568.  
  569. nut.command.add("flail", {
  570. onRun = function(client, arguments)
  571. local char = client:getChar()
  572. local crit = math.random(1, 1000)
  573. local critmsg = ""
  574. if (crit <= (char:getAttrib("luck")*2 + 10)) then
  575. crit = (1.5 + char:getAttrib("luck")/10)
  576. critmsg = " (Crit!)"
  577. else
  578. crit = 1
  579. end
  580. local rolled = (math.random(0, 20) * ((char:getAttrib("str") * 0.014) + (math.random(0,char:getAttrib("luck")) * 0.003)) + math.random(0, 10)) * crit
  581. nut.log.add(client:Name().." rolled \""..rolled.."\"")
  582. nut.chat.send(client, "flail", rolled .. critmsg)
  583. end
  584. })
  585.  
  586. nut.command.add("parry", {
  587. onRun = function(client, arguments)
  588. local char = client:getChar()
  589. local crit = math.random(1, 1000)
  590. local critmsg = ""
  591. if (crit <= (char:getAttrib("luck") + 10)) then
  592. crit = (1.5 + char:getAttrib("luck")/25)
  593. critmsg = " (Crit!)"
  594. else
  595. crit = 1
  596. end
  597. local rolled = (math.random(0, 20) * ((char:getAttrib("str") * 0.005) + (char:getAttrib("accuracy") * 0.005) + (char:getAttrib("stm") * 0.005) + (char:getAttrib("perception") * 0.002)) + math.random(0, 8)) * crit
  598. nut.log.add(client:Name().." rolled \""..rolled.."\"")
  599. nut.chat.send(client, "parry", rolled .. critmsg)
  600. end
  601. })
  602.  
  603. nut.command.add("suppress", {
  604. onRun = function(client, arguments)
  605. local char = client:getChar()
  606. local crit = math.random(1, 1000)
  607. local critmsg = ""
  608. if (crit <= (char:getAttrib("luck") + 10)) then
  609. crit = (1.5 + char:getAttrib("luck")/25)
  610. critmsg = " (Crit!)"
  611. else
  612. crit = 1
  613. end
  614. local rolled = (math.random(0, 20) * ((char:getAttrib("str") * 0.016) + (char:getAttrib("accuracy") * 0.005)) + math.random(0, 10)) * crit
  615. nut.log.add(client:Name().." rolled \""..rolled.."\"")
  616. nut.chat.send(client, "suppress", rolled .. critmsg)
  617. end
  618. })
  619.  
  620. nut.command.add("grapple", {
  621. onRun = function(client, arguments)
  622. local char = client:getChar()
  623. local crit = math.random(1, 1000)
  624. local critmsg = ""
  625. if (crit <= (char:getAttrib("luck") + 10)) then
  626. crit = (1.5 + char:getAttrib("luck")/25)
  627. critmsg = " (Crit!)"
  628. else
  629. crit = 1
  630. end
  631. local rolled = (math.random(0, 20) * ((char:getAttrib("str") * 0.018) + (char:getAttrib("accuracy") * 0.002)) + math.random(0, 10)) * crit
  632. nut.log.add(client:Name().." rolled \""..rolled.."\"")
  633. nut.chat.send(client, "grapple", rolled .. critmsg)
  634. end
  635. })
  636.  
  637. --should integrate fear meter here
  638. nut.command.add("sneak", {
  639. onRun = function(client, arguments)
  640. local char = client:getChar()
  641. local crit = math.random(1, 1000)
  642. local critmsg = ""
  643. if (crit <= (char:getAttrib("luck") + 10)) then
  644. crit = (1.5 + char:getAttrib("luck")/25)
  645. critmsg = " (Crit!)"
  646. else
  647. crit = 1
  648. end
  649. local rolled = (math.random(0, 20) * (char:getAttrib("stm")* 0.02) + math.random(0, 10)) * crit
  650. nut.log.add(client:Name().." rolled \""..rolled.."\"")
  651. nut.chat.send(client, "sneak", rolled .. critmsg)
  652. end
  653. })
  654.  
  655. --This is used for detecting sneaking targets, or for finding secrets
  656. nut.command.add("perception", {
  657. onRun = function(client, arguments)
  658. local char = client:getChar()
  659. local crit = math.random(1, 1000)
  660. local critmsg = ""
  661. if (crit <= (char:getAttrib("luck") + 10)) then
  662. crit = (1.5 + char:getAttrib("luck")/25)
  663. critmsg = " (Crit!)"
  664. else
  665. crit = 1
  666. end
  667. local rolled = (math.random(0, 20) * (char:getAttrib("perception") * 0.02) + math.random(0, 10)) * crit
  668. nut.log.add(client:Name().." rolled \""..rolled.."\"")
  669. nut.chat.send(client, "perception", rolled .. critmsg)
  670. end
  671. })
  672.  
  673. nut.command.add("scavenge", {
  674. onRun = function(client, arguments)
  675. local char = client:getChar()
  676. local luckroll = math.random(0, char:getAttrib("luck"))
  677. local rolled = math.random(luckroll, 100)
  678. nut.log.add(client:Name().." rolled \""..rolled.."\"")
  679. nut.chat.send(client, "scavenge", rolled)
  680. end
  681. })
  682. --for resisting mental attacks (hallucinations, panic, etc)
  683. nut.command.add("fortitude", {
  684. onRun = function(client, arguments)
  685. local char = client:getChar()
  686. local rolled = (math.random(0, 20) * (char:getAttrib("fortitude") * 0.017) + (char:getAttrib("end") * 0.003) + math.random(0, 10))
  687. nut.log.add(client:Name().." rolled \""..rolled.."\"")
  688. nut.chat.send(client, "fortitude", rolled)
  689. end
  690. })
  691. --for resisting physical things (drugs, sound attacks, knockouts, etc)
  692. nut.command.add("endure", {
  693. onRun = function(client, arguments)
  694. local char = client:getChar()
  695. local rolled = (math.random(0, 20) * (char:getAttrib("end") * 0.017) + (char:getAttrib("fortitude") * 0.003) + math.random(0, 10))
  696. nut.log.add(client:Name().." rolled \""..rolled.."\"")
  697. nut.chat.send(client, "endure", rolled)
  698. end
  699. })
  700.  
  701. --for controlling forged (drifter created) aberrations and tamed abominations
  702. nut.command.add("will", {
  703. onRun = function(client, arguments)
  704. local char = client:getChar()
  705. local rolled = (math.random(0, 20) * (char:getAttrib("end") * 0.01) + (char:getAttrib("fortitude") * 0.01) + math.random(0, 10))
  706. nut.log.add(client:Name().." rolled \""..rolled.."\"")
  707. nut.chat.send(client, "will", rolled)
  708. end
  709. })
  710.  
  711. --stat print
  712. nut.command.add("chargetattrib", {
  713. adminOnly = true,
  714. syntax = "<string name> <string type>",
  715. onRun = function(client, arguments)
  716. local target = nut.command.findPlayer(client, arguments[1])
  717. if(IsValid(target) and target:getChar()) then
  718. local findAtt = arguments[2]
  719. local attribName
  720. for k, v in pairs(nut.attribs.list) do
  721. if (nut.util.stringMatches(L(v.name, client), findAtt) or nut.util.stringMatches(k, findAtt)) then
  722. attribName = k
  723. end
  724. end
  725. if(attribName) then
  726. local value = target:getChar():getAttrib(attribName)
  727.  
  728. client:notifyLocalized(target:Name() .." ".. findAtt .. ": " .. value)
  729. else
  730. client:notifyLocalized("Invalid Attribute")
  731. end
  732. end
  733. end
  734. })
  735.  
  736. --stat print
  737. nut.command.add("train", {
  738. syntax = "<string attribute>",
  739. onRun = function(client, arguments)
  740. local char = client:getChar()
  741. local findAtt = arguments[1]
  742. local attribName
  743. for k, v in pairs(nut.attribs.list) do
  744. if (nut.util.stringMatches(L(v.name, client), findAtt) or nut.util.stringMatches(k, findAtt)) then
  745. attribName = k
  746. end
  747. end
  748.  
  749. if(attribName) then
  750. local lastTrain = char:getData("lastTrain")
  751.  
  752. if(!lastTrain) then
  753. char:setData("lastTrain", 0)
  754. lastTrain = 0
  755. end
  756.  
  757. if(lastTrain and math.abs(tonumber(lastTrain) - tonumber(os.date("%d"))) >= 2) then -- train once every 2 days.
  758. local value = char:getAttrib(attribName)
  759. char:updateAttrib(attribName, 1)
  760. char:setData("lastTrain", os.date("%d"))
  761.  
  762. client:notifyLocalized("You have increased your " .. findAtt .. ".")
  763. else
  764. client:notifyLocalized("You can only train once every 2 days.")
  765. end
  766. else
  767. client:notifyLocalized("Invalid Attribute")
  768. end
  769. end
  770. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement