mirror of
https://github.com/Qsgs-Fans/FreeKill.git
synced 2024-11-16 11:42:45 +08:00
58ea0ca80a
* standard generals * assignrole * arrangeSeat * fix bugs
30 lines
761 B
Lua
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
|