forked from 0ad/0ad
Adds armour and attack strengths to AI entity template, based on patch by infyquest. Fixes #991.
This was SVN commit r10393.
This commit is contained in:
parent
81abd0342f
commit
b28ae93dc8
@ -64,7 +64,48 @@ var EntityTemplate = Class({
|
||||
isRepairable: function() { return this._template.Health.Repairable === "true"; },
|
||||
|
||||
|
||||
// TODO: attack, armour
|
||||
armourStrengths: function() {
|
||||
if (!this._template.Armour)
|
||||
return undefined;
|
||||
|
||||
return {
|
||||
hack: +this._template.Armour.Hack,
|
||||
pierce: +this._template.Armour.Pierce,
|
||||
crush: +this._template.Armour.Crush
|
||||
};
|
||||
},
|
||||
|
||||
attackTypes: function() {
|
||||
if (!this._template.Attack)
|
||||
return undefined;
|
||||
|
||||
var ret = [];
|
||||
for (var type in this._template.Attack)
|
||||
ret.push(type);
|
||||
|
||||
return ret;
|
||||
},
|
||||
|
||||
attackRange: function(type) {
|
||||
if (!this._template.Attack || !this._template.Attack[type])
|
||||
return undefined;
|
||||
|
||||
return {
|
||||
max: +this._template.Attack[type].MaxRange,
|
||||
min: +(this._template.Attack[type].MinRange || 0)
|
||||
};
|
||||
},
|
||||
|
||||
attackStrengths: function(type) {
|
||||
if (!this._template.Attack || !this._template.Attack[type])
|
||||
return undefined;
|
||||
|
||||
return {
|
||||
hack: +(this._template.Attack[type].Hack || 0),
|
||||
pierce: +(this._template.Attack[type].Pierce || 0),
|
||||
crush: +(this._template.Attack[type].Crush || 0)
|
||||
};
|
||||
},
|
||||
|
||||
|
||||
buildableEntities: function() {
|
||||
|
Loading…
Reference in New Issue
Block a user