feat: handle better not having enough pp

Fixes #68
This commit is contained in:
Kazhnuz 2021-03-13 17:28:25 +01:00
parent c521ae3c58
commit 17b3e4e172

View file

@ -104,8 +104,13 @@ function widgets.SkillWidget:new(character, menu_name, skill)
label2 = "0" .. label2 label2 = "0" .. label2
end end
end end
local color = {1, 1, 1}
if (self.skilldata.cost > character.abstract.pp) then
color = {1, 0.3, 0.3}
end
widgets.SkillWidget.super.new(self, character, menu_name, self.skilldata.fullname, "-" .. label2, "skills") widgets.SkillWidget.super.new(self, character, menu_name, self.skilldata.fullname, "-" .. label2, "skills")
self.color = color
end end
function widgets.SkillWidget:sendCharacterData() function widgets.SkillWidget:sendCharacterData()
@ -117,6 +122,7 @@ function widgets.SkillWidget:sendCharacterData()
core.debug:warning("cbs/menu", "skill " .. self.skillname .. " doesn't exist") core.debug:warning("cbs/menu", "skill " .. self.skillname .. " doesn't exist")
self.character:doNothing() self.character:doNothing()
self.assets.sfx["mError"]:play() self.assets.sfx["mError"]:play()
self.scene.turns.hud:showMessage("You haven't enough PP!")
end end
end end