Module:Abilities/card: Difference between revisionsGive feedback
Jump to navigation
Jump to search
Gammaton32 (talk | contribs) added heavy melee variable for puddle punch |
Gammaton32 (talk | contribs) added support for other scaling types |
||
| Line 122: | Line 122: | ||
channel_time = ability.AbilityChannelTime and ability.AbilityChannelTime.Value ~= 9999 and ability.AbilityChannelTime.Value, | channel_time = ability.AbilityChannelTime and ability.AbilityChannelTime.Value ~= 9999 and ability.AbilityChannelTime.Value, | ||
channel_time_scale = get_attr_scale(ability.AbilityChannelTime), | |||
channel_time_scale_type = get_attr_scale_type(ability.AbilityChannelTime), | |||
radius = ability.Radius and ability.Radius.Value, | radius = ability.Radius and ability.Radius.Value, | ||
radius_scale = get_attr_scale(ability.Radius), | |||
radius_scale_type = get_attr_scale_type(ability.Radius), | |||
range = ability.AbilityCastRange and ability.AbilityCastRange.Value, | range = ability.AbilityCastRange and ability.AbilityCastRange.Value, | ||
range_scale = get_attr_scale(ability.AbilityCastRange), | |||
range_scale_type = get_attr_scale_type(ability.AbilityCastRange), | |||
duration = ability.AbilityDuration and ability.AbilityDuration.Value, | duration = ability.AbilityDuration and ability.AbilityDuration.Value, | ||
duration_scale = get_attr_scale(ability.AbilityDuration), | |||
duration_scale_type = get_attr_scale_type(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_scale = get_attr_scale(ability.AbilityCooldown), | |||
cooldown_scale_type = get_attr_scale_type(ability.AbilityCooldown), | |||
charge_cooldown = ability.AbilityCooldownBetweenCharge and ability.AbilityCooldownBetweenCharge.Value ~= -1 and ability.AbilityCooldownBetweenCharge.Value, | charge_cooldown = ability.AbilityCooldownBetweenCharge and ability.AbilityCooldownBetweenCharge.Value ~= -1 and ability.AbilityCooldownBetweenCharge.Value, | ||
charge_cooldown_scale = get_attr_scale(ability.AbilityCooldownBetweenCharge), | |||
charge_cooldown_scale_type = get_attr_scale_type(ability.AbilityCooldownBetweenCharge), | |||
num_of_charges = ability.AbilityCharges and ability.AbilityCharges.Value, | num_of_charges = ability.AbilityCharges and ability.AbilityCharges.Value, | ||
| Line 205: | Line 211: | ||
-- Get spirit scaling of attribute, return nil if none is found | -- Get spirit scaling of attribute, return nil if none is found | ||
function | function get_attr_scale(attr) | ||
if not attr then | if not attr then | ||
return nil | return nil | ||
| Line 215: | Line 221: | ||
end | end | ||
if scale. | if scale.Value == 0 then | ||
return nil | return nil | ||
end | |||
return commonutils.round_to_sig_fig(scale.Value, 3) | |||
end | |||
function get_attr_scale_type(attr) | |||
if not attr then | |||
return nil | |||
end | |||
local scale = attr.Scale | |||
if not scale then | |||
return nil | |||
end | end | ||
| Line 223: | Line 242: | ||
end | end | ||
return | return scale.Type | ||
end | end | ||
| Line 607: | Line 626: | ||
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_scale = get_attr_scale(ability.Radius), | |||
radius_scale_type = get_attr_scale_type(ability.Radius), | |||
range = ability.AbilityCastRange and ability.AbilityCastRange.Value, | range = ability.AbilityCastRange and ability.AbilityCastRange.Value, | ||
range_scale = get_attr_scale(ability.AbilityCastRange), | |||
range_scale_type = get_attr_scale_type(ability.AbilityCastRange), | |||
duration = ability.AbilityDuration and ability.AbilityDuration.Value, | duration = ability.AbilityDuration and ability.AbilityDuration.Value, | ||
duration_scale = get_attr_scale(ability.AbilityDuration), | |||
duration_scale_type = get_attr_scale_type(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_scale = get_attr_scale(ability.AbilityCooldown), | |||
cooldown_scale_type = get_attr_scale_type(ability.AbilityCooldown), | |||
charge_cooldown = ability.AbilityCooldownBetweenCharge and ability.AbilityCooldownBetweenCharge.Value, | charge_cooldown = ability.AbilityCooldownBetweenCharge and ability.AbilityCooldownBetweenCharge.Value, | ||
charge_cooldown_scale = get_attr_scale(ability.AbilityCooldownBetweenCharge), | |||
charge_cooldown_scale_type = get_attr_scale_type(ability.AbilityCooldownBetweenCharge), | |||
num_of_charges = ability.AbilityCharges and ability.AbilityCharges.Value, | num_of_charges = ability.AbilityCharges and ability.AbilityCharges.Value, | ||
notes = notes, | notes = notes, | ||