Ticket #3522: 3522.5.diff
File 3522.5.diff, 20.0 KB (added by , 8 years ago) |
---|
-
binaries/data/mods/public/simulation/components/Auras.js
Auras.prototype.Init = function() 76 76 this.affectedPlayers[name] = []; // will be calculated on ownership change 77 77 var aura = {}; 78 78 aura.affects = this.template[name].Affects; 79 79 if (this.template[name].AffectedPlayers) 80 80 aura.affectedPlayers = this.template[name].AffectedPlayers.split(/\s+/); 81 aura.modifications = [];82 for (var value in this.template[name].Modifications)83 {84 var mod = {};85 mod.value = value.replace(/\./g, "/").replace(/\/\//g, ".");86 if (this.template[name].Modifications[value].Add)87 mod.add = +this.template[name].Modifications[value].Add;88 else if (this.template[name].Modifications[value].Multiply)89 mod.multiply = +this.template[name].Modifications[value].Multiply;90 aura.modifications.push(mod);91 }92 81 this.auras[name] = aura; 93 82 } 94 83 }; 95 84 85 Auras.prototype.GetModifierIdentifier = function(name, mod) 86 { 87 return this.templateName + "/" + name + "/" + mod.value; 88 }; 89 96 90 Auras.prototype.GetDescriptions = function() 97 91 { 98 92 var ret = {}; 99 93 for each (var aura in this.template) 100 94 if (aura.AuraName) … … Auras.prototype.Clean = function() 236 230 237 231 if (this[name].rangeQuery) 238 232 cmpRangeManager.DestroyActiveQuery(this[name].rangeQuery); 239 233 } 240 234 235 for (let name in this.template) 236 { 237 let modifications = []; 238 for (let value in this.template[name].Modifications) 239 { 240 let mod = {}; 241 mod.value = value.replace(/\./g, "/").replace(/\/\//g, "."); 242 if (this.template[name].Modifications[value].Add) 243 mod.add = ApplyValueModificationsToEntity("Auras/"+name+"/Modifications/"+mod.value+"/Add", +this.template[name].Modifications[value].Add, this.entity); 244 else if (this.template[name].Modifications[value].Multiply) 245 mod.multiply = ApplyValueModificationsToEntity("Auras/"+name+"/Modifications/"+mod.value+"/Multiply", +this.template[name].Modifications[value].Multiply, this.entity); 246 modifications.push(mod); 247 } 248 this.auras[name].modifications = modifications; 249 } 250 241 251 for (let name of auraNames) 242 252 { 243 253 // only calculate the affected players on re-applying the bonuses 244 254 // this makes sure the template bonuses are removed from the correct players 245 255 this.CalculateAffectedPlayers(name); … … Auras.prototype.ApplyTemplateBonus = fun 329 339 var cmpAuraManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_AuraManager); 330 340 var classes = this.GetClasses(name); 331 341 332 342 for (let mod of modifications) 333 343 for (let player of players) 334 cmpAuraManager.ApplyTemplateBonus(mod.value, player, classes, mod, this. templateName + "/" + name + "/" + mod.value);344 cmpAuraManager.ApplyTemplateBonus(mod.value, player, classes, mod, this.GetModifierIdentifier(name, mod)); 335 345 }; 336 346 337 347 Auras.prototype.RemoveFormationBonus = function(memberList) 338 348 { 339 349 var auraNames = this.GetAuraNames().filter(n => this.IsFormationAura(n)); … … Auras.prototype.RemoveTemplateBonus = fu 358 368 var classes = this.GetClasses(name); 359 369 var players = this.GetAffectedPlayers(name); 360 370 361 371 for each (var mod in modifications) 362 372 for each (var player in players) 363 cmpAuraManager.RemoveTemplateBonus(mod.value, player, classes, this. templateName + "/" + name + "/" + mod.value);373 cmpAuraManager.RemoveTemplateBonus(mod.value, player, classes, this.GetModifierIdentifier(name, mod)); 364 374 }; 365 375 366 376 Auras.prototype.ApplyBonus = function(name, ents) 367 377 { 368 378 var validEnts = this.GiveMembersWithValidClass(name, ents); … … Auras.prototype.ApplyBonus = function(na 370 380 return; 371 381 this[name].targetUnits = this[name].targetUnits.concat(validEnts); 372 382 var modifications = this.GetModifications(name); 373 383 var cmpAuraManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_AuraManager); 374 384 for each (let mod in modifications) 375 cmpAuraManager.ApplyBonus(mod.value, validEnts, mod, this. templateName + "/" + name + "/" + mod.value);385 cmpAuraManager.ApplyBonus(mod.value, validEnts, mod, this.GetModifierIdentifier(name, mod)); 376 386 // update status bars if this has an icon 377 387 if (!this.GetOverlayIcon(name)) 378 388 return; 379 389 for (let ent of validEnts) 380 390 { … … Auras.prototype.RemoveBonus = function(n 391 401 return; 392 402 this[name].targetUnits = this[name].targetUnits.filter(v => validEnts.indexOf(v) == -1); 393 403 var modifications = this.GetModifications(name); 394 404 var cmpAuraManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_AuraManager); 395 405 for each (let mod in modifications) 396 cmpAuraManager.RemoveBonus(mod.value, validEnts, this. templateName + "/" + name + "/" + mod.value);406 cmpAuraManager.RemoveBonus(mod.value, validEnts, this.GetModifierIdentifier(name, mod)); 397 407 // update status bars if this has an icon 398 408 if (!this.GetOverlayIcon(name)) 399 409 return; 400 410 for (let ent of validEnts) 401 411 { -
binaries/data/mods/public/simulation/components/Player.js
Player.prototype.SetMaxPopulation = func 142 142 this.maxPop = max; 143 143 }; 144 144 145 145 Player.prototype.GetMaxPopulation = function() 146 146 { 147 return Math.round(ApplyValueModificationsToPlayer("Player/MaxPopulation", this.maxPop, this.entity ));147 return Math.round(ApplyValueModificationsToPlayer("Player/MaxPopulation", this.maxPop, this.entity, this.playerID)); 148 148 }; 149 149 150 150 Player.prototype.SetGatherRateMultiplier = function(value) 151 151 { 152 152 this.gatherRateMultiplier = value; -
binaries/data/mods/public/simulation/data/technologies/pop_wonder.json
8 8 "ptol": "Peristyle", 9 9 "rome": "Peristyle", 10 10 "pers": "Paradise" 11 11 }, 12 12 "description": "The wonder attracts many more people to your civilization.", 13 "cost": {"food": 3000, "wood": 3000, "stone": 500, "metal": 500},13 "cost": {"food": 2000, "wood": 3000, "stone": 500, "metal": 500}, 14 14 "requirements": {"tech": "phase_city"}, 15 15 "requirementsTooltip": "Unlocked in City Phase.", 16 16 "icon": "special_treasure.png", 17 17 "researchTime": 40, 18 "tooltip": " +50 maximum population cap.",19 "modifications": [{"value": " Player/MaxPopulation", "add": 50}],18 "tooltip": "Increase power of the wonder aura.", 19 "modifications": [{"value": "Auras/Aura1/Modifications/Player/MaxPopulation/Add", "add": 40}], 20 20 "soundComplete": "interface/alarm/alarm_upgradearmory.xml" 21 21 } -
binaries/data/mods/public/simulation/helpers/ValueModification.js
1 // Little helper functions to make applying technology more convenient1 // Little helper functions to make applying technology and auras more convenient 2 2 3 3 function ApplyValueModificationsToEntity(tech_type, current_value, entity) 4 4 { 5 5 let value = current_value; 6 6 let cmpTechnologyManager = QueryOwnerInterface(entity, IID_TechnologyManager); … … function ApplyValueModificationsToEntity 11 11 if (!cmpAuraManager) 12 12 return value; 13 13 return cmpAuraManager.ApplyModifications(tech_type, value, entity); 14 14 } 15 15 16 function ApplyValueModificationsToPlayer(tech_type, current_value, player _entity)16 function ApplyValueModificationsToPlayer(tech_type, current_value, playerEntity, playerID) 17 17 { 18 let cmpTechnologyManager = Engine.QueryInterface(player_entity, IID_TechnologyManager); 19 20 if (!cmpTechnologyManager) 21 return current_value; 22 23 return cmpTechnologyManager.ApplyModifications(tech_type, current_value, player_entity); 18 let cmpTemplateManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_TemplateManager); 19 let entityTemplateName = cmpTemplateManager.GetCurrentTemplateName(playerEntity); 20 let entityTemplate = cmpTemplateManager.GetTemplate(entityTemplateName); 21 return ApplyValueModificationsToTemplate(tech_type, current_value, playerID, entityTemplate) 24 22 } 25 23 26 24 function ApplyValueModificationsToTemplate(tech_type, current_value, playerID, template) 27 25 { 28 26 let value = current_value; -
binaries/data/mods/public/simulation/templates/special/player.xml
46 46 <CivilCentre> 47 47 <RequiredTechs datatype="tokens">phase_town</RequiredTechs> 48 48 </CivilCentre> 49 49 </LimitRemovers> 50 50 </EntityLimits> 51 <Identity> 52 <Civ></Civ> 53 <GenericName>Player</GenericName> 54 <Classes datatype="tokens">Player</Classes> 55 </Identity> 51 56 <Player> 52 57 <SharedLosTech>unlock_shared_los</SharedLosTech> 53 58 </Player> 54 59 <StatisticsTracker/> 55 60 <TechnologyManager/> 56 61 </Entity> -
binaries/data/mods/public/simulation/templates/structures/athen_wonder.xml
2 2 <Entity parent="template_structure_wonder"> 3 3 <Footprint> 4 4 <Square width="28.0" depth="58.0"/> 5 5 <Height>12.0</Height> 6 6 </Footprint> 7 <GarrisonHolder>8 <Max>30</Max>9 <EjectHealth>0.1</EjectHealth>10 <EjectClassesOnDestroy datatype="tokens">Unit</EjectClassesOnDestroy>11 <List datatype="tokens">Support Infantry Cavalry</List>12 <BuffHeal>3</BuffHeal>13 <LoadingRange>2</LoadingRange>14 </GarrisonHolder>15 7 <Identity> 16 8 <Civ>athen</Civ> 17 9 <SpecificName>Naós Parthenṓn</SpecificName> 18 10 <History>The Hellenes built marvelous temples in order to honour their polytheistic pantheon. While all gods were venerated, a specific patron deity was supposed to watch over each polis.</History> 19 11 <Tooltip>Bring glory to your civilization and add large tracts of land to your empire. Garrison up to 30 units to heal them at a quick rate.</Tooltip> -
binaries/data/mods/public/simulation/templates/structures/cart_wonder.xml
2 2 <Entity parent="template_structure_wonder"> 3 3 <Footprint> 4 4 <Square width="29.0" depth="59.0"/> 5 5 <Height>12.0</Height> 6 6 </Footprint> 7 <GarrisonHolder>8 <Max>30</Max>9 <EjectHealth>0.1</EjectHealth>10 <EjectClassesOnDestroy datatype="tokens">Unit</EjectClassesOnDestroy>11 <List datatype="tokens">Support Infantry Cavalry</List>12 <BuffHeal>3</BuffHeal>13 <LoadingRange>2</LoadingRange>14 </GarrisonHolder>15 7 <Identity> 16 8 <Civ>cart</Civ> 17 9 <SpecificName>Temple of Ba'al Hammon</SpecificName> 18 10 <History>Dating from the 2nd Century BC, the Mausoleum of Atban in northern Tunisia is over twenty metres high and was built by the inhabitants of Dougga for a Numidian prince.</History> 19 11 </Identity> -
binaries/data/mods/public/simulation/templates/structures/iber_wonder.xml
2 2 <Entity parent="template_structure_wonder"> 3 3 <Footprint> 4 4 <Square width="43.0" depth="43.0"/> 5 5 <Height>14.0</Height> 6 6 </Footprint> 7 <GarrisonHolder>8 <Max>30</Max>9 <EjectHealth>0.1</EjectHealth>10 <EjectClassesOnDestroy datatype="tokens">Unit</EjectClassesOnDestroy>11 <List datatype="tokens">Support Infantry Cavalry</List>12 <BuffHeal>3</BuffHeal>13 <LoadingRange>2</LoadingRange>14 </GarrisonHolder>15 7 <Identity> 16 8 <Civ>iber</Civ> 17 9 <SpecificName>Cancho Roano</SpecificName> 18 10 <History>ToDo</History> 19 11 </Identity> -
binaries/data/mods/public/simulation/templates/structures/mace_wonder.xml
2 2 <Entity parent="template_structure_wonder"> 3 3 <Footprint> 4 4 <Square width="28.0" depth="58.0"/> 5 5 <Height>12.0</Height> 6 6 </Footprint> 7 <GarrisonHolder>8 <Max>30</Max>9 <EjectHealth>0.1</EjectHealth>10 <EjectClassesOnDestroy datatype="tokens">Unit</EjectClassesOnDestroy>11 <List datatype="tokens">Support Infantry Cavalry</List>12 <BuffHeal>3</BuffHeal>13 <LoadingRange>2</LoadingRange>14 </GarrisonHolder>15 7 <Identity> 16 8 <Civ>mace</Civ> 17 9 <SpecificName>Naós Parthenṓn</SpecificName> 18 10 <History>The Hellenes built marvelous temples in order to honour their polytheistic pantheon. While all gods were venerated, a specific patron deity was supposed to watch over each polis.</History> 19 11 <Tooltip>Bring glory to your civilization and add large tracts of land to your empire. Garrison up to 30 units to heal them at a quick rate.</Tooltip> -
binaries/data/mods/public/simulation/templates/structures/pers_wonder.xml
10 10 <Identity> 11 11 <Civ>pers</Civ> 12 12 <SpecificName>Hanging Gardens of Babylon</SpecificName> 13 13 <History>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.</History> 14 14 </Identity> 15 <Loot>16 <xp>200</xp>17 </Loot>18 15 <Obstruction> 19 16 <Static width="59.0" depth="59.0"/> 20 17 </Obstruction> 21 18 <StatusBars> 22 19 <BarWidth>6.0</BarWidth> -
binaries/data/mods/public/simulation/templates/structures/ptol_wonder.xml
2 2 <Entity parent="template_structure_wonder"> 3 3 <Footprint> 4 4 <Square width="48.0" depth="66.0"/> 5 5 <Height>20.0</Height> 6 6 </Footprint> 7 <GarrisonHolder>8 <Max>30</Max>9 <EjectHealth>0.1</EjectHealth>10 <EjectClassesOnDestroy datatype="tokens">Unit</EjectClassesOnDestroy>11 <List datatype="tokens">Support Infantry Cavalry</List>12 <BuffHeal>3</BuffHeal>13 <LoadingRange>2</LoadingRange>14 </GarrisonHolder>15 7 <Identity> 16 8 <Civ>ptol</Civ> 17 9 <SpecificName>Temple of Edfu</SpecificName> 18 10 <History>The Temple of Edfu is an ancient Egyptian temple located on the west bank of the Nile in the city of Edfu which was known in Greco-Roman times as Apollonopolis Magna, after the chief god Horus-Apollo.The temple, dedicated to the falcon god Horus, was built in the Ptolemaic period between 237 and 57 BCE. In modern times, it is one of the best preserved temples of Egypt.</History> 19 11 </Identity> -
binaries/data/mods/public/simulation/templates/structures/rome_wonder.xml
2 2 <Entity parent="template_structure_wonder"> 3 3 <Footprint> 4 4 <Square width="24.0" depth="44.0"/> 5 5 <Height>12.0</Height> 6 6 </Footprint> 7 <GarrisonHolder>8 <Max>30</Max>9 <EjectHealth>0.1</EjectHealth>10 <EjectClassesOnDestroy datatype="tokens">Unit</EjectClassesOnDestroy>11 <List datatype="tokens">Support Infantry Cavalry</List>12 <BuffHeal>3</BuffHeal>13 <LoadingRange>2</LoadingRange>14 </GarrisonHolder>15 7 <Identity> 16 8 <Civ>rome</Civ> 17 9 <SpecificName>Aedes Iovis Optimi Maximi</SpecificName> 18 10 <History>.</History> 19 11 </Identity> -
binaries/data/mods/public/simulation/templates/structures/spart_wonder.xml
2 2 <Entity parent="template_structure_wonder"> 3 3 <Footprint> 4 4 <Square width="28.0" depth="58.0"/> 5 5 <Height>12.0</Height> 6 6 </Footprint> 7 <GarrisonHolder>8 <Max>30</Max>9 <EjectHealth>0.1</EjectHealth>10 <EjectClassesOnDestroy datatype="tokens">Unit</EjectClassesOnDestroy>11 <List datatype="tokens">Support Infantry Cavalry</List>12 <BuffHeal>3</BuffHeal>13 <LoadingRange>2</LoadingRange>14 </GarrisonHolder>15 7 <Identity> 16 8 <Civ>spart</Civ> 17 9 <SpecificName>Naós Parthenṓn</SpecificName> 18 10 <History>The Hellenes built marvelous temples in order to honour their polytheistic pantheon. While all gods were venerated, a specific patron deity was supposed to watch over each polis.</History> 19 11 <Tooltip>Bring glory to your civilization and add large tracts of land to your empire. Garrison up to 30 units to heal them at a quick rate.</Tooltip> -
binaries/data/mods/public/simulation/templates/template_structure_wonder.xml
8 8 <Hack>2</Hack> 9 9 <Pierce>10</Pierce> 10 10 <Crush>2</Crush> 11 11 </Foundation> 12 12 </Armour> 13 <Auras> 14 <Aura1> 15 <Type>global</Type> 16 <Affects>Player</Affects> 17 <Modifications> 18 <Player.MaxPopulation> <Add>10</Add> </Player.MaxPopulation> 19 </Modifications> 20 <AuraName>Wonder Aura</AuraName> 21 <AuraDescription>Increase maximum population cap.</AuraDescription> 22 </Aura1> 23 </Auras> 13 24 <BuildRestrictions> 14 25 <Category>Wonder</Category> 15 26 </BuildRestrictions> 16 27 <Capturable> 17 <CapturePoints> 1500</CapturePoints>28 <CapturePoints>2000</CapturePoints> 18 29 <RegenRate>5.0</RegenRate> 19 30 </Capturable> 20 31 <Cost> 21 32 <BuildTime>1000</BuildTime> 22 33 <Resources> 23 <food> 0</food>34 <food>1000</food> 24 35 <wood>1000</wood> 25 36 <stone>1000</stone> 26 37 <metal>1000</metal> 27 38 </Resources> 28 39 </Cost> 29 40 <Footprint> 30 41 <Square width="34.0" depth="34.0"/> 31 42 <Height>10.0</Height> 32 43 </Footprint> 33 <GarrisonHolder disable=""/> 44 <GarrisonHolder> 45 <Max>30</Max> 46 <EjectHealth>0.1</EjectHealth> 47 <EjectClassesOnDestroy datatype="tokens">Unit</EjectClassesOnDestroy> 48 <List datatype="tokens">Support Infantry Cavalry</List> 49 <BuffHeal>3</BuffHeal> 50 <LoadingRange>2</LoadingRange> 51 </GarrisonHolder> 34 52 <Health> 35 53 <Max>5000</Max> 36 54 <SpawnEntityOnDeath>rubble/rubble_stone_6x6</SpawnEntityOnDeath> 37 55 </Health> 38 56 <Identity> 39 57 <GenericName>Wonder</GenericName> 40 58 <Tooltip>Bring glory to your civilization and add large tracts of land to your empire.</Tooltip> 41 59 <Classes datatype="tokens"> 42 60 City 43 61 Wonder 44 62 </Classes> 45 63 <Icon>structures/wonder.png</Icon> 46 64 <RequiredTechnology>phase_city</RequiredTechnology> 47 65 </Identity> 48 66 <Loot> 49 67 <xp>200</xp>