mirror of
https://github.com/Qsgs-Fans/FreeKill.git
synced 2024-11-16 11:42:45 +08:00
dedde94643
* the process of using card (uncompleted) * code style: tab is 2 spaces(not \t or 4 space) * update lua54.dll to MinGW version(no cygwin1.dll required) * basic ui logic * ActiveSkill * modidy ActiveSkill defaults * todo: defaultEquipSkill * client * send use card to server * playing phase, equip Co-authored-by: Ho-spair <linyuy@163.com>
39 lines
946 B
Lua
39 lines
946 B
Lua
---@class General : Object
|
|
---@field package Package
|
|
---@field name string
|
|
---@field kingdom string
|
|
---@field hp integer
|
|
---@field maxHp integer
|
|
---@field gender Gender
|
|
---@field skills Skill[]
|
|
---@field 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
|
|
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
|
|
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)
|
|
end
|
|
end
|
|
|
|
return General
|