1. 修复甄姬等
2. 将弃置所有牌、武将牌上的牌等修复为一次性弃置
3. 添加连环状态改变的音效
4. 改进notifyMoveCards的可见

---------

Signed-off-by: Mechanel <nyutanislavsky@qq.com>
This commit is contained in:
Nyutanislavsky 2023-08-03 15:26:52 +08:00 committed by GitHub
parent 7fb5f7bb14
commit d38b0ca805
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 72 additions and 57 deletions

BIN
audio/system/chain.mp3 Normal file

Binary file not shown.

View File

@ -777,15 +777,6 @@ function Room:notifyMoveCards(players, card_moves, forceVisible)
for _, move in ipairs(arg) do for _, move in ipairs(arg) do
-- local to = self:getPlayerById(move.to) -- local to = self:getPlayerById(move.to)
local function infosContainArea(info, area)
for _, i in ipairs(info) do
if i.fromArea == area then
return true
end
end
return false
end
for _, info in ipairs(move.moveInfo) do for _, info in ipairs(move.moveInfo) do
local realFromArea = self:getCardArea(info.cardId) local realFromArea = self:getCardArea(info.cardId)
local playerAreas = { Player.Hand, Player.Equip, Player.Judge, Player.Special } local playerAreas = { Player.Hand, Player.Equip, Player.Judge, Player.Special }
@ -800,28 +791,25 @@ function Room:notifyMoveCards(players, card_moves, forceVisible)
end end
end end
-- forceVisible make the move visible local function containArea(area, relevant) --处理区的处理?
-- FIXME: move.moveInfo is an array, fix this local areas = relevant
move.moveVisible = move.moveVisible or (forceVisible) and {Card.PlayerEquip, Card.PlayerJudge, Card.DiscardPile, Card.Processing, Card.PlayerHand}
-- if move is relevant to player, it should be open or {Card.PlayerEquip, Card.PlayerJudge, Card.DiscardPile, Card.Processing}
or ((move.from == p.id) or (move.to == p.id)) return table.contains(areas, area)
-- cards move from/to equip/judge/discard/processing should be open end
or infosContainArea(move.moveInfo, Card.PlayerEquip)
or move.toArea == Card.PlayerEquip
or infosContainArea(move.moveInfo, Card.PlayerJudge)
or move.toArea == Card.PlayerJudge
or infosContainArea(move.moveInfo, Card.DiscardPile)
or move.toArea == Card.DiscardPile
or infosContainArea(move.moveInfo, Card.Processing)
or move.toArea == Card.Processing
-- TODO: PlayerSpecial
if not move.moveVisible then -- forceVisible make the move visible
-- if move is relevant to player's hands or equips, it should be open
-- cards move from/to equip/judge/discard/processing should be open
if not (move.moveVisible or forceVisible or containArea(move.toArea, move.to == p.id)) then
for _, info in ipairs(move.moveInfo) do for _, info in ipairs(move.moveInfo) do
if not containArea(info.fromArea, move.from == p.id) then
info.cardId = -1 info.cardId = -1
end end
end end
end end
end
p:doNotify("MoveCards", json.encode(arg)) p:doNotify("MoveCards", json.encode(arg))
end end
end end
@ -2580,7 +2568,7 @@ function Room:drawCards(player, num, skillName, fromPlace)
skillName = skillName, skillName = skillName,
fromPlace = fromPlace, fromPlace = fromPlace,
} }
if self.logic:trigger(fk.BeforeDrawCard, player, drawData) or drawData.num < 1 then if self.logic:trigger(fk.BeforeDrawCard, player, drawData) then
self.logic:breakEvent(false) self.logic:breakEvent(false)
end end

View File

