- 改造常备主逻辑,现在常备主会根据可用多余将数调整
- 改良了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,7 +172,9 @@ Flickable {
arr = config.curScheme.banPkg[k];
if (arr.length !== 0) {
const generals = lcall("GetGenerals", k);
disabledGenerals.push(...generals.filter(g => !arr.includes(g)));
if (generals.length !== 0) {
disabledGenerals.push(...generals.filter(g => !arr.includes(g)));
}
}
}
for (k in config.curScheme.normalPkg) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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