mirror of
https://github.com/Qsgs-Fans/FreeKill.git
synced 2024-11-16 11:42:45 +08:00
a1ae83c562
将文档系统改成Sphinx,并增加了新CI
46 lines
1.2 KiB
Lua
46 lines
1.2 KiB
Lua
---@class General : Object
|
|
---@field public package Package
|
|
---@field public name string
|
|
---@field public trueName string
|
|
---@field public kingdom string
|
|
---@field public hp integer
|
|
---@field public maxHp integer
|
|
---@field public gender Gender
|
|
---@field public skills Skill[]
|
|
---@field public other_skills string[]
|
|
General = class("General")
|
|
|
|
---@alias Gender integer
|
|
|
|
General.Male = 1
|
|
General.Female = 2
|
|
|
|
function General:initialize(package, name, kingdom, hp, maxHp, gender)
|
|
self.package = package
|
|
self.name = name
|
|
local name_splited = name:split("__")
|
|
self.trueName = name_splited[#name_splited]
|
|
|
|
self.kingdom = kingdom
|
|
self.hp = hp
|
|
self.maxHp = maxHp or hp
|
|
self.gender = gender or General.Male
|
|
|
|
self.skills = {} -- skills first added to this general
|
|
self.other_skills = {} -- skill belongs other general, e.g. "mashu" of pangde
|
|
|
|
package:addGeneral(self)
|
|
end
|
|
|
|
---@param skill Skill
|
|
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)
|
|
skill.package = self.package
|
|
end
|
|
end
|
|
|
|
return General
|