FreeKill/lua/core/general.lua
Notify-ctrl 58ea0ca80a
Role & Seat (#6)
* standard generals

* assignrole

* arrangeSeat

* fix bugs
2022-03-28 22:24:30 +08:00

30 lines
761 B
Lua

General = class("General")
-- enum Gender
General.Male = 0
General.Female = 1
function General:initialize(package, name, kingdom, hp, maxHp, gender, initialHp)
self.package = package
self.name = name
self.kingdom = kingdom
self.hp = hp
self.maxHp = maxHp or hp
self.gender = gender or General.Male
self.initialHp = initialHp or maxHp
self.skills = {} -- Skill[]
-- skill belongs other general, e.g. "mashu" of pangde
self.other_skills = {} -- string[]
end
function General:addSkill(skill)
if (type(skill) == "string") then
table.insert(self.other_skills, skill)
elseif (skill.class and skill.class:isSubclassOf(Skill)) then
table.insert(self.skills, skill)
end
end
return General