Guest User

battle

a guest
Nov 25th, 2013
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.64 KB | None | 0 0
  1. --Mob: Buckley
  2. local BuckleyName = Buckley
  3. local BuckleyH = 40000
  4. local BuckleyA = 500
  5. local BuckleyS1Dam = math.random(1,20) * 350
  6. local BuckleyS1Atri = Steel
  7. local BuckleyS1Area = false
  8. local BuckleyS1Name = SilverRiver
  9. local BuckleyS2Dam = 3000
  10. local BuckleyS2Atri = Steel
  11. local BuckleyS2Area = false
  12. local BuckleyS2Name = ShiningSilver
  13.  
  14. local BuckleyAttribute = Steel
  15.  
  16.  
  17. --Mob: Angeling
  18. local AngelingName = Angeling
  19. local AngelingH = 8000
  20. local AngelingA = 200
  21. local AngelingS1Dam = 450
  22. local AngelingS1Atri = Light
  23. local AngelingS1Area = false
  24. local AngelingS1Name = LexAeterna
  25.  
  26. local AngelingS2Dam = 600
  27. local AngelingS2Atri = Light
  28. local AngelingS2Area = true
  29. local AngelingS2Name = KyrieEleison
  30.  
  31. local AngelingS3Dam = 300
  32. local AngelingS3Atri = Normal
  33. local AngelingS3Area = false
  34. local AngelingS3Name = Tackle
  35.  
  36. local AngelingAttribute = Light
  37.  
  38.   --Main Collection--
  39. function clear()
  40. term.clear()
  41. term.setCursorPos(1,1)
  42. end
  43.  
  44.  clear()
  45.  
  46. --First Player Info
  47. function Head()
  48. print ("RPG A.I v1.0:")
  49. print ()
  50. end
  51.  
  52.  
  53. function FirstCollect()
  54. Head()
  55. print ("First player name: ")
  56. local first = read()
  57. print ("Total Health: ")
  58. local firstHP = read()
  59. print ("Total Mana: ")
  60. local firstMP = read()
  61. print ("Attack Base: ")
  62. local firstATK = read()
  63. print ("Intelligence: ")
  64. local firstINT = read()
  65. print ("Luck: ")
  66. local firstLuck = read()
  67. sleep(1)
  68. clear()
  69. end
  70.  
  71.  
  72. --Second Player Info
  73. function SecondCollect()
  74. Head()
  75. print ("Second player name: ")
  76. local second = read()
  77. print ("Total Health: ")
  78. local secondHP = read()
  79. print ("Total Mana: ")
  80. local secondMP = read()
  81. print ("Attack Base: ")
  82. local secondATK = read()
  83. print ("Intelligence: ")
  84. local secondINT = read()
  85. print ("Luck: ")
  86. local secondLuck = read()
  87. sleep(1)
  88. clear()
  89. end
  90.  
  91.  
  92. --Third Player Info
  93. function ThirdCollect()
  94. Head()
  95. print ("Third player name: ")
  96. local third = read()
  97. print ("Total Health: ")
  98. local thirdHP = read()
  99. print ("Total Mana: ")
  100. local thirdMP = read()
  101. print ("Attack Base: ")
  102. local thirdATK = read()
  103. print ("Intelligence: ")
  104. local thirdINT = read()
  105. print ("Luck: ")
  106. local thirdLuck = read()
  107. sleep(1)
  108. clear()
  109. end
  110.  
  111.  
  112.  
  113. function PrintThirdInfo()
  114. print (third.." Info:")
  115. print ()
  116. print ("HP: "..thirdHP)
  117. print ("MP: "..thirdMP)
  118. print ("ATK: "..thirdATK)
  119. print ("INT: "..thirdINT)
  120. print ("Luck: "..thirdLuck)
  121. print ()
  122. sleep(1)
  123. print ("Everything correct?")
  124. local thirdCorrect = read()
  125. if thirdCorrect == "Yes" then
  126. print ("Done.")
  127. sleep(2)
  128. clear()
  129. elseif thirdCorrect == "No" then
  130. print ("Correct what you need.")
  131. ThirdCollect()
  132. end
  133. end
  134.  
  135.  
  136.  
  137. function PrintSecondInfo()
  138. print (second.." Info:")
  139. print ()
  140. print ("HP: "..secondHP)
  141. print ("MP: "..secondMP)
  142. print ("ATK: "..secondATK)
  143. print ("INT: "..secondINT)
  144. print ("Luck: "..secondLuck)
  145. print ()
  146. sleep(1)
  147. print ("Everything correct?")
  148. local secondCorrect = read()
  149. if secondCorrect == "Yes" then
  150. print ("Ok, next")
  151. sleep(2)
  152. clear()
  153. elseif secondCorrect == "No" then
  154. print ("Correct what you need.")
  155. SecondCollect()
  156. end
  157. end
  158.  
  159.  
  160.  
  161.  
  162. function PrintFirstInfo()
  163. print (first.." Info:")
  164. print ()
  165. print ("HP: "..firstHP)
  166. print ("MP: "..firstMP)
  167. print ("ATK: "..firstATK)
  168. print ("INT: "..firstINT)
  169. print ("Luck: "..firstLuck)
  170. print ()
  171. sleep(1)
  172. print ("Everything correct?")
  173. local firstCorrect = read()
  174. if firstCorrect == "Yes" then
  175. print ("Ok, next")
  176. sleep(2)
  177. clear()
  178. elseif firstCorrect == "No" then
  179. print ("Correct what you need.")
  180. FirstCollect()
  181. end
  182. end
  183.  
  184. FirstCollect()
  185. SecondCollect()
  186. ThirdCollect()
  187. PrintFirstInfo()
  188. PrintSecondInfo()
  189. PrintThirdInfo()
  190.  
  191. print ("Info collected!")
  192. sleep(1)
  193.  
  194. --PlayersName
  195. local players = {first, second, third}
  196.  
  197. --Clear Screen
  198. function clear()
  199. term.clear()
  200. term.setCursorPos(1,1)
  201. end
  202.  
  203. --Ask for Mob
  204.  
  205. clear()
  206. write ("Monster: ")
  207. local mob = read()
  208.  
  209.  
  210. --Dices and Mult
  211. local d20 = math.random(1,20)
  212. local d20p10 = d20/10
  213. local d10 = math.random(1,10)
  214. local crit = 2
  215.  
  216. --Battle Function (Buckley)
  217. function StartBattleBuckley()
  218. print ("Battle engage!")
  219. print ()
  220. print ("Buckley HP: "..BuckleyH.." HP")
  221. print ("Buckley ATK: "..BuckleyA.." ATK")
  222. print ()
  223. end
  224.  
  225. --Function First Player Attack!
  226.  
  227. function FirstAttack()
  228. print ("Attacker: "..first)
  229. print()
  230. print ("Dice (20): "..d20)
  231. if d10>= 5 then
  232. print ("Dice (10): "..d10)
  233. print ("Critical Hit!")
  234. print ()
  235. print ("Final attack: "..d20p10 * firstATK * crit)
  236. else
  237. print ("Dice (10): "..d10)
  238. print ()
  239. print ("Final attack: "..d20p10 * firstATK)
  240. print ()
  241. end
  242. end
  243.  
  244. --Function Second Player Attack
  245.  
  246. function SecondAttack()
  247. print ("Attacker: "..second)
  248. print ()
  249. print ("Dice (20): "..d20)
  250. if d10>= 5 then
  251. print ("Dice (10): "..d10)
  252. print ("Critical Hit!")
  253. print ()
  254. print ("Final attack: "..d20p10 * secondATK * crit)
  255. else
  256. print ("Dice (10) "..d10)
  257. print ()
  258. print ("Final attack: "..d20p10 * secondATK * crit)
  259. print ()
  260. end
  261. end
  262.  
  263.  
  264. --Function Ask (Attack or Skill)
  265.  
  266. function aos()
  267. print (first.." turn!")
  268. print ("Attack or Skill?")
  269. local aos = read()
  270. if aos == "Attack" then
  271. FirstAttack()
  272. elseif aos == "Skill" then
  273. print ("Skill feature not ready!")
  274. else
  275. print ("Please, give a correct command!")
  276. sleep(1.5)
  277. clear()
  278. aos2()
  279. end
  280. end
  281.  
  282. function aos2()
  283. print (first.." turn!")
  284. print ("Attack or Skill?")
  285. local aos = read()
  286. if aos == "Attack" then
  287. FirstAttack()
  288. elseif aos == "Skill" then
  289. print ("Skill feature not ready!")
  290. else
  291. print ("Please, give a correct command!")
  292. sleep(1.5)
  293. clear()
  294. aos()
  295. end
  296. end
  297.  
  298.  
  299. if mob == "Buckley" then
  300. clear()
  301. StartBattleBuckley()
  302. aos()
  303. elseif mob == "Angeling" then
  304. clear()
  305. test2()
  306. else
  307. print ("Database does not contain that mob!")
  308. print ("Update it, doing 'edit battle'.")
  309. end
Advertisement
Add Comment
Please, Sign In to add comment