mirror of
https://github.com/Qsgs-Fans/FreeKill.git
synced 2024-11-15 19:22:25 +08:00
更多bug fix (#232)
- 修复了 #229 整出来的bug - 修复了禁止技被绕过的bug - 查找事件结果包括端点 --------- Co-authored-by: notify <notify-ctrl@qq.com>
This commit is contained in:
parent
35477c0ea1
commit
a9b5d6cd98
|
@ -458,7 +458,8 @@ function enableTargets(card) { // card: int | { skill: string, subcards: int[] }
|
|||
okButton.enabled = JSON.parse(Backend.callLuaFunction(
|
||||
"CardFitPattern",
|
||||
[card, roomScene.responding_card]
|
||||
));
|
||||
)) && !JSON.parse(Backend.callLuaFunction(
|
||||
"CardProhibitedResponse", [card]));
|
||||
} else {
|
||||
okButton.enabled = false;
|
||||
}
|
||||
|
@ -505,7 +506,8 @@ function enableTargets(card) { // card: int | { skill: string, subcards: int[] }
|
|||
okButton.enabled = JSON.parse(Backend.callLuaFunction(
|
||||
"CardFitPattern",
|
||||
[card, roomScene.responding_card]
|
||||
));
|
||||
)) && (roomScene.autoPending || !JSON.parse(Backend.callLuaFunction(
|
||||
"CardProhibitedUse", [card])));
|
||||
} else if (okButton.enabled && roomScene.state === "playing") {
|
||||
okButton.enabled = JSON.parse(Backend.callLuaFunction("CanUseCard", [card, Self.id]));
|
||||
}
|
||||
|
@ -566,7 +568,8 @@ function updateSelectedTargets(playerid, selected) {
|
|||
okButton.enabled = JSON.parse(Backend.callLuaFunction(
|
||||
"CardFitPattern",
|
||||
[card, roomScene.responding_card]
|
||||
));
|
||||
)) && (roomScene.autoPending || !JSON.parse(Backend.callLuaFunction(
|
||||
"CardProhibitedUse", [card])));
|
||||
} else if (okButton.enabled && roomScene.state === "playing") {
|
||||
okButton.enabled = JSON.parse(Backend.callLuaFunction("CanUseCard", [card, Self.id]));
|
||||
}
|
||||
|
|
|
@ -280,9 +280,24 @@ function CanUseCard(card, player)
|
|||
return json.encode(ret)
|
||||
end
|
||||
|
||||
function CardProhibitedUse(cid)
|
||||
local c = Fk:getCardById(cid)
|
||||
local ret = Self:prohibitUse(c)
|
||||
function CardProhibitedUse(card)
|
||||
local c ---@type Card
|
||||
local ret = false
|
||||
if type(card) == "number" then
|
||||
c = Fk:getCardById(card)
|
||||
else
|
||||
local data = json.decode(card)
|
||||
local skill = Fk.skills[data.skill]
|
||||
local selected_cards = data.subcards
|
||||
if skill:isInstanceOf(ViewAsSkill) then
|
||||
c = skill:viewAs(selected_cards)
|
||||
end
|
||||
end
|
||||
if c == nil then
|
||||
return "true"
|
||||
else
|
||||
ret = Self:prohibitUse(c)
|
||||
end
|
||||
return json.encode(ret)
|
||||
end
|
||||
|
||||
|
@ -509,9 +524,24 @@ function SkillFitPattern(skill_name, pattern)
|
|||
return json.encode(ret)
|
||||
end
|
||||
|
||||
function CardProhibitedResponse(cid)
|
||||
local c = Fk:getCardById(cid)
|
||||
local ret = Self:prohibitResponse(c)
|
||||
function CardProhibitedResponse(card)
|
||||
local c ---@type Card
|
||||
local ret = false
|
||||
if type(card) == "number" then
|
||||
c = Fk:getCardById(card)
|
||||
else
|
||||
local data = json.decode(card)
|
||||
local skill = Fk.skills[data.skill]
|
||||
local selected_cards = data.subcards
|
||||
if skill:isInstanceOf(ViewAsSkill) then
|
||||
c = skill:viewAs(selected_cards)
|
||||
end
|
||||
end
|
||||
if c == nil then
|
||||
return "true"
|
||||
else
|
||||
ret = Self:prohibitUse(c)
|
||||
end
|
||||
return json.encode(ret)
|
||||
end
|
||||
|
||||
|
@ -586,12 +616,15 @@ function GetPlayerEquips(pid)
|
|||
end
|
||||
|
||||
function ResetClientLua()
|
||||
local _data = ClientInstance.enter_room_data;
|
||||
local data = ClientInstance.room_settings
|
||||
Self = ClientPlayer:new(fk.Self)
|
||||
ClientInstance = Client:new() -- clear old client data
|
||||
ClientInstance.players = {Self}
|
||||
ClientInstance.alive_players = {Self}
|
||||
ClientInstance.discard_pile = {}
|
||||
|
||||
ClientInstance.enter_room_data = _data;
|
||||
ClientInstance.room_settings = data
|
||||
|
||||
ClientInstance.disabled_packs = data.disabledPack
|
||||
|
|
|
@ -114,8 +114,10 @@ function Engine:loadPackages()
|
|||
-- load standard & standard_cards first
|
||||
self:loadPackage(require("packages.standard"))
|
||||
self:loadPackage(require("packages.standard_cards"))
|
||||
self:loadPackage(require("packages.maneuvering"))
|
||||
table.removeOne(directories, "standard")
|
||||
table.removeOne(directories, "standard_cards")
|
||||
table.removeOne(directories, "maneuvering")
|
||||
|
||||
for _, dir in ipairs(directories) do
|
||||
if (not string.find(dir, ".disabled")) and FileIO.isDir("packages/" .. dir)
|
||||
|
|
|
@ -314,8 +314,8 @@ GameEvent.functions[GameEvent.CardEffect] = function(self)
|
|||
local self = self.room
|
||||
|
||||
for _, event in ipairs({ fk.PreCardEffect, fk.BeforeCardEffect, fk.CardEffecting, fk.CardEffectFinished }) do
|
||||
local user = cardEffectEvent.from and self:getPlayerById(cardEffectEvent.from) or nil
|
||||
if cardEffectEvent.isCancellOut then
|
||||
local user = cardEffectEvent.from and self:getPlayerById(cardEffectEvent.from) or nil
|
||||
if self.logic:trigger(fk.CardEffectCancelledOut, user, cardEffectEvent) then
|
||||
cardEffectEvent.isCancellOut = false
|
||||
else
|
||||
|
|
|
@ -109,7 +109,7 @@ local function bin_search(events, from, to, n, func)
|
|||
|
||||
for i = mid, #events do
|
||||
local v = events[i]
|
||||
if v.id < to and func(v) then
|
||||
if v.id <= to and func(v) then
|
||||
table.insert(ret, v)
|
||||
end
|
||||
if #ret >= n then break end
|
||||
|
@ -137,7 +137,7 @@ function GameEvent:searchEvents(eventType, n, func, endEvent)
|
|||
if #events < 6 then
|
||||
ret = {}
|
||||
for _, v in ipairs(events) do
|
||||
if v.id > from and v.id < to and func(v) then
|
||||
if v.id >= from and v.id <= to and func(v) then
|
||||
table.insert(ret, v)
|
||||
end
|
||||
if #ret >= n then break end
|
||||
|
|
|
@ -2,21 +2,21 @@
|
|||
|
||||
MarkEnum = {}
|
||||
|
||||
-- 跳过觉醒标记(值为技能名通过+连接)
|
||||
---跳过觉醒标记(值为技能名通过+连接)
|
||||
MarkEnum.StraightToWake = "_straight_to_wake"
|
||||
|
||||
--转换技状态标记前缀(整体为前缀+转换技技能)
|
||||
---转换技状态标记前缀(整体为前缀+转换技技能)
|
||||
MarkEnum.SwithSkillPreName = "__switcher_"
|
||||
--使命技状态标记前缀(整体为前缀+使命技技能)
|
||||
---使命技状态标记前缀(整体为前缀+使命技技能)
|
||||
MarkEnum.QuestSkillPreName = "__questPre_"
|
||||
|
||||
--增加标记值数量的手牌上限
|
||||
---增加标记值数量的手牌上限
|
||||
MarkEnum.AddMaxCards = "AddMaxCards"
|
||||
--于本回合内增加标记值数量的手牌上限
|
||||
---于本回合内增加标记值数量的手牌上限
|
||||
MarkEnum.AddMaxCardsInTurn = "AddMaxCards-turn"
|
||||
--减少标记值数量的手牌上限
|
||||
---减少标记值数量的手牌上限
|
||||
MarkEnum.MinusMaxCards = "MinusMaxCards"
|
||||
--于本回合内减少标记值数量的手牌上限
|
||||
---于本回合内减少标记值数量的手牌上限
|
||||
MarkEnum.MinusMaxCardsInTurn = "MinusMaxCards-turn"
|
||||
|
||||
---使用牌无次数限制,可带清除标记后缀(-tmp为请求专用)
|
||||
|
|
|
@ -1472,7 +1472,7 @@ function Room:askForAddTarget(player, targets, num, can_minus, distance_limited,
|
|||
end
|
||||
for _, p in ipairs(targets) do
|
||||
if not table.contains(AimGroup:getAllTargets(data.tos), p.id) and not room:getPlayerById(data.from):isProhibited(p, data.card) then
|
||||
if data.card.skill:modTargetFilter(p.id, orig_tos, player.id, data.card, distance_limited) then
|
||||
if data.card.skill:modTargetFilter(p.id, orig_tos, data.from, data.card, distance_limited) then
|
||||
table.insertIfNeed(tos, p.id)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -21,7 +21,7 @@ local slashSkill = fk.CreateActiveSkill{
|
|||
target_filter = function(self, to_select, selected, _, card)
|
||||
if #selected < self:getMaxTargetNum(Self, card) then
|
||||
local player = Fk:currentRoom():getPlayerById(to_select)
|
||||
return self:modTargetFilter(to_select, selected, Self.id, true, card) and
|
||||
return self:modTargetFilter(to_select, selected, Self.id, card, true) and
|
||||
(#selected > 0 or self:withinTimesLimit(Self, Player.HistoryPhase, card, "slash", player))
|
||||
end
|
||||
end,
|
||||
|
|
Loading…
Reference in New Issue
Block a user