插件哟,boolean就让他默认可以为nil好不好呀

This commit is contained in:
notify 2023-08-11 03:30:59 +08:00
parent aa05984522
commit 32844bc394
11 changed files with 107 additions and 106 deletions

View File

@ -137,9 +137,9 @@ on_trigger在非常多情况下仅仅只是简单的执行一下doCost而已
---@field moveReason CardMoveReason
---@field proposer integer
---@field skillName string|null
---@field moveVisible boolean|null
---@field moveVisible bool
---@field specialName string|null
---@field specialVisible boolean|null
---@field specialVisible bool
moveCards函数的第一步是将参数中所有的moveInfo都转化为CardsMoveStruct。CardsMoveStruct与CardsMoveInfo几乎没有区别除了它将每一张牌都单独划分出了一个moveinfo之外。这么做是为了在同时移动来源不同的牌的时候让牌能该明牌明牌该暗牌暗牌。

View File

@ -24,7 +24,7 @@
---@field public special_skills string[] | nil @ 衍生技能,如重铸
---@field public is_damage_card boolean @ 是否为会造成伤害的牌
---@field public multiple_targets boolean @ 是否为指定多个目标的牌
---@field public is_derived boolean|null @ 判断是否为衍生牌
---@field public is_derived bool @ 判断是否为衍生牌
local Card = class("Card")
---@alias Suit integer
@ -238,7 +238,7 @@ function Card:matchPattern(pattern)
end
--- 获取卡牌花色并返回花色文字描述(如 黑桃、红桃、梅花、方块)或者符号(如♠♥♣♦,带颜色)。
---@param symbol boolean|nil @ 是否以符号形式显示
---@param symbol bool @ 是否以符号形式显示
---@return string @ 描述花色的字符串
function Card:getSuitString(symbol)
local suit = self.suit
@ -430,7 +430,7 @@ end
--- 比较两张卡牌的花色是否相同
---@param anotherCard Card @ 另一张卡牌
---@param diff boolean|nil @ 比较二者相同还是不同
---@param diff bool @ 比较二者相同还是不同
---@return boolean 返回比较结果
function Card:compareSuitWith(anotherCard, diff)
if self ~= anotherCard and table.contains({ self.suit, anotherCard.suit }, Card.NoSuit) then

View File

@ -397,7 +397,7 @@ end
--- 根据id返回相应的卡牌。
---@param id integer @ 牌的id
---@param ignoreFilter boolean|nil @ 是否要无视掉锁定视为技,直接获得真牌
---@param ignoreFilter bool @ 是否要无视掉锁定视为技,直接获得真牌
---@return Card @ 这个id对应的卡牌
function Engine:getCardById(id, ignoreFilter)
if id == nil then return nil end

View File

@ -103,8 +103,8 @@ end
--- 设置角色、体力、技能。
---@param general General @ 角色类型
---@param setHp boolean|nil @ 是否设置体力
---@param addSkills boolean|nil @ 是否增加技能
---@param setHp bool @ 是否设置体力
---@param addSkills bool @ 是否增加技能
function Player:setGeneral(general, setHp, addSkills)
self.general = general.name
if setHp then
@ -354,7 +354,7 @@ end
--- 返回所有“如手牌般使用或打出”的牌。
--- 或者说,返回所有名字以“&”结尾的pile的牌。
---@param include_hand boolean|nil @ 是否包含真正的手牌
---@param include_hand bool @ 是否包含真正的手牌
---@return integer[]
function Player:getHandlyIds(include_hand)
local ret = include_hand and self:getCardIds("h") or {}
@ -445,7 +445,7 @@ end
--- 通过 二者位次+距离技能之和 与 两者间固定距离 进行对比,更大的为实际距离。
---@param other Player @ 其他玩家
---@param mode string|nil @ 计算模式(left/right/both)
---@param ignore_dead boolean|nil @ 是否忽略尸体
---@param ignore_dead bool @ 是否忽略尸体
function Player:distanceTo(other, mode, ignore_dead)
assert(other:isInstanceOf(Player))
mode = mode or "both"
@ -661,8 +661,8 @@ end
--- 检索玩家是否有对应技能。
---@param skill string | Skill @ 技能名
---@param ignoreNullified boolean|nil @ 忽略技能是否被无效
---@param ignoreAlive boolean|nil @ 忽略角色在场与否
---@param ignoreNullified bool @ 忽略技能是否被无效
---@param ignoreAlive bool @ 忽略角色在场与否
function Player:hasSkill(skill, ignoreNullified, ignoreAlive)
if not ignoreAlive and self.dead then
return false
@ -847,8 +847,8 @@ fk.SwitchYin = 1
--- 获取转换技状态
---@param skillName string @ 技能名
---@param afterUse boolean|nil @ 是否提前计算转换后状态
---@param inWord boolean|nil @ 是否返回文字
---@param afterUse bool @ 是否提前计算转换后状态
---@param inWord bool @ 是否返回文字
---@return number|string @ 转换技状态
function Player:getSwitchSkillState(skillName, afterUse, inWord)
if afterUse then

