mirror of
https://github.com/Qsgs-Fans/FreeKill.git
synced 2024-11-15 19:22:25 +08:00
目标参数改造和bugfix (#287)
- 重做目标参数相关: - 重修`must_targets`参数,必须选择其中**全部**目标后才能选择其他目标/按确定 - 添加`include_targets`参数,必须选择其中**一个**目标后才能选择其他目标/按确定 - 修复expandPile指定牌堆无卡符合要求则收回的bug - 优化ex_choose_skill,添加扩展牌堆和包括装备功能 - 添加ReasonRecast理由,现在recastCard会返回该动作后摸的牌 - 移除了重复的DamageFinished时机触发
This commit is contained in:
parent
9a9fc9c105
commit
8df1985b99
|
@ -574,10 +574,22 @@ function enableTargets(card) { // card: int | { skill: string, subcards: int[] }
|
|||
));
|
||||
photo.selectable = ret;
|
||||
if (roomScene.extra_data instanceof Object) {
|
||||
const must = roomScene.extra_data.must_targets;
|
||||
const included = roomScene.extra_data.include_targets;
|
||||
const exclusived = roomScene.extra_data.exclusive_targets;
|
||||
if (exclusived instanceof Array) {
|
||||
if (exclusived.indexOf(id) === -1) photo.selectable = false;
|
||||
}
|
||||
if (must instanceof Array) {
|
||||
if (must.filter((val) => {
|
||||
return selected_targets.indexOf(val) === -1;
|
||||
}).length !== 0 && must.indexOf(id) === -1) photo.selectable = false;
|
||||
}
|
||||
if (included instanceof Array) {
|
||||
if (included.filter((val) => {
|
||||
return selected_targets.indexOf(val) !== -1;
|
||||
}).length === 0 && included.indexOf(id) === -1) photo.selectable = false;
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -596,8 +608,12 @@ function enableTargets(card) { // card: int | { skill: string, subcards: int[] }
|
|||
if (okButton.enabled) {
|
||||
if (roomScene.extra_data instanceof Object) {
|
||||
const must = roomScene.extra_data.must_targets;
|
||||
const included = roomScene.extra_data.include_targets;
|
||||
if (must instanceof Array) {
|
||||
okButton.enabled = (must.length === 0);
|
||||
if(must.length === 0) okButton.enabled = false;
|
||||
}
|
||||
if (included instanceof Array) {
|
||||
if (included.length === 0) okButton.enabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -636,10 +652,22 @@ function updateSelectedTargets(playerid, selected) {
|
|||
));
|
||||
photo.selectable = ret;
|
||||
if (roomScene.extra_data instanceof Object) {
|
||||
const must = roomScene.extra_data.must_targets;
|
||||
const included = roomScene.extra_data.include_targets;
|
||||
const exclusived = roomScene.extra_data.exclusive_targets;
|
||||
if (exclusived instanceof Array) {
|
||||
if (exclusived.indexOf(id) === -1) photo.selectable = false;
|
||||
}
|
||||
if (must instanceof Array) {
|
||||
if (must.filter((val) => {
|
||||
return selected_targets.indexOf(val) === -1;
|
||||
}).length !== 0 && must.indexOf(id) === -1) photo.selectable = false;
|
||||
}
|
||||
if (included instanceof Array) {
|
||||
if (included.filter((val) => {
|
||||
return selected_targets.indexOf(val) !== -1;
|
||||
}).length === 0 && included.indexOf(id) === -1) photo.selectable = false;
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -658,10 +686,16 @@ function updateSelectedTargets(playerid, selected) {
|
|||
if (okButton.enabled) {
|
||||
if (roomScene.extra_data instanceof Object) {
|
||||
const must = roomScene.extra_data.must_targets;
|
||||
const included = roomScene.extra_data.include_targets;
|
||||
if (must instanceof Array) {
|
||||
okButton.enabled = (must.filter((val) => {
|
||||
if (must.filter((val) => {
|
||||
return selected_targets.indexOf(val) === -1;
|
||||
}).length === 0);
|
||||
}).length !== 0) okButton.enabled = false;
|
||||
}
|
||||
if (included instanceof Array) {
|
||||
if (included.filter((val) => {
|
||||
return selected_targets.indexOf(val) !== -1;
|
||||
}).length === 0) okButton.enabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -365,9 +365,9 @@ RowLayout {
|
|||
[pending_skill, cid, pendings, targets]
|
||||
))) {
|
||||
enabled_cards.push(cid);
|
||||
if (!expanded_piles[pile]) {
|
||||
expandPile(pile);
|
||||
}
|
||||
};
|
||||
if (!expanded_piles[pile]) {
|
||||
expandPile(pile);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -175,7 +175,6 @@ GameEvent.functions[GameEvent.Damage] = function(self)
|
|||
stages = {
|
||||
{fk.Damage, damageStruct.from},
|
||||
{fk.Damaged, damageStruct.to},
|
||||
{fk.DamageFinished, damageStruct.to},
|
||||
}
|
||||
|
||||
for _, struct in ipairs(stages) do
|
||||
|
|
|
@ -3157,6 +3157,7 @@ end
|
|||
---@param card_ids integer[] @ 被重铸的牌
|
||||
---@param who ServerPlayer @ 重铸的角色
|
||||
---@param skillName? string @ 技能名,默认为“重铸”
|
||||
---@return integer[] @ 摸到的牌
|
||||
function Room:recastCard(card_ids, who, skillName)
|
||||
if type(card_ids) == "number" then
|
||||
card_ids = {card_ids}
|
||||
|
@ -3167,7 +3168,7 @@ function Room:recastCard(card_ids, who, skillName)
|
|||
from = who.id,
|
||||
toArea = Card.DiscardPile,
|
||||
skillName = skillName,
|
||||
moveReason = fk.ReasonPutIntoDiscardPile,
|
||||
moveReason = fk.ReasonRecast,
|
||||
proposer = who.id
|
||||
})
|
||||
self:broadcastPlaySound("./audio/system/recast")
|
||||
|
@ -3177,7 +3178,7 @@ function Room:recastCard(card_ids, who, skillName)
|
|||
card = card_ids,
|
||||
arg = skillName,
|
||||
}
|
||||
self:drawCards(who, #card_ids, skillName)
|
||||
return self:drawCards(who, #card_ids, skillName)
|
||||
end
|
||||
|
||||
--- 根据拼点信息开始拼点。
|
||||
|
|
|
@ -192,6 +192,7 @@ fk.ReasonExchange = 8
|
|||
fk.ReasonUse = 9
|
||||
fk.ReasonResonpse = 10
|
||||
fk.ReasonJudge = 11
|
||||
fk.ReasonRecast = 12
|
||||
|
||||
---@class PindianStruct
|
||||
---@field public from ServerPlayer
|
||||
|
|
|
@ -95,7 +95,23 @@ local choosePlayersSkill = fk.CreateActiveSkill{
|
|||
local exChooseSkill = fk.CreateActiveSkill{
|
||||
name = "ex__choose_skill",
|
||||
card_filter = function(self, to_select, selected)
|
||||
return self.pattern ~= "" and Exppattern:Parse(self.pattern):match(Fk:getCardById(to_select)) and #selected < self.max_card_num
|
||||
if #selected < self.max_card_num then return false end
|
||||
|
||||
if Fk:currentRoom():getCardArea(to_select) == Card.PlayerSpecial then
|
||||
if not string.find(self.pattern or "", self.expand_pile or "") then return false end
|
||||
end
|
||||
|
||||
local checkpoint = true
|
||||
local card = Fk:getCardById(to_select)
|
||||
|
||||
if not self.include_equip then
|
||||
checkpoint = checkpoint and (Fk:currentRoom():getCardArea(to_select) ~= Player.Equip)
|
||||
end
|
||||
|
||||
if self.pattern and self.pattern ~= "" then
|
||||
checkpoint = checkpoint and (Exppattern:Parse(self.pattern):match(card))
|
||||
end
|
||||
return checkpoint
|
||||
end,
|
||||
target_filter = function(self, to_select, selected, cards)
|
||||
if self.pattern ~= "" and #cards < self.min_card_num then return end
|
||||
|
|
Loading…
Reference in New Issue
Block a user