Apply modifiers from civ/team bonus auras in Reference Suite
The Reference Suite (Structure Tree, Civ Info, Viewer) wasn't taking
into
account civilization- or team-bonus auras when calculating entity stats.
This wasn't really a problem (for Vanilla 0AD) prior to a18d97b047
, as
civ-bonus auras don't exist in Vanilla 0AD, and our team-bonus auras
didn't
apply to the owning civ before that change. Now they do, the Suite needs
to
take them into consideration.
Differential Revision: https://code.wildfiregames.com/D4093
This was SVN commit r25751.
This commit is contained in:
parent
06672206d4
commit
184ed2fb55
@ -99,7 +99,8 @@ function DeriveModificationsFromTechnologies(techsDataArray)
|
||||
let derivedModifiers = {};
|
||||
for (let technology of techsDataArray)
|
||||
{
|
||||
if (!technology.reqs)
|
||||
// Auras don't have a "reqs" property
|
||||
if ('reqs' in technology && !technology.reqs)
|
||||
continue;
|
||||
|
||||
let modifiers = DeriveModificationsFromTech(technology);
|
||||
|
@ -201,13 +201,16 @@ class TemplateLoader
|
||||
return buildQueue;
|
||||
}
|
||||
|
||||
deriveModifications(civCode)
|
||||
deriveModifications(civCode, auraList)
|
||||
{
|
||||
let techData = [];
|
||||
for (let techName of this.autoResearchTechList)
|
||||
techData.push(GetTechnologyBasicDataHelper(this.loadTechnologyTemplate(techName), civCode));
|
||||
const modificationData = [];
|
||||
for (const techName of this.autoResearchTechList)
|
||||
modificationData.push(GetTechnologyBasicDataHelper(this.loadTechnologyTemplate(techName), civCode));
|
||||
|
||||
return DeriveModificationsFromTechnologies(techData);
|
||||
for (const auraName of auraList)
|
||||
modificationData.push(this.loadAuraTemplate(auraName));
|
||||
|
||||
return DeriveModificationsFromTechnologies(modificationData);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -36,6 +36,7 @@ class TemplateParser
|
||||
|
||||
let affectedPlayers = template.affectedPlayers || this.AuraAffectedPlayerDefault;
|
||||
parsed.affectsTeam = this.AuraTeamIndicators.some(indicator => affectedPlayers.includes(indicator));
|
||||
parsed.affectsSelf = this.AuraSelfIndicators.some(indicator => affectedPlayers.includes(indicator));
|
||||
|
||||
this.auras[auraName] = parsed;
|
||||
return this.auras[auraName];
|
||||
@ -334,7 +335,13 @@ class TemplateParser
|
||||
|
||||
deriveModifications(civCode)
|
||||
{
|
||||
this.modifiers[civCode] = this.TemplateLoader.deriveModifications(civCode);
|
||||
const player = this.getPlayer(civCode);
|
||||
const auraList = clone(player.civbonuses);
|
||||
for (const bonusname of player.teambonuses)
|
||||
if (this.getAura(bonusname).affectsSelf)
|
||||
auraList.push(bonusname);
|
||||
|
||||
this.modifiers[civCode] = this.TemplateLoader.deriveModifications(civCode, auraList);
|
||||
}
|
||||
|
||||
derivePhaseList(technologyList, civCode)
|
||||
@ -380,3 +387,8 @@ TemplateParser.prototype.AuraAffectedPlayerDefault =
|
||||
// that the aura applies to team members.
|
||||
TemplateParser.prototype.AuraTeamIndicators =
|
||||
["MutualAlly", "ExclusiveMutualAlly"];
|
||||
|
||||
// List of tokens that, if found in an aura's "affectedPlayers" attribute, indicate
|
||||
// that the aura applies to the aura's owning civ.
|
||||
TemplateParser.prototype.AuraSelfIndicators =
|
||||
["Player", "Ally", "MutualAlly"];
|
||||
|
Loading…
Reference in New Issue
Block a user