mirror of
https://github.com/Qsgs-Fans/FreeKill.git
synced 2024-11-16 11:42:45 +08:00
翻译+标记处理 (#205)
- 补齐翻译 - 将无限制标记移到判定函数 - askForUseCard缝入无限制标记,可以通过填标记实现用牌无次数/距离限制
This commit is contained in:
parent
3aef53d16c
commit
49e8849061
|
@ -119,7 +119,7 @@ Flickable {
|
|||
const run = gamedata[2];
|
||||
const winRate = (win / 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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
end
|
||||
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
|
||||
|
||||
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
|
||||
if skill:bypassDistancesCheck(player, self, card, to) then return true 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
|
||||
|
||||
return UsableSkill
|
||||
|
|
|
@ -7,7 +7,7 @@ MarkEnum.StraightToWake = "_straight_to_wake"
|
|||
|
||||
---@field SwithSkillPreName string @ 转换技状态标记前缀(整体为前缀+转换技技能)
|
||||
MarkEnum.SwithSkillPreName = "__switcher_"
|
||||
---@field SwithSkillPreName string @ 转换技状态标记前缀(整体为前缀+转换技技能)
|
||||
---@field QuestSkillPreName string @ 使命技状态标记前缀(整体为前缀+使命技技能)
|
||||
MarkEnum.QuestSkillPreName = "__questPre_"
|
||||
|
||||
---@field AddMaxCards string @ 增加标记值数量的手牌上限
|
||||
|
@ -19,10 +19,14 @@ MarkEnum.MinusMaxCards = "MinusMaxCards"
|
|||
---@field AddMaxCards string @ 于本回合内减少标记值数量的手牌上限
|
||||
MarkEnum.MinusMaxCardsInTurn = "MinusMaxCards-turn"
|
||||
|
||||
---@field BypassTimesLimit string @ 对其使用牌无次数限制,可带清除标记后缀
|
||||
MarkEnum.BypassTimesLimit = "bypasstimeslimit"
|
||||
---@field BypassDistanceLimit string @ 对其使用牌无距离限制,可带清除标记后缀
|
||||
MarkEnum.BypassDistanceLimit = "bypassdistancelimit"
|
||||
---@field BypassTimesLimit string @ 使用牌无次数限制,可带清除标记后缀
|
||||
MarkEnum.BypassTimesLimit = "BypassTimesLimit"
|
||||
---@field BypassDistancesLimit string @ 使用牌无距离限制,可带清除标记后缀
|
||||
MarkEnum.BypassDistancesLimit = "BypassDistancesLimit"
|
||||
---@field BypassTimesLimitTo string @ 对其使用牌无次数限制,可带清除标记后缀
|
||||
MarkEnum.BypassTimesLimitTo = "BypassTimesLimitTo"
|
||||
---@field BypassDistancesLimitTo string @ 对其使用牌无距离限制,可带清除标记后缀
|
||||
MarkEnum.BypassDistancesLimitTo = "BypassDistancesLimitTo"
|
||||
---@field UncompulsoryInvalidity string @ 非锁定技失效,可带清除标记后缀
|
||||
MarkEnum.UncompulsoryInvalidity = "uncompulsoryInvalidity"
|
||||
|
||||
|
|
|
@ -1539,6 +1539,8 @@ end
|
|||
-- available extra_data:
|
||||
-- * must_targets: integer[]
|
||||
-- * exclusive_targets: integer[]
|
||||
-- * bypass_distances: boolean
|
||||
-- * bypass_times: boolean
|
||||
--- 询问玩家使用一张牌。
|
||||
---@param player ServerPlayer @ 要询问的玩家
|
||||
---@param card_name string @ 使用牌的牌名,若pattern指定了则可随意写,它影响的是烧条的提示信息
|
||||
|
@ -1566,6 +1568,14 @@ function Room:askForUseCard(player, card_name, pattern, prompt, cancelable, extr
|
|||
card_name = table.concat(splitedCardNames, ",")
|
||||
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"
|
||||
self:notifyMoveFocus(player, card_name)
|
||||
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)
|
||||
|
||||
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
|
||||
else
|
||||
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
|
||||
|
||||
if result ~= "" then
|
||||
player.room:setPlayerMark(player, MarkEnum.BypassDistancesLimit, 0)
|
||||
player.room:setPlayerMark(player, MarkEnum.BypassTimesLimit, 0)
|
||||
return self:handleUseCardReply(player, result)
|
||||
end
|
||||
end
|
||||
player.room:setPlayerMark(player, MarkEnum.BypassDistancesLimit, 0)
|
||||
player.room:setPlayerMark(player, MarkEnum.BypassTimesLimit, 0)
|
||||
return nil
|
||||
end
|
||||
|
||||
|
|
|
@ -122,27 +122,6 @@ local uncompulsoryInvalidity = fk.CreateInvaliditySkill {
|
|||
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 = {
|
||||
discardSkill,
|
||||
chooseCardsSkill,
|
||||
|
@ -150,6 +129,4 @@ AuxSkills = {
|
|||
maxCardsSkill,
|
||||
choosePlayersToMoveCardInBoardSkill,
|
||||
uncompulsoryInvalidity,
|
||||
noTimesLimit,
|
||||
noDistanceLimit,
|
||||
}
|
||||
|
|
|
@ -941,12 +941,8 @@ local bladeSkill = fk.CreateTriggerSkill{
|
|||
end,
|
||||
on_cost = function(self, event, target, player, data)
|
||||
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,
|
||||
true, { must_targets = {target.id}, exclusive_targets = {target.id} })
|
||||
room:setPlayerMark(target, MarkEnum.BypassDistanceLimit, 0)
|
||||
room:setPlayerMark(target, MarkEnum.BypassTimesLimit, 0)
|
||||
true, { must_targets = {target.id}, exclusive_targets = {target.id}, bypass_distances = true, bypass_times = true })
|
||||
if use then
|
||||
use.extraUse = true
|
||||
self.cost_data = use
|
||||
|
|
Loading…
Reference in New Issue
Block a user