Adds max attack range to training tooltip and unit details panel for ranged units.
Adds attack type to unit details panel. Refs #1657 This was SVN commit r12700.
This commit is contained in:
parent
b8baa54722
commit
de6653e255
@ -181,8 +181,15 @@ function displaySingle(entState, template)
|
||||
}
|
||||
|
||||
// Attack and Armor
|
||||
getGUIObjectByName("attackAndArmorStats").tooltip = "[font=\"serif-bold-13\"]Attack:[/font] " + damageTypeDetails(entState.attack) +
|
||||
"\n[font=\"serif-bold-13\"]Armor:[/font] " + damageTypeDetails(entState.armour);
|
||||
var type = "";
|
||||
if (entState.attack)
|
||||
type = entState.attack.type + " ";
|
||||
|
||||
attack = "[font=\"serif-bold-13\"]"+type+"Attack:[/font] " + damageTypeDetails(entState.attack);
|
||||
// Show max attack range if ranged attack, also convert to tiles (4m per tile)
|
||||
if (entState.attack && entState.attack.type == "Ranged")
|
||||
attack += ", [font=\"serif-bold-13\"]Range:[/font] " + Math.round(entState.attack.maxRange/4);
|
||||
getGUIObjectByName("attackAndArmorStats").tooltip = attack + "\n[font=\"serif-bold-13\"]Armor:[/font] " + damageTypeDetails(entState.armour);
|
||||
|
||||
// Icon Tooltip
|
||||
var iconTooltip = "";
|
||||
|
@ -403,15 +403,19 @@ function getEntitySpeed(template)
|
||||
|
||||
function getEntityAttack(template)
|
||||
{
|
||||
var attacks = [];
|
||||
if (template.attack)
|
||||
{
|
||||
for (var type in template.attack)
|
||||
var attacks = [];
|
||||
if (template.attack)
|
||||
{
|
||||
attacks.push("[font=\"serif-bold-13\"]" + type + " Attack:[/font] " + damageTypesToText(template.attack[type]));
|
||||
for (var type in template.attack)
|
||||
{
|
||||
var attack = "[font=\"serif-bold-13\"]" + type + " Attack:[/font] " + damageTypesToText(template.attack[type]);
|
||||
// Show max attack range if ranged attack, also convert to tiles (4m per tile)
|
||||
if (type == "Ranged")
|
||||
attack += ", [font=\"serif-bold-13\"]Range:[/font] "+Math.round(template.attack[type].maxRange/4);
|
||||
attacks.push(attack);
|
||||
}
|
||||
}
|
||||
}
|
||||
return attacks.join("\n");
|
||||
return attacks.join("\n");
|
||||
}
|
||||
|
||||
function getEntityName(template)
|
||||
|
@ -176,6 +176,10 @@ GuiInterface.prototype.GetEntityState = function(player, ent)
|
||||
{
|
||||
var type = cmpAttack.GetBestAttack(); // TODO: how should we decide which attack to show? show all?
|
||||
ret.attack = cmpAttack.GetAttackStrengths(type);
|
||||
var range = cmpAttack.GetRange(type);
|
||||
ret.attack.type = type;
|
||||
ret.attack.minRange = range.min;
|
||||
ret.attack.maxRange = range.max;
|
||||
}
|
||||
|
||||
var cmpArmour = Engine.QueryInterface(ent, IID_DamageReceiver);
|
||||
@ -348,9 +352,11 @@ GuiInterface.prototype.GetTemplateData = function(player, name)
|
||||
for (var type in template.Attack)
|
||||
{
|
||||
ret.attack[type] = {
|
||||
"hack": GetTechModifiedProperty(techMods, template, "Attack/"+type+"/Hack", +template.Attack[type].Hack || 0),
|
||||
"pierce": GetTechModifiedProperty(techMods, template, "Attack/"+type+"/Pierce", +template.Attack[type].Pierce || 0),
|
||||
"crush": GetTechModifiedProperty(techMods, template, "Attack/"+type+"/Crush", +template.Attack[type].Crush || 0),
|
||||
"hack": GetTechModifiedProperty(techMods, template, "Attack/"+type+"/Hack", +(template.Attack[type].Hack || 0)),
|
||||
"pierce": GetTechModifiedProperty(techMods, template, "Attack/"+type+"/Pierce", +(template.Attack[type].Pierce || 0)),
|
||||
"crush": GetTechModifiedProperty(techMods, template, "Attack/"+type+"/Crush", +(template.Attack[type].Crush || 0)),
|
||||
"minRange": GetTechModifiedProperty(techMods, template, "Attack/"+type+"/MinRange", +(template.Attack[type].MinRange || 0)),
|
||||
"maxRange": GetTechModifiedProperty(techMods, template, "Attack/"+type+"/MaxRange", +template.Attack[type].MaxRange),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user