View File

@ -100,7 +100,7 @@ end
---@param target ServerPlayer @ Player who triggered this event
---@param player ServerPlayer @ Player who is operating
---@param data any @ useful data of the event
---@return boolean|nil
---@return bool
function TriggerSkill:use(event, target, player, data) end
function TriggerSkill:canWake(event, target, player, data)

View File

@ -77,9 +77,9 @@ end
---@class StatusSkillSpec: StatusSkill
---@alias TrigFunc fun(self: TriggerSkill, event: Event, target: ServerPlayer, player: ServerPlayer, data: any):boolean|nil
---@alias TrigFunc fun(self: TriggerSkill, event: Event, target: ServerPlayer, player: ServerPlayer, data: any):bool
---@class TriggerSkillSpec: UsableSkillSpec
---@field public global nil|boolean
---@field public global bool
---@field public events nil|Event | Event[]
---@field public refresh_events nil|Event | Event[]
---@field public priority nil|number | table<Event, number>
@ -165,15 +165,15 @@ function fk.CreateTriggerSkill(spec)
end
---@class ActiveSkillSpec: UsableSkillSpec
---@field public can_use nil|fun(self: ActiveSkill, player: Player, card: Card): boolean|nil
---@field public card_filter nil|fun(self: ActiveSkill, to_select: integer, selected: integer[], selected_targets: integer[]): boolean|nil
---@field public target_filter nil|fun(self: ActiveSkill, to_select: integer, selected: integer[], selected_cards: integer[], card: Card): boolean|nil
---@field public feasible nil|fun(self: ActiveSkill, selected: integer[], selected_cards: integer[]): boolean|nil
---@field public on_use nil|fun(self: ActiveSkill, room: Room, cardUseEvent: CardUseStruct): boolean|nil
---@field public about_to_effect nil|fun(self: ActiveSkill, room: Room, cardEffectEvent: CardEffectEvent): boolean|nil
---@field public on_effect nil|fun(self: ActiveSkill, room: Room, cardEffectEvent: CardEffectEvent): boolean|nil
---@field public on_nullified nil|fun(self: ActiveSkill, room: Room, cardEffectEvent: CardEffectEvent): boolean|nil
---@field public mod_target_filter nil|fun(self: ActiveSkill, to_select: integer, selected: integer[], user: integer, card: Card, distance_limited: boolean): boolean|nil
---@field public can_use nil|fun(self: ActiveSkill, player: Player, card: Card): bool
---@field public card_filter nil|fun(self: ActiveSkill, to_select: integer, selected: integer[], selected_targets: integer[]): bool
---@field public target_filter nil|fun(self: ActiveSkill, to_select: integer, selected: integer[], selected_cards: integer[], card: Card): bool
---@field public feasible nil|fun(self: ActiveSkill, selected: integer[], selected_cards: integer[]): bool
---@field public on_use nil|fun(self: ActiveSkill, room: Room, cardUseEvent: CardUseStruct): bool
---@field public about_to_effect nil|fun(self: ActiveSkill, room: Room, cardEffectEvent: CardEffectEvent): bool
---@field public on_effect nil|fun(self: ActiveSkill, room: Room, cardEffectEvent: CardEffectEvent): bool
---@field public on_nullified nil|fun(self: ActiveSkill, room: Room, cardEffectEvent: CardEffectEvent): bool
---@field public mod_target_filter nil|fun(self: ActiveSkill, to_select: integer, selected: integer[], user: integer, card: Card, distance_limited: boolean): bool
---@field public prompt nil|fun(self: ActiveSkill, selected: integer[], selected_cards: integer[]): string
---@field public interaction any
@ -217,11 +217,11 @@ function fk.CreateActiveSkill(spec)
end
---@class ViewAsSkillSpec: UsableSkillSpec
---@field public card_filter nil|fun(self: ViewAsSkill, to_select: integer, selected: integer[]): boolean|nil
---@field public card_filter nil|fun(self: ViewAsSkill, to_select: integer, selected: integer[]): bool
---@field public view_as fun(self: ViewAsSkill, cards: integer[]): Card|nil
---@field public pattern nil|string
---@field public enabled_at_play nil|fun(self: ViewAsSkill, player: Player): boolean|nil
---@field public enabled_at_response nil|fun(self: ViewAsSkill, player: Player, response: boolean): boolean|nil
---@field public enabled_at_play nil|fun(self: ViewAsSkill, player: Player): bool
---@field public enabled_at_response nil|fun(self: ViewAsSkill, player: Player, response: boolean): bool
---@field public before_use nil|fun(self: ViewAsSkill, player: ServerPlayer, use: CardUseStruct)
---@field public prompt nil|fun(self: ActiveSkill, selected: integer[], selected_cards: integer[]): string
@ -291,10 +291,10 @@ function fk.CreateDistanceSkill(spec)
end
---@class ProhibitSpec: StatusSkillSpec
---@field public is_prohibited nil|fun(self: ProhibitSkill, from: Player, to: Player, card: Card): boolean|nil
---@field public prohibit_use nil|fun(self: ProhibitSkill, player: Player, card: Card): boolean|nil
---@field public prohibit_response nil|fun(self: ProhibitSkill, player: Player, card: Card): boolean|nil
---@field public prohibit_discard nil|fun(self: ProhibitSkill, player: Player, card: Card): boolean|nil
---@field public is_prohibited nil|fun(self: ProhibitSkill, from: Player, to: Player, card: Card): bool
---@field public prohibit_use nil|fun(self: ProhibitSkill, player: Player, card: Card): bool
---@field public prohibit_response nil|fun(self: ProhibitSkill, player: Player, card: Card): bool
---@field public prohibit_discard nil|fun(self: ProhibitSkill, player: Player, card: Card): bool
---@param spec ProhibitSpec
---@return ProhibitSkill
@ -313,7 +313,7 @@ end
---@class AttackRangeSpec: StatusSkillSpec
---@field public correct_func nil|fun(self: AttackRangeSkill, from: Player, to: Player): number|nil
---@field public within_func nil|fun(self: AttackRangeSkill, from: Player, to: Player): boolean|nil
---@field public within_func nil|fun(self: AttackRangeSkill, from: Player, to: Player): bool
---@param spec AttackRangeSpec
---@return AttackRangeSkill
@ -336,7 +336,7 @@ end
---@class MaxCardsSpec: StatusSkillSpec
---@field public correct_func nil|fun(self: MaxCardsSkill, player: Player): number|nil
---@field public fixed_func nil|fun(self: MaxCardsSkill, player: Player): number|nil
---@field public exclude_from nil|fun(self: MaxCardsSkill, player: Player, card: Card): boolean|nil
---@field public exclude_from nil|fun(self: MaxCardsSkill, player: Player, card: Card): bool
---@param spec MaxCardsSpec
---@return MaxCardsSkill
@ -358,9 +358,9 @@ function fk.CreateMaxCardsSkill(spec)
end
---@class TargetModSpec: StatusSkillSpec
---@field public bypass_times nil|fun(self: TargetModSkill, player: Player, skill: ActiveSkill, scope: integer, card: Card, to: Player): boolean|nil
---@field public bypass_times nil|fun(self: TargetModSkill, player: Player, skill: ActiveSkill, scope: integer, card: Card, to: Player): bool
---@field public residue_func nil|fun(self: TargetModSkill, player: Player, skill: ActiveSkill, scope: integer, card: Card, to: Player): number|nil
---@field public bypass_distances nil|fun(self: TargetModSkill, player: Player, skill: ActiveSkill, card: Card, to: Player): boolean|nil
---@field public bypass_distances nil|fun(self: TargetModSkill, player: Player, skill: ActiveSkill, card: Card, to: Player): bool
---@field public distance_limit_func nil|fun(self: TargetModSkill, player: Player, skill: ActiveSkill, card: Card, to: Player): number|nil
---@field public extra_target_func nil|fun(self: TargetModSkill, player: Player, skill: ActiveSkill, card: Card): number|nil
@ -391,7 +391,7 @@ function fk.CreateTargetModSkill(spec)
end
---@class FilterSpec: StatusSkillSpec
---@field public card_filter nil|fun(self: FilterSkill, card: Card, player: Player): boolean|nil
---@field public card_filter nil|fun(self: FilterSkill, card: Card, player: Player): bool
---@field public view_as nil|fun(self: FilterSkill, card: Card, player: Player): Card|nil
---@param spec FilterSpec
@ -408,7 +408,7 @@ function fk.CreateFilterSkill(spec)
end
---@class InvaliditySpec: StatusSkillSpec
---@field public invalidity_func nil|fun(self: InvaliditySkill, from: Player, skill: Skill): boolean|nil
---@field public invalidity_func nil|fun(self: InvaliditySkill, from: Player, skill: Skill): bool
---@param spec InvaliditySpec
---@return InvaliditySkill
@ -426,8 +426,8 @@ end
---@field public skill nil|Skill
---@field public equip_skill nil|Skill
---@field public special_skills string[] | nil
---@field public is_damage_card nil|boolean
---@field public multiple_targets nil|boolean
---@field public is_damage_card bool
---@field public multiple_targets bool
local defaultCardSkill = fk.CreateActiveSkill{
name = "default_card_skill",

View File

@ -6,6 +6,7 @@
-- Just for convenience when using sumneko.lua
---@alias null nil
---@alias bool boolean | nil
---@class fk
---FreeKill's lua API

View File

@ -15,13 +15,13 @@
---@field public interrupted boolean @ 事件是否是因为被强行中断而结束的
local GameEvent = class("GameEvent")
---@type (fun(self: GameEvent): boolean|nil)[]
---@type (fun(self: GameEvent): bool)[]
GameEvent.functions = {}
---@type (fun(self: GameEvent): boolean|nil)[]
---@type (fun(self: GameEvent): bool)[]
GameEvent.cleaners = {}
---@type (fun(self: GameEvent): boolean|nil)[]
---@type (fun(self: GameEvent): bool)[]
GameEvent.exit_funcs = {}
local function wrapCoFunc(f, ...)

View File

@ -323,7 +323,7 @@ end
--- 获得当前房间中的所有玩家。
---
--- 返回的数组的第一个元素是当前回合玩家,并且按行动顺序进行排序。
---@param sortBySeat boolean|nil @ 是否无视按座位排序直接返回
---@param sortBySeat bool @ 是否无视按座位排序直接返回
---@return ServerPlayer[] @ 房间中玩家的数组
function Room:getAllPlayers(sortBySeat)
if not self.game_started then
@ -345,7 +345,7 @@ function Room:getAllPlayers(sortBySeat)
end
--- 获得所有存活玩家参看getAllPlayers
---@param sortBySeat boolean|nil
---@param sortBySeat bool
---@return ServerPlayer[]
function Room:getAlivePlayers(sortBySeat)
if sortBySeat == nil or sortBySeat then
@ -372,8 +372,8 @@ end
--- 获得除一名玩家外的其他玩家。
---@param player ServerPlayer @ 要排除的玩家
---@param sortBySeat boolean|nil @ 是否要按座位排序?
---@param include_dead boolean|nil @ 是否要把死人也算进去?
---@param sortBySeat bool @ 是否要按座位排序?
---@param include_dead bool @ 是否要把死人也算进去?
---@return ServerPlayer[] @ 其他玩家列表
function Room:getOtherPlayers(player, sortBySeat, include_dead)
if sortBySeat == nil then
@ -543,8 +543,8 @@ end
---@param player ServerPlayer
---@param general string
---@param changeKingdom boolean|nil
---@param noBroadcast boolean|null
---@param changeKingdom bool
---@param noBroadcast bool
function Room:setPlayerGeneral(player, general, changeKingdom, noBroadcast)
if Fk.generals[general] == nil then return end
player.general = general
@ -572,9 +572,9 @@ end
---@param player ServerPlayer @ 要换将的玩家
---@param new_general string @ 要变更的武将,若不存在则变身为孙策,孙策不存在变身为士兵
---@param full boolean|nil @ 是否血量满状态变身
---@param isDeputy boolean|nil @ 是否变的是副将
---@param sendLog boolean|nil @ 是否发Log
---@param full bool @ 是否血量满状态变身
---@param isDeputy bool @ 是否变的是副将
---@param sendLog bool @ 是否发Log
function Room:changeHero(player, new_general, full, isDeputy, sendLog)
local orig = isDeputy and (player.deputyGeneral or "") or player.general
@ -644,7 +644,7 @@ end
---@param player ServerPlayer @ 发出这个请求的目标玩家
---@param command string @ 请求的类型
---@param jsonData string @ 请求的数据
---@param wait boolean|nil @ 是否要等待答复默认为true
---@param wait bool @ 是否要等待答复默认为true
---@return string | nil @ 收到的答复如果wait为false的话就返回nil
function Room:doRequest(player, command, jsonData, wait)
if wait == nil then wait = true end
@ -770,7 +770,7 @@ end
--- 向多名玩家告知一次移牌行为。
---@param players ServerPlayer[] | nil @ 要被告知的玩家列表,默认为全员
---@param card_moves CardsMoveStruct[] @ 要告知的移牌信息列表
---@param forceVisible boolean|nil @ 是否让所有牌对告知目标可见
---@param forceVisible bool @ 是否让所有牌对告知目标可见
function Room:notifyMoveCards(players, card_moves, forceVisible)
if players == nil or players == {} then players = self.players end
for _, p in ipairs(players) do
@ -997,9 +997,9 @@ end
---@param player ServerPlayer @ 询问目标
---@param skill_name string @ 主动技的技能名
---@param prompt string|nil @ 烧条上面显示的提示文本内容
---@param cancelable boolean|nil @ 是否可以点取消
---@param cancelable bool @ 是否可以点取消
---@param extra_data table|nil @ 额外信息,因技能而异了
---@param no_indicate boolean|nil @ 是否不显示指示线
---@param no_indicate bool @ 是否不显示指示线
---@return boolean, table
function Room:askForUseActiveSkill(player, skill_name, prompt, cancelable, extra_data, no_indicate)
prompt = prompt or ""
@ -1059,13 +1059,13 @@ Room.askForUseViewAsSkill = Room.askForUseActiveSkill
---@param player ServerPlayer @ 弃牌角色
---@param minNum integer @ 最小值
---@param maxNum integer @ 最大值
---@param includeEquip boolean|nil @ 能不能弃装备区?
---@param includeEquip bool @ 能不能弃装备区?
---@param skillName string|nil @ 引发弃牌的技能名
---@param cancelable boolean|nil @ 能不能点取消?
---@param cancelable bool @ 能不能点取消?
---@param pattern string|nil @ 弃牌需要符合的规则
---@param prompt string|nil @ 提示信息
---@param skipDiscard boolean|nil @ 是否跳过弃牌(即只询问选择可以弃置的牌)
---@param no_indicate boolean|nil @ 是否不显示指示线
---@param skipDiscard bool @ 是否跳过弃牌(即只询问选择可以弃置的牌)
---@param no_indicate bool @ 是否不显示指示线
---@return integer[] @ 弃掉的牌的id列表可能是空的
function Room:askForDiscard(player, minNum, maxNum, includeEquip, skillName, cancelable, pattern, prompt, skipDiscard, no_indicate)
cancelable = (cancelable == nil) and true or cancelable
@ -1141,8 +1141,8 @@ end
---@param maxNum integer @ 最大值
---@param prompt string|nil @ 提示信息
---@param skillName string|nil @ 技能名
---@param cancelable boolean|nil @ 能否点取消
---@param no_indicate boolean|nil @ 是否不显示指示线
---@param cancelable bool @ 能否点取消
---@param no_indicate bool @ 是否不显示指示线
---@return integer[] @ 选择的玩家id列表可能为空
function Room:askForChoosePlayers(player, targets, minNum, maxNum, prompt, skillName, cancelable, no_indicate)
if maxNum < 1 then
@ -1176,13 +1176,13 @@ end
---@param player ServerPlayer @ 要询问的玩家
---@param minNum integer @ 最小值
---@param maxNum integer @ 最大值
---@param includeEquip boolean|nil @ 能不能选装备
---@param includeEquip bool @ 能不能选装备
---@param skillName string @ 技能名
---@param cancelable boolean|nil @ 能否点取消
---@param cancelable bool @ 能否点取消
---@param pattern string|nil @ 选牌规则
---@param prompt string|nil @ 提示信息
---@param expand_pile string|nil @ 可选私人牌堆名称
---@param no_indicate boolean|nil @ 是否不显示指示线
---@param no_indicate bool @ 是否不显示指示线
---@return integer[] @ 选择的牌的id列表可能是空的
function Room:askForCard(player, minNum, maxNum, includeEquip, skillName, cancelable, pattern, prompt, expand_pile, no_indicate)
if minNum < 1 then
@ -1230,8 +1230,8 @@ end
---@param maxNum integer @ 选目标最大值
---@param pattern string|nil @ 选牌规则
---@param prompt string|nil @ 提示信息
---@param cancelable boolean|nil @ 能否点取消
---@param no_indicate boolean|nil @ 是否不显示指示线
---@param cancelable bool @ 能否点取消
---@param no_indicate bool @ 是否不显示指示线
---@return integer[], integer
function Room:askForChooseCardAndPlayers(player, targets, minNum, maxNum, pattern, prompt, skillName, cancelable, no_indicate)
if maxNum < 1 then
@ -1415,7 +1415,7 @@ end
---@param choices string[] @ 可选选项列表
---@param skill_name string|nil @ 技能名
---@param prompt string|nil @ 提示信息
---@param detailed boolean|nil @ 选项详细描述
---@param detailed bool @ 选项详细描述
---@param all_choices string[]|nil @ 所有选项(不可选变灰)
---@return string @ 选择的选项
function Room:askForChoice(player, choices, skill_name, prompt, detailed, all_choices)
@ -1511,7 +1511,7 @@ end
---@param bottom_limit integer[]|nil @ 置于牌堆底的牌的限制(下限,上限),不填写则不限
---@param customNotify string|null @ 自定义读条操作提示
---param prompt string|null @ 观星框的标题(暂时雪藏)
---@param noPut boolean|null @ 是否进行放置牌操作
---@param noPut bool @ 是否进行放置牌操作
---@param areaNames string[]|null @ 左侧提示信息
---@return table<"top"|"bottom", integer[]>
function Room:askForGuanxing(player, cards, top_limit, bottom_limit, customNotify, noPut, areaNames)
@ -1690,7 +1690,7 @@ end
---@param card_name string|nil @ 使用牌的牌名若pattern指定了则可随意写它影响的是烧条的提示信息
---@param pattern string|nil @ 使用牌的规则默认就是card_name的值
---@param prompt string|nil @ 提示信息
---@param cancelable boolean|nil @ 能否点取消
---@param cancelable bool @ 能否点取消
---@param extra_data integer|nil @ 额外信息
---@param event_data CardEffectEvent|nil @ 事件信息
---@return CardUseStruct | nil @ 返回关于本次使用牌的数据,以便后续处理
@ -1763,7 +1763,7 @@ end
---@param card_name string @ 牌名
---@param pattern string|nil @ 牌的规则
---@param prompt string|nil @ 提示信息
---@param cancelable boolean|nil @ 能否取消
---@param cancelable bool @ 能否取消
---@param extra_data any|nil @ 额外数据
---@param effectData CardEffectEvent|nil @ 关联的卡牌生效流程
---@return Card | nil @ 打出的牌
@ -1813,7 +1813,7 @@ end
---@param card_name string @ 询问的牌名,默认为无懈
---@param pattern string @ 牌的规则
---@param prompt string|nil @ 提示信息
---@param cancelable boolean|nil @ 能否点取消
---@param cancelable bool @ 能否点取消
---@param extra_data any|nil @ 额外信息
---@return CardUseStruct | nil @ 最终决胜出的卡牌使用信息
function Room:askForNullification(players, card_name, pattern, prompt, cancelable, extra_data)
@ -1850,7 +1850,7 @@ end
--- 询问玩家从AG中选择一张牌。
---@param player ServerPlayer @ 要询问的玩家
---@param id_list integer[] | Card[] @ 可选的卡牌列表
---@param cancelable boolean|nil @ 能否点取消
---@param cancelable bool @ 能否点取消
---@param reason string|nil @ 原因
---@return integer @ 选择的卡牌
function Room:askForAG(player, id_list, cancelable, reason)
@ -2024,9 +2024,9 @@ end
---@param player ServerPlayer @ 要做选择的玩家
---@param prompt string @ 提示信息
---@param skillName string @ 技能名
---@param cancelable boolean|null @ 是否可以取消选择
---@param cancelable bool @ 是否可以取消选择
---@param flag string|null @ 限定可移动的区域值为nil装备区和判定区ej
---@param no_indicate boolean|nil @ 是否不显示指示线
---@param no_indicate bool @ 是否不显示指示线
---@return integer[] @ 选择的玩家id列表可能为空
function Room:askForChooseToMoveCardInBoard(player, prompt, skillName, cancelable, flag, no_indicate, excludeIds)
if flag then
@ -2497,7 +2497,7 @@ end
---@param from ServerPlayer @ 使用来源
---@param tos ServerPlayer | ServerPlayer[] @ 目标角色(列表)
---@param skillName string|nil @ 技能名
---@param extra boolean|nil @ 是否不计入次数
---@param extra bool @ 是否不计入次数
function Room:useVirtualCard(card_name, subcards, from, tos, skillName, extra)
local card = Fk:cloneCard(card_name)
card.skillName = skillName
@ -2539,7 +2539,7 @@ end
--- 让一名玩家获得一张牌
---@param player integer|ServerPlayer @ 要拿牌的玩家
---@param cid integer|Card @ 要拿到的卡牌
---@param unhide boolean|nil @ 是否明着拿
---@param unhide bool @ 是否明着拿
---@param reason CardMoveReason|nil @ 卡牌移动的原因
function Room:obtainCard(player, cid, unhide, reason)
if type(cid) ~= "number" then
@ -2605,8 +2605,8 @@ end
---@param reason integer|nil @ 移动时使用的移牌原因
---@param skill_name string|nil @ 技能名
---@param special_name string|nil @ 私人牌堆名
---@param visible boolean|nil @ 是否明置
---@param proposer integer
---@param visible bool @ 是否明置
---@param proposer integer | nil
function Room:moveCardTo(card, to_place, target, reason, skill_name, special_name, visible, proposer)
reason = reason or fk.ReasonJustMove
skill_name = skill_name or ""
@ -2714,7 +2714,7 @@ end
---@param player ServerPlayer @ 玩家
---@param skill_names string[] | string @ 要获得/失去的技能
---@param source_skill string | Skill | null @ 源技能
---@param no_trigger boolean | null @ 是否不触发相关时机
---@param no_trigger bool @ 是否不触发相关时机
function Room:handleAddLoseSkills(player, skill_names, source_skill, sendlog, no_trigger)
if type(skill_names) == "string" then
skill_names = skill_names:split("|")
@ -2797,7 +2797,7 @@ end
---@param player ServerPlayer @ 改判的玩家
---@param judge JudgeStruct @ 要被改判的判定数据
---@param skillName string|nil @ 技能名
---@param exchange boolean|nil @ 是否要替换原有判定牌(即类似鬼道那样)
---@param exchange bool @ 是否要替换原有判定牌(即类似鬼道那样)
function Room:retrial(card, player, judge, skillName, exchange)
if not card then return end
local triggerResponded = self.owner_map[card:getEffectiveId()] == player
@ -3004,7 +3004,7 @@ function Room:useSkill(player, skill, effect_cb)
end
---@param player ServerPlayer
---@param sendLog boolean|nil
---@param sendLog bool
function Room:revivePlayer(player, sendLog)
if not player.dead then return end
self:setPlayerProperty(player, "dead", false)

View File

@ -187,7 +187,7 @@ function ServerPlayer:waitForReply(timeout)
end
---@param player ServerPlayer
---@param observe boolean|nil
---@param observe bool
function ServerPlayer:marshal(player, observe)
local room = self.room
if not room.game_started then
@ -746,7 +746,7 @@ function ServerPlayer:isFakeSkill(skill)
end
---@param skill string | Skill
---@param isPrelight boolean | nil
---@param isPrelight bool
function ServerPlayer:prelightSkill(skill, isPrelight)
if type(skill) == "string" then skill = Fk.skills[skill] end
assert(skill:isInstanceOf(Skill))

View File

@ -7,12 +7,12 @@
---@field public from integer|null
---@field public to integer|null
---@field public toArea CardArea
---@field public moveReason CardMoveReason
---@field public proposer integer
---@field public moveReason CardMoveReason|nil
---@field public proposer integer|nil
---@field public skillName string|null
---@field public moveVisible boolean|null
---@field public moveVisible bool
---@field public specialName string|null
---@field public specialVisible boolean|null
---@field public specialVisible bool
---@class MoveInfo
---@field public cardId integer
@ -27,9 +27,9 @@
---@field public moveReason CardMoveReason
---@field public proposer integer|null
---@field public skillName string|null
---@field public moveVisible boolean|null
---@field public moveVisible bool
---@field public specialName string|null
---@field public specialVisible boolean|null
---@field public specialVisible bool
---@field public drawPilePosition number|null @ 移至牌堆的索引位置,值为-1代表置入牌堆底或者牌堆牌数+1也为牌堆底
---@class PindianResult
@ -42,7 +42,7 @@
---@field public reason string @ 体力变化原因
---@field public skillName string @ 引起体力变化的技能名
---@field public damageEvent DamageStruct|nil @ 引起这次体力变化的伤害数据
---@field public preventDying boolean|null @ 是否阻止本次体力变更流程引发濒死流程
---@field public preventDying bool @ 是否阻止本次体力变更流程引发濒死流程
--- 描述跟失去体力有关的数据
---@class HpLostData
@ -62,7 +62,7 @@ fk.IceDamage = 4
---@field public to ServerPlayer @ 伤害目标
---@field public damage integer @ 伤害值
---@field public card Card | nil @ 造成伤害的牌
---@field public chain boolean | nil @ 伤害是否是铁索传导的伤害
---@field public chain bool @ 伤害是否是铁索传导的伤害
---@field public damageType DamageType | nil @ 伤害的属性
---@field public skillName string | nil @ 造成本次伤害的技能名
---@field public beginnerOfTheDamage boolean | nil @ 是否是本次铁索传导的起点
@ -78,7 +78,7 @@ fk.IceDamage = 4
---@class DyingStruct
---@field public who integer
---@field public damage DamageStruct
---@field public ignoreDeath boolean|null
---@field public ignoreDeath bool
---@class DeathStruct
---@field public who integer
@ -91,7 +91,7 @@ fk.IceDamage = 4
---@field public toCard Card|null
---@field public responseToEvent CardUseStruct|null
---@field public nullifiedTargets integer[]|null
---@field public extraUse boolean|null
---@field public extraUse bool
---@field public disresponsiveList integer[]|null
---@field public unoffsetableList integer[]|null
---@field public additionalDamage integer|null
@ -112,8 +112,8 @@ fk.IceDamage = 4
---@field public firstTarget boolean
---@field public additionalDamage integer|null
---@field public additionalRecover integer|null
---@field public disresponsive boolean|null
---@field public unoffsetableList boolean|null
---@field public disresponsive bool
---@field public unoffsetableList bool
---@field public additionalResponseTimes table<string, integer>|integer|null
---@field public fixedAddTimesResponsors integer[]
@ -126,16 +126,16 @@ fk.IceDamage = 4
---@field public toCard Card|null
---@field public responseToEvent CardEffectEvent|null
---@field public nullifiedTargets integer[]|null
---@field public extraUse boolean|null
---@field public extraUse bool
---@field public disresponsiveList integer[]|null
---@field public unoffsetableList integer[]|null
---@field public additionalDamage integer|null
---@field public additionalRecover integer|null
---@field public customFrom integer|null
---@field public cardsResponded Card[]|null
---@field public disresponsive boolean|null
---@field public unoffsetable boolean|null
---@field public isCancellOut boolean|null
---@field public disresponsive bool
---@field public unoffsetable bool
---@field public isCancellOut bool
---@field public fixedResponseTimes table<string, integer>|integer|null
---@field public fixedAddTimesResponsors integer[]
---@field public prohibitedCardNames string[]|null
@ -150,13 +150,13 @@ fk.IceDamage = 4
---@field public card Card
---@field public reason string
---@field public pattern string
---@field public skipDrop boolean|null
---@field public skipDrop bool
---@class CardResponseEvent
---@field public from integer
---@field public card Card
---@field public responseToEvent CardEffectEvent|null
---@field public skipDrop boolean|null
---@field public skipDrop bool
---@field public customFrom integer|null
---@class AskForCardUse
@ -197,9 +197,9 @@ fk.ReasonJudge = 11
---@field public from integer | nil
---@field public to integer[] | nil
---@field public card integer[] | nil
---@field public arg any | nil
---@field public arg2 any | nil
---@field public arg3 any | nil
---@field public arg any
---@field public arg2 any
---@field public arg3 any
---@class SkillUseStruct
---@field public skill Skill