Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/common/tooltips.js
Show First 20 Lines • Show All 327 Lines • ▼ Show 20 Lines | function getSplashDamageTooltip(template) | ||||
} | } | ||||
// If multiple attack types deal splash damage, the attack type should be shown to differentiate. | // If multiple attack types deal splash damage, the attack type should be shown to differentiate. | ||||
return tooltips.join("\n"); | return tooltips.join("\n"); | ||||
} | } | ||||
function getGarrisonTooltip(template) | function getGarrisonTooltip(template) | ||||
{ | { | ||||
if (!template.garrisonHolder) | let tooltips = []; | ||||
return ""; | if (template.garrisonHolder) | ||||
{ | |||||
let tooltips = [ | tooltips.push ( | ||||
sprintf(translate("%(label)s: %(garrisonLimit)s"), { | sprintf(translate("%(label)s: %(garrisonLimit)s"), { | ||||
"label": headerFont(translate("Garrison Limit")), | "label": headerFont(translate("Garrison Limit")), | ||||
"garrisonLimit": template.garrisonHolder.capacity | "garrisonLimit": template.garrisonHolder.capacity | ||||
Freagarach: Should we correct for the number of units garrisoned inside? E.g.: A ram has normally a size of… | |||||
}) | }) | ||||
]; | ); | ||||
if (template.garrisonHolder.buffHeal) | if (template.garrisonHolder.buffHeal) | ||||
tooltips.push( | tooltips.push( | ||||
sprintf(translate("%(healRateLabel)s %(value)s %(health)s / %(second)s"), { | sprintf(translate("%(healRateLabel)s %(value)s %(health)s / %(second)s"), { | ||||
"healRateLabel": headerFont(translate("Heal:")), | "healRateLabel": headerFont(translate("Heal:")), | ||||
"value": Math.round(template.garrisonHolder.buffHeal), | "value": Math.round(template.garrisonHolder.buffHeal), | ||||
"health": unitFont(translate("Health")), | "health": unitFont(translate("Health")), | ||||
"second": unitFont(translate("second")), | "second": unitFont(translate("second")), | ||||
}) | }) | ||||
); | ); | ||||
return tooltips.join(commaFont(translate(", "))); | tooltips.join(commaFont(translate(", "))); | ||||
} | |||||
if (template.canGarrison) | |||||
{ | |||||
let extraSize; | |||||
if (template.garrisonHolder) | |||||
extraSize = template.garrisonHolder.garrisonedSlots; | |||||
if (template.canGarrison.size > 1 || extraSize) | |||||
tooltips.push ( | |||||
sprintf(translate("%(label)s: %(garrisonSize)s %(extraSize)s"), { | |||||
"label": headerFont(translate("Garrison Size")), | |||||
"garrisonSize": template.canGarrison.size, | |||||
"extraSize": extraSize ? "+ " + extraSize : "" | |||||
}) | |||||
); | |||||
} | |||||
return tooltips.join("\n"); | |||||
} | } | ||||
function getProjectilesTooltip(template) | function getProjectilesTooltip(template) | ||||
{ | { | ||||
if (!template.garrisonHolder || !template.buildingAI) | if (!template.garrisonHolder || !template.buildingAI) | ||||
return ""; | return ""; | ||||
let limit = Math.min( | let limit = Math.min( | ||||
▲ Show 20 Lines • Show All 471 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
Should we correct for the number of units garrisoned inside? E.g.: A ram has normally a size of 2, so "2" is shown in the tooltip. When we garrison a bunch of units of size 1 in the ram (say 5), the tooltip of the ram shows "7".
Or maybe even better:
`2+5".