@ -589,19 +589,21 @@ function ServerPlayer:bury()
end end
function ServerPlayer:throwAllCards(flag) function ServerPlayer:throwAllCards(flag)
local room = self.room local cardIds = {}
flag = flag or "hej" flag = flag or "hej"
if string.find(flag, "h") then if string.find(flag, "h") then
room:throwCard(self.player_cards[Player.Hand], "", self) table.insertTable(cardIds, self.player_cards[Player.Hand])
end end
if string.find(flag, "e") then if string.find(flag, "e") then
room:throwCard(self.player_cards[Player.Equip], "", self) table.insertTable(cardIds, self.player_cards[Player.Equip])
end end
if string.find(flag, "j") then if string.find(flag, "j") then
room:throwCard(self.player_cards[Player.Judge], "", self) table.insertTable(cardIds, self.player_cards[Player.Judge])
end end
self.room:throwCard(cardIds, "", self)
end end
function ServerPlayer:throwAllMarks() function ServerPlayer:throwAllMarks()
@ -611,9 +613,11 @@ function ServerPlayer:throwAllMarks()
end end
function ServerPlayer:clearPiles() function ServerPlayer:clearPiles()
local cardIds = {}
for _, ids in pairs(self.special_cards) do for _, ids in pairs(self.special_cards) do
self.room:throwCard(ids, "", self) table.insertTable(cardIds, ids)
end end
self.room:moveCardTo(cardIds, Card.DiscardPile, nil, fk.ReasonPutIntoDiscardPile, "", nil, true)
end end
function ServerPlayer:addVirtualEquip(card) function ServerPlayer:addVirtualEquip(card)
@ -656,19 +660,22 @@ end
---@param chained boolean ---@param chained boolean
function ServerPlayer:setChainState(chained) function ServerPlayer:setChainState(chained)
if self.room.logic:trigger(fk.BeforeChainStateChange, self) then local room = self.room
if room.logic:trigger(fk.BeforeChainStateChange, self) then
return return
end end
self.chained = chained self.chained = chained
self.room:broadcastProperty(self, "chained")
self.room:sendLog{ room:broadcastProperty(self, "chained")
room:sendLog{
type = "#ChainStateChange", type = "#ChainStateChange",
from = self.id, from = self.id,
arg = self.chained and "chained" or "un-chained" arg = self.chained and "chained" or "un-chained"
} }
room:delay(150)
self.room.logic:trigger(fk.ChainStateChanged, self) room:broadcastPlaySound("./audio/system/chain")
room.logic:trigger(fk.ChainStateChanged, self)
end end
function ServerPlayer:reset() function ServerPlayer:reset()

View File

@ -76,6 +76,7 @@ Fk:loadTranslationTable{
["$luoshen2"] = "飘飖兮若流风之回雪。", ["$luoshen2"] = "飘飖兮若流风之回雪。",
["luoshen"] = "洛神", ["luoshen"] = "洛神",
[":luoshen"] = "准备阶段开始时,你可以进行判定:若结果为黑色,判定牌生效后你获得之,然后你可以再次发动“洛神”。", [":luoshen"] = "准备阶段开始时,你可以进行判定:若结果为黑色,判定牌生效后你获得之,然后你可以再次发动“洛神”。",
["#luoshen_obtain"] = "洛神",
["$qingguo1"] = "凌波微步,罗袜生尘。", ["$qingguo1"] = "凌波微步,罗袜生尘。",
["$qingguo2"] = "体迅飞凫,飘忽若神。", ["$qingguo2"] = "体迅飞凫,飘忽若神。",
["qingguo"] = "倾国", ["qingguo"] = "倾国",

View File

@ -130,10 +130,7 @@ local fankui = fk.CreateTriggerSkill{
on_use = function(self, event, target, player, data) on_use = function(self, event, target, player, data)
local room = player.room local room = player.room
local from = data.from local from = data.from
local flag = "he" local flag = from == player and "e" or "he"
if from == player then
flag = "e"
end
local card = room:askForCardChosen(player, from, flag, self.name) local card = room:askForCardChosen(player, from, flag, self.name)
room:obtainCard(player.id, card, false, fk.ReasonPrey) room:obtainCard(player.id, card, false, fk.ReasonPrey)
end end
@ -366,16 +363,24 @@ local luoshen = fk.CreateTriggerSkill{
pattern = ".|.|spade,club", pattern = ".|.|spade,club",
} }
room:judge(judge) room:judge(judge)
if judge.card.color ~= Card.Black then if judge.card.color ~= Card.Black or player.dead or not room:askForSkillInvoke(player, self.name) then
break
end
room:obtainCard(player.id, judge.card, true, fk.ReasonJustMove)
if player.dead or not room:askForSkillInvoke(player, self.name) then
break break
end end
end end
end, end,
} }
local luoshen_obtain = fk.CreateTriggerSkill{
name = "#luoshen_obtain",
mute = true,
frequency = Skill.Compulsory,
events = {fk.FinishJudge},
can_trigger = function(self, event, target, player, data)
return target == player and data.reason == "luoshen" and data.card.color == Card.Black end,
on_use = function(self, event, target, player, data)
player.room:obtainCard(player.id, data.card)
end,
}
luoshen:addRelatedSkill(luoshen_obtain)
local qingguo = fk.CreateViewAsSkill{ local qingguo = fk.CreateViewAsSkill{
name = "qingguo", name = "qingguo",
anim_type = "defensive", anim_type = "defensive",
@ -383,7 +388,7 @@ local qingguo = fk.CreateViewAsSkill{
card_filter = function(self, to_select, selected) card_filter = function(self, to_select, selected)
if #selected == 1 then return false end if #selected == 1 then return false end
return Fk:getCardById(to_select).color == Card.Black return Fk:getCardById(to_select).color == Card.Black
and Fk:currentRoom():getCardArea(to_select) ~= Player.Hand and Fk:currentRoom():getCardArea(to_select) == Player.Hand
end, end,
view_as = function(self, cards) view_as = function(self, cards)
if #cards ~= 1 then if #cards ~= 1 then
@ -951,24 +956,38 @@ local xiaoji = fk.CreateTriggerSkill{
events = {fk.AfterCardsMove}, events = {fk.AfterCardsMove},
can_trigger = function(self, event, target, player, data) can_trigger = function(self, event, target, player, data)
if not player:hasSkill(self.name) then return end if not player:hasSkill(self.name) then return end
self.trigger_times = 0
for _, move in ipairs(data) do for _, move in ipairs(data) do
if move.from == player.id then if move.from == player.id then
for _, info in ipairs(move.moveInfo) do for _, info in ipairs(move.moveInfo) do
if info.fromArea == Card.PlayerEquip then if info.fromArea == Card.PlayerEquip then
self.trigger_times = self.trigger_times + 1 return true
end end
end end
end end
end end
return self.trigger_times > 0
end, end,
on_trigger = function(self, event, target, player, data) on_trigger = function(self, event, target, player, data)
local ret local i = 0
for i = 1, self.trigger_times do for _, move in ipairs(data) do
ret = self:doCost(event, target, player, data) if move.from == player.id then
if ret then return ret end for _, info in ipairs(move.moveInfo) do
if info.fromArea == Card.PlayerEquip then
i = i + 1
end
end
end
end end
self.cancel_cost = false
for i = 1, i do
if self.cancel_cost or not player:hasSkill(self.name) then break end
self:doCost(event, target, player, data)
end
end,
on_cost = function(self, event, target, player, data)
if player.room:askForSkillInvoke(player, self.name) then
return true
end
self.cancel_cost = true
end, end,
on_use = function(self, event, target, player, data) on_use = function(self, event, target, player, data)
player:drawCards(2, self.name) player:drawCards(2, self.name)
@ -997,14 +1016,14 @@ local jieyin = fk.CreateActiveSkill{
room:recover({ room:recover({
who = room:getPlayerById(effect.tos[1]), who = room:getPlayerById(effect.tos[1]),
num = 1, num = 1,
recoverBy = room:getPlayerById(effect.from), recoverBy = from,
skillName = self.name skillName = self.name
}) })
if from:isWounded() then if from:isWounded() then
room:recover({ room:recover({
who = room:getPlayerById(effect.from), who = from,
num = 1, num = 1,
recoverBy = room:getPlayerById(effect.from), recoverBy = from,
skillName = self.name skillName = self.name
}) })
end end
@ -1034,7 +1053,7 @@ local qingnang = fk.CreateActiveSkill{
room:recover({ room:recover({
who = room:getPlayerById(effect.tos[1]), who = room:getPlayerById(effect.tos[1]),
num = 1, num = 1,
recoverBy = room:getPlayerById(effect.from), recoverBy = from,
skillName = self.name skillName = self.name
}) })
end, end,