JustDoesGames

FOR DISCORD TESTING

Jan 1st, 2020
447
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.75 KB | None | 0 0
  1. -- Pokemon in Computercraft --
  2.  
  3. local w,h = term.getSize()
  4. if not term.isColor() or w ~= 51 or h ~= 19 then return printError("Computer needs to be of specs: 51x19 w/ color") end
  5. if not fs.exists(shell.dir().."/maps/mp.lua") then return printError("Mp file was not found: "..shell.dir().."/maps/mp.lua") end
  6.  
  7. -- Main Functions --
  8. function clr() return term.clear() end
  9. function cp(x,y) return term.setCursorPos(x,y) end
  10. function setText(col) return term.setTextColor(colors[col]) end
  11. function setBack(col) return term.setBackgroundColor(colors[col]) end
  12. function notnil(vari) if vari == nil then return false else return true end end
  13. -- Main Functions --
  14.  
  15.  
  16.  
  17. --[[
  18.  
  19. Pokemon Information:
  20.  
  21.  - Name (user name, default name, trainer name, other)
  22.  - Type (water, fire, grass, other)
  23.  - Current Health (party members, wild encounters, and trainers)
  24.  
  25.  - Max Health /
  26.  - Attack ==\
  27.  - Defense == Base Stats
  28.  - Speed ===/
  29.  
  30. Pokemon Pokedex Data:
  31.  
  32.  - Id (location inside the pokedex) = table index
  33.  - Name (base name, not the name of the user pokemon) = 1
  34.  - Type (water, fire, ground, and more) = 2
  35.  - Species (bird, deer, other things like that) = 3
  36.  - Height (6'10'') = 4
  37.  - Weight (6.9 kg) = 5
  38.  - Growth Rate (exp over time. slow med fast) = 6
  39.  - Growth Rate (Fast Medium Slow) = 7
  40.  - Evolution level = 8
  41.  - Entry (Description) = 9
  42.  
  43.  !! HIDDEN STATS !!
  44.  - Base HP = added 10
  45.  - Base Attack = added 11
  46.  - Base Defense = added 12
  47.  - Base Speed = added 13
  48.  !! HIDDEN STATS !!
  49.  
  50.  !! USER POKEMON STATS !!
  51.  - Current Health 14
  52.  - Lv 15
  53.  !! USER POKEMON STATS !!
  54.  
  55.  
  56.  - Locations (where in the world it can be found) = left out
  57.  - Catch Rate (you have a 10% chance of catching this thing) = left out
  58.  
  59. ]]
  60.  
  61. local px,py = math.ceil(w/2), math.ceil(h/2)
  62. local scrollx,scrolly = 1,1
  63. local direction = 5
  64. local colision = {}
  65. local cols = {"white", "orange", "magenta", "lightBlue", "yellow", "lime", "pink", "gray", "lightGray", "cyan", "purple", "blue", "brown", "green", "red", "black"}
  66. --               1         2         3            4          5        6       7       8          9        10       11       12       13       14      15      16
  67. --               a         b         c            d          e        f       g       h          i        j        k        l        m        n       o       p
  68.  
  69. local pokemon = {
  70.  
  71. --{"", {""}, " Pokemon", "0.7 m (2'04'')", "6.9 kg (15.2 lbs)", , "", , ""},  BASE POKEMON TEMPLATE
  72. {"Bulbasaur", {"Grass", "Poison"}, "Seed Pokemon", "0.7 m (2'04'')", "6.9 kg (15.2 lbs)", 64, "Medium", 16, "A strange seed was planted on its back at birth. The plant sprouts and grows with this POKéMON.", 45,49,49,45},
  73. {"Ivysaur", {"Grass", "Poison"}, "Seed Pokemon", "1.0 m (3'03'')", "13.0 kg (28.7 lbs)", 142, "Medium", 32, "When the bulb on its back grows large, it appears to lose the ability to stand on its hind legs.", 60,62,63,60},
  74. {"Venusaur", {"Grass", "Poison"}, "Seed Pokemon", "2.0 m (6'07'')", "100.0 kg (220.5 lbs)", 236, "Medium", 0, "The plant blooms when it is absorbing solar energy. It stays on the move to seek sunlight.", 80,82,83,80},
  75. {"Charmander", {"Fire"}, "Lizard Pokemon", "0.6 m (2'00'')", "8.5 kg (18.7 lbs)", 62, "Medium", 16, "Obviously prefers hot places. When it rains, steam is said to spout from the tip of its tail.", 39,52,43,65},
  76. {"Charmeleon", {"Fire"}, "Flame Pokemon", "1.1 m (3'07'')", "19.0 kg (41.9 lbs)", 142, "Medium", 36, "When it swings its burning tail, it elevates the temperature to unbearably high levels.", 58,64,58,80},
  77. {"Charizard", {"Fire", "Flying"}, "Flame Pokemon", "1.7 m (5'07'')", "90.5 kg (199.5 lbs)", 240, "Medium", 0, "Spits fire that is hot enough to melt boulders. Known to cause forest fires unintentionally.", 78,84,78,100},
  78. {"Squirtle", {"Water"}, "Turtle Pokemon", "0.5 m (1'08'')", "9.0 kg (19.8 lbs)", 63, "Medium", 16, "After birth, its back swells and hardens into a shell. Powerfully sprays foam from its mouth.", 44,48,65,43},
  79. {"Wartortle", {"Water"}, "Turtle Pokemon", "1.0 m (3'03'')", "22.5 kg (49.6 lbs)", 142, "Medium", 36, "Often hides in water to stalk unwary prey. For swimming fast, it moves its ears to maintain balance.", 59,63,80,58},
  80. {"Blastoise", {"Water"}, "Shellfish Pokemon", "1.6 m (5'03'')", "85.5 kg (188.5 lbs)", 239, "Medium", 0, "A brutal POKéMON with pressurized water jets on its shell. They are used for high speed tackles.", 79,83,100,78},
  81.  
  82. }
  83.  
  84. userpokemon = {}
  85. function createUserPokemon(pokedexid,current_health,lv)
  86.     if notnil(pokemon[pokedexid]) and #userpokemon < 6 then
  87.         table.insert(userpokemon, pokemon[pokedexid]) -- copy pokemon from pokemon list above
  88.         userpokemon[#userpokemon][10] = math.random(userpokemon[#userpokemon][10]-8, userpokemon[#userpokemon][10]+8)+math.floor(lv/2) -- random HP
  89.         userpokemon[#userpokemon][11] = math.random(userpokemon[#userpokemon][11]-8, userpokemon[#userpokemon][11]+8)+math.floor(lv/2) -- random Attack
  90.         userpokemon[#userpokemon][12] = math.random(userpokemon[#userpokemon][12]-8, userpokemon[#userpokemon][12]+8)+math.floor(lv/2) -- random Defense
  91.         userpokemon[#userpokemon][13] = math.random(userpokemon[#userpokemon][13]-8, userpokemon[#userpokemon][13]+8)+math.floor(lv/2) -- random Speed
  92.        
  93.         if current_health >= 0 then
  94.             table.insert(userpokemon[#userpokemon], current_health)
  95.         else
  96.             --error("")
  97.             if current_health == -50 then
  98.                 table.insert(userpokemon[#userpokemon], math.ceil(userpokemon[#userpokemon][10]/2))
  99.             else
  100.                 table.insert(userpokemon[#userpokemon], userpokemon[#userpokemon][10])
  101.             end
  102.         end
  103.         table.insert(userpokemon[#userpokemon], lv)
  104.     end
  105. end
  106. createUserPokemon(1,10,5)
  107. createUserPokemon(2,-1,5)
  108. createUserPokemon(2,-1,5)
  109. createUserPokemon(2,-1,5)
  110. createUserPokemon(2,-1,5)
  111.  
  112. for i=1, #userpokemon do
  113.     print(userpokemon[i][14].."/"..userpokemon[i][10])
  114. end
  115. error()
Advertisement
Add Comment
Please, Sign In to add comment