Module:Abilities/card: Difference between revisions

Jump to navigation Jump to search
LVL (talk | contribs)
Undo revision 47170 by Saag (talk).
Tags: Undo Mobile edit Mobile web edit
Added prefix support for altbox
Line 29: Line 29:
combat_barrier = {img='Barrier.png', link='Barrier', color = 'Green'},
combat_barrier = {img='Barrier.png', link='Barrier', color = 'Green'},
time = {img='AttributeIconTechDuration.png', link='Ability Duration', color = 'Purple'},
time = {img='AttributeIconTechDuration.png', link='Ability Duration', color = 'Purple'},
}
--- 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
}
}


Line 285: Line 303:
end
end
end
end
--- 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 366: Line 366:
for k, prop in pairs(props) do
for k, prop in pairs(props) do
local exclude_plus_flag = ABSOLUTE_VALUE_TYPES[prop.Type] or false
-- Some props don't have values, as those come from upgrades
-- Some props don't have values, as those come from upgrades
-- For now, we will ignore these and only show data for the base ability
-- For now, we will ignore these and only show data for the base ability
Line 374: Line 375:
args = {
args = {
  key = prop.Key,
  key = prop.Key,
  value = prop.Value,
    value = utils.format_value_with_prepost(prop.Key, prop.Value, frame, exclude_plus_flag),
  icon = icon.img,
  icon = icon.img,
  icon_link = icon.link,
  icon_link = icon.link,