mirror of
https://github.com/Qsgs-Fans/FreeKill.git
synced 2024-11-15 19:22:25 +08:00
Dev bugfix (#203)
- 修复泛转化牌的canUse炸锅的bug - 未上场时显示新手保护 --------- Co-authored-by: notify <notify-ctrl@qq.com>
This commit is contained in:
parent
d5330d5bed
commit
1036159d38
|
@ -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" : "<br/>" + Backend.translate("Win=%1 Run=%2 Total=%3").arg(winRate.toFixed(2))
|
||||
.arg(runRate.toFixed(2)).arg(total);
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
});
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<string, integer>|integer|null
|
||||
---@field public fixedAddTimesResponsors integer[]
|
||||
---@field public prohibitedCardNames string[]|null
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user