forked from 0ad/0ad
Techs can now modify an aura
Wonder population bonus is now an aura (reverted when the wonder is destroyed) with 10 pop (wonder) with an additionnal +40 with the tech patch by fatherbushido This was SVN commit r17809.
This commit is contained in:
parent
b88fd4fe09
commit
c9b0db7f5f
@ -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;
|
||||
|
@ -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)
|
||||
|
@ -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"
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -48,8 +48,13 @@
|
||||
</CivilCentre>
|
||||
</LimitRemovers>
|
||||
</EntityLimits>
|
||||
<Identity>
|
||||
<Civ></Civ>
|
||||
<GenericName>Player</GenericName>
|
||||
<Classes datatype="tokens">Player</Classes>
|
||||
</Identity>
|
||||
<Player>
|
||||
<SharedLosTech>unlock_shared_los</SharedLosTech>
|
||||
<SharedLosTech>unlock_shared_los</SharedLosTech>
|
||||
</Player>
|
||||
<StatisticsTracker/>
|
||||
<TechnologyManager/>
|
||||
|
@ -4,14 +4,6 @@
|
||||
<Square width="28.0" depth="58.0"/>
|
||||
<Height>12.0</Height>
|
||||
</Footprint>
|
||||
<GarrisonHolder>
|
||||
<Max>30</Max>
|
||||
<EjectHealth>0.1</EjectHealth>
|
||||
<EjectClassesOnDestroy datatype="tokens">Unit</EjectClassesOnDestroy>
|
||||
<List datatype="tokens">Support Infantry Cavalry</List>
|
||||
<BuffHeal>3</BuffHeal>
|
||||
<LoadingRange>2</LoadingRange>
|
||||
</GarrisonHolder>
|
||||
<Identity>
|
||||
<Civ>athen</Civ>
|
||||
<SpecificName>Naós Parthenṓn</SpecificName>
|
||||
|
@ -4,14 +4,6 @@
|
||||
<Square width="29.0" depth="59.0"/>
|
||||
<Height>12.0</Height>
|
||||
</Footprint>
|
||||
<GarrisonHolder>
|
||||
<Max>30</Max>
|
||||
<EjectHealth>0.1</EjectHealth>
|
||||
<EjectClassesOnDestroy datatype="tokens">Unit</EjectClassesOnDestroy>
|
||||
<List datatype="tokens">Support Infantry Cavalry</List>
|
||||
<BuffHeal>3</BuffHeal>
|
||||
<LoadingRange>2</LoadingRange>
|
||||
</GarrisonHolder>
|
||||
<Identity>
|
||||
<Civ>cart</Civ>
|
||||
<SpecificName>Temple of Ba'al Hammon</SpecificName>
|
||||
|
@ -4,14 +4,6 @@
|
||||
<Square width="43.0" depth="43.0"/>
|
||||
<Height>14.0</Height>
|
||||
</Footprint>
|
||||
<GarrisonHolder>
|
||||
<Max>30</Max>
|
||||
<EjectHealth>0.1</EjectHealth>
|
||||
<EjectClassesOnDestroy datatype="tokens">Unit</EjectClassesOnDestroy>
|
||||
<List datatype="tokens">Support Infantry Cavalry</List>
|
||||
<BuffHeal>3</BuffHeal>
|
||||
<LoadingRange>2</LoadingRange>
|
||||
</GarrisonHolder>
|
||||
<Identity>
|
||||
<Civ>iber</Civ>
|
||||
<SpecificName>Cancho Roano</SpecificName>
|
||||
|
@ -4,14 +4,6 @@
|
||||
<Square width="28.0" depth="58.0"/>
|
||||
<Height>12.0</Height>
|
||||
</Footprint>
|
||||
<GarrisonHolder>
|
||||
<Max>30</Max>
|
||||
<EjectHealth>0.1</EjectHealth>
|
||||
<EjectClassesOnDestroy datatype="tokens">Unit</EjectClassesOnDestroy>
|
||||
<List datatype="tokens">Support Infantry Cavalry</List>
|
||||
<BuffHeal>3</BuffHeal>
|
||||
<LoadingRange>2</LoadingRange>
|
||||
</GarrisonHolder>
|
||||
<Identity>
|
||||
<Civ>mace</Civ>
|
||||
<SpecificName>Naós Parthenṓn</SpecificName>
|
||||
|
@ -12,9 +12,6 @@
|
||||
<SpecificName>Hanging Gardens of Babylon</SpecificName>
|
||||
<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>
|
||||
</Identity>
|
||||
<Loot>
|
||||
<xp>200</xp>
|
||||
</Loot>
|
||||
<Obstruction>
|
||||
<Static width="59.0" depth="59.0"/>
|
||||
</Obstruction>
|
||||
|
@ -4,14 +4,6 @@
|
||||
<Square width="48.0" depth="66.0"/>
|
||||
<Height>20.0</Height>
|
||||
</Footprint>
|
||||
<GarrisonHolder>
|
||||
<Max>30</Max>
|
||||
<EjectHealth>0.1</EjectHealth>
|
||||
<EjectClassesOnDestroy datatype="tokens">Unit</EjectClassesOnDestroy>
|
||||
<List datatype="tokens">Support Infantry Cavalry</List>
|
||||
<BuffHeal>3</BuffHeal>
|
||||
<LoadingRange>2</LoadingRange>
|
||||
</GarrisonHolder>
|
||||
<Identity>
|
||||
<Civ>ptol</Civ>
|
||||
<SpecificName>Temple of Edfu</SpecificName>
|
||||
|
@ -4,14 +4,6 @@
|
||||
<Square width="24.0" depth="44.0"/>
|
||||
<Height>12.0</Height>
|
||||
</Footprint>
|
||||
<GarrisonHolder>
|
||||
<Max>30</Max>
|
||||
<EjectHealth>0.1</EjectHealth>
|
||||
<EjectClassesOnDestroy datatype="tokens">Unit</EjectClassesOnDestroy>
|
||||
<List datatype="tokens">Support Infantry Cavalry</List>
|
||||
<BuffHeal>3</BuffHeal>
|
||||
<LoadingRange>2</LoadingRange>
|
||||
</GarrisonHolder>
|
||||
<Identity>
|
||||
<Civ>rome</Civ>
|
||||
<SpecificName>Aedes Iovis Optimi Maximi</SpecificName>
|
||||
|
@ -4,14 +4,6 @@
|
||||
<Square width="28.0" depth="58.0"/>
|
||||
<Height>12.0</Height>
|
||||
</Footprint>
|
||||
<GarrisonHolder>
|
||||
<Max>30</Max>
|
||||
<EjectHealth>0.1</EjectHealth>
|
||||
<EjectClassesOnDestroy datatype="tokens">Unit</EjectClassesOnDestroy>
|
||||
<List datatype="tokens">Support Infantry Cavalry</List>
|
||||
<BuffHeal>3</BuffHeal>
|
||||
<LoadingRange>2</LoadingRange>
|
||||
</GarrisonHolder>
|
||||
<Identity>
|
||||
<Civ>spart</Civ>
|
||||
<SpecificName>Naós Parthenṓn</SpecificName>
|
||||
|
@ -10,17 +10,28 @@
|
||||
<Crush>2</Crush>
|
||||
</Foundation>
|
||||
</Armour>
|
||||
<Auras>
|
||||
<Aura1>
|
||||
<Type>global</Type>
|
||||
<Affects>Player</Affects>
|
||||
<Modifications>
|
||||
<Player.MaxPopulation> <Add>10</Add> </Player.MaxPopulation>
|
||||
</Modifications>
|
||||
<AuraName>Wonder Aura</AuraName>
|
||||
<AuraDescription>+10 maximum population cap.</AuraDescription>
|
||||
</Aura1>
|
||||
</Auras>
|
||||
<BuildRestrictions>
|
||||
<Category>Wonder</Category>
|
||||
</BuildRestrictions>
|
||||
<Capturable>
|
||||
<CapturePoints>1500</CapturePoints>
|
||||
<CapturePoints>2000</CapturePoints>
|
||||
<RegenRate>5.0</RegenRate>
|
||||
</Capturable>
|
||||
<Cost>
|
||||
<BuildTime>1000</BuildTime>
|
||||
<Resources>
|
||||
<food>0</food>
|
||||
<food>1000</food>
|
||||
<wood>1000</wood>
|
||||
<stone>1000</stone>
|
||||
<metal>1000</metal>
|
||||
@ -30,7 +41,14 @@
|
||||
<Square width="34.0" depth="34.0"/>
|
||||
<Height>10.0</Height>
|
||||
</Footprint>
|
||||
<GarrisonHolder disable=""/>
|
||||
<GarrisonHolder>
|
||||
<Max>30</Max>
|
||||
<EjectHealth>0.1</EjectHealth>
|
||||
<EjectClassesOnDestroy datatype="tokens">Unit</EjectClassesOnDestroy>
|
||||
<List datatype="tokens">Support Infantry Cavalry</List>
|
||||
<BuffHeal>3</BuffHeal>
|
||||
<LoadingRange>2</LoadingRange>
|
||||
</GarrisonHolder>
|
||||
<Health>
|
||||
<Max>5000</Max>
|
||||
<SpawnEntityOnDeath>rubble/rubble_stone_6x6</SpawnEntityOnDeath>
|
||||
@ -38,10 +56,7 @@
|
||||
<Identity>
|
||||
<GenericName>Wonder</GenericName>
|
||||
<Tooltip>Bring glory to your civilization and add large tracts of land to your empire.</Tooltip>
|
||||
<Classes datatype="tokens">
|
||||
City
|
||||
Wonder
|
||||
</Classes>
|
||||
<Classes datatype="tokens">City Wonder</Classes>
|
||||
<Icon>structures/wonder.png</Icon>
|
||||
<RequiredTechnology>phase_city</RequiredTechnology>
|
||||
</Identity>
|
||||
|
Loading…
Reference in New Issue
Block a user