无用空表Util.DummyTable化+若干bug fix+若干调整 (#189)
- 将一些作为替代选项的空表替换为Util.DummyTable - 修复了控制失效bug - 修复了askForCards的bug - 为弃牌阶段弃牌禁止取消 - 谋徐盛血量变为100 - setMark追加count为0时设为nil的设定 - 各种国际化 - 观星盒追加旁边的牌堆名
This commit is contained in:
parent
b2a963739b
commit
8a11690de7
|
@ -154,7 +154,7 @@ Item {
|
|||
if (!skilldata) return;
|
||||
const extension = skilldata.extension;
|
||||
for (let i = 0; i < 999; i++) {
|
||||
let fname = AppPath + "/packages/" + extension + "/audio/skill/" +
|
||||
const fname = AppPath + "/packages/" + extension + "/audio/skill/" +
|
||||
skill + (i !== 0 ? i.toString() : "") + ".mp3";
|
||||
|
||||
if (Backend.exists(fname)) {
|
||||
|
@ -163,6 +163,12 @@ Item {
|
|||
if (i > 0) break;
|
||||
}
|
||||
}
|
||||
const fname = AppPath + "/packages/" + extension + "/audio/death/" + general + ".mp3";
|
||||
if (Backend.exists(fname)) {
|
||||
audioDeath.visible = true;
|
||||
} else {
|
||||
audioDeath.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
function updateGeneral() {
|
||||
|
@ -247,6 +253,7 @@ Item {
|
|||
}
|
||||
|
||||
Button {
|
||||
id: audioDeath
|
||||
Layout.fillWidth: true
|
||||
contentItem: ColumnLayout {
|
||||
Text {
|
||||
|
|
|
@ -33,6 +33,28 @@ GraphicsBox {
|
|||
property int areaCapacity: modelData
|
||||
property string areaName: index < areaNames.length ? qsTr(areaNames[index]) : ""
|
||||
|
||||
Rectangle {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
color: "#6B5D42"
|
||||
width: 20
|
||||
height: 100
|
||||
radius: 5
|
||||
|
||||
Text {
|
||||
anchors.fill: parent
|
||||
width: 20
|
||||
height: 100
|
||||
text: areaName
|
||||
color: "white"
|
||||
font.family: fontLibian.name
|
||||
font.pixelSize: 18
|
||||
style: Text.Outline
|
||||
wrapMode: Text.WordWrap
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
}
|
||||
}
|
||||
|
||||
Repeater {
|
||||
id: cardRepeater
|
||||
model: areaCapacity
|
||||
|
|
|
@ -144,14 +144,14 @@ local function parseMsg(msg, nocolor)
|
|||
|
||||
local from = getPlayerStr(data.from, "#0C8F0C")
|
||||
|
||||
local to = data.to or {}
|
||||
local to = data.to or Util.DummyTable
|
||||
local to_str = {}
|
||||
for _, id in ipairs(to) do
|
||||
table.insert(to_str, getPlayerStr(id, "#CC3131"))
|
||||
end
|
||||
to = table.concat(to_str, ", ")
|
||||
|
||||
local card = data.card or {}
|
||||
local card = data.card or Util.DummyTable
|
||||
local allUnknown = true
|
||||
local unknownCount = 0
|
||||
for _, id in ipairs(card) do
|
||||
|
|
|
@ -145,7 +145,7 @@ function GetCards(pack_name)
|
|||
end
|
||||
|
||||
function GetCardSpecialSkills(cid)
|
||||
return json.encode(Fk:getCardById(cid).special_skills or {})
|
||||
return json.encode(Fk:getCardById(cid).special_skills or Util.DummyTable)
|
||||
end
|
||||
|
||||
function DistanceTo(from, to)
|
||||
|
@ -159,7 +159,7 @@ function GetPile(id, name)
|
|||
end
|
||||
|
||||
function GetAllPiles(id)
|
||||
return json.encode(ClientInstance:getPlayerById(id).special_cards or {})
|
||||
return json.encode(ClientInstance:getPlayerById(id).special_cards or Util.DummyTable)
|
||||
end
|
||||
|
||||
function GetPlayerSkills(id)
|
||||
|
|
|
@ -158,6 +158,7 @@ FreeKill使用的是libgit2的C API,与此同时使用Git完成拓展包的下
|
|||
["AskForGeneral"] = "选择武将",
|
||||
["AskForGuanxing"] = "观星",
|
||||
["AskForExchange"] = "换牌",
|
||||
["Pile"] = "牌堆",
|
||||
["AskForChoice"] = "选择",
|
||||
["AskForKingdom"] = "选择势力",
|
||||
["AskForPindian"] = "拼点",
|
||||
|
|
|
@ -315,6 +315,7 @@ end
|
|||
---@param mark string @ 标记
|
||||
---@param count integer @ 为标记删除的数量
|
||||
function Card:setMark(mark, count)
|
||||
if count == 0 then count = nil end
|
||||
if self.mark[mark] ~= count then
|
||||
self.mark[mark] = count
|
||||
end
|
||||
|
|
|
@ -386,7 +386,7 @@ function Engine:filterCard(id, player, data)
|
|||
return
|
||||
end
|
||||
local skills = player:getAllSkills()
|
||||
local filters = self:currentRoom().status_skills[FilterSkill] or {}
|
||||
local filters = self:currentRoom().status_skills[FilterSkill] or Util.DummyTable
|
||||
|
||||
if #filters == 0 then
|
||||
filtered_cards[id] = nil
|
||||
|
|
|
@ -185,6 +185,7 @@ end
|
|||
---@param mark string @ 标记
|
||||
---@param count integer @ 为标记删除的数量
|
||||
function Player:setMark(mark, count)
|
||||
if count == 0 then count = nil end
|
||||
if self.mark[mark] ~= count then
|
||||
self.mark[mark] = count
|
||||
end
|
||||
|
@ -360,7 +361,7 @@ end
|
|||
function Player:getMaxCards()
|
||||
local baseValue = math.max(self.hp, 0)
|
||||
|
||||
local status_skills = Fk:currentRoom().status_skills[MaxCardsSkill] or {}
|
||||
local status_skills = Fk:currentRoom().status_skills[MaxCardsSkill] or Util.DummyTable
|
||||
local max_fixed = nil
|
||||
for _, skill in ipairs(status_skills) do
|
||||
local f = skill:getFixed(self)
|
||||
|
@ -384,7 +385,7 @@ function Player:getAttackRange()
|
|||
local weapon = Fk:getCardById(self:getEquipment(Card.SubtypeWeapon))
|
||||
local baseAttackRange = math.max(weapon and weapon.attack_range or 1, 0)
|
||||
|
||||
local status_skills = Fk:currentRoom().status_skills[AttackRangeSkill] or {}
|
||||
local status_skills = Fk:currentRoom().status_skills[AttackRangeSkill] or Util.DummyTable
|
||||
for _, skill in ipairs(status_skills) do
|
||||
local correct = skill:getCorrect(self)
|
||||
baseAttackRange = baseAttackRange + correct
|
||||
|
@ -424,7 +425,7 @@ function Player:distanceTo(other)
|
|||
local left = #Fk:currentRoom().alive_players - right
|
||||
local ret = math.min(left, right)
|
||||
|
||||
local status_skills = Fk:currentRoom().status_skills[DistanceSkill] or {}
|
||||
local status_skills = Fk:currentRoom().status_skills[DistanceSkill] or Util.DummyTable
|
||||
for _, skill in ipairs(status_skills) do
|
||||
local correct = skill:getCorrect(self, other)
|
||||
if correct == nil then correct = 0 end
|
||||
|
@ -448,7 +449,7 @@ function Player:inMyAttackRange(other, fixLimit)
|
|||
|
||||
fixLimit = fixLimit or 0
|
||||
|
||||
local status_skills = Fk:currentRoom().status_skills[AttackRangeSkill] or {}
|
||||
local status_skills = Fk:currentRoom().status_skills[AttackRangeSkill] or Util.DummyTable
|
||||
for _, skill in ipairs(status_skills) do
|
||||
if skill:withinAttackRange(self, other) then
|
||||
return true
|
||||
|
@ -724,7 +725,7 @@ end
|
|||
---@param card Card @ 特定牌
|
||||
function Player:isProhibited(to, card)
|
||||
local r = Fk:currentRoom()
|
||||
local status_skills = r.status_skills[ProhibitSkill] or {}
|
||||
local status_skills = r.status_skills[ProhibitSkill] or Util.DummyTable
|
||||
for _, skill in ipairs(status_skills) do
|
||||
if skill:isProhibited(self, to, card) then
|
||||
return true
|
||||
|
@ -736,7 +737,7 @@ end
|
|||
--- 确认玩家是否可以使用特定牌。
|
||||
---@param card Card @ 特定的牌
|
||||
function Player:prohibitUse(card)
|
||||
local status_skills = Fk:currentRoom().status_skills[ProhibitSkill] or {}
|
||||
local status_skills = Fk:currentRoom().status_skills[ProhibitSkill] or Util.DummyTable
|
||||
for _, skill in ipairs(status_skills) do
|
||||
if skill:prohibitUse(self, card) then
|
||||
return true
|
||||
|
@ -748,7 +749,7 @@ end
|
|||
--- 确认玩家是否可以打出特定牌。
|
||||
---@param card Card @ 特定的牌
|
||||
function Player:prohibitResponse(card)
|
||||
local status_skills = Fk:currentRoom().status_skills[ProhibitSkill] or {}
|
||||
local status_skills = Fk:currentRoom().status_skills[ProhibitSkill] or Util.DummyTable
|
||||
for _, skill in ipairs(status_skills) do
|
||||
if skill:prohibitResponse(self, card) then
|
||||
return true
|
||||
|
@ -760,7 +761,7 @@ end
|
|||
--- 确认玩家是否可以弃置特定牌。
|
||||
---@param card Card @ 特定的牌
|
||||
function Player:prohibitDiscard(card)
|
||||
local status_skills = Fk:currentRoom().status_skills[ProhibitSkill] or {}
|
||||
local status_skills = Fk:currentRoom().status_skills[ProhibitSkill] or Util.DummyTable
|
||||
for _, skill in ipairs(status_skills) do
|
||||
if skill:prohibitDiscard(self, card) then
|
||||
return true
|
||||
|
|
|
@ -83,7 +83,7 @@ function Skill:isEffectable(player)
|
|||
return true
|
||||
end
|
||||
|
||||
local nullifySkills = Fk:currentRoom().status_skills[InvaliditySkill] or {}
|
||||
local nullifySkills = Fk:currentRoom().status_skills[InvaliditySkill] or Util.DummyTable
|
||||
for _, nullifySkill in ipairs(nullifySkills) do
|
||||
if self.name ~= nullifySkill.name and nullifySkill:getInvalidity(player, self) then
|
||||
return false
|
||||
|
|
|
@ -79,7 +79,7 @@ function ActiveSkill:getMaxTargetNum(player, card)
|
|||
ret = ret[#ret]
|
||||
end
|
||||
|
||||
local status_skills = Fk:currentRoom().status_skills[TargetModSkill] or {}
|
||||
local status_skills = Fk:currentRoom().status_skills[TargetModSkill] or Util.DummyTable
|
||||
for _, skill in ipairs(status_skills) do
|
||||
local correct = skill:getExtraTargetNum(player, self, card)
|
||||
if correct == nil then correct = 0 end
|
||||
|
@ -122,7 +122,7 @@ end
|
|||
|
||||
function ActiveSkill:getDistanceLimit(player, card, to)
|
||||
local ret = self.distance_limit or 0
|
||||
local status_skills = Fk:currentRoom().status_skills[TargetModSkill] or {}
|
||||
local status_skills = Fk:currentRoom().status_skills[TargetModSkill] or Util.DummyTable
|
||||
for _, skill in ipairs(status_skills) do
|
||||
local correct = skill:getDistanceLimit(player, self, card, to)
|
||||
if correct == nil then correct = 0 end
|
||||
|
|
|
@ -15,7 +15,7 @@ end
|
|||
function UsableSkill:getMaxUseTime(player, scope, card, to)
|
||||
scope = scope or Player.HistoryTurn
|
||||
local ret = self.max_use_time[scope]
|
||||
local status_skills = Fk:currentRoom().status_skills[TargetModSkill] or {}
|
||||
local status_skills = Fk:currentRoom().status_skills[TargetModSkill] or Util.DummyTable
|
||||
for _, skill in ipairs(status_skills) do
|
||||
local correct = skill:getResidueNum(player, self, scope, card, to)
|
||||
if correct == nil then correct = 0 end
|
||||
|
|
|
@ -318,7 +318,7 @@ local function cmd_eval(code)
|
|||
if chunk == nil then return false end
|
||||
|
||||
-- Call the chunk and collect the results.
|
||||
local success, err = pcall(chunk, unpack(rawget(env, "...") or {}))
|
||||
local success, err = pcall(chunk, unpack(rawget(env, "...") or Util.DummyTable))
|
||||
if not success then
|
||||
dbg_writeln(COLOR_RED.."错误:"..COLOR_RESET.." "..tostring(err))
|
||||
end
|
||||
|
|
|
@ -277,7 +277,7 @@ fkp.CreateActiveSkill = function(spec)
|
|||
end
|
||||
|
||||
fkp.functions.newVirtualCard = function(number, suit, name, subcards, skill)
|
||||
subcards = subcards or {}
|
||||
subcards = subcards or Util.DummyTable
|
||||
local ret = Fk:cloneCard(name, string2suit[suit], number)
|
||||
if not ret then
|
||||
ret = Fk:cloneCard("slash", string2suit[suit], number)
|
||||
|
|
|
@ -32,7 +32,7 @@ local function useActiveSkill(self, skill, card)
|
|||
local ret = skill:targetFilter(p.id, selected_targets, selected_cards, card or Fk:cloneCard'zixing')
|
||||
if ret and card then
|
||||
local r = self.room
|
||||
local status_skills = r.status_skills[ProhibitSkill] or {}
|
||||
local status_skills = r.status_skills[ProhibitSkill] or Util.DummyTable
|
||||
for _, skill in ipairs(status_skills) do
|
||||
if skill:isProhibited(self.player, p, card) then
|
||||
ret = false
|
||||
|
|
|
@ -288,13 +288,13 @@ GameEvent.functions[GameEvent.Phase] = function(self)
|
|||
local discardNum = #table.filter(
|
||||
player:getCardIds(Player.Hand), function(id)
|
||||
local card = Fk:getCardById(id)
|
||||
return table.every(room.status_skills[MaxCardsSkill] or {}, function(skill)
|
||||
return table.every(room.status_skills[MaxCardsSkill] or Util.DummyTable, function(skill)
|
||||
return not skill:excludeFrom(player, card)
|
||||
end)
|
||||
end
|
||||
) - player:getMaxCards()
|
||||
if discardNum > 0 then
|
||||
room:askForDiscard(player, discardNum, discardNum, false, "game_rule")
|
||||
room:askForDiscard(player, discardNum, discardNum, false, "game_rule", false)
|
||||
end
|
||||
end,
|
||||
[Player.Finish] = function()
|
||||
|
|
|
@ -56,7 +56,7 @@ local sendCardEmotionAndLog = function(room, cardUseEvent)
|
|||
playCardEmotionAndSound(room, room:getPlayerById(from), card)
|
||||
room:doAnimate("Indicate", {
|
||||
from = from,
|
||||
to = cardUseEvent.tos or {},
|
||||
to = cardUseEvent.tos or Util.DummyTable,
|
||||
})
|
||||
|
||||
local useCardIds = card:isVirtual() and card.subcards or { card.id }
|
||||
|
@ -330,7 +330,7 @@ GameEvent.functions[GameEvent.CardEffect] = function(self)
|
|||
self.logic:breakEvent()
|
||||
end
|
||||
|
||||
if table.contains((cardEffectEvent.nullifiedTargets or {}), cardEffectEvent.to) then
|
||||
if table.contains((cardEffectEvent.nullifiedTargets or Util.DummyTable), cardEffectEvent.to) then
|
||||
self.logic:breakEvent()
|
||||
end
|
||||
|
||||
|
|
|
@ -381,7 +381,7 @@ function GameLogic:trigger(event, target, data, refresh_only)
|
|||
local room = self.room
|
||||
local broken = false
|
||||
local skills = self.skill_table[event] or {}
|
||||
local skills_to_refresh = self.refresh_skill_table[event] or {}
|
||||
local skills_to_refresh = self.refresh_skill_table[event] or Util.DummyTable
|
||||
local _target = room.current -- for iteration
|
||||
local player = _target
|
||||
|
||||
|
|
|
@ -484,7 +484,7 @@ function Room:changeHero(player, new_general, full, isDeputy, sendLog)
|
|||
local orig = isDeputy and (player.deputyGeneral or "") or player.general
|
||||
|
||||
orig = Fk.generals[orig]
|
||||
local orig_skills = orig and orig:getSkillNameList() or {}
|
||||
local orig_skills = orig and orig:getSkillNameList() or Util.DummyTable
|
||||
|
||||
local new = Fk.generals[new_general] or Fk.generals["sunce"]
|
||||
local new_skills = new:getSkillNameList()
|
||||
|
@ -884,7 +884,7 @@ function Room:askForUseActiveSkill(player, skill_name, prompt, cancelable, extra
|
|||
prompt = prompt or ""
|
||||
cancelable = (cancelable == nil) and true or cancelable
|
||||
no_indicate = (no_indicate == nil) and true or no_indicate
|
||||
extra_data = extra_data or {}
|
||||
extra_data = extra_data or Util.DummyTable
|
||||
local skill = Fk.skills[skill_name]
|
||||
if not (skill and (skill:isInstanceOf(ActiveSkill) or skill:isInstanceOf(ViewAsSkill))) then
|
||||
print("Attempt ask for use non-active skill: " .. skill_name)
|
||||
|
@ -956,14 +956,14 @@ function Room:askForDiscard(player, minNum, maxNum, includeEquip, skillName, can
|
|||
local checkpoint = true
|
||||
local card = Fk:getCardById(id)
|
||||
|
||||
local status_skills = Fk:currentRoom().status_skills[ProhibitSkill] or {}
|
||||
local status_skills = Fk:currentRoom().status_skills[ProhibitSkill] or Util.DummyTable
|
||||
for _, skill in ipairs(status_skills) do
|
||||
if skill:prohibitDiscard(player, card) then
|
||||
return false
|
||||
end
|
||||
end
|
||||
if skillName == "game_rule" then
|
||||
status_skills = Fk:currentRoom().status_skills[MaxCardsSkill] or {}
|
||||
status_skills = Fk:currentRoom().status_skills[MaxCardsSkill] or Util.DummyTable
|
||||
for _, skill in ipairs(status_skills) do
|
||||
if skill:excludeFrom(player, card) then
|
||||
return false
|
||||
|
@ -1078,7 +1078,7 @@ function Room:askForCard(player, minNum, maxNum, includeEquip, skillName, cancel
|
|||
expand_pile = expand_pile,
|
||||
}
|
||||
local prompt = prompt or ("#AskForCard:::" .. maxNum .. ":" .. minNum)
|
||||
local _, ret = self:askForUseActiveSkill(player, "choose_cards_skill", prompt, cancelable, no_indicate)
|
||||
local _, ret = self:askForUseActiveSkill(player, "choose_cards_skill", prompt, cancelable, data, no_indicate)
|
||||
if ret then
|
||||
chosenCards = ret.cards
|
||||
else
|
||||
|
@ -1292,21 +1292,21 @@ end
|
|||
---@return table<top|bottom, cardId[]>
|
||||
function Room:askForGuanxing(player, cards, top_limit, bottom_limit, customNotify, noPut, areaNames)
|
||||
-- 这一大堆都是来提前报错的
|
||||
top_limit = top_limit or {}
|
||||
bottom_limit = bottom_limit or {}
|
||||
top_limit = top_limit or Util.DummyTable
|
||||
bottom_limit = bottom_limit or Util.DummyTable
|
||||
if #top_limit > 0 then
|
||||
assert(top_limit[1] >= 0 and top_limit[2] >= 0, "牌堆顶区间设置错误:数值小于0")
|
||||
assert(top_limit[1] <= top_limit[2], "牌堆顶区间设置错误:上限小于下限")
|
||||
assert(top_limit[1] >= 0 and top_limit[2] >= 0, "limits error: The lower limit should be greater than 0")
|
||||
assert(top_limit[1] <= top_limit[2], "limits error: The upper limit should be less than the lower limit")
|
||||
end
|
||||
if #bottom_limit > 0 then
|
||||
assert(bottom_limit[1] >= 0 and bottom_limit[2] >= 0, "牌堆底区间设置错误:数值小于0")
|
||||
assert(bottom_limit[1] <= bottom_limit[2], "牌堆底区间设置错误:上限小于下限")
|
||||
assert(bottom_limit[1] >= 0 and bottom_limit[2] >= 0, "limits error: The lower limit should be greater than 0")
|
||||
assert(bottom_limit[1] <= bottom_limit[2], "limits error: The upper limit should be less than the lower limit")
|
||||
end
|
||||
if #top_limit > 0 and #bottom_limit > 0 then
|
||||
assert(#cards >= top_limit[1] + bottom_limit[1] and #cards <= top_limit[2] + bottom_limit[2], "限定区间设置错误:可用空间不能容纳所有牌。")
|
||||
assert(#cards >= top_limit[1] + bottom_limit[1] and #cards <= top_limit[2] + bottom_limit[2], "limits Error: No enough space")
|
||||
end
|
||||
if areaNames then
|
||||
assert(#areaNames > 1, "左侧提示信息设置错误:应有Top和Bottom两个提示信息")
|
||||
assert(#areaNames == 2, "areaNames error: Should have 2 elements")
|
||||
end
|
||||
local command = "AskForGuanxing"
|
||||
self:notifyMoveFocus(player, customNotify or command)
|
||||
|
@ -1332,8 +1332,8 @@ function Room:askForGuanxing(player, cards, top_limit, bottom_limit, customNotif
|
|||
bottom = d[2]
|
||||
end
|
||||
else
|
||||
top = table.random(cards, top_limit and top_limit[2] or #cards) or {}
|
||||
bottom = table.shuffle(table.filter(cards, function(id) return not table.contains(top, id) end)) or {}
|
||||
top = table.random(cards, top_limit and top_limit[2] or #cards) or Util.DummyTable
|
||||
bottom = table.shuffle(table.filter(cards, function(id) return not table.contains(top, id) end)) or Util.DummyTable
|
||||
end
|
||||
|
||||
if not noPut then
|
||||
|
@ -1362,13 +1362,13 @@ end
|
|||
---@param piles_name string[] @ 牌堆名,必须一一对应,否则统一替换为“牌堆X”
|
||||
---@param customNotify string|null @ 自定义读条操作提示
|
||||
---@return table<cardIds, cardId[]>
|
||||
function Room:AskForExchange(player, piles, piles_name, customNotify)
|
||||
function Room:askForExchange(player, piles, piles_name, customNotify)
|
||||
local command = "AskForExchange"
|
||||
piles_name = piles_name or {}
|
||||
piles_name = piles_name or Util.DummyTable
|
||||
if #piles_name ~= #piles then
|
||||
piles_name = {}
|
||||
for i, _ in ipairs(piles) do
|
||||
table.insert(piles_name, "牌堆" .. i)
|
||||
table.insert(piles_name, "Pile" .. i)
|
||||
end
|
||||
end
|
||||
self:notifyMoveFocus(player, customNotify or command)
|
||||
|
@ -1465,7 +1465,7 @@ end
|
|||
---@param event_data CardEffectEvent|nil @ 事件信息
|
||||
---@return CardUseStruct | nil @ 返回关于本次使用牌的数据,以便后续处理
|
||||
function Room:askForUseCard(player, card_name, pattern, prompt, cancelable, extra_data, event_data)
|
||||
if event_data and (event_data.disresponsive or table.contains(event_data.disresponsiveList or {}, player.id)) then
|
||||
if event_data and (event_data.disresponsive or table.contains(event_data.disresponsiveList or Util.DummyTable, player.id)) then
|
||||
return nil
|
||||
end
|
||||
|
||||
|
@ -1485,7 +1485,7 @@ function Room:askForUseCard(player, card_name, pattern, prompt, cancelable, extr
|
|||
local command = "AskForUseCard"
|
||||
self:notifyMoveFocus(player, card_name)
|
||||
cancelable = (cancelable == nil) and true or cancelable
|
||||
extra_data = extra_data or {}
|
||||
extra_data = extra_data or Util.DummyTable
|
||||
pattern = pattern or card_name
|
||||
prompt = prompt or ""
|
||||
|
||||
|
@ -1524,14 +1524,14 @@ end
|
|||
---@param effectData CardEffectEvent @ 关联的卡牌生效流程
|
||||
---@return Card | nil @ 打出的牌
|
||||
function Room:askForResponse(player, card_name, pattern, prompt, cancelable, extra_data, effectData)
|
||||
if effectData and (effectData.disresponsive or table.contains(effectData.disresponsiveList or {}, player.id)) then
|
||||
if effectData and (effectData.disresponsive or table.contains(effectData.disresponsiveList or Util.DummyTable, player.id)) then
|
||||
return nil
|
||||
end
|
||||
|
||||
local command = "AskForResponseCard"
|
||||
self:notifyMoveFocus(player, card_name)
|
||||
cancelable = (cancelable == nil) and true or cancelable
|
||||
extra_data = extra_data or {}
|
||||
extra_data = extra_data or Util.DummyTable
|
||||
pattern = pattern or card_name
|
||||
prompt = prompt or ""
|
||||
|
||||
|
@ -1580,7 +1580,7 @@ function Room:askForNullification(players, card_name, pattern, prompt, cancelabl
|
|||
local command = "AskForUseCard"
|
||||
card_name = card_name or "nullification"
|
||||
cancelable = (cancelable == nil) and true or cancelable
|
||||
extra_data = extra_data or {}
|
||||
extra_data = extra_data or Util.DummyTable
|
||||
prompt = prompt or ""
|
||||
pattern = pattern or card_name
|
||||
|
||||
|
@ -2118,7 +2118,7 @@ function Room:handleCardEffect(event, cardEffectEvent)
|
|||
if cardEffectEvent.card.skill:aboutToEffect(self, cardEffectEvent) then return end
|
||||
if
|
||||
cardEffectEvent.card.trueName == "slash" and
|
||||
not (cardEffectEvent.unoffsetable or table.contains(cardEffectEvent.unoffsetableList or {}, cardEffectEvent.to))
|
||||
not (cardEffectEvent.unoffsetable or table.contains(cardEffectEvent.unoffsetableList or Util.DummyTable, cardEffectEvent.to))
|
||||
then
|
||||
local loopTimes = 1
|
||||
if cardEffectEvent.fixedResponseTimes then
|
||||
|
@ -2160,7 +2160,7 @@ function Room:handleCardEffect(event, cardEffectEvent)
|
|||
elseif
|
||||
cardEffectEvent.card.type == Card.TypeTrick and
|
||||
not (cardEffectEvent.disresponsive or cardEffectEvent.unoffsetable) and
|
||||
not table.contains(cardEffectEvent.prohibitedCardNames or {}, "nullification")
|
||||
not table.contains(cardEffectEvent.prohibitedCardNames or Util.DummyTable, "nullification")
|
||||
then
|
||||
local players = {}
|
||||
for _, p in ipairs(self.alive_players) do
|
||||
|
@ -2169,8 +2169,8 @@ function Room:handleCardEffect(event, cardEffectEvent)
|
|||
if
|
||||
Fk:getCardById(cid).name == "nullification" and
|
||||
not (
|
||||
table.contains(cardEffectEvent.disresponsiveList or {}, p.id) or
|
||||
table.contains(cardEffectEvent.unoffsetableList or {}, p.id)
|
||||
table.contains(cardEffectEvent.disresponsiveList or Util.DummyTable, p.id) or
|
||||
table.contains(cardEffectEvent.unoffsetableList or Util.DummyTable, p.id)
|
||||
)
|
||||
then
|
||||
table.insert(players, p)
|
||||
|
@ -2184,8 +2184,8 @@ function Room:handleCardEffect(event, cardEffectEvent)
|
|||
Exppattern:Parse("nullification"):matchExp(s.pattern) and
|
||||
not (s.enabledAtResponse and not s:enabledAtResponse(p)) and
|
||||
not (
|
||||
table.contains(cardEffectEvent.disresponsiveList or {}, p.id) or
|
||||
table.contains(cardEffectEvent.unoffsetableList or {}, p.id)
|
||||
table.contains(cardEffectEvent.disresponsiveList or Util.DummyTable, p.id) or
|
||||
table.contains(cardEffectEvent.unoffsetableList or Util.DummyTable, p.id)
|
||||
)
|
||||
then
|
||||
table.insert(players, p)
|
||||
|
@ -2800,7 +2800,7 @@ function Room:getSubcardsByRule(card, fromAreas)
|
|||
end
|
||||
|
||||
local cardIds = {}
|
||||
fromAreas = fromAreas or {}
|
||||
fromAreas = fromAreas or Util.DummyTable
|
||||
for _, cardId in ipairs(card:isVirtual() and card.subcards or { card.id }) do
|
||||
if #fromAreas == 0 or table.contains(fromAreas, self:getCardArea(cardId)) then
|
||||
table.insert(cardIds, cardId)
|
||||
|
|
|
@ -10,14 +10,14 @@ local discardSkill = fk.CreateActiveSkill{
|
|||
local checkpoint = true
|
||||
local card = Fk:getCardById(to_select)
|
||||
|
||||
local status_skills = Fk:currentRoom().status_skills[ProhibitSkill] or {}
|
||||
local status_skills = Fk:currentRoom().status_skills[ProhibitSkill] or Util.DummyTable
|
||||
for _, skill in ipairs(status_skills) do
|
||||
if skill:prohibitDiscard(Self, card) then
|
||||
return false
|
||||
end
|
||||
end
|
||||
if Fk.currentResponseReason == "game_rule" then
|
||||
status_skills = Fk:currentRoom().status_skills[MaxCardsSkill] or {}
|
||||
status_skills = Fk:currentRoom().status_skills[MaxCardsSkill] or Util.DummyTable
|
||||
for _, skill in ipairs(status_skills) do
|
||||
if skill:excludeFrom(Self, card) then
|
||||
return false
|
||||
|
|
|
@ -242,8 +242,8 @@ local change_hero = fk.CreateActiveSkill{
|
|||
room:changeHero(target, general, false, false, true)
|
||||
end,
|
||||
}
|
||||
local test2 = General(extension, "mouxusheng", "wu", 4, 4, General.Female)
|
||||
test2.shield = 4
|
||||
local test2 = General(extension, "mouxusheng", "wu", 100, 100, General.Female)
|
||||
test2.shield = 5
|
||||
test2:addSkill("rende")
|
||||
test2:addSkill(cheat)
|
||||
test2:addSkill(control)
|
||||
|
|
|
@ -166,7 +166,7 @@ void QmlBackend::pushLuaValue(lua_State *L, QVariant v) {
|
|||
}
|
||||
break;
|
||||
default:
|
||||
qCritical() << "cannot handle QVariant type" << v.typeId();
|
||||
// qCritical() << "cannot handle QVariant type" << v.typeId();
|
||||
lua_pushnil(L);
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue