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

View File

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