Index: binaries/data/mods/public/gui/gamesetup/gamesetup.js
===================================================================
--- binaries/data/mods/public/gui/gamesetup/gamesetup.js (revision 18254)
+++ binaries/data/mods/public/gui/gamesetup/gamesetup.js (working copy)
@@ -353,6 +353,7 @@
"optionExploreMap",
"optionDisableTreasures",
"optionLockTeams",
+ "optionLastManStanding",
"optionCheats",
"optionRating",
"hideMoreOptions"
@@ -508,6 +509,7 @@
"ExploreMap": "exploreMap",
"DisableTreasures": "disableTreasures",
"LockTeams": "lockTeams",
+ "LastManStanding" : "lastManStanding",
"CheatsEnabled": "enableCheats"
};
@@ -525,6 +527,12 @@
Engine.GetGUIObjectByName("lockTeams").enabled = !this.checked;
updateGameAttributes();
};
+ Engine.GetGUIObjectByName("lockTeams").onPress = function() {
+ g_GameAttributes.settings.LockTeams = this.checked;
+ g_GameAttributes.settings.LastManStanding = !this.checked;
+ hideControl("lastManStanding", "lastManStandingText", !g_GameAttributes.settings.LockTeams);
+ updateGameAttributes();
+ };
}
/**
@@ -1173,6 +1181,7 @@
if (g_GameAttributes.mapType == "scenario")
delete g_GameAttributes.settings.WonderDuration;
+ delete g_GameAttributes.settings.LastManStanding;
if (mapSettings.PlayerData)
sanitizePlayerData(mapSettings.PlayerData);
@@ -1371,6 +1380,7 @@
setGUIBoolean("exploreMap", "exploreMapText", !!mapSettings.ExploreMap);
setGUIBoolean("revealMap", "revealMapText", !!mapSettings.RevealMap);
setGUIBoolean("lockTeams", "lockTeamsText", !!mapSettings.LockTeams);
+ setGUIBoolean("lastManStanding", "lastManStandingText", !!mapSettings.LastManStanding);
setGUIBoolean("enableRating", "enableRatingText", !!mapSettings.RatingEnabled);
Engine.GetGUIObjectByName("optionWonderDuration").hidden =
@@ -1381,6 +1391,7 @@
Engine.GetGUIObjectByName("enableCheats").enabled = !mapSettings.RatingEnabled;
Engine.GetGUIObjectByName("lockTeams").enabled = !mapSettings.RatingEnabled;
+ Engine.GetGUIObjectByName("lastManStandingText").hidden = mapSettings.LockTeams;
// Mapsize completely hidden for non-random maps
let isRandom = g_GameAttributes.mapType == "random";
@@ -1389,12 +1400,13 @@
Engine.GetGUIObjectByName("mapSizeText").hidden = !isRandom || g_IsController;
hideControl("numPlayers", "numPlayersText", isRandom && g_IsController);
- let notScenario = g_GameAttributes.mapType != "scenario" && g_IsController ;
+ let notScenario = g_GameAttributes.mapType != "scenario" && g_IsController;
for (let ctrl of ["victoryCondition", "wonderDuration", "populationCap",
"startingResources", "ceasefire", "revealMap",
"exploreMap", "disableTreasures", "lockTeams"])
hideControl(ctrl, ctrl + "Text", notScenario);
+ hideControl("lastManStanding", "lastManStandingText", !mapSettings.LockTeams && notScenario);
Engine.GetGUIObjectByName("civResetButton").hidden = !notScenario;
Index: binaries/data/mods/public/gui/gamesetup/gamesetup.xml
===================================================================
--- binaries/data/mods/public/gui/gamesetup/gamesetup.xml (revision 18254)
+++ binaries/data/mods/public/gui/gamesetup/gamesetup.xml (working copy)
@@ -385,8 +385,18 @@
Toggle locked teams.
+
+
-
+
Cheats:
@@ -396,7 +406,7 @@
-
+
Rated Game:
Index: binaries/data/mods/public/simulation/components/EndGameManager.js
===================================================================
--- binaries/data/mods/public/simulation/components/EndGameManager.js (revision 18254)
+++ binaries/data/mods/public/simulation/components/EndGameManager.js (working copy)
@@ -19,7 +19,7 @@
this.wonderDuration = 10 * 60 * 1000;
// Allied victory means allied players can win if victory conditions are met for each of them
- // Would be false for a "last man standing" game (when diplomacy is fully implemented)
+ // False for a "last man standing" game
this.alliedVictory = true;
};
@@ -81,6 +81,7 @@
return;
var cmpPlayerManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_PlayerManager);
+ var cmpGUIInterface = Engine.QueryInterface(SYSTEM_ENTITY, IID_GuiInterface);
var cmpPlayers = [];
var allies = [];
@@ -100,9 +101,16 @@
onlyAlliesLeft = false;
}
+ if (!this.alliedVictory && onlyAlliesLeft)
+ cmpGUIInterface.PushNotification({
+ "message": markForTranslation("Last player remaining wins"),
+ "translateMessage": true
+ });
+
// check if there are winners, or the game needs to continue
- if (!allies.length || !onlyAlliesLeft || !this.alliedVictory)
- return;
+ if (!allies.length || !onlyAlliesLeft ||
+ !this.alliedVictory && cmpPlayers.filter(pData => pData.GetState() == "active").length != 1)
+ return;
for (var p of allies)
cmpPlayers[p].SetState("won");
Index: binaries/data/mods/public/simulation/helpers/Setup.js
===================================================================
--- binaries/data/mods/public/simulation/helpers/Setup.js (revision 18254)
+++ binaries/data/mods/public/simulation/helpers/Setup.js (working copy)
@@ -51,6 +51,8 @@
cmpEndGameManager.SetGameType(settings.GameType);
if (settings.WonderDuration)
cmpEndGameManager.SetWonderDuration(settings.WonderDuration * 60 * 1000);
+ if (settings.LastManStanding)
+ cmpEndGameManager.SetAlliedVictory(false);
if (settings.Garrison)
{