Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/ai/common-api/technology.js
Show First 20 Lines • Show All 122 Lines • ▼ Show 20 Lines | |||||||||||||||||||||
m.Technology.prototype.affects = function() | m.Technology.prototype.affects = function() | ||||||||||||||||||||
{ | { | ||||||||||||||||||||
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; | |||||||||||||||||||||
}; | }; | ||||||||||||||||||||
StanUnsubmitted Done Inline Actions
Stan: | |||||||||||||||||||||
return m; | return m; | ||||||||||||||||||||
}(API3); | }(API3); | ||||||||||||||||||||
Lint: no-use-before-define 'API3' was used before it was defined. Lint: no-use-before-define: 'API3' was used before it was defined. |
Wildfire Games · Phabricator