sonic-radiance/sonic-radiance.love/game/abstractmobs/character/datas.lua

38 lines
884 B
Lua

local CharacterData = Object:extend()
local charutils = require "game.utils.characters"
function CharacterData:getCommonData()
self.data = charutils.getCharacterData(self.simplename)
self.name = self.data.name
self.fullname = self.data.fullname
self.turns = self.data.turns
end
function CharacterData:getData()
local data = {}
data.simplename = self.simplename
data.level = self.level
data.exp = self.exp
data.exp_next = self.exp_next
data.hp = self.hp
data.pp = self.pp
data.statuts = self.statuts
return data
end
function CharacterData:setData(data)
self.simplename = data.simplename
self:getCommonData()
self.level = data.level
self.exp = data.exp
self.exp_next = data.exp_next
self:createStats()
self.hp = data.hp
self.pp = data.pp
self.statuts = data.statuts
end
return CharacterData