fix (#358)
Some checks failed
Check Whitespace and New Line / check (push) Has been cancelled
Deploy Sphinx documentation to Pages / pages (push) Has been cancelled

- 修复了装备牌格式报错的bug
- 修复了副将相关bug
This commit is contained in:
YoumuKon 2024-06-27 18:42:06 +08:00 committed by notify
parent d11bf58cb4
commit bdfcf805e4
9 changed files with 51 additions and 12 deletions

View File

@ -1,5 +1,12 @@
# ChangeLog
## v0.4.18
- 修复掉线仍在读条的bug
- 修复国战单亮副将导致UI失常的bug
___
## v0.4.16 & v0.4.17
在引入freekill-core之后的第一次版本更新甚至无法保证这次更新是否正常

View File

@ -6,7 +6,7 @@
cmake_minimum_required(VERSION 3.16)
project(FreeKill VERSION 0.4.17)
project(FreeKill VERSION 0.4.18)
add_definitions(-DFK_VERSION=\"${CMAKE_PROJECT_VERSION}\")
find_package(Qt6 REQUIRED COMPONENTS

View File

@ -522,7 +522,7 @@ function doIndicate(from, tos) {
function getPlayerStr(playerid) {
const photo = getPhoto(playerid);
if (photo.general === "anjiang" && (photo.deputyGeneral === "anjiang" || !p.deputyGeneral)) {
if (photo.general === "anjiang" && (photo.deputyGeneral === "anjiang" || !photo.deputyGeneral)) {
return luatr("seat#" + photo.seatNumber);
}
@ -755,7 +755,7 @@ function updateSelectedTargets(playerid, selected) {
roomScene.resetPrompt(); // update prompt due to selected_targets
const prompt = lcall("ActiveSkillPrompt",
dashboard.pending_skill !== "" ? dashboard.pending_skill: lcall("GetCardSkill", card),
dashboard.pending_skill !== "" ? dashboard.pendings : [card],
dashboard.pending_skill !== "" ? dashboard.pendings : card,
selected_targets);
if (prompt !== "") {
roomScene.setPrompt(Util.processPrompt(prompt));

View File

@ -14,7 +14,7 @@ function convertNumber(number) {
function getPlayerStr(playerid) {
const photo = getPhoto(playerid);
if (photo.general === "anjiang" && (photo.deputyGeneral === "anjiang" || !p.deputyGeneral)) {
if (photo.general === "anjiang" && (photo.deputyGeneral === "anjiang" || !photo.deputyGeneral)) {
return luatr("seat#" + photo.seatNumber);
}

View File

@ -3,8 +3,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.notify.FreeKill"
android:installLocation="preferExternal"
android:versionCode="417"
android:versionName="0.4.17">
android:versionCode="418"
android:versionName="0.4.18">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

View File

@ -94,7 +94,7 @@ end
---@return boolean
function Skill:isEquipmentSkill(player)
if player then
local filterSkills = Fk:currentRoom().status_skills[FilterSkill]
local filterSkills = Fk:currentRoom().status_skills[FilterSkill] or Util.DummyTable
for _, filter in ipairs(filterSkills) do
local result = filter:equipSkillFilter(self, player)
if result then

View File

@ -355,9 +355,8 @@ function CardEffect:main()
local logic = room.logic
for _, event in ipairs({ fk.PreCardEffect, fk.BeforeCardEffect, fk.CardEffecting, fk.CardEffectFinished }) do
local user = cardEffectEvent.from and room:getPlayerById(cardEffectEvent.from) or nil
if cardEffectEvent.isCancellOut then
if logic:trigger(fk.CardEffectCancelledOut, user, cardEffectEvent) then
if logic:trigger(fk.CardEffectCancelledOut, room:getPlayerById(cardEffectEvent.from), cardEffectEvent) then
cardEffectEvent.isCancellOut = false
else
logic:breakEvent()
@ -379,7 +378,7 @@ function CardEffect:main()
end
if event == fk.PreCardEffect then
if cardEffectEvent.from and logic:trigger(event, room:getPlayerById(cardEffectEvent.from), cardEffectEvent) then
if logic:trigger(event, room:getPlayerById(cardEffectEvent.from), cardEffectEvent) then
if cardEffectEvent.to then
cardEffectEvent.nullifiedTargets = cardEffectEvent.nullifiedTargets or {}
table.insert(cardEffectEvent.nullifiedTargets, cardEffectEvent.to)

View File

@ -160,6 +160,25 @@ function Room:makeGeneralPile()
return true
end
-- 因为现在已经不是轮询了,加上有点难分析
-- 选择开摆
function Room:isReady()
-- 因为delay函数而延时判断延时是否已经结束。
-- 注意整个delay函数的实现都搬到这来了delay本身只负责挂起协程了。
--[[
if self.in_delay then
local rest = self.delay_duration - (os.getms() - self.delay_start) / 1000
if rest <= 50 then
self.in_delay = false
return true
end
return false, rest
end
--]]
return true
end
--[[
-- 供调度器使用的函数,用来指示房间是否就绪。
-- 如果没有就绪的话,可能会返回第二个值来告诉调度器自己还有多久就绪。
function Room:isReady()
@ -197,6 +216,7 @@ function Room:isReady()
end
return ret, (rest and rest > 1) and rest or nil
end
--]]
function Room:checkNoHuman(chkOnly)
if #self.players == 0 then return end
@ -920,6 +940,10 @@ end
--- 延迟一段时间。
---@param ms integer @ 要延迟的毫秒数
function Room:delay(ms)
local start = os.getms()
self.delay_start = start
self.delay_duration = ms
self.in_delay = true
self.room:delay(ms)
coroutine.yield("__handleRequest", ms)
end
@ -2115,9 +2139,14 @@ function Room:askForGuanxing(player, cards, top_limit, bottom_limit, customNotif
local command = "AskForGuanxing"
self:notifyMoveFocus(player, customNotify or command)
local max_top = top_limit and top_limit[2] or #cards
local card_map = {table.slice(cards, 1, max_top + 1)}
local card_map = {}
if max_top > 0 then
table.insert(card_map, table.slice(cards, 1, max_top + 1))
else
table.insert(card_map, {})
end
if max_top < #cards then
table.insert(card_map, table.slice(cards, max_top))
table.insert(card_map, table.slice(cards, max_top + 1))
end
local data = {
prompt = "",

View File

@ -199,6 +199,10 @@ void ServerPlayer::onDisconnected() {
deleteLater();
return;
}
if (room->getThread()) {
// && thinking()) {
room->getThread()->wakeUp(room->getId());
}
setState(Player::Offline);
setSocket(nullptr);
// TODO: add a robot