diff --git a/lua/client/client.lua b/lua/client/client.lua index 4942941b1a3b706e4f882a0feaaf7f007cd901f4..f6296ee7e53bd01f785907cbd6a793a1a2cd2363 100644 --- a/lua/client/client.lua +++ b/lua/client/client.lua @@ -495,14 +495,20 @@ local function separateMoves(moves) for _, move in ipairs(moves) do local singleVisible = move.moveVisible - if move.visiblePlayers and not singleVisible then - local visiblePlayers = move.visiblePlayers - if type(visiblePlayers) == "number" then - if Self:isBuddy(visiblePlayers) then - singleVisible = true + if not singleVisible then + if move.visiblePlayers then + local visiblePlayers = move.visiblePlayers + if type(visiblePlayers) == "number" then + if Self:isBuddy(visiblePlayers) then + singleVisible = true + end + elseif type(visiblePlayers) == "table" then + if table.find(visiblePlayers, function(pid) return Self:isBuddy(pid) end) then + singleVisible = true + end end - elseif type(visiblePlayers) == "table" then - if table.find(visiblePlayers, function(pid) return Self:isBuddy(pid) end) then + else + if move.to and move.toArea == Card.PlayerSpecial and Self:isBuddy(move.to) then singleVisible = true end end @@ -646,8 +652,27 @@ local function sendMoveCardLog(move) from = move.from, card = move.ids, } - -- elseif move.toArea == Card.Processing then - -- nop + elseif move.toArea == Card.Processing then + if move.fromArea == Card.DrawPile and (move.moveReason == fk.ReasonPut or move.moveReason == fk.ReasonJustMove) then + if hidden then + client:appendLog{ + type = "$ViewCardFromDrawPile", + from = move.proposer, + arg = #move.ids, + } + else + client:appendLog{ + type = "$TurnOverCardFromDrawPile", + from = move.proposer, + card = move.ids, + arg = #move.ids, + } + client:setCardNote(move.ids, { + type = "$$TurnOverCard", + from = move.proposer, + }) + end + end elseif move.from and move.toArea == Card.DrawPile then msgtype = hidden and "$PutCard" or "$PutKnownCard" client:appendLog{ diff --git a/lua/client/i18n/zh_CN.lua b/lua/client/i18n/zh_CN.lua index 369c60bb1e45198968f3c308ef28dc3b5063a22d..3b90079f9709e137c59401e92f4314e4b728bf93 100644 --- a/lua/client/i18n/zh_CN.lua +++ b/lua/client/i18n/zh_CN.lua @@ -435,6 +435,8 @@ Fk:loadTranslationTable{ ["$DiscardCards"] = "%from 弃置了 %arg 张牌 %card", ["$DiscardOther"] = "%to 弃置了 %from 的 %arg 张牌 %card", ["$PutToDiscard"] = "%arg 张牌 %card 被置入弃牌堆", + ["$ViewCardFromDrawPile"] = "%from 观看了 %arg 张牌", + ["$TurnOverCardFromDrawPile"] = "%from 亮出了 %arg 张牌 %card", ["#AbortArea"] = "%from 的 %arg 被废除", ["#ResumeArea"] = "%from 的 %arg 被恢复", @@ -510,6 +512,7 @@ Fk:loadTranslationTable{ Fk:loadTranslationTable{ ["$$DiscardCards"] = "%from弃置", ["$$PutCard"] = "%from置于", + ["$$TurnOverCard"] = "%from亮出", ["##UseCard"] = "%from使用", ["##UseCardTo"] = "%from对%to", diff --git a/lua/core/player.lua b/lua/core/player.lua index 5db1ea3022b632e532a7217cf26d7b8b8939b898..4d231bc0600187931ec09f568d027e8fb82179d0 100644 --- a/lua/core/player.lua +++ b/lua/core/player.lua @@ -590,6 +590,11 @@ function Player:inMyAttackRange(other, fixLimit) fixLimit = fixLimit or 0 local status_skills = Fk:currentRoom().status_skills[AttackRangeSkill] or Util.DummyTable + for _, skill in ipairs(status_skills) do + if skill:withoutAttackRange(self, other) then + return false + end + end for _, skill in ipairs(status_skills) do if skill:withinAttackRange(self, other) then return true diff --git a/lua/core/skill_type/attack_range.lua b/lua/core/skill_type/attack_range.lua index aa48de04d6fd8613b07c4bcae5b7e048a35d2c2a..66fe79252afceff0a3ca51247de72b99c429e730 100644 --- a/lua/core/skill_type/attack_range.lua +++ b/lua/core/skill_type/attack_range.lua @@ -15,8 +15,18 @@ function AttackRangeSkill:getFixed(from) return nil end +---@param from Player +---@param to Player +---@return boolean function AttackRangeSkill:withinAttackRange(from, to) return false end +---@param from Player +---@param to Player +---@return boolean +function AttackRangeSkill:withoutAttackRange(from, to) + return false +end + return AttackRangeSkill diff --git a/lua/fk_ex.lua b/lua/fk_ex.lua index 9c0f31c05c47aff2e776570eb63e7a23b36c8e9f..074ef0509099b3984dbdde416c130c40e36a813b 100644 --- a/lua/fk_ex.lua +++ b/lua/fk_ex.lua @@ -335,12 +335,14 @@ end ---@field public correct_func? fun(self: AttackRangeSkill, from: Player, to: Player): number? ---@field public fixed_func? fun(self: AttackRangeSkill, player: Player): number? ---@field public within_func? fun(self: AttackRangeSkill, from: Player, to: Player): boolean? +---@field public without_func? fun(self: AttackRangeSkill, from: Player, to: Player): boolean? ---@param spec AttackRangeSpec ---@return AttackRangeSkill function fk.CreateAttackRangeSkill(spec) assert(type(spec.name) == "string") - assert(type(spec.correct_func) == "function" or type(spec.fixed_func) == "function" or type(spec.within_func) == "function") + assert(type(spec.correct_func) == "function" or type(spec.fixed_func) == "function" or + type(spec.within_func) == "function" or type(spec.without_func) == "function") local skill = AttackRangeSkill:new(spec.name) readStatusSpecToSkill(skill, spec) @@ -353,6 +355,9 @@ function fk.CreateAttackRangeSkill(spec) if spec.within_func then skill.withinAttackRange = spec.within_func end + if spec.without_func then + skill.withoutAttackRange = spec.without_func + end return skill end diff --git a/lua/server/serverplayer.lua b/lua/server/serverplayer.lua index b6d1e441425243943654157400a9db70924ef1cd..519936c6240c5cda90b1f713294415d36696bea1 100644 --- a/lua/server/serverplayer.lua +++ b/lua/server/serverplayer.lua @@ -602,13 +602,8 @@ end ---@param visible? boolean ---@param skillName? string ---@param proposer? integer ----@param visiblePlayers? integer | integer[] +---@param visiblePlayers? integer | integer[] @ 为nil时默认对自己可见 function ServerPlayer:addToPile(pile_name, card, visible, skillName, proposer, visiblePlayers) - if type(visiblePlayers) == "table" and #visiblePlayers == 0 then - visiblePlayers = nil - elseif visiblePlayers == nil then - visiblePlayers = self.id - end self.room:moveCardTo(card, Card.PlayerSpecial, self, fk.ReasonJustMove, skillName, pile_name, visible, proposer or self.id, nil, visiblePlayers) end diff --git a/standard/init.lua b/standard/init.lua index 44aed8d0cc42c40f7a4e8133a935f51d7b9c6e97..940920963d624aab497ab3652772fe6eae344a36 100644 --- a/standard/init.lua +++ b/standard/init.lua @@ -13,11 +13,7 @@ local jianxiong = fk.CreateTriggerSkill{ anim_type = "masochism", events = {fk.Damaged}, can_trigger = function(self, event, target, player, data) - if target == player and player:hasSkill(self) and data.card then - local room = player.room - local subcards = data.card:isVirtual() and data.card.subcards or {data.card.id} - return #subcards>0 and table.every(subcards, function(id) return room:getCardArea(id) == Card.Processing end) - end + return target == player and player:hasSkill(self) and data.card and player.room:getCardArea(data.card) == Card.Processing end, on_use = function(self, event, target, player, data) player.room:obtainCard(player.id, data.card, true, fk.ReasonJustMove) @@ -157,11 +153,11 @@ local tuxi = fk.CreateTriggerSkill{ events = {fk.EventPhaseStart}, can_trigger = function(self, event, target, player, data) return target == player and player:hasSkill(self) and player.phase == Player.Draw and - table.find(player.room:getOtherPlayers(player), function(p) return not p:isKongcheng() end) + table.find(player.room:getOtherPlayers(player, false), function(p) return not p:isKongcheng() end) end, on_cost = function(self, event, target, player, data) local room = player.room - local targets = table.map(table.filter(room:getOtherPlayers(player), function(p) + local targets = table.map(table.filter(room:getOtherPlayers(player, false), function(p) return not p:isKongcheng() end), Util.IdMapper) local result = room:askForChoosePlayers(player, targets, 1, 2, "#tuxi-ask", self.name) @@ -994,8 +990,8 @@ local qingnang = fk.CreateActiveSkill{ card_num = 1, on_use = function(self, room, effect) local from = room:getPlayerById(effect.from) - room:throwCard(effect.cards, self.name, from, from) local to = room:getPlayerById(effect.tos[1]) + room:throwCard(effect.cards, self.name, from, from) if to:isAlive() and to:isWounded() then room:recover({ who = to, @@ -1073,7 +1069,9 @@ local lijian = fk.CreateActiveSkill{ end, target_filter = function(self, to_select, selected) if #selected < 2 and to_select ~= Self.id then - return Fk:currentRoom():getPlayerById(to_select):isMale() + local target = Fk:currentRoom():getPlayerById(to_select) + return target:isMale() and (#selected == 0 or + target:canUseTo(Fk:cloneCard("duel"), Fk:currentRoom():getPlayerById(selected[1]))) end end, target_num = 2, diff --git a/standard_cards/init.lua b/standard_cards/init.lua index 962e3d111da01d4efc1c2ebde6b6ce370ef14cb2..e2879c3ef44d28c94a8961d0d31af171725ecd8c 100644 --- a/standard_cards/init.lua +++ b/standard_cards/init.lua @@ -622,6 +622,7 @@ local amazingGraceSkill = fk.CreateActiveSkill{ ids = toDisplay, toArea = Card.Processing, moveReason = fk.ReasonPut, + proposer = use.from, }) table.forEach(room.players, function(p) @@ -816,10 +817,16 @@ local crossbowAudio = fk.CreateTriggerSkill{ local crossbowSkill = fk.CreateTargetModSkill{ name = "#crossbow_skill", attached_equip = "crossbow", - bypass_times = function(self, player, skill, scope) - if player:hasSkill(self) and skill.trueName == "slash_skill" - and scope == Player.HistoryPhase then - return true + bypass_times = function(self, player, skill, scope, card) + if player:hasSkill(self) and skill.trueName == "slash_skill" and scope == Player.HistoryPhase then + --FIXME: 无法检测到非转化的cost选牌的情况,如活墨等 + local cardIds = Card:getIdList(card) + local crossbows = table.filter(player:getEquipments(Card.SubtypeWeapon), function(id) + return Fk:getCardById(id).equip_skill == self + end) + return #crossbows == 0 or not table.every(crossbows, function(id) + return table.contains(cardIds, id) + end) end end, }