function Cost() {}
Cost.prototype.Schema =
"Specifies the construction/training costs of this entity." +
"" +
"1" +
"15" +
"20.0" +
"" +
"50" +
"0" +
"0" +
"25" +
"" +
"" +
"" +
"" +
"" +
"" +
"" +
"" +
"" +
"" +
"" +
"" +
"" +
"" +
"" +
"" +
"" +
"" +
"";
Cost.prototype.Init = function()
{
};
Cost.prototype.Serialize = null; // we have no dynamic state to save
Cost.prototype.GetPopCost = function()
{
return +this.template.Population;
};
Cost.prototype.GetPopBonus = function()
{
return +this.template.PopulationBonus;
};
Cost.prototype.GetBuildTime = function()
{
var cmpPlayer = QueryOwnerInterface(this.entity, IID_Player);
var buildTime = (+this.template.BuildTime) * cmpPlayer.cheatTimeMultiplier;
var cmpTechnologyManager = QueryOwnerInterface(this.entity, IID_TechnologyManager);
if (cmpTechnologyManager)
buildTime = cmpTechnologyManager.ApplyModifications("Cost/BuildTime", buildTime, this.entity);
return buildTime;
}
Cost.prototype.GetResourceCosts = function()
{
var costs = {};
var cmpTechnologyManager = QueryOwnerInterface(this.entity, IID_TechnologyManager);
for (var r in this.template.Resources)
{
costs[r] = +this.template.Resources[r];
if (cmpTechnologyManager)
costs[r] = cmpTechnologyManager.ApplyModifications("Cost/Resources/"+r, costs[r], this.entity);
}
return costs;
};
Engine.RegisterComponentType(IID_Cost, "Cost", Cost);