Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/ai/common-api/technology.js
Show First 20 Lines • Show All 124 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) | if (!this._template.affects) | ||||||||||||||||||||
return false; | return false; | ||||||||||||||||||||
for (let affect of this._template.affects) | for (let affect of this._template.affects) | ||||||||||||||||||||
{ | { | ||||||||||||||||||||
let reqClasses = affect.split(" "); | if (MatchesClassList(classes, affect)) | ||||||||||||||||||||
let fitting = true; | |||||||||||||||||||||
for (let reqClass of reqClasses) | |||||||||||||||||||||
{ | |||||||||||||||||||||
if (classes.indexOf(reqClass) !== -1) | |||||||||||||||||||||
continue; | |||||||||||||||||||||
fitting = false; | |||||||||||||||||||||
break; | |||||||||||||||||||||
} | |||||||||||||||||||||
if (fitting === true) | |||||||||||||||||||||
return true; | return true; | ||||||||||||||||||||
} | } | ||||||||||||||||||||
return false; | return false; | ||||||||||||||||||||
}; | }; | ||||||||||||||||||||
StanUnsubmitted Done Inline Actions
Stan: | |||||||||||||||||||||
return m; | return m; | ||||||||||||||||||||
}(API3); | }(API3); |
Wildfire Games · Phabricator