diff --git a/binaries/data/mods/public/simulation/components/Auras.js b/binaries/data/mods/public/simulation/components/Auras.js index c593843ce0..8ccdd009e9 100644 --- a/binaries/data/mods/public/simulation/components/Auras.js +++ b/binaries/data/mods/public/simulation/components/Auras.js @@ -78,21 +78,15 @@ Auras.prototype.Init = function() aura.affects = this.template[name].Affects; if (this.template[name].AffectedPlayers) aura.affectedPlayers = this.template[name].AffectedPlayers.split(/\s+/); - aura.modifications = []; - for (var value in this.template[name].Modifications) - { - var mod = {}; - mod.value = value.replace(/\./g, "/").replace(/\/\//g, "."); - if (this.template[name].Modifications[value].Add) - mod.add = +this.template[name].Modifications[value].Add; - else if (this.template[name].Modifications[value].Multiply) - mod.multiply = +this.template[name].Modifications[value].Multiply; - aura.modifications.push(mod); - } this.auras[name] = aura; } }; +Auras.prototype.GetModifierIdentifier = function(name, mod) +{ + return this.templateName + "/" + name + "/" + mod.value; +}; + Auras.prototype.GetDescriptions = function() { var ret = {}; @@ -238,6 +232,25 @@ Auras.prototype.Clean = function() cmpRangeManager.DestroyActiveQuery(this[name].rangeQuery); } + for (let name in this.template) + { + let modifications = []; + for (let value in this.template[name].Modifications) + { + let mod = {}; + mod.value = value.replace(/\./g, "/").replace(/\/\//g, "."); + let templateModifications = this.template[name].Modifications[value]; + if (templateModifications.Add) + mod.add = ApplyValueModificationsToEntity("Auras/"+name+"/Modifications/"+mod.value+"/Add", + +templateModifications.Add, this.entity); + else if (templateModifications.Multiply) + mod.multiply = ApplyValueModificationsToEntity("Auras/"+name+"/Modifications/"+mod.value+"/Multiply", + +templateModifications.Multiply, this.entity); + modifications.push(mod); + } + this.auras[name].modifications = modifications; + } + for (let name of auraNames) { // only calculate the affected players on re-applying the bonuses @@ -331,7 +344,7 @@ Auras.prototype.ApplyTemplateBonus = function(name, players) for (let mod of modifications) for (let player of players) - cmpAuraManager.ApplyTemplateBonus(mod.value, player, classes, mod, this.templateName + "/" + name + "/" + mod.value); + cmpAuraManager.ApplyTemplateBonus(mod.value, player, classes, mod, this.GetModifierIdentifier(name, mod)); }; Auras.prototype.RemoveFormationBonus = function(memberList) @@ -360,7 +373,7 @@ Auras.prototype.RemoveTemplateBonus = function(name) for each (var mod in modifications) for each (var player in players) - cmpAuraManager.RemoveTemplateBonus(mod.value, player, classes, this.templateName + "/" + name + "/" + mod.value); + cmpAuraManager.RemoveTemplateBonus(mod.value, player, classes, this.GetModifierIdentifier(name, mod)); }; Auras.prototype.ApplyBonus = function(name, ents) @@ -372,7 +385,7 @@ Auras.prototype.ApplyBonus = function(name, ents) var modifications = this.GetModifications(name); var cmpAuraManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_AuraManager); for each (let mod in modifications) - cmpAuraManager.ApplyBonus(mod.value, validEnts, mod, this.templateName + "/" + name + "/" + mod.value); + cmpAuraManager.ApplyBonus(mod.value, validEnts, mod, this.GetModifierIdentifier(name, mod)); // update status bars if this has an icon if (!this.GetOverlayIcon(name)) return; @@ -393,7 +406,7 @@ Auras.prototype.RemoveBonus = function(name, ents) var modifications = this.GetModifications(name); var cmpAuraManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_AuraManager); for each (let mod in modifications) - cmpAuraManager.RemoveBonus(mod.value, validEnts, this.templateName + "/" + name + "/" + mod.value); + cmpAuraManager.RemoveBonus(mod.value, validEnts, this.GetModifierIdentifier(name, mod)); // update status bars if this has an icon if (!this.GetOverlayIcon(name)) return; diff --git a/binaries/data/mods/public/simulation/components/Player.js b/binaries/data/mods/public/simulation/components/Player.js index 19d36feff3..d0f5f42090 100644 --- a/binaries/data/mods/public/simulation/components/Player.js +++ b/binaries/data/mods/public/simulation/components/Player.js @@ -144,7 +144,7 @@ Player.prototype.SetMaxPopulation = function(max) Player.prototype.GetMaxPopulation = function() { - return Math.round(ApplyValueModificationsToPlayer("Player/MaxPopulation", this.maxPop, this.entity)); + return Math.round(ApplyValueModificationsToPlayer("Player/MaxPopulation", this.maxPop, this.entity, this.playerID)); }; Player.prototype.SetGatherRateMultiplier = function(value) diff --git a/binaries/data/mods/public/simulation/data/technologies/pop_wonder.json b/binaries/data/mods/public/simulation/data/technologies/pop_wonder.json index 6e93e74d62..2cc0515dcb 100644 --- a/binaries/data/mods/public/simulation/data/technologies/pop_wonder.json +++ b/binaries/data/mods/public/simulation/data/technologies/pop_wonder.json @@ -10,12 +10,13 @@ "pers": "Paradise" }, "description": "The wonder attracts many more people to your civilization.", - "cost": {"food": 3000, "wood": 3000, "stone": 500, "metal": 500}, + "cost": {"food": 2000, "wood": 3000, "stone": 500, "metal": 500}, "requirements": {"tech": "phase_city"}, "requirementsTooltip": "Unlocked in City Phase.", "icon": "special_treasure.png", "researchTime": 40, - "tooltip": "+50 maximum population cap.", - "modifications": [{"value": "Player/MaxPopulation", "add": 50}], + "tooltip": "Increase the population bonus of the wonder by 40.", + "modifications": [{"value": "Auras/Aura1/Modifications/Player/MaxPopulation/Add", "add": 40}], + "affects": ["Wonder"], "soundComplete": "interface/alarm/alarm_upgradearmory.xml" } diff --git a/binaries/data/mods/public/simulation/helpers/ValueModification.js b/binaries/data/mods/public/simulation/helpers/ValueModification.js index 51d79a0f29..4995cbc7fe 100644 --- a/binaries/data/mods/public/simulation/helpers/ValueModification.js +++ b/binaries/data/mods/public/simulation/helpers/ValueModification.js @@ -1,4 +1,4 @@ -// Little helper functions to make applying technology more convenient +// Little helper functions to make applying technology and auras more convenient function ApplyValueModificationsToEntity(tech_type, current_value, entity) { @@ -13,14 +13,12 @@ function ApplyValueModificationsToEntity(tech_type, current_value, entity) return cmpAuraManager.ApplyModifications(tech_type, value, entity); } -function ApplyValueModificationsToPlayer(tech_type, current_value, player_entity) +function ApplyValueModificationsToPlayer(tech_type, current_value, playerEntity, playerID) { - let cmpTechnologyManager = Engine.QueryInterface(player_entity, IID_TechnologyManager); - - if (!cmpTechnologyManager) - return current_value; - - return cmpTechnologyManager.ApplyModifications(tech_type, current_value, player_entity); + let cmpTemplateManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_TemplateManager); + let entityTemplateName = cmpTemplateManager.GetCurrentTemplateName(playerEntity); + let entityTemplate = cmpTemplateManager.GetTemplate(entityTemplateName); + return ApplyValueModificationsToTemplate(tech_type, current_value, playerID, entityTemplate); } function ApplyValueModificationsToTemplate(tech_type, current_value, playerID, template) diff --git a/binaries/data/mods/public/simulation/templates/special/player.xml b/binaries/data/mods/public/simulation/templates/special/player.xml index e7a2ad8912..d25510b1bc 100644 --- a/binaries/data/mods/public/simulation/templates/special/player.xml +++ b/binaries/data/mods/public/simulation/templates/special/player.xml @@ -48,8 +48,13 @@ + + + Player + Player + - unlock_shared_los + unlock_shared_los diff --git a/binaries/data/mods/public/simulation/templates/structures/athen_wonder.xml b/binaries/data/mods/public/simulation/templates/structures/athen_wonder.xml index f5712ad33a..cb0d771b45 100644 --- a/binaries/data/mods/public/simulation/templates/structures/athen_wonder.xml +++ b/binaries/data/mods/public/simulation/templates/structures/athen_wonder.xml @@ -4,14 +4,6 @@ 12.0 - - 30 - 0.1 - Unit - Support Infantry Cavalry - 3 - 2 - athen Naós Parthenṓn diff --git a/binaries/data/mods/public/simulation/templates/structures/cart_wonder.xml b/binaries/data/mods/public/simulation/templates/structures/cart_wonder.xml index 737df9a0ee..88625b7bc9 100644 --- a/binaries/data/mods/public/simulation/templates/structures/cart_wonder.xml +++ b/binaries/data/mods/public/simulation/templates/structures/cart_wonder.xml @@ -4,14 +4,6 @@ 12.0 - - 30 - 0.1 - Unit - Support Infantry Cavalry - 3 - 2 - cart Temple of Ba'al Hammon diff --git a/binaries/data/mods/public/simulation/templates/structures/iber_wonder.xml b/binaries/data/mods/public/simulation/templates/structures/iber_wonder.xml index 91695c134a..2452d2257e 100644 --- a/binaries/data/mods/public/simulation/templates/structures/iber_wonder.xml +++ b/binaries/data/mods/public/simulation/templates/structures/iber_wonder.xml @@ -4,14 +4,6 @@ 14.0 - - 30 - 0.1 - Unit - Support Infantry Cavalry - 3 - 2 - iber Cancho Roano diff --git a/binaries/data/mods/public/simulation/templates/structures/mace_wonder.xml b/binaries/data/mods/public/simulation/templates/structures/mace_wonder.xml index 7e753543d8..7d93402fd7 100644 --- a/binaries/data/mods/public/simulation/templates/structures/mace_wonder.xml +++ b/binaries/data/mods/public/simulation/templates/structures/mace_wonder.xml @@ -4,14 +4,6 @@ 12.0 - - 30 - 0.1 - Unit - Support Infantry Cavalry - 3 - 2 - mace Naós Parthenṓn diff --git a/binaries/data/mods/public/simulation/templates/structures/pers_wonder.xml b/binaries/data/mods/public/simulation/templates/structures/pers_wonder.xml index 979927cc7e..ba5bac8314 100644 --- a/binaries/data/mods/public/simulation/templates/structures/pers_wonder.xml +++ b/binaries/data/mods/public/simulation/templates/structures/pers_wonder.xml @@ -12,9 +12,6 @@ Hanging Gardens of Babylon A magnificent structure built in the 6th century BC by the Neo-Babylonian king Nebuchadnezzar II in order to please his wife Amytis of Media, who was homesick for the gardens and mountains of her homeland. - - 200 - diff --git a/binaries/data/mods/public/simulation/templates/structures/ptol_wonder.xml b/binaries/data/mods/public/simulation/templates/structures/ptol_wonder.xml index 5b6024e2ea..55db4ac276 100644 --- a/binaries/data/mods/public/simulation/templates/structures/ptol_wonder.xml +++ b/binaries/data/mods/public/simulation/templates/structures/ptol_wonder.xml @@ -4,14 +4,6 @@ 20.0 - - 30 - 0.1 - Unit - Support Infantry Cavalry - 3 - 2 - ptol Temple of Edfu diff --git a/binaries/data/mods/public/simulation/templates/structures/rome_wonder.xml b/binaries/data/mods/public/simulation/templates/structures/rome_wonder.xml index 4f1541ab48..9ce1bd7ac5 100644 --- a/binaries/data/mods/public/simulation/templates/structures/rome_wonder.xml +++ b/binaries/data/mods/public/simulation/templates/structures/rome_wonder.xml @@ -4,14 +4,6 @@ 12.0 - - 30 - 0.1 - Unit - Support Infantry Cavalry - 3 - 2 - rome Aedes Iovis Optimi Maximi diff --git a/binaries/data/mods/public/simulation/templates/structures/spart_wonder.xml b/binaries/data/mods/public/simulation/templates/structures/spart_wonder.xml index e6ac76cf42..b1ce643a52 100644 --- a/binaries/data/mods/public/simulation/templates/structures/spart_wonder.xml +++ b/binaries/data/mods/public/simulation/templates/structures/spart_wonder.xml @@ -4,14 +4,6 @@ 12.0 - - 30 - 0.1 - Unit - Support Infantry Cavalry - 3 - 2 - spart Naós Parthenṓn diff --git a/binaries/data/mods/public/simulation/templates/template_structure_wonder.xml b/binaries/data/mods/public/simulation/templates/template_structure_wonder.xml index 6289fcdba5..b480ae88d4 100644 --- a/binaries/data/mods/public/simulation/templates/template_structure_wonder.xml +++ b/binaries/data/mods/public/simulation/templates/template_structure_wonder.xml @@ -10,17 +10,28 @@ 2 + + + global + Player + + 10 + + Wonder Aura + +10 maximum population cap. + + Wonder - 1500 + 2000 5.0 1000 - 0 + 1000 1000 1000 1000 @@ -30,7 +41,14 @@ 10.0 - + + 30 + 0.1 + Unit + Support Infantry Cavalry + 3 + 2 + 5000 rubble/rubble_stone_6x6 @@ -38,10 +56,7 @@ Wonder Bring glory to your civilization and add large tracts of land to your empire. - - City - Wonder - + City Wonder structures/wonder.png phase_city