Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/Attack.js
Show First 20 Lines • Show All 202 Lines • ▼ Show 20 Lines | "<element name='Slaughter' a:help='A special attack to kill domestic animals'>" + | ||||
Attack.prototype.preferredClassesSchema + | Attack.prototype.preferredClassesSchema + | ||||
Attack.prototype.restrictedClassesSchema + | Attack.prototype.restrictedClassesSchema + | ||||
"</interleave>" + | "</interleave>" + | ||||
"</element>" + | "</element>" + | ||||
"</optional>"; | "</optional>"; | ||||
Attack.prototype.Init = function() | Attack.prototype.Init = function() | ||||
{ | { | ||||
}; | }; | ||||
Stan: Should be removed. | |||||
Attack.prototype.Serialize = null; // we have no dynamic state to save | Attack.prototype.Serialize = null; // we have no dynamic state to save | ||||
Attack.prototype.GetAttackTypes = function(wantedTypes) | Attack.prototype.GetAttackTypes = function(wantedTypes) | ||||
{ | { | ||||
let types = g_AttackTypes.filter(type => !!this.template[type]); | let types = g_AttackTypes.filter(type => !!this.template[type]); | ||||
if (!wantedTypes) | if (!wantedTypes) | ||||
return types; | return types; | ||||
▲ Show 20 Lines • Show All 106 Lines • ▼ Show 20 Lines | Attack.prototype.GetPreference = function(target) | ||||
return minPref; | return minPref; | ||||
}; | }; | ||||
/** | /** | ||||
* Get the full range of attack using all available attack types. | * Get the full range of attack using all available attack types. | ||||
*/ | */ | ||||
Attack.prototype.GetFullAttackRange = function() | Attack.prototype.GetFullAttackRange = function() | ||||
{ | { | ||||
let ret = { "min": Infinity, "max": 0 }; | let ret = { "min": Infinity, "max": 0, "elevationBonus": Infinity }; | ||||
for (let type of this.GetAttackTypes()) | for (let type of this.GetAttackTypes()) | ||||
{ | { | ||||
let range = this.GetRange(type); | let range = this.GetRange(type); | ||||
ret.min = Math.min(ret.min, range.min); | ret.min = Math.min(ret.min, range.min); | ||||
ret.max = Math.max(ret.max, range.max); | ret.max = Math.max(ret.max, range.max); | ||||
ret.elevationBonus = Math.min(ret.elevationBonus, range.elevationBonus); | |||||
Not Done Inline Actionssince elevationBonus affects maximum and minimum range and can go negative, I would suggest to get maximal possible value not minimal if there is no specific case why minimum was choosen Silier: since elevationBonus affects maximum and minimum range and can go negative, I would suggest to… | |||||
Not Done Inline ActionsMy reasoning was: If we have an attack which has the largest range but an elevation bonus of 0 and there is another attack which has a smaller max range but an elevation bonus of 5 the full attack range would be not really an attack range, for the unit would not be in range when these values are used. Freagarach: My reasoning was: If we have an attack which has the largest range but an elevation bonus of… | |||||
wraitiiUnsubmitted Not Done Inline Actionsseems unrelated wraitii: seems unrelated | |||||
} | } | ||||
return ret; | return ret; | ||||
}; | }; | ||||
Attack.prototype.GetAttackEffectsData = function(type, splash) | Attack.prototype.GetAttackEffectsData = function(type, splash) | ||||
{ | { | ||||
let template = this.template[type]; | let template = this.template[type]; | ||||
if (splash) | if (splash) | ||||
▲ Show 20 Lines • Show All 277 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
Should be removed.