FreeKill/lua/core/skill.lua
notify 694deecdf1
Fixbug (#74)
- 修复ak和咆哮失效
- 修复服务端调viewAs的时候缺个Self
- 修复不能显示数字型标记
- 新函数player:gainAnExtraTurn,可用来进行额外回合
2023-03-13 20:51:12 +08:00

55 lines
1.3 KiB
Lua

---@class Skill : Object
---@field name string
---@field trueName string
---@field package Package
---@field frequency Frequency
---@field visible boolean
---@field mute boolean
---@field anim_type string
---@field related_skills Skill[]
---@field attached_equip string
local Skill = class("Skill")
---@alias Frequency integer
Skill.Frequent = 1
Skill.NotFrequent = 2
Skill.Compulsory = 3
Skill.Limited = 4
Skill.Wake = 5
function Skill:initialize(name, frequency)
-- TODO: visible, lord, etc
self.name = name
-- skill's package is assigned when calling General:addSkill
-- if you need skills that not belongs to any general (like 'jixi')
-- then you should assign skill.package explicitly
self.package = { extensionName = "standard" }
self.frequency = frequency
self.visible = true
self.mute = false
self.anim_type = ""
self.related_skills = {}
local name_splited = name:split("__")
self.trueName = name_splited[#name_splited]
if string.sub(name, 1, 1) == "#" then
self.visible = false
end
self.attached_equip = nil
end
---@param skill Skill
function Skill:addRelatedSkill(skill)
table.insert(self.related_skills, skill)
end
---@return boolean
function Skill:isEquipmentSkill()
return self.attached_equip and type(self.attached_equip) == 'string' and self.attached_equip ~= ""
end
return Skill