Differential D2150 Diff 17818 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 124 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
if (!this._template.affects) | if (!this._template.affects) | ||||
return undefined; | return undefined; | ||||
return this._template.affects; | return this._template.affects; | ||||
}; | }; | ||||
m.Technology.prototype.isAffected = function(classes) | m.Technology.prototype.isAffected = function(classes) | ||||
{ | { | ||||
if (!this._template.affects) | return this._template.affects && this._template.affects.some(affect => MatchesClassList(classes, affect)); | ||||
return false; | |||||
for (let affect of this._template.affects) | |||||
{ | |||||
let reqClasses = affect.split(" "); | |||||
let fitting = true; | |||||
for (let reqClass of reqClasses) | |||||
{ | |||||
if (classes.indexOf(reqClass) !== -1) | |||||
continue; | |||||
fitting = false; | |||||
break; | |||||
} | |||||
if (fitting === true) | |||||
return true; | |||||
} | |||||
return false; | |||||
}; | }; | ||||
return m; | return m; | ||||
}(API3); | }(API3); |
Wildfire Games · Phabricator