move card log (WIP) (#80)

移牌log
This commit is contained in:
notify 2023-03-18 15:35:44 +08:00 committed by GitHub
parent fd1a1ce5fd
commit 5228991930
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 81 additions and 3 deletions

View File

@ -368,14 +368,83 @@ local function mergeMoves(moves)
end
local function sendMoveCardLog(move)
if move.moveReason == fk.ReasonDraw then
if #move.ids == 0 then return end
local hidden = table.contains(move.ids, -1)
local msgtype
if move.from and move.toArea == Card.DrawPile then
msgtype = hidden and "$PutCard" or "$PutKnownCard"
ClientInstance:appendLog{
type = msgtype,
from = move.from,
card = move.ids,
arg = #move.ids,
}
elseif move.toArea == Card.PlayerSpecial then
msgtype = hidden and "$RemoveCardFromGame" or "$AddToPile"
ClientInstance:appendLog{
type = msgtype,
arg = move.specialName,
arg2 = #move.ids,
card = move.ids,
}
elseif move.fromArea == Card.PlayerSpecial and move.to then
ClientInstance:appendLog{
type = "$GetCardsFromPile",
from = move.to,
arg = move.fromSpecialName,
arg2 = #move.ids,
card = move.ids,
}
elseif move.fromArea == Card.DrawPile and move.toArea == Card.PlayerHand then
ClientInstance:appendLog{
type = "$DrawCards",
from = move.to,
card = move.ids,
arg = #move.ids,
}
elseif move.moveReason == fk.ReasonDiscard then
elseif (move.fromArea == Card.Processing or move.fromArea == Card.PlayerJudge)
and move.toArea == Card.PlayerHand then
ClientInstance:appendLog{
type = "$GotCardBack",
from = move.to,
card = move.ids,
arg = #move.ids,
}
elseif move.fromArea == Card.DiscardPile and move.toArea == Card.PlayerHand then
ClientInstance:appendLog{
type = "$RecycleCard",
from = move.to,
card = move.ids,
arg = #move.ids,
}
elseif move.from and move.fromArea ~= Card.PlayerJudge and
move.toArea ~= Card.PlayerJudge and move.to and move.from ~= move.to then
ClientInstance:appendLog{
type = "$MoveCards",
from = move.from,
to = { move.to },
arg = #move.ids,
card = move.ids,
}
elseif move.from and move.to and move.toArea == Card.PlayerJudge then
if move.fromArea == Card.PlayerJudge and move.from ~= move.to then
msgtype = "$LightningMove"
elseif move.fromArea ~= Card.PlayerJudge then
msgtype = "$PasteCard"
end
if msgtype then
ClientInstance:appendLog{
type = msgtype,
from = move.from,
to = { move.to },
card = move.ids,
}
end
end
-- TODO ...
if move.moveReason == fk.ReasonDiscard then
ClientInstance:appendLog{
type = "$DiscardCards",
from = move.from,

View File

@ -149,8 +149,17 @@ Fk:loadTranslationTable{
["#LoseSkill"] = "%from 失去了技能“%arg”",
-- moveCards (they are sent by notifyMoveCards)
["$PutCard"] = "%from 的 %arg 张牌被置于牌堆顶",
["$PutKnownCard"] = "%from 的牌 %card 被置于牌堆顶",
["$RemoveCardFromGame"] = "%arg2 张牌被作为 %arg 移出游戏",
["$AddToPile"] = "%card 被作为 %arg 移出游戏",
["$GetCardsFromPile"] = "%from 从 %arg 中获得了 %arg2 张牌 %card",
["$DrawCards"] = "%from 摸了 %arg 张牌 %card",
["$GotCardBack"] = "%from 收回了 %arg 张牌 %card",
["$RecycleCard"] = "%from 从弃牌堆回收了 %arg 张牌 %card",
["$MoveCards"] = "%to 从 %from 处获得了 %arg 张牌 %card",
["$LightningMove"] = "%card 从 %from 转移到了 %to",
["$PasteCard"] = "%from 给 %to 贴了张 %card",
["$DiscardCards"] = "%from 弃置了 %arg 张牌 %card",
["$InstallEquip"] = "%from 装备了 %card",
["$UninstallEquip"] = "%from 卸载了 %card",