mirror of
https://github.com/Qsgs-Fans/FreeKill.git
synced 2024-11-16 19:58:13 +08:00
cc271bcdf8
* support fkp * get default setting in qml * correct zixing * mark * TODO: parse fkp in c++ * scale the drawer * free assign * fix free assign bug * add submodule for official generals * generate fkp in cpp code * use UTF-8 in windows conhost * use onUse for regular skill * active skill for fkp * add fkp function; change data for DMG and Heal * add cancelable to askForDiscard * don't let generals naked * config bg and bgm * fix exists for win * bugfix: rewardandpunish * fkp: vs skill * room config * observe * god_salavation * fkp: judge * add read storage permission for android build * remove submodule fk_official * remove include/ * use a submodule as include directory * libgit2 * remove debugging 'downloadNewPack' * libgit2.dll for Windows * rewrite system_enum, disable dangerous function * fix bug in trigger() * filter skill * filter judgement card * add about page for git2 * very basic general detail * FKP: status skill * libgit: android test * libgit: build for android * 1 * libgit2.dll * android: load qm file after copy asset * filter skill: if no filter skill then remove filtered card * allow warning and critical to show a popup, and fix warnings from QML * resource: move general audio/image to packages/ * move assets of cards * FKP: modify * use sqlite db to manage packages * packman cli * packman gui * use Popup for error dialog * android full screen note * fix android ssl problem
64 lines
1.5 KiB
Lua
64 lines
1.5 KiB
Lua
---@class Package : Object
|
|
---@field name string
|
|
---@field extensionName string
|
|
---@field type PackageType
|
|
---@field generals General[]
|
|
---@field extra_skills Skill[]
|
|
---@field related_skills table<string, string>
|
|
---@field cards Card[]
|
|
local Package = class("Package")
|
|
|
|
---@alias PackageType integer
|
|
|
|
Package.GeneralPack = 1
|
|
Package.CardPack = 2
|
|
Package.SpecialPack = 3
|
|
|
|
function Package:initialize(name, _type)
|
|
assert(type(name) == "string")
|
|
assert(type(_type) == "nil" or type(_type) == "number")
|
|
self.name = name
|
|
self.extensionName = name -- used for get assets
|
|
self.type = _type or Package.GeneralPack
|
|
|
|
self.generals = {}
|
|
self.extra_skills = {} -- skill not belongs to any generals, like "jixi"
|
|
self.related_skills = {}
|
|
self.cards = {}
|
|
end
|
|
|
|
---@return Skill[]
|
|
function Package:getSkills()
|
|
local ret = {table.unpack(self.related_skills)}
|
|
if self.type == Package.GeneralPack then
|
|
for _, g in ipairs(self.generals) do
|
|
for _, s in ipairs(g.skills) do
|
|
table.insert(ret, s)
|
|
end
|
|
end
|
|
end
|
|
return ret
|
|
end
|
|
|
|
---@param general General
|
|
function Package:addGeneral(general)
|
|
assert(general.class and general:isInstanceOf(General))
|
|
table.insertIfNeed(self.generals, general)
|
|
end
|
|
|
|
---@param card Card
|
|
function Package:addCard(card)
|
|
assert(card.class and card:isInstanceOf(Card))
|
|
card.package = self
|
|
table.insert(self.cards, card)
|
|
end
|
|
|
|
---@param cards Card[]
|
|
function Package:addCards(cards)
|
|
for _, card in ipairs(cards) do
|
|
self:addCard(card)
|
|
end
|
|
end
|
|
|
|
return Package
|