Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Pokemon in Computercraft --
- local w,h = term.getSize()
- if not term.isColor() or w ~= 51 or h ~= 19 then return printError("Computer needs to be of specs: 51x19 w/ color") end
- if not fs.exists(shell.dir().."/maps/mp.lua") then return printError("Mp file was not found: "..shell.dir().."/maps/mp.lua") end
- -- Main Functions --
- function clr() return term.clear() end
- function cp(x,y) return term.setCursorPos(x,y) end
- function setText(col) return term.setTextColor(colors[col]) end
- function setBack(col) return term.setBackgroundColor(colors[col]) end
- function notnil(vari) if vari == nil then return false else return true end end
- -- Main Functions --
- --[[
- Pokemon Information:
- - Name (user name, default name, trainer name, other)
- - Type (water, fire, grass, other)
- - Current Health (party members, wild encounters, and trainers)
- - Max Health /
- - Attack ==\
- - Defense == Base Stats
- - Speed ===/
- Pokemon Pokedex Data:
- - Id (location inside the pokedex) = table index
- - Name (base name, not the name of the user pokemon) = 1
- - Type (water, fire, ground, and more) = 2
- - Species (bird, deer, other things like that) = 3
- - Height (6'10'') = 4
- - Weight (6.9 kg) = 5
- - Growth Rate (exp over time. slow med fast) = 6
- - Growth Rate (Fast Medium Slow) = 7
- - Evolution level = 8
- - Entry (Description) = 9
- !! HIDDEN STATS !!
- - Base HP = added 10
- - Base Attack = added 11
- - Base Defense = added 12
- - Base Speed = added 13
- !! HIDDEN STATS !!
- !! USER POKEMON STATS !!
- - Current Health 14
- - Lv 15
- !! USER POKEMON STATS !!
- - Locations (where in the world it can be found) = left out
- - Catch Rate (you have a 10% chance of catching this thing) = left out
- ]]
- local px,py = math.ceil(w/2), math.ceil(h/2)
- local scrollx,scrolly = 1,1
- local direction = 5
- local colision = {}
- local cols = {"white", "orange", "magenta", "lightBlue", "yellow", "lime", "pink", "gray", "lightGray", "cyan", "purple", "blue", "brown", "green", "red", "black"}
- -- 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
- -- a b c d e f g h i j k l m n o p
- local pokemon = {
- --{"", {""}, " Pokemon", "0.7 m (2'04'')", "6.9 kg (15.2 lbs)", , "", , ""}, BASE POKEMON TEMPLATE
- {"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},
- {"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},
- {"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},
- {"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},
- {"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},
- {"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},
- {"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},
- {"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},
- {"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},
- }
- userpokemon = {}
- function createUserPokemon(pokedexid,current_health,lv)
- if notnil(pokemon[pokedexid]) and #userpokemon < 6 then
- table.insert(userpokemon, pokemon[pokedexid]) -- copy pokemon from pokemon list above
- userpokemon[#userpokemon][10] = math.random(userpokemon[#userpokemon][10]-8, userpokemon[#userpokemon][10]+8)+math.floor(lv/2) -- random HP
- userpokemon[#userpokemon][11] = math.random(userpokemon[#userpokemon][11]-8, userpokemon[#userpokemon][11]+8)+math.floor(lv/2) -- random Attack
- userpokemon[#userpokemon][12] = math.random(userpokemon[#userpokemon][12]-8, userpokemon[#userpokemon][12]+8)+math.floor(lv/2) -- random Defense
- userpokemon[#userpokemon][13] = math.random(userpokemon[#userpokemon][13]-8, userpokemon[#userpokemon][13]+8)+math.floor(lv/2) -- random Speed
- if current_health >= 0 then
- table.insert(userpokemon[#userpokemon], current_health)
- else
- --error("")
- if current_health == -50 then
- table.insert(userpokemon[#userpokemon], math.ceil(userpokemon[#userpokemon][10]/2))
- else
- table.insert(userpokemon[#userpokemon], userpokemon[#userpokemon][10])
- end
- end
- table.insert(userpokemon[#userpokemon], lv)
- end
- end
- createUserPokemon(1,10,5)
- createUserPokemon(2,-1,5)
- createUserPokemon(2,-1,5)
- createUserPokemon(2,-1,5)
- createUserPokemon(2,-1,5)
- for i=1, #userpokemon do
- print(userpokemon[i][14].."/"..userpokemon[i][10])
- end
- error()
Advertisement
Add Comment
Please, Sign In to add comment