PokeBot/util/paint.lua

58 lines
1.4 KiB
Lua

local paint = {}
local memory = require "util.memory"
local player = require "util.player"
local utils = require "util.utils"
local inventory = require "storage.inventory"
local pokemon = require "storage.pokemon"
local encounters = 0
local elapsedTime = utils.elapsedTime
function paint.draw(currentMap)
local px, py = player.position()
gui.text(0, 14, currentMap..": "..px.." "..py)
gui.text(0, 0, elapsedTime())
if memory.value("battle", "our_id") > 0 then
local hp = pokemon.index(0, "hp")
local hpStatus
if hp == 0 then
hpStatus = "DEAD"
elseif hp <= math.ceil(pokemon.index(0, "max_hp") * 0.2) then
hpStatus = "RED"
end
if hpStatus then
gui.text(120, 7, hpStatus)
end
end
local nidx = pokemon.indexOf("nidoran", "nidorino", "nidoking")
if nidx ~= -1 then
local att = pokemon.index(nidx, "attack")
local def = pokemon.index(nidx, "defense")
local spd = pokemon.index(nidx, "speed")
local scl = pokemon.index(nidx, "special")
gui.text(100, 0, att.." "..def.." "..spd.." "..scl)
end
local enc = " encounter"
if encounters ~= 1 then
enc = enc.."s"
end
gui.text(0, 116, memory.value("battle", "critical"))
gui.text(0, 125, memory.value("player", "repel"))
gui.text(0, 134, encounters..enc)
return true
end
function paint.wildEncounters(count)
encounters = count
end
function paint.reset()
encounters = 0
end
return paint