Module:Abilities/card: Difference between revisionsGive feedback
Fixed prefix (I hope) |
Update stat formatting to exclude the '+' prefix for absolute values (e.g., Damage, Health). |
||
| Line 278: | Line 278: | ||
local props = info_section.Main.Props | local props = info_section.Main.Props | ||
--- A set of stat types that represent absolute values and should not have a '+' prefix. | |||
local ABSOLUTE_VALUE_TYPES = { | |||
damage = true, | |||
bullet_damage = true, | |||
tech_damage = true, | |||
melee_damage = true, | |||
health = true, | |||
healing = true, | |||
range = true, | |||
distance = true, | |||
duration = true, | |||
cooldown = true, | |||
time = true, | |||
charges = true, | |||
cast = true, | |||
combat_barrier = true | |||
} | |||
local main_boxes = {} | local main_boxes = {} | ||
| Line 290: | Line 308: | ||
-- Exclude 0 values | -- Exclude 0 values | ||
if value and value ~= 0 then | if value and value ~= 0 then | ||
--- Determine if the '+' sign should be excluded for this stat type by checking against the set. | |||
local exclude_plus_flag = ABSOLUTE_VALUE_TYPES[prop.Type] or false | |||
local icon = get_icon(prop.Type) | local icon = get_icon(prop.Type) | ||
local main_box = frame:expandTemplate{ | local main_box = frame:expandTemplate{ | ||
| Line 296: | Line 317: | ||
title = prop.Title, | title = prop.Title, | ||
key = prop.Key, | key = prop.Key, | ||
value = utils.format_value_with_prepost(prop.Key, value, frame), | value = utils.format_value_with_prepost(prop.Key, value, frame, exclude_plus_flag), | ||
icon = icon.img, | icon = icon.img, | ||
icon_link = icon.link, | icon_link = icon.link, | ||