diff --git a/Fk/Cheat/PlayerDetail.qml b/Fk/Cheat/PlayerDetail.qml index d54ccbc1..1b99f0e1 100644 --- a/Fk/Cheat/PlayerDetail.qml +++ b/Fk/Cheat/PlayerDetail.qml @@ -119,7 +119,7 @@ Flickable { const run = gamedata[2]; const winRate = (win / total) * 100; const runRate = (run / total) * 100; - playerGameData.text = Backend.translate("Win=%1 Run=%2 Total=%3").arg(winRate.toFixed(2)) + playerGameData.text = total === 0 ? "Newbie" : "
" + Backend.translate("Win=%1 Run=%2 Total=%3").arg(winRate.toFixed(2)) .arg(runRate.toFixed(2)).arg(total); } diff --git a/Fk/Pages/Room.qml b/Fk/Pages/Room.qml index 91562eca..7f5fdc2d 100644 --- a/Fk/Pages/Room.qml +++ b/Fk/Pages/Room.qml @@ -581,7 +581,7 @@ Item { Drawer { id: roomDrawer - width: roomScene.width * 0.3 / mainWindow.scale + width: parent.width * 0.3 / mainWindow.scale height: parent.height / mainWindow.scale dim: false clip: true @@ -895,6 +895,13 @@ Item { const datalist = []; for (let i = 0; i < photoModel.count; i++) { const item = photoModel.get(i); + let gameData; + try { + gameData = JSON.parse(Backend.callLuaFunction("GetPlayerGameData", [item.id])); + } catch (e) { + console.log(e); + gameData = [0, 0, 0]; + } if (item.id > 0) { datalist.push({ id: item.id, @@ -902,6 +909,7 @@ Item { name: item.screenName, isOwner: item.isOwner, ready: item.ready, + gameData: gameData, }); } } @@ -926,6 +934,7 @@ Item { roomScene.isOwner = d.isOwner; } else { Backend.callLuaFunction("ResetAddPlayer", [JSON.stringify([d.id, d.name, d.avatar, d.ready])]); + Backend.callLuaFunction("SetPlayerGameData", [d.id, d.gameData]); } Logic.getPhotoModel(d.id).isOwner = d.isOwner; }); diff --git a/lua/client/client_util.lua b/lua/client/client_util.lua index 99023634..7c45b2a1 100644 --- a/lua/client/client_util.lua +++ b/lua/client/client_util.lua @@ -598,4 +598,10 @@ function GetPlayerGameData(pid) return json.encode(ret) end +function SetPlayerGameData(pid, data) + local c = ClientInstance + local p = c:getPlayerById(pid) + p.player:setGameData(table.unpack(data)) +end + dofile "lua/client/i18n/init.lua" diff --git a/lua/client/i18n/zh_CN.lua b/lua/client/i18n/zh_CN.lua index ab1975a7..7e150a2f 100644 --- a/lua/client/i18n/zh_CN.lua +++ b/lua/client/i18n/zh_CN.lua @@ -53,6 +53,7 @@ Fk:loadTranslationTable{ ["Give Egg"] = "砸蛋", ["Give Shoe"] = "拖鞋", ["Kick From Room"] = "踢出房间", + ["Newbie"] = "新手保护ing", ["Win=%1 Run=%2 Total=%3"] = "胜率%1% 逃率%2% 总场次%3", ["$OnlineInfo"] = "大厅人数:%1,总在线人数:%2", diff --git a/lua/core/skill_type/usable_skill.lua b/lua/core/skill_type/usable_skill.lua index ecb1244d..3a8f0cec 100644 --- a/lua/core/skill_type/usable_skill.lua +++ b/lua/core/skill_type/usable_skill.lua @@ -24,13 +24,14 @@ function UsableSkill:getMaxUseTime(player, scope, card, to) return ret end -function UsableSkill:withinTimesLimit(player, scope, card, to) +function UsableSkill:withinTimesLimit(player, scope, card, card_name, to) scope = scope or Player.HistoryTurn local status_skills = Fk:currentRoom().status_skills[TargetModSkill] or Util.DummyTable for _, skill in ipairs(status_skills) do if skill:isUnlimited(player, self, scope, card, to) then return true end end - return player:usedCardTimes(card.trueName, scope) < self:getMaxUseTime(player, scope, card, to) + card_name = card_name or card.trueName + return player:usedCardTimes(card_name, scope) < self:getMaxUseTime(player, scope, card, to) end function UsableSkill:withinDistanceLimit(player, isattack, card, to) diff --git a/lua/server/events/gameflow.lua b/lua/server/events/gameflow.lua index dfb9d015..76151365 100644 --- a/lua/server/events/gameflow.lua +++ b/lua/server/events/gameflow.lua @@ -258,7 +258,7 @@ GameEvent.functions[GameEvent.Phase] = function(self) tos = { {player.id} }, } room:doCardEffect(effect_data) - if effect_data.isCanCellout and card.skill then + if effect_data.isCancellOut and card.skill then card.skill:onNullified(room, effect_data) end end diff --git a/lua/server/events/usecard.lua b/lua/server/events/usecard.lua index 2e64fbfb..c5f0bd4d 100644 --- a/lua/server/events/usecard.lua +++ b/lua/server/events/usecard.lua @@ -311,10 +311,10 @@ GameEvent.functions[GameEvent.CardEffect] = function(self) local self = self.room for _, event in ipairs({ fk.PreCardEffect, fk.BeforeCardEffect, fk.CardEffecting, fk.CardEffectFinished }) do - if cardEffectEvent.isCanCellout then + if cardEffectEvent.isCancellOut then local user = cardEffectEvent.from and self:getPlayerById(cardEffectEvent.from) or nil if self.logic:trigger(fk.CardEffectCancelledOut, user, cardEffectEvent) then - cardEffectEvent.isCanCellout = false + cardEffectEvent.isCancellOut = false else self.logic:breakEvent() end diff --git a/lua/server/room.lua b/lua/server/room.lua index b1e799aa..2bf64f51 100644 --- a/lua/server/room.lua +++ b/lua/server/room.lua @@ -2236,11 +2236,11 @@ function Room:handleCardEffect(event, cardEffectEvent) self:useCard(use) end - if not cardEffectEvent.isCanCellout then + if not cardEffectEvent.isCancellOut then break end - cardEffectEvent.isCanCellout = i == loopTimes + cardEffectEvent.isCancellOut = i == loopTimes end elseif cardEffectEvent.card.type == Card.TypeTrick and diff --git a/lua/server/system_enum.lua b/lua/server/system_enum.lua index a1c24cb6..b62acdc4 100644 --- a/lua/server/system_enum.lua +++ b/lua/server/system_enum.lua @@ -133,7 +133,7 @@ fk.IceDamage = 4 ---@field public cardsResponded Card[]|null ---@field public disresponsive boolean|null ---@field public unoffsetable boolean|null ----@field public isCanCellout boolean|null +---@field public isCancellOut boolean|null ---@field public fixedResponseTimes table|integer|null ---@field public fixedAddTimesResponsors integer[] ---@field public prohibitedCardNames string[]|null diff --git a/packages/maneuvering/init.lua b/packages/maneuvering/init.lua index 87dd88f4..0048577c 100644 --- a/packages/maneuvering/init.lua +++ b/packages/maneuvering/init.lua @@ -80,7 +80,7 @@ local analepticSkill = fk.CreateActiveSkill{ name = "analeptic_skill", max_turn_use_time = 1, can_use = function(self, player, card) - return self:withinTimesLimit(player, Player.HistoryTurn, card, player) + return self:withinTimesLimit(player, Player.HistoryTurn, card, "analeptic", player) end, on_use = function(self, room, use) if not use.tos or #TargetGroup:getRealTargets(use.tos) == 0 then diff --git a/packages/standard_cards/init.lua b/packages/standard_cards/init.lua index 9dfd2f34..94b0a7e5 100644 --- a/packages/standard_cards/init.lua +++ b/packages/standard_cards/init.lua @@ -50,14 +50,14 @@ local slashSkill = fk.CreateActiveSkill{ can_use = function(self, player, card) return table.find(Fk:currentRoom().alive_players, function(p) - return self:withinTimesLimit(player, Player.HistoryPhase, card, p) + return self:withinTimesLimit(player, Player.HistoryPhase, card, "slash", p) end) end, target_filter = function(self, to_select, selected, _, card) if #selected < self:getMaxTargetNum(Self, card) then local player = Fk:currentRoom():getPlayerById(to_select) return Self ~= player and self:withinDistanceLimit(Self, true, card, player) and - (#selected > 0 or self:withinTimesLimit(Self, Player.HistoryPhase, card, player)) + (#selected > 0 or self:withinTimesLimit(Self, Player.HistoryPhase, card, "slash", player)) end end, on_effect = function(self, room, effect) @@ -125,7 +125,7 @@ local jinkSkill = fk.CreateActiveSkill{ end, on_effect = function(self, room, effect) if effect.responseToEvent then - effect.responseToEvent.isCanCellout = true + effect.responseToEvent.isCancellOut = true end end } @@ -436,7 +436,7 @@ local nullificationSkill = fk.CreateActiveSkill{ end, on_effect = function(self, room, effect) if effect.responseToEvent then - effect.responseToEvent.isCanCellout = true + effect.responseToEvent.isCancellOut = true end end }