修复了无法聊天
修复拼点没赢时双方都没赢
修复了被拼点的人无法选牌(或许吧
This commit is contained in:
notify 2023-04-28 10:27:56 +08:00 committed by GitHub
parent 8d2230766d
commit 930826e664
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 44 additions and 23 deletions

View File

@ -7,3 +7,4 @@ Icon=freekill_logo
Exec=/usr/bin/FreeKill
Type=Application
Terminal=false
Categories=Game

View File

@ -151,6 +151,10 @@ FreeKill使用的是libgit2的C API与此同时使用Git完成拓展包的下
["#AskForCard"] = "请选择 %arg 张牌,最少 %arg2 张",
["#askForPindian"] = "请选择一张手牌作为拼点牌",
["#StartPindianReason"] = "%from 由于 %arg 而发起拼点",
["#ShowPindianCard"] = "%from 的拼点牌是 %card",
["#ShowPindianResult"] = "%from 在 %from 和 %to 之间的拼点中 %arg",
["pindianwin"] = "",
["pindiannotwin"] = "没赢",
["#RevealGeneral"] = "%from 亮出 %arg %arg2",
["mainGeneral"] = "主将",

View File

@ -2,11 +2,12 @@
GameEvent.functions[GameEvent.Pindian] = function(self)
local pindianData = table.unpack(self.data)
local self = self.room
self.logic:trigger(fk.StartPindian, pindianData.from, pindianData)
local room = self.room
local logic = room.logic
logic:trigger(fk.StartPindian, pindianData.from, pindianData)
if pindianData.reason ~= "" then
self:sendLog{
room:sendLog{
type = "#StartPindianReason",
from = pindianData.from.id,
arg = pindianData.reason,
@ -17,7 +18,8 @@ GameEvent.functions[GameEvent.Pindian] = function(self)
num = 1,
min_num = 1,
include_equip = false,
reason = pindianData.reason
pattern = ".",
reason = pindianData.reason,
}
local prompt = "#askForPindian"
local data = { "choose_cards_skill", prompt, true, json.encode(extraData) }
@ -34,8 +36,8 @@ GameEvent.functions[GameEvent.Pindian] = function(self)
end
end
self:notifyMoveFocus(targets, "AskForPindian")
self:doBroadcastRequest("AskForUseActiveSkill", targets)
room:notifyMoveFocus(targets, "AskForPindian")
room:doBroadcastRequest("AskForUseActiveSkill", targets)
local moveInfos = {}
for _, p in ipairs(targets) do
@ -62,53 +64,67 @@ GameEvent.functions[GameEvent.Pindian] = function(self)
skillName = pindianData.reason,
moveVisible = true,
})
room:sendLog{
type = "#ShowPindianCard",
from = p.id,
card = { pindianCard.id },
}
end
self:moveCards(table.unpack(moveInfos))
room:moveCards(table.unpack(moveInfos))
self.logic:trigger(fk.PindianCardsDisplayed, nil, pindianData)
logic:trigger(fk.PindianCardsDisplayed, nil, pindianData)
for toId, result in pairs(pindianData.results) do
local to = room:getPlayerById(toId)
if pindianData.fromCard.number > result.toCard.number then
pindianData.results[toId].winner = pindianData.from
elseif pindianData.fromCard.number > result.toCard.number then
pindianData.results[toId].winner = Fk:getCardById(toId)
result.winner = pindianData.from
elseif pindianData.fromCard.number < result.toCard.number then
result.winner = to
end
local singlePindianData = {
from = pindianData.from,
to = self:getPlayerById(toId),
to = to,
fromCard = pindianData.fromCard,
toCard = result.toCard,
winner = pindianData.results[toId].winner,
winner = result.winner,
}
self.logic:trigger(fk.PindianResultConfirmed, nil, singlePindianData)
room:sendLog{
type = "#ShowPindianResult",
from = pindianData.from.id,
to = { toId },
arg = result.winner == pindianData.from and "pindianwin" or "pindiannotwin"
}
logic:trigger(fk.PindianResultConfirmed, nil, singlePindianData)
end
if self.logic:trigger(fk.PindianFinished, pindianData.from, pindianData) then
self.logic:breakEvent()
if logic:trigger(fk.PindianFinished, pindianData.from, pindianData) then
logic:breakEvent()
end
end
GameEvent.cleaners[GameEvent.Pindian] = function(self)
local pindianData = table.unpack(self.data)
local self = self.room
local room = self.room
local toProcessingArea = {}
local leftFromCardIds = self:getSubcardsByRule(pindianData.fromCard, { Card.Processing })
local leftFromCardIds = room:getSubcardsByRule(pindianData.fromCard, { Card.Processing })
if #leftFromCardIds > 0 then
table.insertTable(toProcessingArea, leftFromCardIds)
end
for _, result in pairs(pindianData.results) do
local leftToCardIds = self:getSubcardsByRule(result.toCard, { Card.Processing })
local leftToCardIds = room:getSubcardsByRule(result.toCard, { Card.Processing })
if #leftToCardIds > 0 then
table.insertTable(toProcessingArea, leftToCardIds)
end
end
if #toProcessingArea > 0 then
self:moveCards({
room:moveCards({
ids = toProcessingArea,
toArea = Card.DiscardPile,
moveReason = fk.ReasonPutIntoDiscardPile,

View File

@ -684,7 +684,7 @@ Item {
if (specialChat(pid, raw, raw.msg.slice(1))) return;
}
chat.append(msg);
let photo = Logic.getPhotoOrSelf(pid);
let photo = Logic.getPhoto(pid);
if (photo === undefined) {
let user = raw.userName;
let m = raw.msg;
@ -727,7 +727,7 @@ Item {
else
chat.append(`[${time}] ${userName}(${general}): ${m}`);
let photo = Logic.getPhotoOrSelf(pid);
let photo = Logic.getPhoto(pid);
if (photo === undefined) {
danmaku.sendLog(`${userName}: ${m}`);
return true;
@ -752,7 +752,7 @@ Item {
else
chat.append(`[${time}] ${userName}(${general}): ${m}`);
let photo = Logic.getPhotoOrSelf(pid);
let photo = Logic.getPhoto(pid);
if (photo === undefined) {
danmaku.sendLog(`${userName}: ${m}`);
return true;