Class Request#

class Request: Object#
room: Room#

Room是fk游戏逻辑运行的主要场所,同时也提供了许多API函数供编写技能使用。

一个房间中只有一个Room实例,保存在RoomInstance全局变量中。

n: integer#

产生n个winner后,询问直接结束

accept_cancel: boolean?#

是否将取消也算作是收到肯定答复

ai_start_time: integer?#

只剩AI思考开始的时间(微秒),delay专用

timeout: integer?#

本次耗时(秒),默认为房间内配置的出手时间

command: string#

command自然就是command

data: table<integer, any>#

每个player对应的询问数据

default_reply: table<integer, any>#

玩家id - 默认回复内容 默认空串

send_encode: boolean?#

是否需要对data使用json.encode,默认true

receive_decode: boolean?#

是否需要对reply使用json.decode,默认true

result: table<integer, any>#

玩家id - 回复内容 nil表示完全未回复

winners: ServerPlayer[]#

按肯定回复先后顺序排序 由于有概率所有人烧条 可能会空

overtimes: ServerPlayer[]#

超时的玩家

luck_data: any#

是否是询问手气卡 TODO: 有需求的话把这个通用化一点

focus_players: ServerPlayer[]?#

要moveFocus的玩家们 默认参与者

focus_text: string?#

要moveFocus的文字 默认self.command

getResult(self: Request, player: Base.Player): any#

获取本次Request中此人的回复,若还未询问过,那么先询问 * <any>: 成功发出回复 获取的是decode后的回复 * "" (空串): 发出了“取消” 或者烧完了绳子 反正就是取消

_sendPacket(self: Request, player: ServerPlayerBase)#

将相应请求数据发给player 不能向thinking中的玩家发送,这种情况下暂存起来等待收到答复后

_checkReply(self: Request, player: ServerPlayer, use_ai: boolean): any#

检查一下该玩家是否已经有答复了,若为AI则直接计算出回复 一般来说,在一次同时询问中,需要人类玩家全部回复完了,AI才进行回复

_finish(self: Request)#

善后工作,主要是result规范化、投降检测等