Module:Abilities/card: Difference between revisionsGive feedback
m fixed description generator trying to use scale attributes |
assigned any spirit scalings for header attributes |
||
| Line 97: | Line 97: | ||
description = mw.getCurrentFrame():preprocess(lang.get_string(ability.DescKey)), | description = mw.getCurrentFrame():preprocess(lang.get_string(ability.DescKey)), | ||
radius = ability.Radius and ability.Radius.Value, | radius = ability.Radius and ability.Radius.Value, | ||
radius_ss = get_attr_ss(ability.Radius), | |||
range = ability.AbilityCastRange and ability.AbilityCastRange.Value, | range = ability.AbilityCastRange and ability.AbilityCastRange.Value, | ||
range_ss = get_attr_ss(ability.AbilityCastRange), | |||
duration = ability.AbilityDuration and ability.AbilityDuration.Value, | duration = ability.AbilityDuration and ability.AbilityDuration.Value, | ||
duration_ss = get_attr_ss(ability.AbilityDuration), | |||
-- ability_width = format_value_with_prepost(width_key, ability[width_key]), | -- ability_width = format_value_with_prepost(width_key, ability[width_key]), | ||
cooldown =ability.AbilityCooldown and ability.AbilityCooldown.Value, | cooldown =ability.AbilityCooldown and ability.AbilityCooldown.Value, | ||
cooldown_ss = get_attr_ss(ability.AbilityCooldown), | |||
charge_cooldown = ability.AbilityCooldownBetweenCharge and ability.AbilityCooldownBetweenCharge.Value, | charge_cooldown = ability.AbilityCooldownBetweenCharge and ability.AbilityCooldownBetweenCharge.Value, | ||
charge_cooldown_ss = get_attr_ss(ability.AbilityCooldownBetweenCharge), | |||
num_of_charges = ability.AbilityCharges and ability.AbilityCharges.Value, | num_of_charges = ability.AbilityCharges and ability.AbilityCharges.Value, | ||
notes = notes, | notes = notes, | ||
| Line 109: | Line 114: | ||
end | end | ||
-- Get spirit scaling of attribute, return nil if none is found | |||
function get_attr_ss(attr) | |||
if not attr then | |||
return nil | |||
end | |||
local scale = attr.Scale | |||
if not scale then | |||
return nil | |||
end | |||
if scale.Type ~= 'spirit' then | |||
return nil | |||
end | |||
if scale.Value == 0 then | |||
return nil | |||
end | |||
return scale.Value | |||
end | |||
--for use from an ability page (ability pages are WIP), not hero pages | --for use from an ability page (ability pages are WIP), not hero pages | ||
function p.write_ability_card_from_ability_key(frame) | function p.write_ability_card_from_ability_key(frame) | ||