Ticket #2160: Regicide_v1.1.patch
File Regicide_v1.1.patch, 2.6 KB (added by , 8 years ago) |
---|
-
binaries/data/mods/public/maps/scripts/Regicide.js
51 51 getSpawnPreference(entity2) - getSpawnPreference(entity1)); 52 52 53 53 this.regicideHeroes[playerID] = this.SpawnRegicideHero(playerID, heroTemplates[playersCivs[playerID]], spawnPoints); 54 55 let cmpAttack = Engine.QueryInterface(this.regicideHeroes[playerID], IID_Attack); 56 cmpAttack.SetEnabled(false); 57 58 let cmpAuras = Engine.QueryInterface(this.regicideHeroes[playerID], IID_Auras); 59 for (let aura of cmpAuras.GetAuraNames()) 60 if (cmpAuras.IsGlobalAura(aura)) 61 cmpAuras.RemoveTemplateBonus(aura); 54 62 } 55 63 }; 56 64 … … 98 106 return undefined; 99 107 }; 100 108 109 Trigger.prototype.CityPhaseReached = function(data) 110 { 111 if (data.tech.indexOf("phase_city") == -1) 112 return; 113 114 let cmpAttack = Engine.QueryInterface(this.regicideHeroes[data.player], IID_Attack); 115 cmpAttack.SetEnabled(true); 116 117 let cmpAuras = Engine.QueryInterface(this.regicideHeroes[data.player], IID_Auras); 118 for (let aura of cmpAuras.GetAuraNames()) 119 if (cmpAuras.IsGlobalAura(aura)) 120 cmpAuras.ApplyTemplateBonus(aura, [data.player]); 121 122 }; 123 101 124 let cmpTrigger = Engine.QueryInterface(SYSTEM_ENTITY, IID_Trigger); 102 125 cmpTrigger.regicideHeroes = []; 103 126 cmpTrigger.DoAfterDelay(0, "InitRegicideGame", {}); 104 127 cmpTrigger.RegisterTrigger("OnOwnershipChanged", "CheckRegicideDefeat", { "enabled": true }); 128 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;