2021-04-23 10:21:54 +02:00
|
|
|
local PageParent = require "scenes.overworld.screens.mainmenu.character.pageparent"
|
|
|
|
local BasicPage = PageParent:extend()
|
2020-08-29 17:26:38 +02:00
|
|
|
|
|
|
|
local menu = require "game.modules.menus.fancy"
|
|
|
|
local gui = require "game.modules.gui"
|
|
|
|
local const = require "scenes.overworld.screens.mainmenu.const"
|
|
|
|
|
2020-10-04 09:26:49 +02:00
|
|
|
local ComplexHPBar = require "game.modules.gui.complexhpbar"
|
|
|
|
|
|
|
|
local HPBAR_SIZE = 80
|
|
|
|
|
2020-08-29 17:26:38 +02:00
|
|
|
function BasicPage:new(view, character)
|
|
|
|
self.view = view
|
|
|
|
self.character = game.characters.list[character]
|
|
|
|
|
|
|
|
self.statBox = gui.newTextBox("assets/gui/dialogbox.png", const.CHARPAGESIZE, 48+8)
|
|
|
|
self.nameBox = gui.newTextBox("assets/gui/dialogbox.png", const.CHARPAGESIZE, 40)
|
2020-10-04 09:26:49 +02:00
|
|
|
|
|
|
|
self.hpbar = ComplexHPBar(HPBAR_SIZE)
|
|
|
|
self.ppbar = ComplexHPBar(HPBAR_SIZE)
|
|
|
|
self.hpbar:setColorForeground(248/255, 160/255, 0, 1)
|
|
|
|
self.hpbar:setColorBackground(112/255, 0, 0)
|
|
|
|
self.ppbar:setColorForeground(0, 248/255, 248/255, 1)
|
|
|
|
self.ppbar:setColorBackground(0, 54/255, 229/255)
|
2020-08-29 17:26:38 +02:00
|
|
|
|
2021-04-23 10:21:54 +02:00
|
|
|
BasicPage.super.new(self, view, character, {})
|
2020-08-29 17:26:38 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
function BasicPage:draw()
|
|
|
|
self:drawIdentity(const.X, const.Y)
|
2020-10-04 09:26:49 +02:00
|
|
|
self:drawHPPP(const.X, const.Y + 48)
|
2020-08-29 17:26:38 +02:00
|
|
|
self:drawLevel(const.X, 100)
|
2021-04-23 10:21:54 +02:00
|
|
|
self:drawWeakStrong(const.X, 160)
|
2020-08-29 17:26:38 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
function BasicPage:drawIdentity(x, y)
|
|
|
|
local identityString = self.character.fullname .. "\n"
|
|
|
|
identityString = identityString .. "Class: " .. self.character.data.class
|
|
|
|
|
|
|
|
love.graphics.draw(self.nameBox, x, y)
|
|
|
|
self.view.scene.assets.fonts["small"]:draw(identityString, x + 6, y + 4, -1, "left")
|
|
|
|
end
|
|
|
|
|
2020-10-04 09:26:49 +02:00
|
|
|
function BasicPage:drawHPPP(x, y)
|
2021-07-03 09:51:19 +02:00
|
|
|
local stats = self.character.stats
|
2020-10-04 09:26:49 +02:00
|
|
|
self.view.scene.assets.fonts["hudnbrs_small"]:set()
|
2021-07-03 09:51:19 +02:00
|
|
|
self.hpbar:drawWithLabels(x, y - 4, self.character.hp, stats:get(stats.HPMAX))
|
2020-10-04 09:26:49 +02:00
|
|
|
local xx = x + const.CHARPAGESIZE - HPBAR_SIZE - 7
|
2021-07-03 09:51:19 +02:00
|
|
|
self.ppbar:drawWithLabels(xx, y - 4, self.character.pp, stats:get(stats.PPMAX))
|
2020-10-04 09:26:49 +02:00
|
|
|
end
|
|
|
|
|
2020-08-29 17:26:38 +02:00
|
|
|
function BasicPage:drawLevel(x, y)
|
|
|
|
local levelString = "Level: " .. self.character.level .. "\n"
|
|
|
|
local levelString = levelString .. "Current exp: " .. self.character.exp .. "\n"
|
|
|
|
local levelString = levelString .. "Next level: " .. self.character.exp_next
|
|
|
|
|
|
|
|
love.graphics.draw(self.statBox, x, y)
|
|
|
|
self.view.scene.assets.fonts["small"]:draw(levelString, x + 6, y + 4, -1, "left")
|
|
|
|
end
|
|
|
|
|
|
|
|
function BasicPage:drawWeakStrong(x, y)
|
2021-04-23 10:21:54 +02:00
|
|
|
local weakString = "Weak to: Nothing"--"Earth, Lightning"
|
|
|
|
local strongString = "Resist To: Nothing"
|
2020-08-29 17:26:38 +02:00
|
|
|
|
|
|
|
love.graphics.draw(self.nameBox, x, y)
|
|
|
|
self.view.scene.assets.fonts["small"]:draw(weakString .. "\n" .. strongString, x + 6, y + 4, -1, "left")
|
|
|
|
end
|
|
|
|
|
|
|
|
return BasicPage
|