Advertisement
ravneravn

pixelmon moves

Nov 25th, 2013
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 53.68 KB | None | 0 0
  1.  
  2.  
  3. term.setTextColor(colors.black)
  4. term.setBackgroundColor(colors.white)
  5. term.clear()
  6. local w, h = term.getSize()
  7. local cursor = 1
  8. player1Select = {}
  9. player2Select = {}
  10. selectedMove = "none"
  11. randomNum = "none"
  12.  
  13.  
  14.  
  15.  
  16.  
  17. local function debugging2()
  18. shell.run("clear")
  19. for k, v in pairs(moves["Meditation"]["effect"]) do
  20. print(v)
  21. end
  22. os.pullEvent("key")
  23. shell.run("clear")
  24. end
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35. --###################### MOVES ####################################
  36.  
  37. moves = {
  38. -- ############## NORMAL ###############
  39. Tackle = {
  40. name = "Tackle",
  41. type = "Normal",
  42. doesDamage = true,
  43. attackForm = "phys",
  44. target = "opponent",
  45. power = 1,
  46. effect = {"none"},
  47. effectValue = 0,
  48. accuracy = 100,
  49. pp = 15
  50. },
  51.  
  52. Growl = {
  53. name = "Growl",
  54. type = "Normal",
  55. doesDamage = false,
  56. attackForm = "phys",
  57. target = "opponent",
  58. power = 0,
  59. effect = {"none", "debuffDefense"},
  60. effectValue = 10,
  61. accuracy = 100,
  62. pp = 15
  63. },
  64.  
  65. Scratch = {
  66. name = "Scratch",
  67. type = "Normal",
  68. doesDamage = true,
  69. attackForm = "phys",
  70. target = "opponent",
  71. power = 1,
  72. effect = {"none"},
  73. effectValue = 0,
  74. accuracy = 100,
  75. pp = 15
  76. },
  77.  
  78.  
  79. Harden = {
  80. name = "Harden",
  81. type = "Normal",
  82. doesDamage = false,
  83. attackForm = "phys",
  84. target = "self",
  85. power = 0,
  86. effect = {"none", "buffDefense"},
  87. effectValue = 10,
  88. accuracy = 100,
  89. pp = 15
  90. },
  91.  
  92.  
  93. Smoke = {
  94. name = "Smoke",
  95. type = "Normal",
  96. doesDamage = false,
  97. attackForm = "phys",
  98. target = "opponent",
  99. power = 0,
  100. effect = {"none", "debuffAccuracy"},
  101. effectValue = 10,
  102. accuracy = 100,
  103. pp = 5
  104. },
  105.  
  106. BodySlam = {
  107. name = "Bodyslam",
  108. type = "Normal",
  109. doesDamage = true,
  110. attackForm = "phys",
  111. target = "opponent",
  112. power = 2,
  113. effect = {"none"},
  114. effectValue = 0,
  115. accuracy = 100,
  116. pp = 10
  117. },
  118.  
  119. Stomp = {
  120. name = "Stomp",
  121. type = "Normal",
  122. doesDamage = true,
  123. attackForm = "phys",
  124. target = "opponent",
  125. power = 3,
  126. effect = {"none"},
  127. effectValue = 0,
  128. accuracy = 100,
  129. pp = 10
  130. },
  131.  
  132. Screech = {
  133. name = "Screech",
  134. type = "Normal",
  135. doesDamage = false,
  136. attackForm = "phys",
  137. target = "opponent",
  138. power = 0,
  139. effect = {"none", "debuffAttack"},
  140. effectValue = 10,
  141. accuracy = 100,
  142. pp = 10
  143. },
  144.  
  145. Heal = {
  146. name = "Heal",
  147. type = "Normal",
  148. doesDamage = false,
  149. attackForm = "phys",
  150. target = "self",
  151. power = 0,
  152. effect = {"none", "heal"},
  153. effectValue = 5,
  154. accuracy = 100,
  155. pp = 10
  156. },
  157.  
  158. Restore = {
  159. name = "Restore",
  160. type = "Normal",
  161. doesDamage = false,
  162. attackForm = "phys",
  163. target = "self",
  164. power = 0,
  165. effect = {"none", "heal"},
  166. effectValue = 10,
  167. accuracy = 100,
  168. pp = 5
  169. },
  170.  
  171. Selfdestruct = {
  172. name = "Selfdestruct",
  173. type = "Normal",
  174. doesDamage = true,
  175. attackForm = "spec",
  176. target = "opponent",
  177. power = 7,
  178. effect = {"none", "selfdestruct"},
  179. effectValue = 0,
  180. accuracy = 100,
  181. pp = 5
  182. },
  183.  
  184. Snore = {
  185. name = "Snore",
  186. type = "Normal",
  187. doesDamage = false,
  188. attackForm = "phys",
  189. target = "self",
  190. power = 0,
  191. effect = {"none", "heal", "sleepSelf"},
  192. effectValue = 1000,
  193. accuracy = 100,
  194. pp = 5
  195. },
  196.  
  197.  
  198.  
  199. -- ############## Grass ###############
  200. VineWhip = {
  201. name = "VineWhip",
  202. type = "Grass",
  203. doesDamage = true,
  204. attackForm = "phys",
  205. target = "opponent",
  206. power = 2,
  207. effect = {"none"},
  208. effectValue = 0,
  209. accuracy = 100,
  210. pp = 10
  211. },
  212.  
  213. Sundance = {
  214. name = "Sundance",
  215. type = "Grass",
  216. doesDamage = false,
  217. attackForm = "phys",
  218. target = "self",
  219. power = 0,
  220. effect = {"none", "buffAttack", "buffSpecAttack"},
  221. effectValue = 10,
  222. accuracy = 100,
  223. pp = 10
  224. },
  225.  
  226. RazorLeafs = {
  227. name = "Razorleafs",
  228. type = "Grass",
  229. doesDamage = true,
  230. attackForm = "spec",
  231. target = "opponent",
  232. power = 4,
  233. effect = {"none"},
  234. effectValue = 0,
  235. accuracy = 100,
  236. pp = 10
  237. },
  238.  
  239. LeafBlade = {
  240. name = "LeafBlade",
  241. type = "Grass",
  242. doesDamage = true,
  243. attackForm = "phys",
  244. target = "opponent",
  245. power = 2,
  246. effect = {"none", "crit"},
  247. effectValue = 10,
  248. accuracy = 100,
  249. pp = 10
  250. },
  251.  
  252. MagicalLeafs = {
  253. name = "MagicalLeafs",
  254. type = "Grass",
  255. doesDamage = true,
  256. attackForm = "spec",
  257. target = "self",
  258. power = 3,
  259. effect = {"none"},
  260. effectValue = 0,
  261. accuracy = 100,
  262. pp = 10
  263. },
  264.  
  265.  
  266. -- ############## Bug ###############
  267. HornCharge = {
  268. name = "HornCharge",
  269. type = "Bug",
  270. doesDamage = true,
  271. attackForm = "phys",
  272. target = "opponent",
  273. power = 3,
  274. effect = {"none"},
  275. effectValue = 0,
  276. accuracy = 100,
  277. pp = 10
  278. },
  279.  
  280. BugBite = {
  281. name = "BugBite",
  282. type = "Bug",
  283. doesDamage = true,
  284. attackForm = "phys",
  285. target = "opponent",
  286. power = 2,
  287. effect = {"none", "debuffSpeed"},
  288. effectValue = 5,
  289. accuracy = 100,
  290. pp = 10
  291. },
  292.  
  293. DefendOrder = {
  294. name = "DefendOrder",
  295. type = "Bug",
  296. doesDamage = false,
  297. attackForm = "phys",
  298. target = "self",
  299. power = 0,
  300. effect = {"none", "buffDefense", "buffSpecDefense"},
  301. effectValue = 10,
  302. accuracy = 100,
  303. pp = 10
  304. },
  305.  
  306. AttackOrder = {
  307. name = "AttackOrder",
  308. type = "Bug",
  309. doesDamage = false,
  310. attackForm = "phys",
  311. target = "self",
  312. power = 0,
  313. effect = {"none", "buffAttack", "buffSpecAttack"},
  314. effectValue = 10,
  315. accuracy = 100,
  316. pp = 10
  317. },
  318.  
  319. Net = {
  320. name = "Net",
  321. type = "Bug",
  322. doesDamage = false,
  323. attackForm = "phys",
  324. target = "opponent",
  325. power = 0,
  326. effect = {"none", "debuffSpeed"},
  327. effectValue = 20,
  328. accuracy = 100,
  329. pp = 10
  330. },
  331.  
  332.  
  333. -- ############## Poison ###############
  334. Poison = {
  335. name = "Poison",
  336. type = "Poison",
  337. doesDamage = true,
  338. attackForm = "phys",
  339. target = "opponent",
  340. power = 1,
  341. effect = {"none", "poison"},
  342. effectValue = 100,
  343. accuracy = 100,
  344. pp = 10
  345. },
  346.  
  347. SleepSpore = {
  348. name = "SleepSpore",
  349. type = "Poison",
  350. doesDamage = false,
  351. attackForm = "phys",
  352. target = "opponent",
  353. power = 0,
  354. effect = {"none", "sleep"},
  355. effectValue = 0,
  356. accuracy = 85,
  357. pp = 10
  358. },
  359.  
  360. PoisonJab = {
  361. name = "PoisonJab",
  362. type = "Poison",
  363. doesDamage = true,
  364. attackForm = "phys",
  365. target = "opponent",
  366. power = 2,
  367. effect = {"none", "poison"},
  368. effectValue = 0,
  369. accuracy = 65,
  370. pp = 10
  371. },
  372.  
  373. -- ############## Rock ###############
  374. RockThrow = {
  375. name = "RockThrow",
  376. type = "Rock",
  377. doesDamage = true,
  378. attackForm = "phys",
  379. target = "opponent",
  380. power = 2,
  381. effect = {"none"},
  382. effectValue = 0,
  383. accuracy = 95,
  384. pp = 10
  385. },
  386.  
  387. StoneEdge = {
  388. name = "StoneEdge",
  389. type = "Rock",
  390. doesDamage = true,
  391. attackForm = "phys",
  392. target = "opponent",
  393. power = 3,
  394. effect = {"none", "crit"},
  395. effectValue = 10,
  396. accuracy = 95,
  397. pp = 10
  398. },
  399.  
  400. Reinforce = {
  401. name = "Reinforce",
  402. type = "Rock",
  403. doesDamage = false,
  404. attackForm = "phys",
  405. target = "self",
  406. power = 0,
  407. effect = {"none", "buffDefense", "buffSpecDefense"},
  408. effectValue = 10,
  409. accuracy = 100,
  410. pp = 10
  411. },
  412.  
  413. RockPolish = {
  414. name = "RockPolish",
  415. type = "Rock",
  416. doesDamage = false,
  417. attackForm = "phys",
  418. target = "self",
  419. power = 0,
  420. effect = {"none", "buffSpeed"},
  421. effectValue = 15,
  422. accuracy = 100,
  423. pp = 10
  424. },
  425.  
  426. -- ############## Ground ###############
  427. DirtSpikes = {
  428. name = "DirtSpikes",
  429. type = "Ground",
  430. doesDamage = true,
  431. attackForm = "phys",
  432. target = "opponent",
  433. power = 2,
  434. effect = {"none"},
  435. effectValue = 0,
  436. accuracy = 100,
  437. pp = 10
  438. },
  439.  
  440. Earthquake = {
  441. name = "Earthquake",
  442. type = "Ground",
  443. doesDamage = true,
  444. attackForm = "spec",
  445. target = "opponent",
  446. power = 4,
  447. effect = {"none"},
  448. effectValue = 0,
  449. accuracy = 100,
  450. pp = 5
  451. },
  452.  
  453.  
  454. MudSquirt = {
  455. name = "MudSquirt",
  456. type = "Ground",
  457. doesDamage = true,
  458. attackForm = "spec",
  459. target = "opponent",
  460. power = 1,
  461. effect = {"none", "debuffAccuracy"},
  462. effectValue = 5,
  463. accuracy = 100,
  464. pp = 20
  465. },
  466.  
  467.  
  468. -- ############## Dark ###############
  469. Bite = {
  470. name = "Bite",
  471. type = "Dark",
  472. doesDamage = true,
  473. attackForm = "phys",
  474. target = "opponent",
  475. power = 3,
  476. effect = {"none", "flinch"},
  477. effectValue = 50,
  478. accuracy = 100,
  479. pp = 10
  480. },
  481.  
  482. NightSlash = {
  483. name = "NightSlash",
  484. type = "Dark",
  485. doesDamage = true,
  486. attackForm = "spec",
  487. target = "opponent",
  488. power = 2,
  489. effect = {"none", "crit"},
  490. effectValue = 15,
  491. accuracy = 100,
  492. pp = 10
  493. },
  494.  
  495. DarkPulse = {
  496. name = "DarkPulse",
  497. type = "Dark",
  498. doesDamage = true,
  499. attackForm = "spec",
  500. target = "opponent",
  501. power = 2,
  502. effect = {"none", "flinch"},
  503. effectValue = 40,
  504. accuracy = 100,
  505. pp = 10
  506. },
  507.  
  508. NastyPlot = {
  509. name = "NastyPlot",
  510. type = "Dark",
  511. doesDamage = false,
  512. attackForm = "spec",
  513. target = "self",
  514. power = 0,
  515. effect = {"none", "buffSpecAttack"},
  516. effectValue = 20,
  517. accuracy = 100,
  518. pp = 5
  519. },
  520.  
  521. -- ############## Ghost ###############
  522. OminousWind = {
  523. name = "OminousWind",
  524. type = "Ghost",
  525. doesDamage = false,
  526. attackForm = "spec",
  527. target = "self",
  528. power = 0,
  529. effect = {"none", "buffSpecAttack", "buffAttack", "buffDefense", "buffSpecDefense", "buffSpeed", "buffAccuracy"},
  530. effectValue = 5,
  531. accuracy = 100,
  532. pp = 5
  533. },
  534.  
  535. ShadowClaw = {
  536. name = "ShadowClaw",
  537. type = "Ghost",
  538. doesDamage = true,
  539. attackForm = "spec",
  540. target = "self",
  541. power = 2,
  542. effect = {"none", "crit"},
  543. effectValue = 5,
  544. accuracy = 100,
  545. pp = 10
  546. },
  547.  
  548. Curse = {
  549. name = "Curse",
  550. type = "Ghost",
  551. doesDamage = true,
  552. attackForm = "spec",
  553. target = "self",
  554. power = 3,
  555. effect = {"none", "curse"},
  556. effectValue = 5,
  557. accuracy = 100,
  558. pp = 5
  559. },
  560.  
  561. -- ############## Psychic ###############
  562. Psybeam = {
  563. name = "Psybeam",
  564. type = "Psychic",
  565. doesDamage = true,
  566. attackForm = "spec",
  567. target = "opponent",
  568. power = 2,
  569. effect = {"none", "confusion"},
  570. effectValue = 60,
  571. accuracy = 100,
  572. pp = 10
  573. },
  574.  
  575. Psychic = {
  576. name = "Psychic",
  577. type = "Psychic",
  578. doesDamage = true,
  579. attackForm = "spec",
  580. target = "opponent",
  581. power = 4,
  582. effect = {"none", "none"},
  583. effectValue = 0,
  584. accuracy = 100,
  585. pp = 10
  586. },
  587.  
  588. Confusion = {
  589. name = "Confusion",
  590. type = "Psychic",
  591. doesDamage = false,
  592. attackForm = "spec",
  593. target = "opponent",
  594. power = 0,
  595. effect = {"none", "confusion"},
  596. effectValue = 100,
  597. accuracy = 85,
  598. pp = 10
  599. },
  600.  
  601. Meditation = {
  602. name = "Meditation",
  603. type = "Psychic",
  604. doesDamage = false,
  605. attackForm = "spec",
  606. target = "self",
  607. power = 0,
  608. effect = {[1] = "none", [2] = "heal", [3] = "buffAccuracy", [4] = "buffSpecAttack"},
  609. effectValue = 5,
  610. accuracy = 100,
  611. pp = 10
  612. },
  613.  
  614. -- ############## Water ###############
  615. SquirtGun = {
  616. name = "SquirtGun",
  617. type = "Water",
  618. doesDamage = true,
  619. attackForm = "spec",
  620. target = "opponent",
  621. power = 2,
  622. effect = {"none"},
  623. effectValue = 0,
  624. accuracy = 100,
  625. pp = 15
  626. },
  627.  
  628. Surf = {
  629. name = "Surf",
  630. type = "Water",
  631. doesDamage = true,
  632. attackForm = "spec",
  633. target = "opponent",
  634. power = 4,
  635. effect = {"none"},
  636. effectValue = 0,
  637. accuracy = 100,
  638. pp = 10
  639. },
  640.  
  641. AquaJet = {
  642. name = "AquaJet",
  643. type = "Water",
  644. doesDamage = true,
  645. attackForm = "phys",
  646. target = "opponent",
  647. power = 3,
  648. effect = {"none"},
  649. effectValue = 0,
  650. accuracy = 100,
  651. pp = 10
  652. },
  653.  
  654. Raindance = {
  655. name = "Raindance",
  656. type = "Water",
  657. doesDamage = false,
  658. attackForm = "spec",
  659. target = "self",
  660. power = 0,
  661. effect = {"none", "buffSpecAttack"},
  662. effectValue = 15,
  663. accuracy = 100,
  664. pp = 10
  665. },
  666.  
  667.  
  668. -- ############## Fire ###############
  669. Flamethrower = {
  670. name = "Flamethrower",
  671. type = "Fire",
  672. doesDamage = true,
  673. attackForm = "spec",
  674. target = "opponent",
  675. power = 2,
  676. effect = {"none", "burn"},
  677. effectValue = 60,
  678. accuracy = 90,
  679. pp = 10
  680. },
  681.  
  682.  
  683. FireRing = {
  684. name = "FireRing",
  685. type = "Fire",
  686. doesDamage = true,
  687. attackForm = "spec",
  688. target = "opponent",
  689. power = 3,
  690. effect = {"none", "burn"},
  691. effectValue = 60,
  692. accuracy = 95,
  693. pp = 10
  694. },
  695.  
  696.  
  697. FireStorm = {
  698. name = "FireStorm",
  699. type = "Fire",
  700. doesDamage = true,
  701. attackForm = "phys",
  702. target = "opponent",
  703. power = 3,
  704. effect = {"none", "burn"},
  705. effectValue = 50,
  706. accuracy = 95,
  707. pp = 10
  708. },
  709.  
  710. Armageddon = {
  711. name = "Armageddon",
  712. type = "Fire",
  713. doesDamage = true,
  714. attackForm = "phys",
  715. target = "opponent",
  716. power = 8,
  717. effect = {"none"},
  718. effectValue = 0,
  719. accuracy = 50,
  720. pp = 5
  721. },
  722.  
  723. -- ############## Steel ###############
  724. Impenetrable = {
  725. name = "Impenetrable",
  726. type = "Steel",
  727. doesDamage = false,
  728. attackForm = "spec",
  729. target = "self",
  730. power = 0,
  731. effect = {"none", "buffDefense"},
  732. effectValue = 25,
  733. accuracy = 100,
  734. pp = 5
  735. },
  736.  
  737. FlashCannon = {
  738. name = "FlashCannon",
  739. type = "Steel",
  740. doesDamage = false,
  741. attackForm = "spec",
  742. target = "opponent",
  743. power = 0,
  744. effect = {"none", "debuffSpecDefense"},
  745. effectValue = 15,
  746. accuracy = 100,
  747. pp = 10
  748. },
  749.  
  750. SteelFist = {
  751. name = "SteelFist",
  752. type = "Steel",
  753. doesDamage = true,
  754. attackForm = "phys",
  755. target = "opponent",
  756. power = 3,
  757. effect = {"none"},
  758. effectValue = 0,
  759. accuracy = 85,
  760. },
  761.  
  762.  
  763. GyroBall = {
  764. name = "GyroBall",
  765. type = "Steel",
  766. doesDamage = true,
  767. attackForm = "spec",
  768. target = "opponent",
  769. power = 0, --(100 - player..playerTurn.speed) / 15,
  770. effect = {"none"},
  771. effectValue = 0,
  772. accuracy = 95,
  773. pp = 15
  774. },
  775.  
  776.  
  777.  
  778. -- ############## Electric ###############
  779. Shock = {
  780. name = "Shock",
  781. type = "Electric",
  782. doesDamage = true,
  783. attackForm = "spec",
  784. target = "opponent",
  785. power = 3,
  786. effect = {"none", "paralyze"},
  787. effectValue = 60,
  788. accuracy = 100,
  789. pp = 15
  790. },
  791.  
  792. ElectroShock = {
  793. name = "ElectroShock",
  794. type = "Electric",
  795. doesDamage = true,
  796. attackForm = "spec",
  797. target = "opponent",
  798. power = 4,
  799. effect = {"none", "paralyze"},
  800. effectValue = 50,
  801. accuracy = 100,
  802. pp = 5
  803. },
  804.  
  805. ChargeBeam = {
  806. name = "ChargeBeam",
  807. type = "Electric",
  808. doesDamage = false,
  809. attackForm = "spec",
  810. target = "self",
  811. power = 0,
  812. effect = {"none", "buffSpecAttack"},
  813. effectValue = 15,
  814. accuracy = 100,
  815. pp = 5
  816. },
  817.  
  818. Discharge = {
  819. name = "Discharge",
  820. type = "Electric",
  821. doesDamage = false,
  822. attackForm = "spec",
  823. target = "opponent",
  824. power = 0,
  825. effect = {"none", "paralyze"},
  826. effectValue = 100,
  827. accuracy = 100,
  828. pp = 5
  829. },
  830.  
  831. -- ############## Ice ###############
  832. IceFang = {
  833. name = "IceFang",
  834. type = "Ice",
  835. doesDamage = true,
  836. attackForm = "phys",
  837. target = "opponent",
  838. power = 3,
  839. effect = {"none", "freeze"},
  840. effectValue = 50,
  841. accuracy = 95,
  842. pp = 5
  843. },
  844.  
  845. Freeze = {
  846. name = "Freeze",
  847. type = "Ice",
  848. doesDamage = false,
  849. attackForm = "spec",
  850. target = "opponent",
  851. power = 0,
  852. effect = {"none", "freeze"},
  853. effectValue = 100,
  854. accuracy = 95,
  855. pp = 10
  856. },
  857.  
  858. Blizzard = {
  859. name = "Blizzard",
  860. type = "Ice",
  861. doesDamage = true,
  862. attackForm = "spec",
  863. target = "opponent",
  864. power = 2,
  865. effect = {"none", "freeze", "buffSpecAttack"},
  866. effectValue = 15,
  867. accuracy = 100,
  868. pp = 10
  869. },
  870.  
  871. -- ############## Fighting ###############
  872. CosmicPunch = {
  873. name = "CosmicPunch",
  874. type = "Fighting",
  875. doesDamage = true,
  876. attackForm = "phys",
  877. target = "opponent",
  878. power = 5,
  879. effect = {"none"},
  880. effectValue = 0,
  881. accuracy = 75,
  882. pp = 10
  883. },
  884.  
  885. SuckerPunch = {
  886. name = "SuckerPunch",
  887. type = "Fighting",
  888. doesDamage = true,
  889. attackForm = "phys",
  890. target = "self",
  891. power = 2,
  892. effect = {"none"},
  893. effectValue = 0,
  894. accuracy = 100,
  895. pp = 10
  896. },
  897.  
  898. RoundhouseKick = {
  899. name = "RoundhouseKick",
  900. type = "Fighting",
  901. doesDamage = true,
  902. attackForm = "phys",
  903. target = "opponent",
  904. power = 3,
  905. effect = {"none"},
  906. effectValue = 0,
  907. accuracy = 100,
  908. pp = 10
  909. },
  910.  
  911. Flex = {
  912. name = "Flex",
  913. type = "Fighting",
  914. doesDamage = false,
  915. attackForm = "phys",
  916. target = "self",
  917. power = 0,
  918. effect = {"none", "buffAttack"},
  919. effectValue = 15,
  920. accuracy = 100,
  921. pp = 10
  922. },
  923.  
  924. -- ############## Dragon ###############
  925. DracoMeteor = {
  926. name = "DracoMeteor",
  927. type = "Dragon",
  928. doesDamage = true,
  929. attackForm = "phys",
  930. target = "opponent",
  931. power = 3,
  932. effect = {"none", "debuffSpecDefense"},
  933. effectValue = 10,
  934. accuracy = 100,
  935. pp = 10
  936. },
  937.  
  938. SpacialRend = {
  939. name = "SpacialRend",
  940. type = "Dragon",
  941. doesDamage = true,
  942. attackForm = "phys",
  943. target = "opponent",
  944. power = 3,
  945. effect = {"none", "crit"},
  946. effectValue = 10,
  947. accuracy = 100,
  948. pp = 10
  949. },
  950.  
  951. DragonRage = {
  952. name = "DragonRage",
  953. type = "Dragon",
  954. doesDamage = true,
  955. attackForm = "spec",
  956. target = "opponent",
  957. power = 4,
  958. effect = {"none", "flinch"},
  959. effectValue = 40,
  960. accuracy = 100,
  961. pp = 10
  962. },
  963.  
  964. -- ############## Flying ###############
  965. Fly = {
  966. name = "Fly",
  967. type = "Flying",
  968. doesDamage = true,
  969. attackForm = "spec",
  970. target = "opponent",
  971. power = 3,
  972. effect = {"none"},
  973. effectValue = 0,
  974. accuracy = 100,
  975. pp = 10
  976. },
  977.  
  978. AirSlash = {
  979. name = "AirSlash",
  980. type = "Flying",
  981. doesDamage = true,
  982. attackForm = "spec",
  983. target = "self",
  984. power = 3,
  985. effect = {"none", "flinch"},
  986. effectValue = 40,
  987. accuracy = 100,
  988. pp = 10
  989. },
  990.  
  991. Peck = {
  992. name = "Peck",
  993. type = "Flying",
  994. doesDamage = true,
  995. attackForm = "phys",
  996. target = "opponent",
  997. power = 2,
  998. effect = {"none"},
  999. effectValue = 0,
  1000. accuracy = 100,
  1001. pp = 10
  1002. },
  1003.  
  1004. WingAttack = {
  1005. name = "WingAttack",
  1006. type = "Flying",
  1007. doesDamage = true,
  1008. attackForm = "phys",
  1009. target = "opponent",
  1010. power = 3,
  1011. effect = {"none"},
  1012. effectValue = 0,
  1013. accuracy = 100,
  1014. pp = 10
  1015. },
  1016.  
  1017. Hawkeye = {
  1018. name = "Hawkeye",
  1019. type = "Flying",
  1020. doesDamage = false,
  1021. attackForm = "spec",
  1022. target = "self",
  1023. power = 0,
  1024. effect = {"none", "buffAccuracy"},
  1025. effectValue = 20,
  1026. accuracy = 100,
  1027. pp = 10
  1028. },
  1029.  
  1030. Roost = {
  1031. name = "Roost",
  1032. type = "Flying",
  1033. doesDamage = false,
  1034. attackForm = "spec",
  1035. target = "self",
  1036. power = 0,
  1037. effect = {"none", "roost"},
  1038. effectValue = 0,
  1039. accuracy = 100,
  1040. pp = 10
  1041. }
  1042. }
  1043.  
  1044. local function writeFile()
  1045. handle = fs.open("moves", "w")
  1046. handle.write(textutils.serialize(moves))
  1047. handle.close()
  1048. end
  1049.  
  1050. writeFile()
  1051.  
  1052.  
  1053.  
  1054.  
  1055.  
  1056. --selectedMove = "OminousWind"
  1057. --print(moves[selectedMove]["effect"])
  1058. --for k, moveEffect in ipairs(moves[selectedMove]["effect"]) do
  1059. -- print("effect: "..moveEffect)
  1060. --end
  1061.  
  1062. --event = os.pullEvent("key")
  1063.  
  1064.  
  1065. -- #####################################################################################################
  1066.  
  1067.  
  1068.  
  1069.  
  1070.  
  1071.  
  1072.  
  1073.  
  1074.  
  1075.  
  1076.  
  1077.  
  1078.  
  1079.  
  1080. local function writeFile(file)
  1081. handle = fs.open(tostring(file), "w")
  1082. handle.write(textutils.serialize(file))
  1083. handle.close()
  1084. end
  1085.  
  1086.  
  1087.  
  1088.  
  1089.  
  1090.  
  1091. local function loadPokemon()
  1092. handle = fs.open("pokemon", "r")
  1093. loadedFile = textutils.unserialize(handle.readLine())
  1094. handle.close()
  1095. end
  1096.  
  1097.  
  1098.  
  1099.  
  1100.  
  1101.  
  1102. local function drawImage(image, x, y)
  1103. end
  1104.  
  1105.  
  1106.  
  1107.  
  1108.  
  1109. local function writeHP()
  1110. term.setCursorPos(1, h)
  1111. write(player1.name.." "..player1.currHp.." / "..player1.hpMax)
  1112. term.setCursorPos((w-15)/2, h)
  1113. write(player2.name.." "..player2.currHp.." / "..player2.hpMax)
  1114. end
  1115.  
  1116.  
  1117.  
  1118.  
  1119.  
  1120.  
  1121. local function selectMon1()
  1122. number = 0
  1123. for i = 1, #pokemon do
  1124. number = number +1
  1125. end
  1126. shell.run("clear")
  1127. print("player1 select a pokemon")
  1128. print("use arrows to select")
  1129. sleep(0.3)
  1130. shell.run("clear")
  1131. --debugging2()
  1132.  
  1133. local selection = 1
  1134. while true do
  1135. shell.run("clear")
  1136. print("selection: "..selection)
  1137. print("Name: "..pokemon[selection]["name"])
  1138. print("Level: "..pokemon[selection]["level"])
  1139. print("Type: "..pokemon[selection]["type1"].." / "..pokemon[selection]["type2"])
  1140. print("HP: "..pokemon[selection]["hpMax"])
  1141. print("Attack: "..pokemon[selection]["attack"])
  1142. print("Defense: "..pokemon[selection]["defense"])
  1143. print("Spec. Attack: "..pokemon[selection]["specAttack"])
  1144. print("Spec. Defense: "..pokemon[selection]["specDefense"])
  1145. print("Speed: "..pokemon[selection]["speed"])
  1146. print(" ")
  1147. print("Moves:")
  1148. print(pokemon[selection]["move1"].." | Power: "..moves[pokemon[selection]["move1"]]["power"].." | PP: "..moves[pokemon[selection]["move1"]]["pp"])
  1149. print(pokemon[selection]["move2"].." | Power: "..moves[pokemon[selection]["move2"]]["power"].." | PP: "..moves[pokemon[selection]["move2"]]["pp"])
  1150. print(pokemon[selection]["move3"].." | Power: "..moves[pokemon[selection]["move3"]]["power"].." | PP: "..moves[pokemon[selection]["move3"]]["pp"])
  1151. print(pokemon[selection]["move4"].." | Power: "..moves[pokemon[selection]["move4"]]["power"].." | PP: "..moves[pokemon[selection]["move4"]]["pp"])
  1152. --drawImage(pokemon[selection]["name"], x, y)
  1153.  
  1154. local event, arg1 = os.pullEvent("key")
  1155. if keys.getName(arg1) == "enter" or keys.getName(arg1) == "space" then
  1156. --debugging2()
  1157. table.insert(player1Select, pokemon[selection])
  1158. --debugging2()
  1159. --player1 = pokemon[selection]
  1160. break
  1161. elseif keys.getName(arg1) == "left" or keys.getName(arg1) == "a" then
  1162. selection = selection - 1
  1163. if selection == 0 then selection = number end
  1164. elseif keys.getName(arg1) == "right" or keys.getName(arg1) == "d" then
  1165. selection = selection + 1
  1166. if selection > number then selection = 1 end
  1167. end
  1168. end
  1169. --debugging2()
  1170. table.remove(pokemon, selection)
  1171. --debugging2()
  1172. player1 = player1Select[1]
  1173. end
  1174.  
  1175.  
  1176.  
  1177.  
  1178.  
  1179. local function selectMon2()
  1180. shell.run("clear")
  1181. print("player2 select a pokemon")
  1182. print("use arrows to select")
  1183. sleep(0.3)
  1184. shell.run("clear")
  1185.  
  1186. local selection = 1
  1187. while true do
  1188. shell.run("clear")
  1189. print("Name: "..pokemon[selection]["name"])
  1190. print("Level: "..pokemon[selection]["level"])
  1191. print("Type: "..pokemon[selection]["type1"].." / "..pokemon[selection]["type2"])
  1192. print("HP: "..pokemon[selection]["hpMax"])
  1193. print("Attack: "..pokemon[selection]["attack"])
  1194. print("Defense: "..pokemon[selection]["defense"])
  1195. print("Spec. Attack: "..pokemon[selection]["specAttack"])
  1196. print("Spec. Defense: "..pokemon[selection]["specDefense"])
  1197. print("Speed: "..pokemon[selection]["speed"])
  1198. print(" ")
  1199. print("Moves:")
  1200. print(pokemon[selection]["move1"].." | Power: "..moves[pokemon[selection]["move1"]]["power"].." | PP: "..moves[pokemon[selection]["move1"]]["pp"])
  1201. print(pokemon[selection]["move2"].." | Power: "..moves[pokemon[selection]["move2"]]["power"].." | PP: "..moves[pokemon[selection]["move2"]]["pp"])
  1202. print(pokemon[selection]["move3"].." | Power: "..moves[pokemon[selection]["move3"]]["power"].." | PP: "..moves[pokemon[selection]["move3"]]["pp"])
  1203. print(pokemon[selection]["move4"].." | Power: "..moves[pokemon[selection]["move4"]]["power"].." | PP: "..moves[pokemon[selection]["move4"]]["pp"])
  1204. --drawImage(pokemon[selection]["name"], x, y)
  1205.  
  1206. local event, arg1 = os.pullEvent("key")
  1207. if keys.getName(arg1) == "enter" or keys.getName(arg1) == "space" then
  1208. table.insert(player2Select, pokemon[selection])
  1209. --player2 = pokemon[selection]
  1210. break
  1211. elseif keys.getName(arg1) == "left" or keys.getName(arg1) == "a" then
  1212. selection = selection - 1
  1213. if selection == 0 then selection = #pokemon end
  1214. elseif keys.getName(arg1) == "right" or keys.getName(arg1) == "d" then
  1215. selection = selection + 1
  1216. if selection > #pokemon then selection = 1 end
  1217. end
  1218. end
  1219. table.remove(pokemon, selection)
  1220. player2 = player2Select[1]
  1221. end
  1222.  
  1223.  
  1224.  
  1225.  
  1226.  
  1227. local function selectNewMon1()
  1228. number = 0
  1229. for i = 1, #player1Select do
  1230. number = number +1
  1231. end
  1232. shell.run("clear")
  1233.  
  1234. local selection = 1
  1235. while true do
  1236. shell.run("clear")
  1237. print("selection: "..selection)
  1238. print("Name: "..player1Select[selection]["name"])
  1239. print("Level: "..player1Select[selection]["level"])
  1240. print("Type: "..player1Select[selection]["type1"].." / "..player1Select[selection]["type2"])
  1241. print("HP: "..player1Select[selection]["hpMax"])
  1242. print("Attack: "..player1Select[selection]["attack"])
  1243. print("Defense: "..player1Select[selection]["defense"])
  1244. print("Spec. Attack: "..player1Select[selection]["specAttack"])
  1245. print("Spec. Defense: "..player1Select[selection]["specDefense"])
  1246. print("Speed: "..player1Select[selection]["speed"])
  1247. print(" ")
  1248. print("Moves:")
  1249. print(player1Select[selection]["move1"].." | Power: "..moves[player1Select[selection]["move1"]]["power"].." | PP: "..moves[player1Select[selection]["move1"]]["pp"])
  1250. print(player1Select[selection]["move2"].." | Power: "..moves[player1Select[selection]["move2"]]["power"].." | PP: "..moves[player1Select[selection]["move2"]]["pp"])
  1251. print(player1Select[selection]["move3"].." | Power: "..moves[player1Select[selection]["move3"]]["power"].." | PP: "..moves[player1Select[selection]["move3"]]["pp"])
  1252. print(player1Select[selection]["move4"].." | Power: "..moves[player1Select[selection]["move4"]]["power"].." | PP: "..moves[player1Select[selection]["move4"]]["pp"])
  1253. --drawImage(player1Select[selection]["name"], x, y)
  1254.  
  1255. local event, arg1 = os.pullEvent("key")
  1256. if keys.getName(arg1) == "enter" or keys.getName(arg1) == "space" then
  1257. player1 = player1Select[selection]
  1258. choice = true
  1259. break
  1260. elseif keys.getName(arg1) == "left" or keys.getName(arg1) == "a" then
  1261. selection = selection - 1
  1262. if selection == 0 then selection = number end
  1263. elseif keys.getName(arg1) == "right" or keys.getName(arg1) == "d" then
  1264. selection = selection + 1
  1265. if selection > number then selection = 1 end
  1266. end
  1267. end
  1268. end
  1269.  
  1270.  
  1271.  
  1272.  
  1273.  
  1274. local function selectNewMon2()
  1275. number = 0
  1276. for i = 1, #player2Select do
  1277. number = number +1
  1278. end
  1279. shell.run("clear")
  1280.  
  1281. local selection = 1
  1282. while true do
  1283. shell.run("clear")
  1284. print("selection: "..selection)
  1285. print("Name: "..player2Select[selection]["name"])
  1286. print("Level: "..player2Select[selection]["level"])
  1287. print("Type: "..player2Select[selection]["type1"].." / "..player2Select[selection]["type2"])
  1288. print("HP: "..player2Select[selection]["hpMax"])
  1289. print("Attack: "..player2Select[selection]["attack"])
  1290. print("Defense: "..player2Select[selection]["defense"])
  1291. print("Spec. Attack: "..player2Select[selection]["specAttack"])
  1292. print("Spec. Defense: "..player2Select[selection]["specDefense"])
  1293. print("Speed: "..player2Select[selection]["speed"])
  1294. print(" ")
  1295. print("Moves:")
  1296. print(player2Select[selection]["move1"].." | Power: "..moves[player2Select[selection]["move1"]]["power"].." | PP: "..moves[player2Select[selection]["move1"]]["pp"])
  1297. print(player2Select[selection]["move2"].." | Power: "..moves[player2Select[selection]["move2"]]["power"].." | PP: "..moves[player2Select[selection]["move2"]]["pp"])
  1298. print(player2Select[selection]["move3"].." | Power: "..moves[player2Select[selection]["move3"]]["power"].." | PP: "..moves[player2Select[selection]["move3"]]["pp"])
  1299. print(player2Select[selection]["move4"].." | Power: "..moves[player2Select[selection]["move4"]]["power"].." | PP: "..moves[player2Select[selection]["move4"]]["pp"])
  1300. --drawImage(player2Select[selection]["name"], x, y)
  1301.  
  1302. local event, arg1 = os.pullEvent("key")
  1303. if keys.getName(arg1) == "enter" or keys.getName(arg1) == "space" then
  1304. player2 = player2Select[selection]
  1305. choice = true
  1306. break
  1307. elseif keys.getName(arg1) == "left" or keys.getName(arg1) == "a" then
  1308. selection = selection - 1
  1309. if selection == 0 then selection = number end
  1310. elseif keys.getName(arg1) == "right" or keys.getName(arg1) == "d" then
  1311. selection = selection + 1
  1312. if selection > number then selection = 1 end
  1313. end
  1314. end
  1315. end
  1316.  
  1317.  
  1318.  
  1319.  
  1320. local function printPokemon()
  1321. shell.run("clear")
  1322. print("Player1 selected: "..player1Select[1]["name"]..", "..player1Select[2]["name"]..", "..player1Select[3]["name"])
  1323. print("player2 selected: "..player2Select[1]["name"]..", "..player2Select[2]["name"]..", "..player2Select[3]["name"])
  1324. event = os.pullEvent("key")
  1325. end
  1326.  
  1327.  
  1328.  
  1329.  
  1330.  
  1331.  
  1332.  
  1333.  
  1334.  
  1335. local function calcAccuracy()
  1336. --Accuracy
  1337. roll = math.random(0, 100)
  1338. accuracy = false
  1339. if playerTurn == 1 then
  1340. if moves[selectedMove]["accuracy"] + player1.accuracy >= roll then
  1341. accuracy = true
  1342. end
  1343. elseif playerTurn == 2 then
  1344. if moves[selectedMove]["accuracy"] + player2.accuracy >= roll then
  1345. accuracy = true
  1346. end
  1347. end
  1348. if moves[selectedMove]["target"] == "self" then
  1349. accuracy = true
  1350. end
  1351. end
  1352.  
  1353.  
  1354.  
  1355.  
  1356. local function STABBonus()
  1357. --STAB bonus
  1358. if playerTurn == 1 then
  1359. moveType = moves[selectedMove]["type"]
  1360. elseif playerTurn == 2 then
  1361. moveType = moves[selectedMove]["type"]
  1362. end
  1363.  
  1364. STAB = 1
  1365. if playerTurn == 1 and player1.type1 or player1.type2 == moveType then
  1366. STAB = 2
  1367. elseif playerTurn == 2 and player2.type1 or player2.type2 == moveType then
  1368. STAB = 2
  1369. end
  1370. end
  1371.  
  1372.  
  1373.  
  1374.  
  1375. local function strengthAndWeakness()
  1376. -- strengths and weaknesses
  1377. moveType = moves[selectedMove]["type"]
  1378. resist = 1
  1379. weakness = 1
  1380. if moveType == "Normal" then
  1381. se = { "N/A" }
  1382. nve = { "Rock", "Steel" }
  1383. ne = { "Ghost" }
  1384. elseif moveType == "Grass" then
  1385. se = { "Water", "Ground", "Rock" }
  1386. nve = { "Fire", "Grass", "Poison", "Flying", "Bug", "Dragon", "Steel" }
  1387. ne = { "N/A" }
  1388. elseif moveType == "Fire" then
  1389. se = { "Grass", "Ice", "Bug" }
  1390. nve = { "Fire", "Water", "Rock", "Dragon" }
  1391. ne = { "N/A" }
  1392. elseif moveType == "Water" then
  1393. se = { "Fire", "Ground", "Rock" }
  1394. nve = { "Water", "Grass", "Dragon" }
  1395. ne = { "N/A" }
  1396. elseif moveType == "Dragon" then
  1397. se = { "Dragon" }
  1398. nve = { "Steel" }
  1399. ne = { "N/A" }
  1400. elseif moveType == "Flying" then
  1401. se = { "Grass", "Fighting", "Bug" }
  1402. nve = { "Electric", "Rock", "Steel" }
  1403. ne = { "N/A" }
  1404. elseif moveType == "Psychic" then
  1405. se = { "Fighting", "Poison"}
  1406. nve = { "Psychic", "Steel" }
  1407. ne = { "Dark" }
  1408. elseif moveType == "Dark" then
  1409. se = { "Psychic", "Ghost" }
  1410. nve = { "Fighting", "Dark", "Steel" }
  1411. ne = { "N/A" }
  1412. elseif moveType == "Bug" then
  1413. se = { "Grass", "Psychic", "Dark" }
  1414. nve = { "Fire", "Fighting", "Poison", "Flying", "Ghost", "Steel" }
  1415. ne = { "N/A" }
  1416. else
  1417. se = { "N/A" }
  1418. nve = { "N/A" }
  1419. ne = { "N/A" }
  1420. end
  1421.  
  1422. for _,v in pairs(se) do
  1423. if playerTurn == 1 then
  1424. if v == player2.type and v == player2.type2 then
  1425. weakness = weakness * 4
  1426. elseif v == player2.type1 or v == player2.type2 then
  1427. weakness = weakness * 2
  1428. end
  1429. elseif playerTurn == 2 then
  1430. if v == player1.type1 and v == player1.type2 then
  1431. weakness = weakness * 4
  1432. elseif v == player1.type1 or v == player1.type2 then
  1433. weakness = weakness * 2
  1434. end
  1435. end
  1436. end
  1437.  
  1438. for _,v in pairs(nve) do
  1439. if playerTurn == 1 then
  1440. if v == player2.type1 and v == player2.type2 then
  1441. resist = resist * 4
  1442. elseif v == player2.type or v == player2.type2 then
  1443. resist = resist * 2
  1444. end
  1445. elseif playerTurn == 2 then
  1446. if v == player1.type1 and v == player1.type2 then
  1447. resist = resist * 4
  1448. elseif v == player1.type1 or v == player1.type2 then
  1449. resist = resist * 4
  1450. end
  1451. end
  1452. end
  1453.  
  1454. for _,v in pairs(ne) do
  1455. if playerTurn == 1 then
  1456. if v == player2.type1 or v == player2.type2 then
  1457. weakness = weakness * 0
  1458. end
  1459. elseif playerTurn == 2 then
  1460. if v == player1.type1 or v == player1.type2 then
  1461. weakness = weakness * 0
  1462. end
  1463. end
  1464. end
  1465. end
  1466.  
  1467.  
  1468. local function calcDam()
  1469. -- Damage calculation
  1470. if playerTurn == 1 then
  1471. moveForm = moves[selectedMove]["attackForm"]
  1472. elseif playerTurn == 2 then
  1473. moveForm = moves[selectedMove]["attackForm"]
  1474. end
  1475.  
  1476. if moves[selectedMove]["doesDamage"] and accuracy == true and playerTurn == 1 then
  1477. if moveForm == "phys" then
  1478. baseDam = ((player1.attack) * moves[selectedMove]["power"]) / (player2.defense)
  1479. damBonus = (baseDam/100) * math.random(1,15)
  1480. dam = (baseDam + damBonus) * STAB * weakness / resist
  1481. elseif moveForm == "spec" then
  1482. baseDam = ((player1.specAttack) * moves[selectedMove]["power"]) / (player2.specDefense)
  1483. damBonus = (baseDam/100) * math.random(1,15)
  1484. dam = (baseDam + damBonus) * STAB * weakness / resist
  1485. elseif moveForm == "exac" then
  1486. dam = moves[selectedMove]["power"]
  1487. end
  1488.  
  1489. if weakness == 0 then
  1490. dam = 0
  1491. elseif dam < 1 then
  1492. dam = 1
  1493. end
  1494.  
  1495. for k, moveEffect in pairs(moves[selectedMove]) do
  1496. if moveEffect == "crit" then
  1497. crit = math.random(1,100)
  1498. critical = false
  1499. if crit > 95 - moves[selectedMove]["effectValue"] then
  1500. dam = dam * 1.5
  1501. critical = true
  1502. end
  1503. else
  1504. crit = math.random(1,100)
  1505. critical = false
  1506. if crit > 95 then
  1507. dam = dam * 1.5
  1508. critical = true
  1509. end
  1510. end
  1511. end
  1512. dam = math.ceil(dam)
  1513.  
  1514. elseif moves[selectedMove]["doesDamage"] and accuracy == true and playerTurn == 2 then
  1515. if moveForm == "phys" then
  1516. baseDam = ((player2.attack) * moves[selectedMove]["power"]) / (player1.defense)
  1517. damBonus = (baseDam/100) * math.random(1,15)
  1518. dam = math.ceil((baseDam + damBonus) * STAB * weakness / resist)
  1519. elseif moveForm == "spec" then
  1520. baseDam = ((player2.specAttack) * moves[selectedMove]["power"]) / (player1.specDefense)
  1521. damBonus = (baseDam/100) * math.random(1,15)
  1522. dam = math.ceil((baseDam + damBonus) * STAB * weakness / resist)
  1523. elseif moveForm == "exac" then
  1524. dam = moves[selectedMove]["power"]
  1525. end
  1526.  
  1527. if weakness == 0 then
  1528. dam = 0
  1529. elseif dam < 1 then
  1530. dam = 1
  1531. end
  1532.  
  1533. for k, moveEffect in pairs(moves[selectedMove]) do
  1534. if moveEffect == "crit" then
  1535. crit = math.random(1,100)
  1536. critical = false
  1537. if crit > 95 - moves[selectedMove]["effectValue"] then
  1538. dam = dam * 1.5
  1539. critical = true
  1540. end
  1541. else
  1542. crit = math.random(1,100)
  1543. critical = false
  1544. if crit > 95 then
  1545. dam = dam * 1.5
  1546. critical = true
  1547. end
  1548. end
  1549. end
  1550. dam = math.ceil(dam)
  1551. end
  1552.  
  1553. if playerTurn == 1 and accuracy == true and moves[selectedMove]["doesDamage"] == true then
  1554. player2.currHp = player2.currHp - dam
  1555. if player2.currHp < 1 then
  1556. player2.currHp = 0
  1557. end
  1558. elseif playerTurn == 2 and accuracy == true and moves[selectedMove]["doesDamage"] == true then
  1559. player1.currHp = player1.currHp - dam
  1560. if player1.currHp < 1 then
  1561. player1.currHp = 0
  1562. end
  1563. end
  1564. end
  1565.  
  1566.  
  1567.  
  1568.  
  1569.  
  1570.  
  1571. local function buffAndDebuff()
  1572. --debugging2()
  1573. shell.run("clear")
  1574. print(moves[selectedMove]["effect"])
  1575. for k, v in pairs(moves["selectedMove"]["effect"]) do
  1576. print(v)
  1577.  
  1578. if moveEffect2 == "buffAttack" and playerTurn == 1 and accuracy == true then
  1579. player1.attack = player1.attack + moves[selectedMove]["effectValue"]
  1580. elseif moveEffect2 == "buffAttack" and playerTurn == 2 and accuracy == true then
  1581. player2.attack = player2.attack + moves[selectedMove]["effectValue"]
  1582. end
  1583.  
  1584. if moveEffect2 == "buffDefense" and playerTurn == 1 and accuracy == true then
  1585. player1.defense = player1.defense + moves[selectedMove]["effectValue"]
  1586. elseif moveEffect2 == "buffDefense" and playerTurn == 2 and accuracy == true then
  1587. player2.defense = player2.defense + moves[selectedMove]["effectValue"]
  1588. end
  1589.  
  1590. if moveEffect2 == "buffSpecDefense" and playerTurn == 1 and accuracy == true then
  1591. player1.specDefense = player1.specDefense + moves[selectedMove]["effectValue"]
  1592. elseif moveEffect2 == "buffSpecDefense" and playerTurn == 2 and accuracy == true then
  1593. player2.specDefense = player2.specDefense + moves[selectedMove]["effectValue"]
  1594. end
  1595.  
  1596. if moveEffect2 == "buffSpecAttack" and playerTurn == 1 and accuracy == true then
  1597. player1.specAttack = player1.specAttack + moves[selectedMove]["effectValue"]
  1598. elseif moveEffect2 == "buffSpecAttack" and playerTurn == 2 and accuracy == true then
  1599. player2.specAttack = player2.specAttack + moves[selectedMove]["effectValue"]
  1600. end
  1601.  
  1602. if moveEffect2 == "buffSpeed" and playerTurn == 1 and accuracy == true then
  1603. player1.speed = player1.speed + moves[selectedMove]["effectValue"]
  1604. elseif moveEffect2 == "buffSpeed" and playerTurn == 2 and accuracy == true then
  1605. player2.speed = player2.speed + moves[selectedMove]["effectValue"]
  1606. end
  1607.  
  1608. if moveEffect2 == "buffAccuracy" and playerTurn == 1 and accuracy == true then
  1609. player1.accuracy = player1.accuracy + moves[selectedMove]["effectValue"]
  1610. elseif moveEffect2 == "buffAccuracy" and playerTurn == 2 and accuracy == true then
  1611. player2.accuracy = player2.accuracy + moves[selectedMove]["effectValue"]
  1612. end
  1613.  
  1614. if moveEffect2 == "debuffAttack" and playerTurn == 1 and accuracy == true and player1.attack > 5 then
  1615. player2.attack =player2.attack - moves[selectedMove]["effectValue"]
  1616. elseif moveEffect2 == "debuffAttack" and playerTurn == 2 and accuracy == true and player2.attack > 5 then
  1617. player1.attack =player1.attack - moves[selectedMove]["effectValue"]
  1618. end
  1619.  
  1620. if moveEffect2 == "debuffDefense" and playerTurn == 1 and accuracy == true and player1.defense > 5 then
  1621. player2.defense =player2.defense - moves[selectedMove]["effectValue"]
  1622. elseif moveEffect2 == "debuffDefense" and playerTurn == 2 and accuracy == true and player2.defense > 5 then
  1623. player1.defense =player1.defense - moves[selectedMove]["effectValue"]
  1624. end
  1625.  
  1626. if moveEffect2 == "debuffSpecDefense" and playerTurn == 1 and accuracy == true and player1.specDefense > 5 then
  1627. player2.specDefense =player2.specDefense - moves[selectedMove]["effectValue"]
  1628. elseif moveEffect2 == "debuffSpecDefense" and playerTurn == 2 and accuracy == true and player2.specDefense > 5 then
  1629. player1.specDefense =player1.specDefense - moves[selectedMove]["effectValue"]
  1630. end
  1631.  
  1632. if moveEffect2 == "debuffSpecAttack" and playerTurn == 1 and accuracy == true and player1.specAttack > 5 then
  1633. player2.specAttack = player2.specAttack - moves[selectedMove]["effectValue"]
  1634. elseif moveEffect2 == "debuffSpecAttack" and playerTurn == 2 and accuracy == true and player2.specAttack > 5 then
  1635. player1.specAttack =player1.specAttack - moves[selectedMove]["effectValue"]
  1636. end
  1637.  
  1638. if moveEffect2 == "debuffSpeed" and playerTurn == 1 and accuracy == true and player1.speed > 5 then
  1639. player2.speed = player2.speed - moves[selectedMove]["effectValue"]
  1640. elseif moveEffect2 == "debuffSpeed" and playerTurn == 2 and accuracy == true and player2.speed > 5 then
  1641. player1.speed = player1.speed - moves[selectedMove]["effectValue"]
  1642. end
  1643.  
  1644. if moveEffect2 == "debuffAccuracy" and playerTurn == 1 and accuracy == true and moves[selectedMove]["accuracy"] + player1.accuracy > 5 then
  1645. player2.accuracy =player2.accuracy - moves[selectedMove]["effectValue"]
  1646. elseif moveEffect2 == "debuffAccuracy" and playerTurn == 2 and accuracy == true and moves[selectedMove]["accuracy"] + player2.accuracy > 5 then
  1647. player1.accuracy =player1.accuracy - moves[selectedMove]["effectValue"]
  1648. end
  1649.  
  1650. if moveEffect2 == "heal" and playerTurn == 1 and accuracy == true then
  1651. player1.currHp= player1.currHp + moves[selectedMove]["effectValue"]
  1652. if player1.currHp > player1.hpMax then player1.currHp = player1.hpMax end
  1653. elseif moveEffect2 == "heal" and playerTurn == 2 and accuracy == true then
  1654. player2.currHp = player2.currHp + moves[selectedMove]["effectValue"]
  1655. if player2.currHp > player2.hpMax then player2.currHp = player2.hpMax end
  1656. end
  1657.  
  1658. if moveEffect2 == "poison" and playerTurn == 1 and accuracy == true then
  1659. randomNum = math.random(1,100)
  1660. if moves[selectedMove]["effectValue"] >= randomNum then
  1661. player2.status = "poison"
  1662. end
  1663. elseif moveEffect2 == "poison" and playerTurn == 2 and accuracy == true then
  1664. randomNum = math.random(1,100)
  1665. if moves[selectedMove]["effectValue"] >= randomNum then
  1666. player1.status = "poison"
  1667. end
  1668. end
  1669.  
  1670. if moveEffect2 == "burn" and playerTurn == 1 and accuracy == true then
  1671. randomNum = math.random(1,100)
  1672. if moves[selectedMove]["effectValue"] >= randomNum then
  1673. player2.status = "burn"
  1674. end
  1675. elseif moveEffect2 == "burn" and playerTurn == 2 and accuracy == true then
  1676. randomNum = math.random(1,100)
  1677. if moves[selectedMove]["effectValue"] >= randomNum then
  1678. player1.status = "burn"
  1679. end
  1680. end
  1681.  
  1682. if moveEffect2 == "paralyze" and playerTurn == 1 and accuracy == true then
  1683. randomNum = math.random(1,100)
  1684. if moves[selectedMove]["effectValue"] >= randomNum then
  1685. player2.status = "paralyze"
  1686. player2Round = 1
  1687. player2Paralyzed = true
  1688. end
  1689. elseif moveEffect2 == "paralyze" and playerTurn == 2 and accuracy == true then
  1690. randomNum = math.random(1,100)
  1691. if moves[selectedMove]["effectValue"] >= randomNum then
  1692. player1.status = "paralyze"
  1693. player1Round = 1
  1694. player1Paralyzed = true
  1695. end
  1696. end
  1697.  
  1698. if moveEffect2 == "confusion" and playerTurn == 1 and accuracy == true then
  1699. randomNum = math.random(1,100)
  1700. if moves[selectedMove]["effectValue"] >= randomNum then
  1701. player2.status = "confusion"
  1702. player2Confused = true
  1703. player2Round = 0
  1704. end
  1705. elseif moveEffect2 == "confusion" and playerTurn == 2 and accuracy == true then
  1706. randomNum = math.random(1,100)
  1707. if moves[selectedMove]["effectValue"] >= randomNum then
  1708. player1.status = "confusion"
  1709. player1Confused = true
  1710. player1Round = 0
  1711. end
  1712. end
  1713.  
  1714. if moveEffect2 == "sleep" and playerTurn == 1 and accuracy == true and player2Sleeping == false then
  1715. randomNum = math.random(1,100)
  1716. if moves[selectedMove]["effectValue"] >= randomNum then
  1717. player2Sleeping = true
  1718. player2Round = 0
  1719. player2.status = "sleep"
  1720. end
  1721. elseif moveEffect2 == "sleep" and playerTurn == 2 and accuracy == true and player1Sleeping == false then
  1722. randomNum = math.random(1,100)
  1723. if moves[selectedMove]["effectValue"] >= randomNum then
  1724. player1Sleeping = true
  1725. player1Round = 0
  1726. player1.status = "sleep"
  1727. end
  1728. end
  1729.  
  1730. if moveEffect2 == "sleepSelf" and playerTurn == 1 and accuracy == true then
  1731. player1Sleeping = true
  1732. player1Round = 1
  1733. player1.status = "sleep"
  1734. player1.currHp = player1.hpMax
  1735. elseif moveEffect2 == "sleep" and playerTurn == 2 and accuracy == true then
  1736. player2Sleeping = true
  1737. player2Round = 1
  1738. player2.status = "sleep"
  1739. player2.currHp = player2.hpMax
  1740. end
  1741.  
  1742. if moveEffect2 == "flinch" and playerTurn == 1 and accuracy == true then
  1743. randomNum = math.random(1,100)
  1744. if moves[selectedMove]["effectValue"] >= randomNum then
  1745. player2.status = "flinch"
  1746. end
  1747. elseif moveEffect2 == "flinch" and playerTurn == 2 and accuracy == true then
  1748. randomNum = math.random(1,100)
  1749. if moves[selectedMove]["effectValue"] >= randomNum then
  1750. player1.status = "flinch"
  1751. end
  1752. end
  1753.  
  1754. if moveEffect2 == "freeze" and playerTurn == 1 and accuracy == true then
  1755. randomNum = math.random(1,100)
  1756. if moves[selectedMove]["effectValue"] >= randomNum then
  1757. player2.status = "freeze"
  1758. player2Frozen = true
  1759. player2Round = 1
  1760. end
  1761. elseif moveEffect2 == "freeze" and playerTurn == 2 and accuracy == true then
  1762. randomNum = math.random(1,100)
  1763. if moves[selectedMove]["effectValue"] >= randomNum then
  1764. player1.status = "freeze"
  1765. player1Frozen = true
  1766. player1Round = 1
  1767. end
  1768. end
  1769.  
  1770. if moveEffect2 == "curse" and playerTurn == 1 and accuracy == true then
  1771. player2.status = "curse"
  1772. player1.currHp = player1.currHp / 2
  1773. elseif moveEffect2 == "curse" and playerTurn == 2 and accuracy == true then
  1774. player1.status = "curse"
  1775. player2.currHp = player2.currHp / 2
  1776. end
  1777.  
  1778. if moveEffect2 == "roost" and playerTurn == 1 and accuracy == true then
  1779. if player1.type1 == "Flying" and player1.type2 == flying then
  1780. player1.type1 = "Normal"
  1781. player1.type2 = "Normal"
  1782. elseif player1.type1 == "Flying" then
  1783. player1.type1 = "Normal"
  1784. elseif player1.type2 == "Flying" then
  1785. player1.type2 = "Normal"
  1786. end
  1787. player1.currHp = player1currHp + (player1.maxHp / 2)
  1788. if player1.currHp > player1.hpMax then player1.currHp = player1.hpMax end
  1789. elseif moveEffect2 == "roost" and playerTurn == 2 and accuracy == true then
  1790. if player2.type1 == "Flying" and player2.type2 == flying then
  1791. player2.type1 = "Normal"
  1792. player2.type2 = "Normal"
  1793. elseif player2.type1 == "Flying" then
  1794. player2.type1 = "Normal"
  1795. elseif player2.type2 == "Flying" then
  1796. player2.type2 = "Normal"
  1797. end
  1798. player2.currHp = player2currHp + (player2.maxHp / 2)
  1799. if player2.currHp > player2.hpMax then player2.currHp = player2.hpMax end
  1800. end
  1801.  
  1802. end
  1803. -- end
  1804. print("buff/debuff finished")
  1805. event = os.pullEvent("key")
  1806. shell.run("clear")
  1807. end
  1808.  
  1809.  
  1810.  
  1811. local function pokemonAttack(move)
  1812. shell.run("clear")
  1813. --debugging2()
  1814. calcAccuracy()
  1815. --debugging2()
  1816. buffAndDebuff()
  1817. --debugging2()
  1818. STABBonus()
  1819. strengthAndWeakness()
  1820. calcDam()
  1821. end
  1822.  
  1823.  
  1824.  
  1825.  
  1826. local function checkStatus()
  1827. if playerTurn == 1 then
  1828. if player1.status == "poison" then
  1829. print(player1.name.." is poisoned. "..player1.name.." takes damage from the poison")
  1830. player1.currHp = player1.currHp - 1
  1831. end
  1832. if player1.status == "burn" then
  1833. print(player1.name.." is burned. "..player1.name.." takes damage from the burn")
  1834. player1.currHp = player1.currHp - 1
  1835. end
  1836. if player1.status == "curse" then
  1837. print(player1.name.." is cursed. "..player1.name.." takes damage from the curse")
  1838. player1.currHp = math.ceil(player1.currHp / 2)
  1839. end
  1840. if player1.status == "sleep" then
  1841. print(player1.name.." is sleeping. ")
  1842. player1Round = player1Round +1
  1843. if player1Round == 3 then
  1844. player1Sleeping = false
  1845. player1.status = "none"
  1846. end
  1847. end
  1848. if player1.status == "confusion" then
  1849. print(player1.name.." is confused.")
  1850. randomNum = math.random(1,100)
  1851. if randomNum > 0 and randomNum < 26 then
  1852. print("It hurt itself in the confusion")
  1853. elseif randomNum > 25 and randomNum < 51 then
  1854. print(player1.name.." is too confused")
  1855. end
  1856. player1Round = player1Round +1
  1857. if player1Round == 3 then
  1858. player1Confused = false
  1859. player1.status = "none"
  1860. end
  1861. end
  1862. if player1.status == "flinch" then
  1863. print(player1.name.." is flinched. ")
  1864. player1Flinched = false
  1865. player1.status = "none"
  1866. end
  1867. if player1.status == "paralyze" then
  1868. print(player1.name.." is paralyzed. ")
  1869. randomNum = math.random(1,100)
  1870. if randomNum > 0 and randomNum < 61 then
  1871. print("It can't move")
  1872. end
  1873. player1Round = player1Round +1
  1874. if player1Round == 3 then
  1875. player1Paralyzed = false
  1876. player1.status = "none"
  1877. end
  1878. end
  1879. if player1.status == "freeze" then
  1880. print(player1.name.." is frozen. ")
  1881. randomNum = math.random(1,100)
  1882. if randomNum > 0 and randomNum < 61 then
  1883. print("It can't move")
  1884. end
  1885. player1Round = player1Round +1
  1886. if player1Round == 3 then
  1887. player1Frozen = false
  1888. player1.status = "none"
  1889. end
  1890. end
  1891.  
  1892.  
  1893. elseif playerTurn == 2 then
  1894. if player2.status == "poison" then
  1895. print(player2.name.." is poisoned. "..player2.name.." takes damage from the poison")
  1896. player2.currHp = player2.currHp - 1
  1897. end
  1898. end
  1899. end
  1900.  
  1901.  
  1902.  
  1903.  
  1904.  
  1905.  
  1906. local function printResult()
  1907. if moves[selectedMove]["doesDamage"] and accuracy == true then
  1908. if critical == true then
  1909. print("It's a critical hit!")
  1910. end
  1911. if weakness == 0 then
  1912. print("It has no effect")
  1913. elseif weakness > resist then
  1914. print("Its Super Effective.")
  1915. elseif weakness < resist then
  1916. print("Its not very Effective.")
  1917. end
  1918.  
  1919. if playerTurn == 1 then
  1920. if switch == false then
  1921. print("Player2's "..player2.name.." was damaged for "..dam.." points")
  1922. print("Player2's health: "..player2.currHp)
  1923. end
  1924. elseif playerTurn == 2 then
  1925. if switch == false then
  1926. print("Player1's "..player1.name.." was damaged for "..dam.." points")
  1927. print("Player1's health: "..player1.currHp)
  1928. end
  1929. end
  1930. elseif accuracy == false then
  1931. print("It missed")
  1932. end
  1933. end
  1934.  
  1935.  
  1936.  
  1937.  
  1938.  
  1939.  
  1940. local function resolveTurn()
  1941. shell.run("clear")
  1942. if playerTurn == 1 then
  1943. if switch == true then
  1944. print("Player1 switches to "..player1.name)
  1945. elseif itemUsed == true then
  1946. print("Player1 uses ")
  1947. elseif player1.status ~= "none" then
  1948. checkStatus()
  1949. else
  1950. --debugging2()
  1951. pokemonAttack(selectedMove)
  1952. print("Player1's "..player1.name.." use "..selectedMove)
  1953. print(" ")
  1954. sleep(0.5)
  1955. print("moveType "..moveType)
  1956. end
  1957. print("Type1 "..player2.type1)
  1958. print("Type2 "..player2.type2)
  1959. print(" ")
  1960.  
  1961. elseif playerTurn == 2 then
  1962. if switch == true then
  1963. print("Player2 switches to "..player2.name)
  1964. elseif itemUsed == true then
  1965. print("Player2 uses ")
  1966. elseif player2.status ~= "none" then
  1967. checkStatus()
  1968. else
  1969. pokemonAttack(selectedMove)
  1970. print("Player2's "..player2.name.." use "..selectedMove)
  1971. print(" ")
  1972. sleep(0.5)
  1973. print("moveType "..moveType)
  1974. end
  1975. print("Type1 "..player1.type1.." Type2 "..player1.type2)
  1976. print(" ")
  1977. end
  1978.  
  1979.  
  1980.  
  1981. print("playerTurn "..playerTurn)
  1982. print(" ")
  1983. print("randomNum "..randomNum)
  1984. print("value "..moves[selectedMove]["effectValue"])
  1985. print("1 status: "..player1.status.." 2 status "..player2.status)
  1986. print("player1 stats "..player1.attack.." "..player1.defense.." "..player1.specAttack.." "..player1.specDefense.." "..player1.speed.." "..player1.accuracy)
  1987. print("player2 stats "..player2.attack.." "..player2.defense.." "..player2.specAttack.." "..player2.specDefense.." "..player2.speed.." "..player2.accuracy)
  1988.  
  1989. printResult()
  1990.  
  1991. if playerTurn == 1 then
  1992. playerTurn = 2
  1993. elseif playerTurn == 2 then
  1994. playerTurn = 1
  1995. end
  1996. writeHP()
  1997. event = os.pullEvent("key")
  1998. shell.run("clear")
  1999. end
  2000.  
  2001.  
  2002.  
  2003.  
  2004.  
  2005.  
  2006. local function checkFaint()
  2007. faint = false
  2008. if player1.currHp == 0 then
  2009. print("Player1's "..player1.name.." fainted")
  2010. print(" ")
  2011. sleep(0.5)
  2012. print("Player2 win!")
  2013. faint = true
  2014. event = os.pullEvent("key")
  2015. elseif player2.currHp == 0 then
  2016. print("Player2's "..player2.name.." fainted")
  2017. print(" ")
  2018. sleep(0.5)
  2019. print("Player1 win!")
  2020. faint = true
  2021. event = os.pullEvent("key")
  2022. end
  2023. end
  2024.  
  2025.  
  2026.  
  2027.  
  2028.  
  2029.  
  2030.  
  2031. local function showMoves()
  2032. shell.run("clear")
  2033. if playerTurn == 1 then
  2034. print("player "..playerTurn)
  2035. print("1: "..player1["move1"])
  2036. print("2: "..player1["move2"])
  2037. print("3: "..player1["move3"])
  2038. print("4: "..player1["move4"])
  2039.  
  2040. local event, arg1 = os.pullEvent("key")
  2041. --debugging2()
  2042. if keys.getName(arg1) == "one" then
  2043. selectedMove = player1.move1
  2044. --pokemonAttack(selectedMove)
  2045. resolveTurn()
  2046. elseif keys.getName(arg1) == "two" then
  2047. selectedMove = player1.move2
  2048. --pokemonAttack(selectedMove)
  2049. resolveTurn()
  2050. elseif keys.getName(arg1) == "three" then
  2051. selectedMove = player1.move3
  2052. --pokemonAttack(selectedMove)
  2053. --debugging2()
  2054. resolveTurn()
  2055. elseif keys.getName(arg1) == "four" then
  2056. selectedMove = player1.move4
  2057. shell.run("clear")
  2058. --pokemonAttack(selectedMove)
  2059. --debugging2()
  2060. resolveTurn()
  2061. end
  2062. elseif playerTurn == 2 then
  2063. print("player "..playerTurn)
  2064. print("1: "..player2["move1"])
  2065. print("2: "..player2["move2"])
  2066. print("3: "..player2["move3"])
  2067. print("4: "..player2["move4"])
  2068.  
  2069. local event, arg1 = os.pullEvent("key")
  2070. --debugging2()
  2071. if keys.getName(arg1) == "one" then
  2072. selectedMove = player2.move1
  2073. --pokemonAttack(selectedMove)
  2074. resolveTurn()
  2075. elseif keys.getName(arg1) == "two" then
  2076. selectedMove = player2.move2
  2077. --pokemonAttack(selectedMove)
  2078. resolveTurn()
  2079. elseif keys.getName(arg1) == "three" then
  2080. selectedMove = player2.move3
  2081. --debugging2()
  2082. --pokemonAttack(selectedMove)
  2083. resolveTurn()
  2084. elseif keys.getName(arg1) == "four" then
  2085. selectedMove = player2.move4
  2086. --debugging2()
  2087. --pokemonAttack(selectedMove)
  2088. resolveTurn()
  2089. end
  2090. end
  2091. end
  2092.  
  2093.  
  2094.  
  2095.  
  2096.  
  2097.  
  2098. local function showItems()
  2099. shell.run("clear")
  2100. if items == "empty" then
  2101. print("No items")
  2102. else
  2103. itemUsed = true
  2104. end
  2105. sleep(1)
  2106. end
  2107.  
  2108.  
  2109.  
  2110.  
  2111.  
  2112.  
  2113. local function showPokemons()
  2114. shell.run("clear")
  2115. if playerTurn == 1 then
  2116. for i = 1, #player1Select do
  2117. print(player1Select[i]["name"])
  2118. end
  2119. elseif playerTurn == 2 then
  2120. for i = 1, #player2Select do
  2121. print(player2Select[i]["name"])
  2122. end
  2123. end
  2124.  
  2125. if playerTurn == 1 then
  2126. event, arg1 = os.pullEvent("key")
  2127. player1 = player1Select[arg1-1]
  2128. elseif playerTurn == 2 then
  2129. event, arg1 = os.pullEvent("key")
  2130. player2 = player2Select[arg1-1]
  2131. end
  2132. end
  2133.  
  2134.  
  2135.  
  2136.  
  2137.  
  2138.  
  2139. local function run()
  2140. shell.run("clear")
  2141. if trainer == true then
  2142. print("Can't run")
  2143. end
  2144. sleep(1)
  2145. end
  2146.  
  2147.  
  2148.  
  2149.  
  2150.  
  2151. local function turnOne()
  2152. if player1.speed > player2.speed then
  2153. player = 1
  2154. playerTurn = 1
  2155. elseif player2.speed > player1.speed then
  2156. player = 2
  2157. playerTurn = 2
  2158. elseif player1.speed == player2.speed then
  2159. player = math.random(1,2)
  2160. playerTurn = math.random(1,2)
  2161. end
  2162. end
  2163.  
  2164.  
  2165.  
  2166.  
  2167.  
  2168.  
  2169.  
  2170. local function battle()
  2171. switch = false
  2172. shell.run("clear")
  2173. print("player "..playerTurn)
  2174. print("1. Attack")
  2175. print("2. Items")
  2176. print("3. Pokemons")
  2177. print("4. Run")
  2178.  
  2179. local event, arg1 = os.pullEvent("key")
  2180. --debugging2()
  2181. if keys.getName(arg1) == "one" then
  2182. --debugging2()
  2183. noAttack = false
  2184. showMoves()
  2185. choice = true
  2186. elseif keys.getName(arg1) == "two" then
  2187. showItems()
  2188. noAttack = true
  2189. elseif keys.getName(arg1) == "three" then
  2190. --showPokemons()
  2191. if playerTurn == 1 then
  2192. selectNewMon1()
  2193. elseif playerTurn == 2 then
  2194. selectNewMon2()
  2195. end
  2196. switch = true
  2197. choice = true
  2198. noAttack = true
  2199. elseif keys.getName(arg1) == "four" then
  2200. run()
  2201. end
  2202. end
  2203.  
  2204.  
  2205.  
  2206.  
  2207.  
  2208.  
  2209.  
  2210.  
  2211.  
  2212.  
  2213. -- #############################
  2214. local function debugging()
  2215. print("pairs(moves[Meditation])")
  2216. for k, v in pairs(moves["Meditation"]) do
  2217. print(tostring(k).." "..tostring(v))
  2218. end
  2219. os.pullEvent()
  2220. shell.run("clear")
  2221. -- skriver effect table
  2222.  
  2223. print("ipairs(moves[Meditation])")
  2224. for k,v in ipairs(moves["Meditation"]) do
  2225. print(tostring(k).." "..tostring(v))
  2226. end
  2227. os.pullEvent()
  2228. shell.run("clear")
  2229. -- skriver ingenting
  2230.  
  2231. print("pairs(moves[Meditation][effect])")
  2232. for k, v in pairs(moves["Meditation"]["effect"]) do
  2233. print(k.." "..v)
  2234. end
  2235. os.pullEvent()
  2236. shell.run("clear")
  2237. -- skriver 1 None osv
  2238.  
  2239. print("ipairs(moves[Meditation][effect])")
  2240. for k, v in ipairs(moves["Meditation"]["effect"]) do
  2241. print(k.." "..v)
  2242. end
  2243. os.pullEvent()
  2244. shell.run("clear")
  2245. -- skriver 1 None osv
  2246.  
  2247. print(" #moves[Meditation]")
  2248. for i = 1, #moves["Meditation"] do
  2249. print(i)
  2250. end
  2251. os.pullEvent()
  2252. shell.run("clear")
  2253. -- skriver ingenting
  2254.  
  2255. print("#moves[Meditation][effect]")
  2256. for i = 1, #moves["Meditation"]["effect"] do
  2257. print(moves[Meditation]["effect"][i])
  2258. end
  2259. os.pullEvent()
  2260. shell.run("clear")
  2261. -- attempt to index nil value
  2262. end
  2263.  
  2264. --debugging2()
  2265.  
  2266. items = "empty"
  2267. trainer = true
  2268. playerTurn = 1
  2269. --debugging2()
  2270. --shell.run("writeMoves")
  2271. --debugging2()
  2272. shell.run("writePokemon")
  2273.  
  2274. while true do
  2275.  
  2276. --loadMoves()
  2277. --moves = loadedFile
  2278. --for k, v in ipairs(loadedFile) do
  2279. -- table.insert(moves, loadedFile)
  2280. --end
  2281.  
  2282. loadPokemon()
  2283. pokemon = loadedFile
  2284. --for k, v in ipairs(loadedFile) do
  2285. -- table.insert(pokemon, loadedFile)
  2286. --end
  2287.  
  2288.  
  2289. for i = 1,3 do
  2290. selectMon1()
  2291. end
  2292. --debugging2()
  2293. for i = 1,3 do
  2294. selectMon2()
  2295. end
  2296. --debugging2()
  2297. printPokemon()
  2298. --debugging2()
  2299. turnOne()
  2300. --debugging2()
  2301. while true do
  2302. choice = false
  2303. while choice == false do
  2304. battle()
  2305. end
  2306. --resolveTurn()
  2307. checkFaint()
  2308. if faint == true then
  2309. break
  2310. end
  2311. resist = 1
  2312. weakness = 1
  2313. end
  2314.  
  2315. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement