翻译+标记处理 (#205)

- 补齐翻译
- 将无限制标记移到判定函数
- askForUseCard缝入无限制标记,可以通过填标记实现用牌无次数/距离限制
This commit is contained in:
YoumuKon 2023-06-20 19:04:14 +08:00 committed by GitHub
parent 3aef53d16c
commit 49e8849061
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 45 additions and 36 deletions

View File

@ -119,7 +119,7 @@ Flickable {
const run = gamedata[2]; const run = gamedata[2];
const winRate = (win / total) * 100; const winRate = (win / total) * 100;
const runRate = (run / total) * 100; const runRate = (run / total) * 100;
playerGameData.text = total === 0 ? "Newbie" : "<br/>" + Backend.translate("Win=%1 Run=%2 Total=%3").arg(winRate.toFixed(2)) playerGameData.text = total === 0 ? Backend.translate("Newbie") : "<br/>" + Backend.translate("Win=%1 Run=%2 Total=%3").arg(winRate.toFixed(2))
.arg(runRate.toFixed(2)).arg(total); .arg(runRate.toFixed(2)).arg(total);
} }

View File

@ -31,7 +31,15 @@ function UsableSkill:withinTimesLimit(player, scope, card, card_name, to)
if skill:bypassTimesCheck(player, self, scope, card, to) then return true end if skill:bypassTimesCheck(player, self, scope, card, to) then return true end
end end
card_name = card_name or card.trueName card_name = card_name or card.trueName
return player:usedCardTimes(card_name, scope) < self:getMaxUseTime(player, scope, card, to) return player:usedCardTimes(card_name, scope) < self:getMaxUseTime(player, scope, card, to) or
(player:getMark(MarkEnum.BypassTimesLimit) ~= 0 or
table.find(MarkEnum.TempMarkSuffix, function(s)
return player:getMark(MarkEnum.BypassTimesLimit .. s) ~= 0
end)) or
(to:getMark(MarkEnum.BypassTimesLimitTo) ~= 0 or
table.find(MarkEnum.TempMarkSuffix, function(s)
return to:getMark(MarkEnum.BypassTimesLimitTo .. s) ~= 0
end))
end end
function UsableSkill:withinDistanceLimit(player, isattack, card, to) function UsableSkill:withinDistanceLimit(player, isattack, card, to)
@ -39,7 +47,15 @@ function UsableSkill:withinDistanceLimit(player, isattack, card, to)
for _, skill in ipairs(status_skills) do for _, skill in ipairs(status_skills) do
if skill:bypassDistancesCheck(player, self, card, to) then return true end if skill:bypassDistancesCheck(player, self, card, to) then return true end
end end
return isattack and player:inMyAttackRange(to, self:getDistanceLimit(player, card, to)) or player:distanceTo(to) <= self:getDistanceLimit(player, card, to) return isattack and player:inMyAttackRange(to, self:getDistanceLimit(player, card, to)) or player:distanceTo(to) <= self:getDistanceLimit(player, card, to) or
(player:getMark(MarkEnum.BypassDistancesLimit) ~= 0 or
table.find(MarkEnum.TempMarkSuffix, function(s)
return player:getMark(MarkEnum.BypassDistancesLimit .. s) ~= 0
end)) or
(to:getMark(MarkEnum.BypassDistancesLimitTo) ~= 0 or
table.find(MarkEnum.TempMarkSuffix, function(s)
return to:getMark(MarkEnum.BypassDistancesLimitTo .. s) ~= 0
end))
end end
return UsableSkill return UsableSkill

View File

@ -7,7 +7,7 @@ MarkEnum.StraightToWake = "_straight_to_wake"
---@field SwithSkillPreName string @ 转换技状态标记前缀(整体为前缀+转换技技能) ---@field SwithSkillPreName string @ 转换技状态标记前缀(整体为前缀+转换技技能)
MarkEnum.SwithSkillPreName = "__switcher_" MarkEnum.SwithSkillPreName = "__switcher_"
---@field SwithSkillPreName string @ 转换技状态标记前缀(整体为前缀+转换技技能) ---@field QuestSkillPreName string @ 使命技状态标记前缀(整体为前缀+使命技技能)
MarkEnum.QuestSkillPreName = "__questPre_" MarkEnum.QuestSkillPreName = "__questPre_"
---@field AddMaxCards string @ 增加标记值数量的手牌上限 ---@field AddMaxCards string @ 增加标记值数量的手牌上限
@ -19,10 +19,14 @@ MarkEnum.MinusMaxCards = "MinusMaxCards"
---@field AddMaxCards string @ 于本回合内减少标记值数量的手牌上限 ---@field AddMaxCards string @ 于本回合内减少标记值数量的手牌上限
MarkEnum.MinusMaxCardsInTurn = "MinusMaxCards-turn" MarkEnum.MinusMaxCardsInTurn = "MinusMaxCards-turn"
---@field BypassTimesLimit string @ 对其使用牌无次数限制,可带清除标记后缀 ---@field BypassTimesLimit string @ 使用牌无次数限制,可带清除标记后缀
MarkEnum.BypassTimesLimit = "bypasstimeslimit" MarkEnum.BypassTimesLimit = "BypassTimesLimit"
---@field BypassDistanceLimit string @ 对其使用牌无距离限制,可带清除标记后缀 ---@field BypassDistancesLimit string @ 使用牌无距离限制,可带清除标记后缀
MarkEnum.BypassDistanceLimit = "bypassdistancelimit" MarkEnum.BypassDistancesLimit = "BypassDistancesLimit"
---@field BypassTimesLimitTo string @ 对其使用牌无次数限制,可带清除标记后缀
MarkEnum.BypassTimesLimitTo = "BypassTimesLimitTo"
---@field BypassDistancesLimitTo string @ 对其使用牌无距离限制,可带清除标记后缀
MarkEnum.BypassDistancesLimitTo = "BypassDistancesLimitTo"
---@field UncompulsoryInvalidity string @ 非锁定技失效,可带清除标记后缀 ---@field UncompulsoryInvalidity string @ 非锁定技失效,可带清除标记后缀
MarkEnum.UncompulsoryInvalidity = "uncompulsoryInvalidity" MarkEnum.UncompulsoryInvalidity = "uncompulsoryInvalidity"

View File

@ -1539,6 +1539,8 @@ end
-- available extra_data: -- available extra_data:
-- * must_targets: integer[] -- * must_targets: integer[]
-- * exclusive_targets: integer[] -- * exclusive_targets: integer[]
-- * bypass_distances: boolean
-- * bypass_times: boolean
--- 询问玩家使用一张牌。 --- 询问玩家使用一张牌。
---@param player ServerPlayer @ 要询问的玩家 ---@param player ServerPlayer @ 要询问的玩家
---@param card_name string @ 使用牌的牌名若pattern指定了则可随意写它影响的是烧条的提示信息 ---@param card_name string @ 使用牌的牌名若pattern指定了则可随意写它影响的是烧条的提示信息
@ -1566,6 +1568,14 @@ function Room:askForUseCard(player, card_name, pattern, prompt, cancelable, extr
card_name = table.concat(splitedCardNames, ",") card_name = table.concat(splitedCardNames, ",")
end end
if extra_data then
if extra_data.bypass_distances then
player.room:setPlayerMark(player, MarkEnum.BypassDistancesLimit, 1)
end
if extra_data.bypass_times then
player.room:setPlayerMark(player, MarkEnum.BypassTimesLimit, 1)
end
end
local command = "AskForUseCard" local command = "AskForUseCard"
self:notifyMoveFocus(player, card_name) self:notifyMoveFocus(player, card_name)
cancelable = (cancelable == nil) and true or cancelable cancelable = (cancelable == nil) and true or cancelable
@ -1583,6 +1593,8 @@ function Room:askForUseCard(player, card_name, pattern, prompt, cancelable, extr
self.logic:trigger(fk.AskForCardUse, player, askForUseCardData) self.logic:trigger(fk.AskForCardUse, player, askForUseCardData)
if askForUseCardData.result and type(askForUseCardData.result) == 'table' then if askForUseCardData.result and type(askForUseCardData.result) == 'table' then
player.room:setPlayerMark(player, MarkEnum.BypassDistancesLimit, 0)
player.room:setPlayerMark(player, MarkEnum.BypassTimesLimit, 0)
return askForUseCardData.result return askForUseCardData.result
else else
local data = {card_name, pattern, prompt, cancelable, extra_data} local data = {card_name, pattern, prompt, cancelable, extra_data}
@ -1592,9 +1604,13 @@ function Room:askForUseCard(player, card_name, pattern, prompt, cancelable, extr
Fk.currentResponsePattern = nil Fk.currentResponsePattern = nil
if result ~= "" then if result ~= "" then
player.room:setPlayerMark(player, MarkEnum.BypassDistancesLimit, 0)
player.room:setPlayerMark(player, MarkEnum.BypassTimesLimit, 0)
return self:handleUseCardReply(player, result) return self:handleUseCardReply(player, result)
end end
end end
player.room:setPlayerMark(player, MarkEnum.BypassDistancesLimit, 0)
player.room:setPlayerMark(player, MarkEnum.BypassTimesLimit, 0)
return nil return nil
end end

View File

@ -122,27 +122,6 @@ local uncompulsoryInvalidity = fk.CreateInvaliditySkill {
end end
} }
local noTimesLimit = fk.CreateTargetModSkill{
name = "noTimesLimit",
global = true,
bypass_times = function(self, player, skill, scope, card, to)
return to:getMark(MarkEnum.BypassTimesLimit) ~= 0 or
table.find(MarkEnum.TempMarkSuffix, function(s)
return to:getMark(MarkEnum.BypassTimesLimit .. s) ~= 0
end)
end
}
local noDistanceLimit = fk.CreateAttackRangeSkill{
name = "noDistanceLimit",
global = true,
within_func = function(self, player, to)
return to:getMark(MarkEnum.BypassDistanceLimit) ~= 0 or
table.find(MarkEnum.TempMarkSuffix, function(s)
return to:getMark(MarkEnum.BypassDistanceLimit .. s) ~= 0
end)
end
}
AuxSkills = { AuxSkills = {
discardSkill, discardSkill,
chooseCardsSkill, chooseCardsSkill,
@ -150,6 +129,4 @@ AuxSkills = {
maxCardsSkill, maxCardsSkill,
choosePlayersToMoveCardInBoardSkill, choosePlayersToMoveCardInBoardSkill,
uncompulsoryInvalidity, uncompulsoryInvalidity,
noTimesLimit,
noDistanceLimit,
} }

View File

@ -941,12 +941,8 @@ local bladeSkill = fk.CreateTriggerSkill{
end, end,
on_cost = function(self, event, target, player, data) on_cost = function(self, event, target, player, data)
local room = player.room local room = player.room
room:setPlayerMark(target, MarkEnum.BypassDistanceLimit, 1)
room:setPlayerMark(target, MarkEnum.BypassTimesLimit, 1)
local use = room:askForUseCard(player, "slash", nil, "#blade_slash:" .. target.id, local use = room:askForUseCard(player, "slash", nil, "#blade_slash:" .. target.id,
true, { must_targets = {target.id}, exclusive_targets = {target.id} }) true, { must_targets = {target.id}, exclusive_targets = {target.id}, bypass_distances = true, bypass_times = true })
room:setPlayerMark(target, MarkEnum.BypassDistanceLimit, 0)
room:setPlayerMark(target, MarkEnum.BypassTimesLimit, 0)
if use then if use then
use.extraUse = true use.extraUse = true
self.cost_data = use self.cost_data = use