- 改造常备主逻辑,现在常备主会根据可用多余将数调整
- 改良了getCardArea
- 重新启用将框不足提醒
- 修复了司马懿问打出牌的bug
- 修复了白名单武将不存在时无法创房的bug

---------

Co-authored-by: notify <notify-ctrl@qq.com>
This commit is contained in:
YoumuKon 2024-04-07 00:51:29 +08:00 committed by GitHub
parent 30e33f92c7
commit e75836ff8d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 33 additions and 29 deletions

View File

@ -172,9 +172,11 @@ Flickable {
arr = config.curScheme.banPkg[k]; arr = config.curScheme.banPkg[k];
if (arr.length !== 0) { if (arr.length !== 0) {
const generals = lcall("GetGenerals", k); const generals = lcall("GetGenerals", k);
if (generals.length !== 0) {
disabledGenerals.push(...generals.filter(g => !arr.includes(g))); disabledGenerals.push(...generals.filter(g => !arr.includes(g)));
} }
} }
}
for (k in config.curScheme.normalPkg) { for (k in config.curScheme.normalPkg) {
arr = config.curScheme.normalPkg[k] ?? []; arr = config.curScheme.normalPkg[k] ?? [];
if (arr.length !== 0) if (arr.length !== 0)

View File

@ -634,8 +634,8 @@ Item {
function loadPackages() { function loadPackages() {
if (loaded) return; if (loaded) return;
const _mods = lcall("GetAllModNames") const _mods = lcall("GetAllModNames");
const modData = lcall("GetAllMods") const modData = lcall("GetAllMods");
const packs = lcall("GetAllGeneralPack"); const packs = lcall("GetAllGeneralPack");
_mods.forEach(name => { _mods.forEach(name => {
const pkgs = modData[name].filter(p => packs.includes(p) const pkgs = modData[name].filter(p => packs.includes(p)

View File

@ -66,25 +66,28 @@ function Client:getPlayerById(id)
return nil return nil
end end
---@param cardId integer | card ---@param cardId integer | Card
---@return CardArea ---@return CardArea
function Client:getCardArea(cardId) function Client:getCardArea(cardId)
if type(cardId) ~= "number" then local cardIds = Card:getIdList(cardId)
assert(cardId and cardId:isInstanceOf(Card)) local resultPos = {}
cardId = cardId:getEffectiveId() for _, cid in ipairs(cardIds) do
if not table.contains(resultPos, Card.PlayerHand) and table.contains(Self.player_cards[Player.Hand], cid) then
table.insert(resultPos, Card.PlayerHand)
end end
if table.contains(Self.player_cards[Player.Hand], cardId) then if not table.contains(resultPos, Card.PlayerEquip) and table.contains(Self.player_cards[Player.Equip], cid) then
return Card.PlayerHand table.insert(resultPos, Card.PlayerEquip)
end
if table.contains(Self.player_cards[Player.Equip], cardId) then
return Card.PlayerEquip
end end
for _, t in pairs(Self.special_cards) do for _, t in pairs(Self.special_cards) do
if table.contains(t, cardId) then if table.contains(t, cid) then
return Card.PlayerSpecial table.insertIfNeed(resultPos, Card.PlayerSpecial)
end end
end end
error("Client:getCardArea can only judge cards in your hand or equip area") end
if #resultPos == 1 then
return resultPos[1]
end
return Card.Unknown
end end
function Client:moveCards(moves) function Client:moveCards(moves)

View File

@ -151,7 +151,7 @@ function GetAllGeneralPack()
end end
function GetGenerals(pack_name) function GetGenerals(pack_name)
if not Fk.packages[pack_name] then return "{}" end if not Fk.packages[pack_name] then return "[]" end
local ret = {} local ret = {}
for _, g in ipairs(Fk.packages[pack_name].generals) do for _, g in ipairs(Fk.packages[pack_name].generals) do
if not g.total_hidden then if not g.total_hidden then

View File

@ -265,11 +265,8 @@ end
---@param cardId integer | Card @ 要获得区域的那张牌可以是Card或者一个id ---@param cardId integer | Card @ 要获得区域的那张牌可以是Card或者一个id
---@return CardArea @ 这张牌的区域 ---@return CardArea @ 这张牌的区域
function Room:getCardArea(cardId) function Room:getCardArea(cardId)
if type(cardId) ~= "number" then local cardIds = table.map(Card:getIdList(cardId), function(cid) return self.card_place[cid] or Card.Unknown end)
assert(cardId and cardId:isInstanceOf(Card)) return #cardIds == 1 and cardIds[1] or Card.Unknown
cardId = cardId:getEffectiveId()
end
return self.card_place[cardId] or Card.Unknown
end end
--- 获得拥有某一张牌的玩家。 --- 获得拥有某一张牌的玩家。

View File

@ -71,6 +71,7 @@ fk.IceDamage = 4
---@field public damageType? DamageType @ 伤害的属性 ---@field public damageType? DamageType @ 伤害的属性
---@field public skillName? string @ 造成本次伤害的技能名 ---@field public skillName? string @ 造成本次伤害的技能名
---@field public beginnerOfTheDamage? boolean @ 是否是本次铁索传导的起点 ---@field public beginnerOfTheDamage? boolean @ 是否是本次铁索传导的起点
---@field public by_user? boolean @ 是否由卡牌直接生效造成的伤害
--- 用来描述和回复体力有关的数据。 --- 用来描述和回复体力有关的数据。
---@class RecoverStruct ---@class RecoverStruct

View File

@ -84,14 +84,14 @@ local guicai = fk.CreateTriggerSkill{
on_cost = function(self, event, target, player, data) on_cost = function(self, event, target, player, data)
local room = player.room local room = player.room
local prompt = "#guicai-ask::" .. target.id local prompt = "#guicai-ask::" .. target.id
local card = room:askForResponse(player, self.name, ".|.|.|hand", prompt, true) local card = room:askForCard(player, 1, 1, false, self.name, true, ".|.|.|hand", prompt)
if card ~= nil then if #card > 0 then
self.cost_data = card self.cost_data = card[1]
return true return true
end end
end, end,
on_use = function(self, event, target, player, data) on_use = function(self, event, target, player, data)
player.room:retrial(self.cost_data, player, data, self.name) player.room:retrial(Fk:getCardById(self.cost_data), player, data, self.name)
end, end,
} }
local fankui = fk.CreateTriggerSkill{ local fankui = fk.CreateTriggerSkill{
@ -1119,7 +1119,7 @@ local role_getlogic = function()
if lord ~= nil then if lord ~= nil then
room.current = lord room.current = lord
local a1 = #room.general_pile local a1 = #room.general_pile
local a2 = #room.players * generalNum + lord_num local a2 = #room.players * generalNum
if a1 < a2 then if a1 < a2 then
room:sendLog{ room:sendLog{
type = "#NoEnoughGeneralDraw", type = "#NoEnoughGeneralDraw",
@ -1129,6 +1129,7 @@ local role_getlogic = function()
} }
room:gameOver("") room:gameOver("")
end end
lord_num = math.min(a1 - a2, lord_num)
local generals = table.connect(room:findGenerals(function(g) local generals = table.connect(room:findGenerals(function(g)
return table.find(Fk.generals[g].skills, function(s) return s.lordSkill end) return table.find(Fk.generals[g].skills, function(s) return s.lordSkill end)
end, lord_num), room:getNGenerals(generalNum)) end, lord_num), room:getNGenerals(generalNum))