Ticket #2160: Regicide_v1.3.patch
File Regicide_v1.3.patch, 12.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
335 335 </object> 336 336 </object> 337 337 338 <object name="option PopulationCap" size="14 98 94% 126">338 <object name="optionRegicideEarlyAttack" size="14 98 94% 126"> 339 339 <object size="0 0 40% 28" type="text" style="ModernRightLabelText"> 340 <translatableAttribute id="caption">Hero Attack at Start:</translatableAttribute> 341 </object> 342 <object name="regicideEarlyAttackText" size="40% 0 100% 28" type="text" style="ModernLeftLabelText"/> 343 <object name="regicideEarlyAttack" size="40%+10 5 40%+30 100%-5" type="checkbox" style="ModernTickBox" hidden="true" tooltip_style="onscreenToolTip"> 344 <translatableAttribute id="tooltip">Toggle whether heroes can attack from the start of the game, or only once City Phase has been reached.</translatableAttribute> 345 </object> 346 </object> 347 348 <object name="optionPopulationCap" size="14 128 94% 156"> 349 <object size="0 0 40% 28" type="text" style="ModernRightLabelText"> 340 350 <translatableAttribute id="caption">Population Cap:</translatableAttribute> 341 351 </object> 342 352 <object name="populationCapText" size="40% 0 100% 100%" type="text" style="ModernLeftLabelText"/> … … 345 355 </object> 346 356 </object> 347 357 348 <object name="optionStartingResources" size="14 1 28 94% 156">358 <object name="optionStartingResources" size="14 158 94% 186"> 349 359 <object size="0 0 40% 28" type="text" style="ModernRightLabelText"> 350 360 <translatableAttribute id="caption">Starting Resources:</translatableAttribute> 351 361 </object> … … 355 365 </object> 356 366 </object> 357 367 358 <object name="optionCeasefire" size="14 158 94% 186">368 <object name="optionCeasefire" size="14 218 94% 246"> 359 369 <object size="0 0 40% 28" type="text" style="ModernRightLabelText"> 360 370 <translatableAttribute id="caption">Ceasefire:</translatableAttribute> 361 371 </object> … … 365 375 </object> 366 376 </object> 367 377 368 <object name="optionRevealMap" size="14 2 18 94% 246">378 <object name="optionRevealMap" size="14 248 94% 276"> 369 379 <object size="0 0 40% 28" type="text" style="ModernRightLabelText"> 370 380 <translatableAttribute id="caption" comment="Make sure to differentiate between the revealed map and explored map options!">Revealed Map:</translatableAttribute> 371 381 </object> … … 375 385 </object> 376 386 </object> 377 387 378 <object name="optionExploreMap" size="14 2 48 94% 276">388 <object name="optionExploreMap" size="14 278 94% 306"> 379 389 <object size="0 0 40% 28" type="text" style="ModernRightLabelText"> 380 390 <translatableAttribute id="caption" comment="Make sure to differentiate between the revealed map and explored map options!">Explored Map:</translatableAttribute> 381 391 </object> … … 385 395 </object> 386 396 </object> 387 397 388 <object name="optionDisableTreasures" size="14 278 94% 306">398 <object name="optionDisableTreasures" size="14 308 94% 336"> 389 399 <object size="0 0 40% 28" type="text" style="ModernRightLabelText"> 390 400 <translatableAttribute id="caption">Disable Treasures:</translatableAttribute> 391 401 </object> … … 395 405 </object> 396 406 </object> 397 407 398 <object name="optionLockTeams" size="14 3 08 94% 336">408 <object name="optionLockTeams" size="14 338 94% 366"> 399 409 <object size="0 0 40% 28" type="text" style="ModernRightLabelText"> 400 410 <translatableAttribute id="caption">Teams Locked:</translatableAttribute> 401 411 </object> … … 405 415 </object> 406 416 </object> 407 417 408 <object name="optionLastManStanding" size="14 3 38 94% 366">418 <object name="optionLastManStanding" size="14 368 94% 396"> 409 419 <object size="0 0 40% 28" type="text" style="ModernRightLabelText"> 410 420 <translatableAttribute id="caption">Last Man Standing:</translatableAttribute> 411 421 </object> … … 415 425 </object> 416 426 </object> 417 427 418 <object name="optionCheats" size="14 3 68 94% 396" hidden="true">428 <object name="optionCheats" size="14 398 94% 426" hidden="true"> 419 429 <object size="0 0 40% 28" type="text" style="ModernRightLabelText"> 420 430 <translatableAttribute id="caption">Cheats:</translatableAttribute> 421 431 </object> … … 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 { 68 cmpAuras.SetEnabled(false); 69 cmpAuras.Clean(); 70 } 71 } 54 72 } 55 73 }; 56 74 … … 98 116 return undefined; 99 117 }; 100 118 119 Trigger.prototype.CityPhaseReached = function(data) 120 { 121 if (data.tech.indexOf("phase_city") == -1) 122 return; 123 124 if (!this.regicideEarlyAttack) 125 { 126 let cmpAttack = Engine.QueryInterface(this.regicideHeroes[data.player], IID_Attack); 127 if (cmpAttack) 128 cmpAttack.SetEnabled(true); 129 130 let cmpAuras = Engine.QueryInterface(this.regicideHeroes[data.player], IID_Auras); 131 if (cmpAuras) 132 for (let aura of cmpAuras.GetAuraNames()) 133 { 134 cmpAuras.SetEnabled(true); 135 cmpAuras.Clean(); 136 } 137 } 138 }; 139 101 140 let cmpTrigger = Engine.QueryInterface(SYSTEM_ENTITY, IID_Trigger); 102 141 cmpTrigger.regicideHeroes = []; 142 cmpTrigger.regicideEarlyAttack = false; 103 143 cmpTrigger.DoAfterDelay(0, "InitRegicideGame", {}); 104 144 cmpTrigger.RegisterTrigger("OnOwnershipChanged", "CheckRegicideDefeat", { "enabled": true }); 145 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/components/Auras.js
8 8 9 9 Auras.prototype.Init = function() 10 10 { 11 this.enabled = true; 11 12 let cmpDataTemplateManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_DataTemplateManager); 12 13 this.auras = {}; 13 14 this.affectedPlayers = {}; … … 22 23 this.Clean(); 23 24 }; 24 25 26 Auras.prototype.GetEnabled = function(enabled) 27 { 28 return this.enabled; 29 }; 30 31 Auras.prototype.SetEnabled = function(enabled) 32 { 33 this.enabled = enabled; 34 }; 35 25 36 // We can modify identifier if we want stackable auras in some case. 26 37 Auras.prototype.GetModifierIdentifier = function(name) 27 38 { … … 109 120 110 121 Auras.prototype.CanApply = function(name) 111 122 { 123 if (!this.enabled) 124 return false; 112 125 if (!this.auras[name].requiredTechnology) 113 126 return true; 114 127 let cmpTechnologyManager = QueryOwnerInterface(this.entity, IID_TechnologyManager); -
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