Differential D4333 Diff 19020 ps/trunk/binaries/data/mods/public/simulation/ai/common-api/technology.js
Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/simulation/ai/common-api/technology.js
Show First 20 Lines • Show All 59 Lines • ▼ Show 20 Lines | |||||
m.Technology.prototype.pairedWith = function() | m.Technology.prototype.pairedWith = function() | ||||
{ | { | ||||
if (!this._isPair) | if (!this._isPair) | ||||
return undefined; | return undefined; | ||||
return this._pairedWith; | return this._pairedWith; | ||||
}; | }; | ||||
m.Technology.prototype.cost = function(productionQueue) | m.Technology.prototype.cost = function(researcher) | ||||
{ | { | ||||
if (!this._template.cost) | if (!this._template.cost) | ||||
return undefined; | return undefined; | ||||
let cost = {}; | let cost = {}; | ||||
for (let type in this._template.cost) | for (let type in this._template.cost) | ||||
{ | { | ||||
cost[type] = +this._template.cost[type]; | cost[type] = +this._template.cost[type]; | ||||
if (productionQueue) | if (researcher) | ||||
cost[type] *= productionQueue.techCostMultiplier(type); | cost[type] *= researcher.techCostMultiplier(type); | ||||
} | } | ||||
return cost; | return cost; | ||||
}; | }; | ||||
m.Technology.prototype.costSum = function(productionQueue) | m.Technology.prototype.costSum = function(researcher) | ||||
{ | { | ||||
let cost = this.cost(productionQueue); | const cost = this.cost(researcher); | ||||
if (!cost) | if (!cost) | ||||
return 0; | return 0; | ||||
let ret = 0; | let ret = 0; | ||||
for (let type in cost) | for (let type in cost) | ||||
ret += cost[type]; | ret += cost[type]; | ||||
return ret; | return ret; | ||||
}; | }; | ||||
▲ Show 20 Lines • Show All 46 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator