fix surrender

This commit is contained in:
Ho-spair 2023-07-02 22:13:51 +08:00
parent dad2b5406c
commit 297d466b05
2 changed files with 4 additions and 4 deletions

View File

@ -101,7 +101,7 @@ Item {
id: surrenderButton id: surrenderButton
text: Backend.translate("Surrender") text: Backend.translate("Surrender")
onClicked: { onClicked: {
if (isStarted) { if (isStarted && !getPhoto(Self.id).dead) {
const surrenderCheck = JSON.parse(Backend.callLuaFunction('CheckSurrenderAvailable', [miscStatus.playedTime])); const surrenderCheck = JSON.parse(Backend.callLuaFunction('CheckSurrenderAvailable', [miscStatus.playedTime]));
if (!surrenderCheck.length) { if (!surrenderCheck.length) {
surrenderDialog.informativeText = Backend.translate('Surrender is disabled in this mode'); surrenderDialog.informativeText = Backend.translate('Surrender is disabled in this mode');
@ -149,7 +149,7 @@ Item {
title: Backend.translate("Quit") title: Backend.translate("Quit")
informativeText: Backend.translate("Are you sure to quit?") informativeText: Backend.translate("Are you sure to quit?")
buttons: MessageDialog.Ok | MessageDialog.Cancel buttons: MessageDialog.Ok | MessageDialog.Cancel
onButtonClicked: function (button, role) { onButtonClicked: function (button) {
switch (button) { switch (button) {
case MessageDialog.Ok: { case MessageDialog.Ok: {
ClientInstance.notifyServer("QuitRoom", "[]"); ClientInstance.notifyServer("QuitRoom", "[]");

View File

@ -1147,7 +1147,7 @@ local role_mode = fk.CreateGameMode{
end end
if p ~= Self and p.role == "rebel" then if p ~= Self and p.role == "rebel" then
if p:isAlive() then if not p.dead then
break break
else else
rebelNum = rebelNum - 1 rebelNum = rebelNum - 1
@ -1177,7 +1177,7 @@ local role_mode = fk.CreateGameMode{
end end
if p ~= Self and (p.role == "lord" or p.role == "loyalist") then if p ~= Self and (p.role == "lord" or p.role == "loyalist") then
if p:isAlive() then if not p.dead then
break break
else else
lordNum = lordNum - 1 lordNum = lordNum - 1