PokeBot/util/paint.lua

58 lines
1.4 KiB
Lua
Raw Normal View History

2015-04-06 01:18:46 -07:00
local Paint = {}
2014-07-12 18:47:39 -07:00
2015-04-06 01:18:46 -07:00
local Memory = require "util.memory"
local Player = require "util.player"
local Utils = require "util.utils"
2014-07-12 18:47:39 -07:00
2015-04-06 01:18:46 -07:00
local Pokemon = require "storage.pokemon"
2014-07-12 18:47:39 -07:00
local encounters = 0
2015-04-06 01:18:46 -07:00
local elapsedTime = Utils.elapsedTime
2015-04-07 19:06:29 -07:00
local drawText = Utils.drawText
2014-07-12 18:47:39 -07:00
2015-04-06 01:18:46 -07:00
function Paint.draw(currentMap)
local px, py = Player.position()
2015-04-07 19:06:29 -07:00
drawText(0, 14, currentMap..": "..px.." "..py)
drawText(0, 0, elapsedTime())
2014-07-12 18:47:39 -07:00
2015-04-06 01:18:46 -07:00
if Memory.value("battle", "our_id") > 0 then
2015-04-08 01:51:38 -07:00
local curr_hp = Pokemon.index(0, "hp")
2014-07-12 18:47:39 -07:00
local hpStatus
2015-04-08 01:51:38 -07:00
if curr_hp == 0 then
2014-07-12 18:47:39 -07:00
hpStatus = "DEAD"
2015-04-08 01:51:38 -07:00
elseif curr_hp <= math.ceil(Pokemon.index(0, "max_hp") * 0.2) then
2014-07-12 18:47:39 -07:00
hpStatus = "RED"
end
if hpStatus then
2015-04-07 19:06:29 -07:00
drawText(120, 7, hpStatus)
2014-07-12 18:47:39 -07:00
end
end
2015-04-06 01:18:46 -07:00
local nidx = Pokemon.indexOf("nidoran", "nidorino", "nidoking")
if nidx ~= -1 then
2015-04-06 01:18:46 -07:00
local att = Pokemon.index(nidx, "attack")
local def = Pokemon.index(nidx, "defense")
local spd = Pokemon.index(nidx, "speed")
local scl = Pokemon.index(nidx, "special")
2015-04-07 19:06:29 -07:00
drawText(100, 0, att.." "..def.." "..spd.." "..scl)
2014-07-12 18:47:39 -07:00
end
local enc = " encounter"
if encounters ~= 1 then
2014-07-12 18:47:39 -07:00
enc = enc.."s"
end
2015-04-07 19:06:29 -07:00
drawText(0, 116, Memory.value("battle", "critical"))
drawText(0, 125, Memory.value("player", "repel"))
drawText(0, 134, encounters..enc)
2014-07-12 18:47:39 -07:00
return true
end
2015-04-06 01:18:46 -07:00
function Paint.wildEncounters(count)
2014-07-12 18:47:39 -07:00
encounters = count
end
2015-04-06 01:18:46 -07:00
function Paint.reset()
2014-07-12 18:47:39 -07:00
encounters = 0
end
2015-04-06 01:18:46 -07:00
return Paint