Ticket #3970: lastmanstanding.patch
File lastmanstanding.patch, 6.2 KB (added by , 8 years ago) |
---|
-
binaries/data/mods/public/gui/gamesetup/gamesetup.js
353 353 "optionExploreMap", 354 354 "optionDisableTreasures", 355 355 "optionLockTeams", 356 "optionLastMan", 356 357 "optionCheats", 357 358 "optionRating", 358 359 "hideMoreOptions" … … 508 509 "ExploreMap": "exploreMap", 509 510 "DisableTreasures": "disableTreasures", 510 511 "LockTeams": "lockTeams", 512 "disableAlliedVictory" : "disableAlliedVictory", 511 513 "CheatsEnabled": "enableCheats" 512 514 }; 513 515 … … 525 527 Engine.GetGUIObjectByName("lockTeams").enabled = !this.checked; 526 528 updateGameAttributes(); 527 529 }; 530 Engine.GetGUIObjectByName("lockTeams").onPress = function() { 531 g_GameAttributes.settings.LockTeams = this.checked; 532 g_GameAttributes.settings.disableAlliedVictory = !this.checked; 533 hideControl("disableAlliedVictory", "disableAlliedVictoryText", !g_GameAttributes.settings.LockTeams); 534 updateGameAttributes(); 535 }; 528 536 } 529 537 530 538 /** … … 1371 1379 setGUIBoolean("exploreMap", "exploreMapText", !!mapSettings.ExploreMap); 1372 1380 setGUIBoolean("revealMap", "revealMapText", !!mapSettings.RevealMap); 1373 1381 setGUIBoolean("lockTeams", "lockTeamsText", !!mapSettings.LockTeams); 1382 setGUIBoolean("disableAlliedVictory", "disableAlliedVictoryText", !!mapSettings.disableAlliedVictory); 1374 1383 setGUIBoolean("enableRating", "enableRatingText", !!mapSettings.RatingEnabled); 1375 1384 1376 1385 Engine.GetGUIObjectByName("optionWonderDuration").hidden = … … 1381 1390 1382 1391 Engine.GetGUIObjectByName("enableCheats").enabled = !mapSettings.RatingEnabled; 1383 1392 Engine.GetGUIObjectByName("lockTeams").enabled = !mapSettings.RatingEnabled; 1393 Engine.GetGUIObjectByName("disableAlliedVictoryText").hidden = mapSettings.LockTeams; 1384 1394 1385 1395 // Mapsize completely hidden for non-random maps 1386 1396 let isRandom = g_GameAttributes.mapType == "random"; … … 1395 1405 "startingResources", "ceasefire", "revealMap", 1396 1406 "exploreMap", "disableTreasures", "lockTeams"]) 1397 1407 hideControl(ctrl, ctrl + "Text", notScenario); 1408 hideControl("disableAlliedVictory", "disableAlliedVictoryText", !mapSettings.LockTeams && notScenario); 1398 1409 1399 1410 Engine.GetGUIObjectByName("civResetButton").hidden = !notScenario; 1400 1411 -
binaries/data/mods/public/gui/gamesetup/gamesetup.xml
385 385 <translatableAttribute id="tooltip">Toggle locked teams.</translatableAttribute> 386 386 </object> 387 387 </object> 388 389 <object name="optionLastMan" size="14 338 94% 366"> 390 <object size="0 0 40% 28" type="text" style="ModernRightLabelText"> 391 <translatableAttribute id="caption">Last Man Standing:</translatableAttribute> 392 </object> 393 <object name="disableAlliedVictoryText" size="40% 0 100% 28" type="text" style="ModernLeftLabelText"/> 394 <object name="disableAlliedVictory" size="40%+10 5 40%+30 100%-5" type="checkbox" style="ModernTickBox" hidden="true" tooltip_style="onscreenToolTip"> 395 <translatableAttribute id="tooltip">Toggle the "Last Man Standing" option (only one player can win).</translatableAttribute> 396 </object> 397 </object> 388 398 389 <object name="optionCheats" size="14 3 38 94% 366" hidden="true">399 <object name="optionCheats" size="14 368 94% 396" hidden="true"> 390 400 <object size="0 0 40% 28" type="text" style="ModernRightLabelText"> 391 401 <translatableAttribute id="caption">Cheats:</translatableAttribute> 392 402 </object> … … 396 406 </object> 397 407 </object> 398 408 399 <object name="optionRating" size="14 3 68 94% 396" hidden="true">409 <object name="optionRating" size="14 398 94% 426" hidden="true"> 400 410 <object size="0 0 40% 28" hidden="false" type="text" style="ModernRightLabelText"> 401 411 <translatableAttribute id="caption">Rated Game:</translatableAttribute> 402 412 </object> -
binaries/data/mods/public/simulation/components/EndGameManager.js
19 19 this.wonderDuration = 10 * 60 * 1000; 20 20 21 21 // Allied victory means allied players can win if victory conditions are met for each of them 22 // Would be false for a "last man standing" game (when diplomacy is fully implemented)22 // False for a "last man standing" game (when diplomacy is fully implemented) 23 23 this.alliedVictory = true; 24 24 }; 25 25 … … 81 81 return; 82 82 83 83 var cmpPlayerManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_PlayerManager); 84 var cmpGUIInterface = Engine.QueryInterface(SYSTEM_ENTITY, IID_GuiInterface); 84 85 var cmpPlayers = []; 85 86 86 87 var allies = []; … … 100 101 onlyAlliesLeft = false; 101 102 } 102 103 104 if (!this.alliedVictory && onlyAlliesLeft) 105 cmpGUIInterface.PushNotification({ 106 "players": [1,2,3,4,5,6,7,8], 107 "message": markForTranslation("Last civilization remaining wins"), 108 "translateMessage": true 109 }); 110 103 111 // check if there are winners, or the game needs to continue 104 if (!allies.length || !onlyAlliesLeft || !this.alliedVictory)105 return; 112 if (!allies.length || !onlyAlliesLeft || (!this.alliedVictory && cmpPlayers.filter(pData => pData.GetState() == "active").length != 1)) 113 return; 106 114 107 115 for (var p of allies) 108 116 cmpPlayers[p].SetState("won"); -
binaries/data/mods/public/simulation/helpers/Setup.js
51 51 cmpEndGameManager.SetGameType(settings.GameType); 52 52 if (settings.WonderDuration) 53 53 cmpEndGameManager.SetWonderDuration(settings.WonderDuration * 60 * 1000); 54 if (settings.disableAlliedVictory) 55 cmpEndGameManager.SetAlliedVictory(false); 54 56 55 57 if (settings.Garrison) 56 58 {