Ticket #2160: Regicide_v1.2.patch
File Regicide_v1.2.patch, 8.0 KB (added by , 8 years ago) |
---|
-
binaries/data/mods/public/gui/gamesetup/gamesetup.js
499 499 "DisableTreasures": "disableTreasures", 500 500 "LockTeams": "lockTeams", 501 501 "LastManStanding" : "lastManStanding", 502 "RegicideEarlyAttack" : "regicideEarlyAttack", 502 503 "CheatsEnabled": "enableCheats" 503 504 }; 504 505 … … 1183 1184 { 1184 1185 delete g_GameAttributes.settings.WonderDuration; 1185 1186 delete g_GameAttributes.settings.LastManStanding; 1187 delete g_GameAttributes.settings.RegicideEarlyAttack; 1186 1188 } 1187 1189 1188 1190 if (mapSettings.PlayerData) … … 1380 1382 setGUIBoolean("revealMap", "revealMapText", !!mapSettings.RevealMap); 1381 1383 setGUIBoolean("lockTeams", "lockTeamsText", !!mapSettings.LockTeams); 1382 1384 setGUIBoolean("lastManStanding", "lastManStandingText", !!mapSettings.LastManStanding); 1385 setGUIBoolean("regicideEarlyAttack", "regicideEarlyAttackText", !!mapSettings.RegicideEarlyAttack); 1383 1386 setGUIBoolean("enableRating", "enableRatingText", !!mapSettings.RatingEnabled); 1384 1387 1385 1388 Engine.GetGUIObjectByName("optionWonderDuration").hidden = … … 1386 1389 g_GameAttributes.settings.GameType && 1387 1390 g_GameAttributes.settings.GameType != "wonder"; 1388 1391 Engine.GetGUIObjectByName("optionLastManStanding").hidden = mapSettings.LockTeams; 1392 Engine.GetGUIObjectByName("optionRegicideEarlyAttack").hidden = 1393 g_GameAttributes.settings.GameType && 1394 g_GameAttributes.settings.GameType != "regicide"; 1389 1395 1390 1396 Engine.GetGUIObjectByName("cheatWarningText").hidden = !g_IsNetworked || !mapSettings.CheatsEnabled; 1391 1397 … … 1403 1409 1404 1410 for (let ctrl of ["victoryCondition", "wonderDuration", "populationCap", 1405 1411 "startingResources", "ceasefire", "revealMap", 1406 "exploreMap", "disableTreasures", "lockTeams", "lastManStanding"]) 1412 "exploreMap", "disableTreasures", "lockTeams", 1413 "lastManStanding", "regicideEarlyAttack"]) 1407 1414 hideControl(ctrl, ctrl + "Text", notScenario); 1408 1415 1409 1416 Engine.GetGUIObjectByName("civResetButton").hidden = !notScenario; -
binaries/data/mods/public/gui/gamesetup/gamesetup.xml
415 415 </object> 416 416 </object> 417 417 418 <object name="option Cheats" size="14 368 94% 396" hidden="true">418 <object name="optionRegicideEarlyAttack" size="14 368 94% 396"> 419 419 <object size="0 0 40% 28" type="text" style="ModernRightLabelText"> 420 <translatableAttribute id="caption">Hero Attack at Start:</translatableAttribute> 421 </object> 422 <object name="regicideEarlyAttackText" size="40% 0 100% 28" type="text" style="ModernLeftLabelText"/> 423 <object name="regicideEarlyAttack" size="40%+10 5 40%+30 100%-5" type="checkbox" style="ModernTickBox" hidden="true" tooltip_style="onscreenToolTip"> 424 <translatableAttribute id="tooltip">Toggle whether heroes can attack from the start of the game, or only once City Phase has been reached.</translatableAttribute> 425 </object> 426 </object> 427 428 <object name="optionCheats" size="14 398 94% 426" hidden="true"> 429 <object size="0 0 40% 28" type="text" style="ModernRightLabelText"> 420 430 <translatableAttribute id="caption">Cheats:</translatableAttribute> 421 431 </object> 422 432 <object name="enableCheatsText" size="40% 0 100% 28" type="text" style="ModernLeftLabelText"/> … … 425 435 </object> 426 436 </object> 427 437 428 <object name="optionRating" size="14 398 94% 426" hidden="true">438 <object name="optionRating" size="14 428 94% 456" hidden="true"> 429 439 <object size="0 0 40% 28" hidden="false" type="text" style="ModernRightLabelText"> 430 440 <translatableAttribute id="caption">Rated Game:</translatableAttribute> 431 441 </object> … … 440 450 name="hideMoreOptions" 441 451 type="button" 442 452 style="StoneButton" 443 size="50%-70 4 28 50%+70 456"453 size="50%-70 458 50%+70 486" 444 454 tooltip_style="onscreenToolTip" 445 455 hotkey="cancel" 446 456 > -
binaries/data/mods/public/maps/scripts/Regicide.js
45 45 46 46 // Attempt to spawn one hero per player 47 47 let cmpRangeManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager); 48 let cmpEndGameManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_EndGameManager); 49 this.regicideEarlyAttack = cmpEndGameManager.GetGameTypeSettings().regicideEarlyAttack || false; 50 48 51 for (let playerID = 1; playerID < TriggerHelper.GetNumberOfPlayers(); ++playerID) 49 52 { 50 53 let spawnPoints = cmpRangeManager.GetEntitiesByPlayer(playerID).sort((entity1, entity2) => … … 51 54 getSpawnPreference(entity2) - getSpawnPreference(entity1)); 52 55 53 56 this.regicideHeroes[playerID] = this.SpawnRegicideHero(playerID, heroTemplates[playersCivs[playerID]], spawnPoints); 57 58 if (!this.regicideEarlyAttack) 59 { 60 let cmpAttack = Engine.QueryInterface(this.regicideHeroes[playerID], IID_Attack); 61 if (cmpAttack) 62 cmpAttack.SetEnabled(false); 63 64 let cmpAuras = Engine.QueryInterface(this.regicideHeroes[playerID], IID_Auras); 65 if (cmpAuras) 66 for (let aura of cmpAuras.GetAuraNames()) 67 cmpAuras.RemoveTemplateBonus(aura); 68 } 54 69 } 55 70 }; 56 71 … … 98 113 return undefined; 99 114 }; 100 115 116 Trigger.prototype.CityPhaseReached = function(data) 117 { 118 if (data.tech.indexOf("phase_city") == -1) 119 return; 120 121 if (!this.regicideEarlyAttack) 122 { 123 let cmpAttack = Engine.QueryInterface(this.regicideHeroes[data.player], IID_Attack); 124 if (cmpAttack) 125 cmpAttack.SetEnabled(true); 126 127 let cmpAuras = Engine.QueryInterface(this.regicideHeroes[data.player], IID_Auras); 128 if (cmpAuras) 129 for (let aura of cmpAuras.GetAuraNames()) 130 if (cmpAuras.IsGlobalAura(aura)) 131 cmpAuras.ApplyTemplateBonus(aura, [data.player]); 132 } 133 }; 134 101 135 let cmpTrigger = Engine.QueryInterface(SYSTEM_ENTITY, IID_Trigger); 102 136 cmpTrigger.regicideHeroes = []; 137 cmpTrigger.regicideEarlyAttack = false; 103 138 cmpTrigger.DoAfterDelay(0, "InitRegicideGame", {}); 104 139 cmpTrigger.RegisterTrigger("OnOwnershipChanged", "CheckRegicideDefeat", { "enabled": true }); 140 cmpTrigger.RegisterTrigger("OnResearchFinished", "CityPhaseReached", { "enabled": true }); -
binaries/data/mods/public/simulation/components/Attack.js
202 202 203 203 Attack.prototype.Init = function() 204 204 { 205 this.enabled = true; 205 206 }; 206 207 207 208 Attack.prototype.Serialize = null; // we have no dynamic state to save 208 209 210 Attack.prototype.GetEnabled = function(enabled) 211 { 212 return this.enabled; 213 }; 214 215 Attack.prototype.SetEnabled = function(enabled) 216 { 217 this.enabled = enabled; 218 }; 219 209 220 Attack.prototype.GetAttackTypes = function() 210 221 { 211 222 return ["Melee", "Ranged", "Capture"].filter(type => !!this.template[type]); … … 231 242 232 243 Attack.prototype.CanAttack = function(target) 233 244 { 245 if (!this.enabled) 246 return false; 247 234 248 let cmpFormation = Engine.QueryInterface(target, IID_Formation); 235 249 if (cmpFormation) 236 250 return true; -
binaries/data/mods/public/simulation/helpers/Setup.js
47 47 let gameTypeSettings = {}; 48 48 if (settings.WonderDuration) 49 49 gameTypeSettings.wonderDuration = settings.WonderDuration * 60 * 1000; 50 if (settings.RegicideEarlyAttack && settings.GameType == "regicide") 51 gameTypeSettings.regicideEarlyAttack = true; 50 52 if (settings.GameType) 51 53 cmpEndGameManager.SetGameType(settings.GameType, gameTypeSettings); 52 54