Ticket #3792: 3792.diff
File 3792.diff, 3.7 KB (added by , 8 years ago) |
---|
-
binaries/data/mods/public/simulation/components/Auras.js
Auras.prototype.Schema = 58 58 "<optional>" + 59 59 "<element name='AffectedPlayers' a:help='Affected players'>" + 60 60 "<text/>" + 61 61 "</element>" + 62 62 "</optional>" + 63 "<optional>" + 64 "<element name='Stackable' a:help='Allow multiple applications of this aura'>" + 65 "<data type='boolean'/>" + 66 "</element>" + 67 "</optional>" + 63 68 "</interleave>" + 64 69 "</element>" + 65 70 "</oneOrMore>"; 66 71 67 72 Auras.prototype.Init = function() … … Auras.prototype.Init = function() 91 96 } 92 97 this.auras[name] = aura; 93 98 } 94 99 }; 95 100 101 Auras.prototype.GetModifierIdentifier = function(name, mod) 102 { 103 let identifier = name + "/" + mod.value + "/"; 104 if (this.template[name].Stackable) 105 return identifier + this.entity; 106 // We add add/mul to prevent applying the same aura of different templates 107 return identifier + (mod.Add || 0) + "/" + (mod.Multiply || 1); 108 }; 109 96 110 Auras.prototype.GetDescriptions = function() 97 111 { 98 112 var ret = {}; 99 113 for each (var aura in this.template) 100 114 if (aura.AuraName) … … Auras.prototype.ApplyTemplateBonus = fun 329 343 var cmpAuraManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_AuraManager); 330 344 var classes = this.GetClasses(name); 331 345 332 346 for (let mod of modifications) 333 347 for (let player of players) 334 cmpAuraManager.ApplyTemplateBonus(mod.value, player, classes, mod, this. templateName + "/" + name + "/" + mod.value);348 cmpAuraManager.ApplyTemplateBonus(mod.value, player, classes, mod, this.GetModifierIdentifier(name, mod)); 335 349 }; 336 350 337 351 Auras.prototype.RemoveFormationBonus = function(memberList) 338 352 { 339 353 var auraNames = this.GetAuraNames().filter(n => this.IsFormationAura(n)); … … Auras.prototype.RemoveTemplateBonus = fu 358 372 var classes = this.GetClasses(name); 359 373 var players = this.GetAffectedPlayers(name); 360 374 361 375 for each (var mod in modifications) 362 376 for each (var player in players) 363 cmpAuraManager.RemoveTemplateBonus(mod.value, player, classes, this. templateName + "/" + name + "/" + mod.value);377 cmpAuraManager.RemoveTemplateBonus(mod.value, player, classes, this.GetModifierIdentifier(name, mod)); 364 378 }; 365 379 366 380 Auras.prototype.ApplyBonus = function(name, ents) 367 381 { 368 382 var validEnts = this.GiveMembersWithValidClass(name, ents); … … Auras.prototype.ApplyBonus = function(na 370 384 return; 371 385 this[name].targetUnits = this[name].targetUnits.concat(validEnts); 372 386 var modifications = this.GetModifications(name); 373 387 var cmpAuraManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_AuraManager); 374 388 for each (let mod in modifications) 375 cmpAuraManager.ApplyBonus(mod.value, validEnts, mod, this. templateName + "/" + name + "/" + mod.value);389 cmpAuraManager.ApplyBonus(mod.value, validEnts, mod, this.GetModifierIdentifier(name, mod)); 376 390 // update status bars if this has an icon 377 391 if (!this.GetOverlayIcon(name)) 378 392 return; 379 393 for (let ent of validEnts) 380 394 { … … Auras.prototype.RemoveBonus = function(n 391 405 return; 392 406 this[name].targetUnits = this[name].targetUnits.filter(v => validEnts.indexOf(v) == -1); 393 407 var modifications = this.GetModifications(name); 394 408 var cmpAuraManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_AuraManager); 395 409 for each (let mod in modifications) 396 cmpAuraManager.RemoveBonus(mod.value, validEnts, this. templateName + "/" + name + "/" + mod.value);410 cmpAuraManager.RemoveBonus(mod.value, validEnts, this.GetModifierIdentifier(name, mod)); 397 411 // update status bars if this has an icon 398 412 if (!this.GetOverlayIcon(name)) 399 413 return; 400 414 for (let ent of validEnts) 401 415 {