修bug... 虽然不知道是不是修了
修那个gameOver触发时机的
注意了休整下投降仍未修复哦
先放个PR在这了
This commit is contained in:
notify 2024-02-17 09:47:17 +08:00 committed by GitHub
parent c3cdb8dc50
commit 7779f06411
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 19 additions and 26 deletions

View File

@ -1,4 +1,8 @@
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
# ------------------------------------------------------------
# CMake+QT
# 2022-01-24 2023-02-21 v0.0.1
# ------------------------------------------------------------
cmake_minimum_required(VERSION 3.16) cmake_minimum_required(VERSION 3.16)

View File

@ -255,9 +255,9 @@ Item {
const gdata = lcall("GetGeneralData", modelData); const gdata = lcall("GetGeneralData", modelData);
const pack = gdata.package; const pack = gdata.package;
if (s.banPkg[pack]) { if (s.banPkg[pack]) {
if (!s.banPkg[pack].includes(modelData)) return 0.7; if (!s.banPkg[pack].includes(modelData)) return 0.5;
} else { } else {
if (!!s.normalPkg[pack]?.includes(modelData)) return 0.7; if (!!s.normalPkg[pack]?.includes(modelData)) return 0.5;
} }
return 0; return 0;
} }

View File

@ -768,9 +768,7 @@ fk.client_callback["AskForUseActiveSkill"] = function(jsonData)
local data = json.decode(jsonData) local data = json.decode(jsonData)
local skill = Fk.skills[data[1]] local skill = Fk.skills[data[1]]
local extra_data = data[4] local extra_data = data[4]
for k, v in pairs(extra_data) do skill._extra_data = extra_data
skill[k] = v
end
Fk.currentResponseReason = extra_data.skillName Fk.currentResponseReason = extra_data.skillName
ClientInstance:notifyUI("AskForUseActiveSkill", jsonData) ClientInstance:notifyUI("AskForUseActiveSkill", jsonData)

View File

@ -414,14 +414,6 @@ function Card:getMark(mark)
return ret return ret
end end
--- 判定卡牌是否拥有对应的Mark。
---@param mark string @ 标记
---@return boolean
function Card:hasMark(mark)
fk.qWarning("hasMark will be deleted in future version!")
return self:getMark(mark) ~= 0
end
--- 获取卡牌有哪些Mark。 --- 获取卡牌有哪些Mark。
function Card:getMarkNames() function Card:getMarkNames()
local ret = {} local ret = {}

View File

@ -221,14 +221,6 @@ function Player:getMark(mark)
return mark return mark
end end
--- 判定角色是否拥有对应的Mark。
---@param mark string @ 标记
---@return boolean
function Player:hasMark(mark)
fk.qWarning("hasMark will be deleted in future version!")
return self:getMark(mark) ~= 0
end
--- 获取角色有哪些Mark。 --- 获取角色有哪些Mark。
function Player:getMarkNames() function Player:getMarkNames()
local ret = {} local ret = {}

View File

@ -44,6 +44,7 @@ function Skill:initialize(name, frequency)
self.anim_type = "" self.anim_type = ""
self.related_skills = {} self.related_skills = {}
self.attachedKingdom = {} self.attachedKingdom = {}
self._extra_data = {}
local name_splited = name:split("__") local name_splited = name:split("__")
self.trueName = name_splited[#name_splited] self.trueName = name_splited[#name_splited]
@ -63,6 +64,8 @@ end
function Skill:__index(k) function Skill:__index(k)
if k == "cost_data" then if k == "cost_data" then
return Fk:currentRoom().skill_costs[self.name] return Fk:currentRoom().skill_costs[self.name]
else
return self._extra_data[k]
end end
end end

View File

@ -114,9 +114,7 @@ smart_cb["AskForUseActiveSkill"] = function(self, jsonData)
local skillName, prompt, cancelable, extra_data = table.unpack(data) local skillName, prompt, cancelable, extra_data = table.unpack(data)
local skill = Fk.skills[skillName] local skill = Fk.skills[skillName]
for k, v in pairs(extra_data) do skill._extra_data = extra_data
skill[k] = v
end
local ret = self:callFromTable(fk.ai_active_skill, nil, skillName, local ret = self:callFromTable(fk.ai_active_skill, nil, skillName,
self, prompt, cancelable, extra_data) self, prompt, cancelable, extra_data)

View File

@ -3429,7 +3429,13 @@ end
function Room:gameOver(winner) function Room:gameOver(winner)
if not self.game_started then return end if not self.game_started then return end
if table.contains(
{ "running", "normal" },
coroutine.status(self.main_co)
) then
self.logic:trigger(fk.GameFinished, nil, winner) self.logic:trigger(fk.GameFinished, nil, winner)
end
self.game_started = false self.game_started = false
self.game_finished = true self.game_finished = true

View File

@ -517,7 +517,7 @@ void Server::handleNameAndPassword(ClientSocket *client, const QString &name,
void Server::onRoomAbandoned() { void Server::onRoomAbandoned() {
Room *room = qobject_cast<Room *>(sender()); Room *room = qobject_cast<Room *>(sender());
room->gameOver(); // room->gameOver(); // Lua会出手
rooms.remove(room->getId()); rooms.remove(room->getId());
updateOnlineInfo(); updateOnlineInfo();
// 按理说这时候就可以删除了但是这里肯定比Lua先检测到。 // 按理说这时候就可以删除了但是这里肯定比Lua先检测到。