2010-01-22 21:03:14 +01:00
|
|
|
function Cost() {}
|
|
|
|
|
2010-04-09 21:02:39 +02:00
|
|
|
Cost.prototype.Schema =
|
2010-04-23 18:09:03 +02:00
|
|
|
"<a:help>Specifies the construction/training costs of this entity.</a:help>" +
|
|
|
|
"<a:example>" +
|
|
|
|
"<Population>1</Population>" +
|
|
|
|
"<PopulationBonus>15</PopulationBonus>" +
|
|
|
|
"<BuildTime>20.0</BuildTime>" +
|
|
|
|
"<Resources>" +
|
|
|
|
"<food>50</food>" +
|
|
|
|
"<wood>0</wood>" +
|
|
|
|
"<stone>0</stone>" +
|
|
|
|
"<metal>25</metal>" +
|
|
|
|
"</Resources>" +
|
|
|
|
"</a:example>" +
|
2010-08-21 22:43:55 +02:00
|
|
|
"<element name='Population' a:help='Population cost'>" +
|
|
|
|
"<data type='nonNegativeInteger'/>" +
|
|
|
|
"</element>" +
|
|
|
|
"<element name='PopulationBonus' a:help='Population cap increase while this entity exists'>" +
|
|
|
|
"<data type='nonNegativeInteger'/>" +
|
|
|
|
"</element>" +
|
|
|
|
"<element name='BuildTime' a:help='Time taken to construct/train this unit (in seconds)'>" +
|
|
|
|
"<ref name='positiveDecimal'/>" +
|
|
|
|
"</element>" +
|
2010-04-23 18:09:03 +02:00
|
|
|
"<element name='Resources' a:help='Resource costs to construct/train this unit'>" +
|
2010-04-09 21:02:39 +02:00
|
|
|
"<interleave>" +
|
|
|
|
"<element name='food'><data type='nonNegativeInteger'/></element>" +
|
|
|
|
"<element name='wood'><data type='nonNegativeInteger'/></element>" +
|
|
|
|
"<element name='stone'><data type='nonNegativeInteger'/></element>" +
|
|
|
|
"<element name='metal'><data type='nonNegativeInteger'/></element>" +
|
|
|
|
"</interleave>" +
|
|
|
|
"</element>";
|
|
|
|
|
2011-03-05 23:30:32 +01:00
|
|
|
Cost.prototype.Init = function()
|
|
|
|
{
|
|
|
|
};
|
|
|
|
|
|
|
|
Cost.prototype.Serialize = null; // we have no dynamic state to save
|
|
|
|
|
2010-01-22 21:03:14 +01:00
|
|
|
Cost.prototype.GetPopCost = function()
|
|
|
|
{
|
2010-08-21 22:43:55 +02:00
|
|
|
return +this.template.Population;
|
2010-01-24 18:24:35 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
Cost.prototype.GetPopBonus = function()
|
|
|
|
{
|
2010-08-21 22:43:55 +02:00
|
|
|
return +this.template.PopulationBonus;
|
2010-01-22 21:03:14 +01:00
|
|
|
};
|
|
|
|
|
2010-03-12 23:28:51 +01:00
|
|
|
Cost.prototype.GetBuildTime = function()
|
|
|
|
{
|
2010-08-21 22:43:55 +02:00
|
|
|
return +this.template.BuildTime;
|
2010-03-12 23:28:51 +01:00
|
|
|
}
|
|
|
|
|
2010-02-12 23:46:53 +01:00
|
|
|
Cost.prototype.GetResourceCosts = function()
|
|
|
|
{
|
|
|
|
return {
|
2010-04-09 21:02:39 +02:00
|
|
|
"food": +this.template.Resources.food,
|
|
|
|
"wood": +this.template.Resources.wood,
|
|
|
|
"stone": +this.template.Resources.stone,
|
|
|
|
"metal": +this.template.Resources.metal
|
2010-02-12 23:46:53 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2010-01-22 21:03:14 +01:00
|
|
|
Engine.RegisterComponentType(IID_Cost, "Cost", Cost);
|