Show the garrisoned healrate in tooltips, revealing not necessarily intuitive rates for special buildings and ships.

This was SVN commit r18529.
This commit is contained in:
elexis 2016-07-19 13:19:37 +00:00
parent d0639c4df6
commit 2feeda802d
3 changed files with 23 additions and 5 deletions

View file

@ -229,7 +229,10 @@ function GetTemplateDataHelper(template, player, auraTemplates)
if (template.GarrisonHolder)
{
ret.garrisonHolder = {};
ret.garrisonHolder = {
"buffHeal": getEntityValue("GarrisonHolder/BuffHeal")
};
if (template.GarrisonHolder.Max)
ret.garrisonHolder.max = getEntityValue("GarrisonHolder/Max");
}

View file

@ -226,10 +226,24 @@ function getGarrisonTooltip(template)
if (!template.garrisonHolder)
return "";
return sprintf(translate("%(label)s: %(garrisonLimit)s"), {
"label": headerFont(translate("Garrison Limit")),
"garrisonLimit": template.garrisonHolder.capacity || template.garrisonHolder.max
});
let tooltips = [
sprintf(translate("%(label)s: %(garrisonLimit)s"), {
"label": headerFont(translate("Garrison Limit")),
"garrisonLimit": template.garrisonHolder.capacity || template.garrisonHolder.max
})
];
if (template.garrisonHolder.buffHeal)
tooltips.push(
sprintf(translate("%(healRateLabel)s %(value)s %(health)s / %(second)s"), {
"healRateLabel": headerFont(translate("Heal:")),
"value": Math.round(template.garrisonHolder.buffHeal),
"health": unitFont(translate("health")),
"second": unitFont(translate("second")),
})
);
return tooltips.join(commaFont(translate(", ")));
}
function getProjectilesTooltip(template)

View file

@ -356,6 +356,7 @@ GuiInterface.prototype.GetEntityState = function(player, ent)
if (cmpGarrisonHolder)
ret.garrisonHolder = {
"entities": cmpGarrisonHolder.GetEntities(),
"buffHeal": cmpGarrisonHolder.GetHealRate(),
"allowedClasses": cmpGarrisonHolder.GetAllowedClasses(),
"capacity": cmpGarrisonHolder.GetCapacity(),
"garrisonedEntitiesCount": cmpGarrisonHolder.GetGarrisonedEntitiesCount()