parent
615a4884e2
commit
64f095d98f
|
@ -140,6 +140,7 @@ FreeKill使用的是libgit2的C API,与此同时使用Git完成拓展包的下
|
||||||
["#AskForNullificationWithoutTo"] = "是否对 %src 使用的 %arg 使用无懈可击?",
|
["#AskForNullificationWithoutTo"] = "是否对 %src 使用的 %arg 使用无懈可击?",
|
||||||
|
|
||||||
["#AskForDiscard"] = "请弃置 %arg 张牌,最少 %arg2 张",
|
["#AskForDiscard"] = "请弃置 %arg 张牌,最少 %arg2 张",
|
||||||
|
["#AskForCard"] = "请选择 %arg 张牌,最少 %arg2 张",
|
||||||
["#askForPindian"] = "请选择一张手牌作为拼点牌",
|
["#askForPindian"] = "请选择一张手牌作为拼点牌",
|
||||||
|
|
||||||
["Trust"] = "托管",
|
["Trust"] = "托管",
|
||||||
|
|
|
@ -846,8 +846,9 @@ end
|
||||||
---@param skillName string @ 引发弃牌的技能名
|
---@param skillName string @ 引发弃牌的技能名
|
||||||
---@param cancelable boolean @ 能不能点取消?
|
---@param cancelable boolean @ 能不能点取消?
|
||||||
---@param pattern string @ 弃牌需要符合的规则
|
---@param pattern string @ 弃牌需要符合的规则
|
||||||
|
---@param prompt string @ 提示信息
|
||||||
---@return integer[] @ 弃掉的牌的id列表,可能是空的
|
---@return integer[] @ 弃掉的牌的id列表,可能是空的
|
||||||
function Room:askForDiscard(player, minNum, maxNum, includeEquip, skillName, cancelable, pattern)
|
function Room:askForDiscard(player, minNum, maxNum, includeEquip, skillName, cancelable, pattern, prompt)
|
||||||
if minNum < 1 then
|
if minNum < 1 then
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
@ -862,7 +863,7 @@ function Room:askForDiscard(player, minNum, maxNum, includeEquip, skillName, can
|
||||||
reason = skillName,
|
reason = skillName,
|
||||||
pattern = pattern,
|
pattern = pattern,
|
||||||
}
|
}
|
||||||
local prompt = "#AskForDiscard:::" .. maxNum .. ":" .. minNum
|
local prompt = prompt or ("#AskForDiscard:::" .. maxNum .. ":" .. minNum)
|
||||||
local _, ret = self:askForUseActiveSkill(player, "discard_skill", prompt, cancelable, data)
|
local _, ret = self:askForUseActiveSkill(player, "discard_skill", prompt, cancelable, data)
|
||||||
if ret then
|
if ret then
|
||||||
toDiscard = ret.cards
|
toDiscard = ret.cards
|
||||||
|
@ -891,10 +892,11 @@ end
|
||||||
---@param prompt string @ 提示信息
|
---@param prompt string @ 提示信息
|
||||||
---@param skillName string @ 技能名
|
---@param skillName string @ 技能名
|
||||||
---@return integer[] @ 选择的玩家id列表,可能为空
|
---@return integer[] @ 选择的玩家id列表,可能为空
|
||||||
function Room:askForChoosePlayers(player, targets, minNum, maxNum, prompt, skillName)
|
function Room:askForChoosePlayers(player, targets, minNum, maxNum, prompt, skillName, cancelable)
|
||||||
if maxNum < 1 then
|
if maxNum < 1 then
|
||||||
return {}
|
return {}
|
||||||
end
|
end
|
||||||
|
cancelable = (not cancelable) and false or true
|
||||||
|
|
||||||
local data = {
|
local data = {
|
||||||
targets = targets,
|
targets = targets,
|
||||||
|
@ -903,12 +905,15 @@ function Room:askForChoosePlayers(player, targets, minNum, maxNum, prompt, skill
|
||||||
pattern = "",
|
pattern = "",
|
||||||
skillName = skillName
|
skillName = skillName
|
||||||
}
|
}
|
||||||
local _, ret = self:askForUseActiveSkill(player, "choose_players_skill", prompt or "", true, data)
|
local _, ret = self:askForUseActiveSkill(player, "choose_players_skill", prompt or "", cancelable, data)
|
||||||
if ret then
|
if ret then
|
||||||
return ret.targets
|
return ret.targets
|
||||||
else
|
else
|
||||||
-- TODO: default
|
if cancelable then
|
||||||
return {}
|
return {}
|
||||||
|
else
|
||||||
|
return table.random(targets, minNum)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -922,8 +927,9 @@ end
|
||||||
---@param skillName string @ 技能名
|
---@param skillName string @ 技能名
|
||||||
---@param cancelable boolean @ 能不能点取消
|
---@param cancelable boolean @ 能不能点取消
|
||||||
---@param pattern string @ 选牌规则
|
---@param pattern string @ 选牌规则
|
||||||
|
---@param prompt string @ 提示信息
|
||||||
---@return integer[] @ 选择的牌的id列表,可能是空的
|
---@return integer[] @ 选择的牌的id列表,可能是空的
|
||||||
function Room:askForCard(player, minNum, maxNum, includeEquip, skillName, cancelable, pattern)
|
function Room:askForCard(player, minNum, maxNum, includeEquip, skillName, cancelable, pattern, prompt)
|
||||||
if minNum < 1 then
|
if minNum < 1 then
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
@ -938,7 +944,7 @@ function Room:askForCard(player, minNum, maxNum, includeEquip, skillName, cancel
|
||||||
reason = skillName,
|
reason = skillName,
|
||||||
pattern = pattern,
|
pattern = pattern,
|
||||||
}
|
}
|
||||||
local prompt = "#askForCard:::" .. maxNum .. ":" .. minNum
|
local prompt = prompt or ("#AskForCard:::" .. maxNum .. ":" .. minNum)
|
||||||
local _, ret = self:askForUseActiveSkill(player, "choose_cards_skill", prompt, cancelable, data)
|
local _, ret = self:askForUseActiveSkill(player, "choose_cards_skill", prompt, cancelable, data)
|
||||||
if ret then
|
if ret then
|
||||||
chosenCards = ret.cards
|
chosenCards = ret.cards
|
||||||
|
@ -967,12 +973,19 @@ end
|
||||||
---@param maxNum integer @ 选目标最大值
|
---@param maxNum integer @ 选目标最大值
|
||||||
---@param pattern string @ 选牌规则
|
---@param pattern string @ 选牌规则
|
||||||
---@param prompt string @ 提示信息
|
---@param prompt string @ 提示信息
|
||||||
|
---@param cancelable boolean @ 能否点取消
|
||||||
---@return integer[], integer
|
---@return integer[], integer
|
||||||
function Room:askForChooseCardAndPlayers(player, targets, minNum, maxNum, pattern, prompt, skillName)
|
function Room:askForChooseCardAndPlayers(player, targets, minNum, maxNum, pattern, prompt, skillName, cancelable)
|
||||||
if maxNum < 1 then
|
if maxNum < 1 then
|
||||||
return {}
|
return {}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local pcards = table.filter(player:getCardIds({ Player.Hand, Player.Equip }), function(id)
|
||||||
|
local c = Fk:getCardById(id)
|
||||||
|
return c:matchPattern(pattern)
|
||||||
|
end)
|
||||||
|
if #pcards == 0 then return {} end
|
||||||
|
|
||||||
local data = {
|
local data = {
|
||||||
targets = targets,
|
targets = targets,
|
||||||
num = maxNum,
|
num = maxNum,
|
||||||
|
@ -984,8 +997,11 @@ function Room:askForChooseCardAndPlayers(player, targets, minNum, maxNum, patter
|
||||||
if ret then
|
if ret then
|
||||||
return ret.targets, ret.cards[1]
|
return ret.targets, ret.cards[1]
|
||||||
else
|
else
|
||||||
-- TODO: default
|
if cancelable then
|
||||||
return {}
|
return {}
|
||||||
|
else
|
||||||
|
return table.random(targets, minNum), table.random(pcards)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1111,12 +1127,13 @@ end
|
||||||
---@param player ServerPlayer @ 要询问的玩家
|
---@param player ServerPlayer @ 要询问的玩家
|
||||||
---@param skill_name string @ 技能名
|
---@param skill_name string @ 技能名
|
||||||
---@param data any @ 未使用
|
---@param data any @ 未使用
|
||||||
|
---@param prompt string @ 提示信息
|
||||||
---@return boolean
|
---@return boolean
|
||||||
function Room:askForSkillInvoke(player, skill_name, data)
|
function Room:askForSkillInvoke(player, skill_name, data, prompt)
|
||||||
local command = "AskForSkillInvoke"
|
local command = "AskForSkillInvoke"
|
||||||
self:notifyMoveFocus(player, skill_name)
|
self:notifyMoveFocus(player, skill_name)
|
||||||
local invoked = false
|
local invoked = false
|
||||||
local result = self:doRequest(player, command, skill_name)
|
local result = self:doRequest(player, command, json.encode{ skill_name, prompt })
|
||||||
if result ~= "" then invoked = true end
|
if result ~= "" then invoked = true end
|
||||||
return invoked
|
return invoked
|
||||||
end
|
end
|
||||||
|
|
|
@ -307,5 +307,6 @@ ___
|
||||||
-- aux skills
|
-- aux skills
|
||||||
Fk:loadTranslationTable{
|
Fk:loadTranslationTable{
|
||||||
["discard_skill"] = "弃牌",
|
["discard_skill"] = "弃牌",
|
||||||
|
["choose_cards_skill"] = "选牌",
|
||||||
["choose_players_skill"] = "选择角色",
|
["choose_players_skill"] = "选择角色",
|
||||||
}
|
}
|
||||||
|
|
|
@ -291,10 +291,14 @@ Item {
|
||||||
Text {
|
Text {
|
||||||
id: prompt
|
id: prompt
|
||||||
visible: progress.visible
|
visible: progress.visible
|
||||||
anchors.top: progress.top
|
anchors.bottom: progress.bottom
|
||||||
anchors.topMargin: -2
|
|
||||||
color: "white"
|
|
||||||
z: 1
|
z: 1
|
||||||
|
color: "#F0E5DA"
|
||||||
|
font.pixelSize: 16
|
||||||
|
font.family: fontLibian.name
|
||||||
|
style: Text.Outline
|
||||||
|
styleColor: "#3D2D1C"
|
||||||
|
textFormat: TextEdit.RichText
|
||||||
anchors.horizontalCenter: progress.horizontalCenter
|
anchors.horizontalCenter: progress.horizontalCenter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -311,20 +315,25 @@ Item {
|
||||||
|
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
implicitWidth: 200
|
implicitWidth: 200
|
||||||
implicitHeight: 14
|
implicitHeight: 12
|
||||||
color: "black"
|
color: "black"
|
||||||
radius: 3
|
radius: 6
|
||||||
}
|
}
|
||||||
|
|
||||||
contentItem: Item {
|
contentItem: Item {
|
||||||
implicitWidth: 200
|
implicitWidth: 196
|
||||||
implicitHeight: 12
|
implicitHeight: 10
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
width: progress.visualPosition * parent.width
|
width: progress.visualPosition * parent.width
|
||||||
height: parent.height
|
height: parent.height
|
||||||
radius: 2
|
radius: 6
|
||||||
color: "red"
|
gradient: Gradient {
|
||||||
|
GradientStop { position: 0.0; color: "orange" }
|
||||||
|
GradientStop { position: 0.3; color: "red" }
|
||||||
|
GradientStop { position: 0.7; color: "red" }
|
||||||
|
GradientStop { position: 1.0; color: "orange" }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -577,9 +577,12 @@ callbacks["AskForGeneral"] = function(jsonData) {
|
||||||
}
|
}
|
||||||
|
|
||||||
callbacks["AskForSkillInvoke"] = function(jsonData) {
|
callbacks["AskForSkillInvoke"] = function(jsonData) {
|
||||||
// jsonData: string name
|
// jsonData: [ string name, string prompt ]
|
||||||
roomScene.promptText = Backend.translate("#AskForSkillInvoke")
|
let data = JSON.parse(jsonData);
|
||||||
.arg(Backend.translate(jsonData));
|
let skill = data[0];
|
||||||
|
let prompt = data[1];
|
||||||
|
roomScene.promptText = prompt ? processPrompt(prompt) : Backend.translate("#AskForSkillInvoke")
|
||||||
|
.arg(Backend.translate(skill));
|
||||||
roomScene.state = "replying";
|
roomScene.state = "replying";
|
||||||
roomScene.okCancel.visible = true;
|
roomScene.okCancel.visible = true;
|
||||||
roomScene.okButton.enabled = true;
|
roomScene.okButton.enabled = true;
|
||||||
|
|
Loading…
Reference in New Issue