fix abort areas (#252)

Co-authored-by: Nyutanislavsky <nyutanislavsky@qq.com>
This commit is contained in:
Ho-spair 2023-08-13 12:35:23 +08:00 committed by GitHub
parent 4284336825
commit 2f7d7d4a96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 39 additions and 3 deletions

View File

@ -158,7 +158,7 @@ Item {
hideAnime.stop(); hideAnime.stop();
x = 0; x = 0;
opacity = 1; opacity = sealed ? 1 : 0;
text = ' ' + Backend.translate(subtype + "_sealed") text = ' ' + Backend.translate(subtype + "_sealed")
} }
} }

View File

@ -343,6 +343,13 @@ Fk:loadTranslationTable{
["weapon_sealed"] = "武器栏废除", ["weapon_sealed"] = "武器栏废除",
["armor_sealed"] = "防具栏废除", ["armor_sealed"] = "防具栏废除",
["treasure_sealed"] = "宝物栏废除", ["treasure_sealed"] = "宝物栏废除",
["WeaponSlot"] = "武器栏",
["ArmorSlot"] = "防具栏",
["OffensiveRideSlot"] = "进攻坐骑栏",
["DefensiveRideSlot"] = "防御坐骑栏",
["TreasureSlot"] = "宝物栏",
["JudgeSlot"] = "判定区",
} }
-- related to sendLog -- related to sendLog

View File

@ -122,4 +122,7 @@ fk.AfterSkillEffect = 82
-- 85 = xxx -- 85 = xxx
-- 86 = AfterPhaseEnd -- 86 = AfterPhaseEnd
fk.NumOfEvents = 83 fk.AreaAborted = 87
fk.AreaResumed = 88
fk.NumOfEvents = 89

View File

@ -128,6 +128,7 @@ function GameLogic:chooseGenerals()
room:setPlayerGeneral(lord, lord_general, true) room:setPlayerGeneral(lord, lord_general, true)
room:askForChooseKingdom({lord}) room:askForChooseKingdom({lord})
room:broadcastProperty(lord, "general") room:broadcastProperty(lord, "general")
room:broadcastProperty(lord, "kingdom")
room:setDeputyGeneral(lord, deputy) room:setDeputyGeneral(lord, deputy)
room:broadcastProperty(lord, "deputyGeneral") room:broadcastProperty(lord, "deputyGeneral")
end end

View File

@ -3258,7 +3258,7 @@ function Room:abortPlayerArea(player, playerSlots)
end end
end end
if next(slotsSealed) == nil then if #slotsToSeal == 0 then
return return
end end
@ -3271,6 +3271,31 @@ function Room:abortPlayerArea(player, playerSlots)
table.insertTable(player.sealedSlots, slotsToSeal) table.insertTable(player.sealedSlots, slotsToSeal)
self:broadcastProperty(player, "sealedSlots") self:broadcastProperty(player, "sealedSlots")
self.logic:trigger(fk.AreaAborted, player, { slots = slotsSealed })
end
function Room:resumePlayerArea(player, playerSlots)
assert(type(playerSlots) == "string" or type(playerSlots) == "table")
if type(playerSlots) == "string" then
playerSlots = { playerSlots }
end
local slotsToResume = {}
for _, slot in ipairs(playerSlots) do
for i = 1, #player.sealedSlots do
if player.sealedSlots[i] == slot then
table.remove(player.sealedSlots, i)
table.insert(slotsToResume, slot)
end
end
end
if #slotsToResume > 0 then
self:broadcastProperty(player, "sealedSlots")
self.logic:trigger(fk.AreaResumed, player, { slots = slotsToResume })
end
end end
return Room return Room