小修小补 (#250)

- 初步添加武将牌堆
- 为长度为2的表做了特判
- 修复了火攻后木马回不来的bug
This commit is contained in:
YoumuKon 2023-08-13 15:05:45 +08:00 committed by GitHub
parent 2f7d7d4a96
commit 3a207442f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 4 deletions

View File

@ -330,6 +330,7 @@ Item {
dashboard.disableSkills();
dashboard.retractAllPiles();
selected_targets = [];
autoPending = false;
if (popupBox.item != null) {
popupBox.item.finished();
@ -348,6 +349,7 @@ Item {
dashboard.enableSkills();
progress.visible = true;
okCancel.visible = true;
autoPending = false;
endPhaseButton.visible = true;
respond_play = false;
}
@ -379,6 +381,7 @@ Item {
dashboard.disableSkills();
progress.visible = true;
respond_play = false;
autoPending = false;
roomScene.okCancel.visible = false;
roomScene.okButton.enabled = false;
roomScene.cancelButton.enabled = false;

View File

@ -187,9 +187,15 @@ function table:contains(element)
end
function table:shuffle()
for i = #self, 2, -1 do
local j = math.random(i)
self[i], self[j] = self[j], self[i]
if #self == 2 then
if math.random() < 0.5 then
self[1], self[2] = self[2], self[1]
end
else
for i = #self, 2, -1 do
local j = math.random(i)
self[i], self[j] = self[j], self[i]
end
end
end

View File

@ -19,6 +19,7 @@
---@field public discard_pile integer[] @ 弃牌堆也是卡牌id的数组
---@field public processing_area integer[] @ 处理区依然是卡牌id数组
---@field public void integer[] @ 从游戏中除外区一样的是卡牌id数组
---@field public general_pile string[] @ 武将牌堆,这是武将名的数组
---@field public card_place table<integer, CardArea> @ 每个卡牌的id对应的区域一张表
---@field public owner_map table<integer, integer> @ 每个卡牌id对应的主人表的值是那个玩家的id可能是nil
---@field public status_skills Skill[] @ 这个房间中含有的状态技列表
@ -80,6 +81,7 @@ function Room:initialize(_room)
self.discard_pile = {}
self.processing_area = {}
self.void = {}
self.general_pile = {}
self.card_place = {}
self.owner_map = {}
self.status_skills = {}
@ -803,7 +805,7 @@ function Room:notifyMoveCards(players, card_moves, forceVisible)
-- if move is relevant to player's hands or equips, it should be open
-- cards move from/to equip/judge/discard/processing should be open
if not (move.moveVisible or forceVisible or containArea(move.toArea, move.to and p:isBuddy(move.to))) then
if not (move.moveVisible or forceVisible or containArea(move.toArea, move.to and p.isBuddy and p:isBuddy(move.to))) then
for _, info in ipairs(move.moveInfo) do
if not containArea(info.fromArea, move.from == p.id) then
info.cardId = -1