Module:Abilities/card: Difference between revisionsGive feedback
Jump to navigation
Jump to search
mNo edit summary Tag: Manual revert |
Gammaton32 (talk | contribs) added multiply function |
||
| Line 121: | Line 121: | ||
channel_time_scale = get_attr_scale(ability.AbilityChannelTime), | channel_time_scale = get_attr_scale(ability.AbilityChannelTime), | ||
channel_time_scale_type = get_attr_scale_type(ability.AbilityChannelTime), | channel_time_scale_type = get_attr_scale_type(ability.AbilityChannelTime), | ||
channel_time_scale_multiply = get_attr_scale_multiply(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 = get_attr_scale(ability.Radius), | ||
radius_scale_type = get_attr_scale_type(ability.Radius), | radius_scale_type = get_attr_scale_type(ability.Radius), | ||
radius_scale_multiply = get_attr_scale_multiply(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 = get_attr_scale(ability.AbilityCastRange), | ||
range_scale_type = get_attr_scale_type(ability.AbilityCastRange), | range_scale_type = get_attr_scale_type(ability.AbilityCastRange), | ||
range_scale_multiply = get_attr_scale_multiply(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 = get_attr_scale(ability.AbilityDuration), | ||
duration_scale_type = get_attr_scale_type(ability.AbilityDuration), | duration_scale_type = get_attr_scale_type(ability.AbilityDuration), | ||
duration_scale_multiply = get_attr_scale_multiply(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 = get_attr_scale(ability.AbilityCooldown), | ||
cooldown_scale_type = get_attr_scale_type(ability.AbilityCooldown), | cooldown_scale_type = get_attr_scale_type(ability.AbilityCooldown), | ||
cooldown_scale_multiply = get_attr_scale_multiply(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 = get_attr_scale(ability.AbilityCooldownBetweenCharge), | ||
charge_cooldown_scale_type = get_attr_scale_type(ability.AbilityCooldownBetweenCharge), | charge_cooldown_scale_type = get_attr_scale_type(ability.AbilityCooldownBetweenCharge), | ||
charge_cooldown_scale_multiply = get_attr_scale_multiply(ability.AbilityCooldownBetweenCharge), | |||
num_of_charges = ability.AbilityCharges and ability.AbilityCharges.Value, | num_of_charges = ability.AbilityCharges and ability.AbilityCharges.Value, | ||
| Line 207: | Line 213: | ||
end | end | ||
-- Get | -- Get scaling of attribute, return nil if none is found | ||
function get_attr_scale(attr) | function get_attr_scale(attr) | ||
if not attr then | if not attr then | ||
| Line 225: | Line 231: | ||
end | end | ||
-- Get scaling type of attribute, return nil if none is found | |||
function get_attr_scale_type(attr) | function get_attr_scale_type(attr) | ||
if not attr then | if not attr then | ||
| Line 240: | Line 247: | ||
return scale.Type | return scale.Type | ||
end | |||
-- Check if scaling should be multiplied instead of added | |||
function get_attr_scale_multiply(attr) | |||
if not attr then | |||
return nil | |||
end | |||
local scale = attr.Scale | |||
if not scale then | |||
return nil | |||
end | |||
return scale.Multiply | |||
end | end | ||
| Line 590: | Line 611: | ||
icon = lang.get_string(ability.Key, 'en') .. '.png', | icon = lang.get_string(ability.Key, 'en') .. '.png', | ||
description = mw.getCurrentFrame():preprocess(lang.get_string(ability.DescKey)), | description = mw.getCurrentFrame():preprocess(lang.get_string(ability.DescKey)), | ||
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), | |||
channel_time_scale_multiply = get_attr_scale_multiply(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 = get_attr_scale(ability.Radius), | ||
radius_scale_type = get_attr_scale_type(ability.Radius), | radius_scale_type = get_attr_scale_type(ability.Radius), | ||
radius_scale_multiply = get_attr_scale_multiply(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 = get_attr_scale(ability.AbilityCastRange), | ||
range_scale_type = get_attr_scale_type(ability.AbilityCastRange), | range_scale_type = get_attr_scale_type(ability.AbilityCastRange), | ||
range_scale_multiply = get_attr_scale_multiply(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 = get_attr_scale(ability.AbilityDuration), | ||
duration_scale_type = get_attr_scale_type(ability.AbilityDuration), | duration_scale_type = get_attr_scale_type(ability.AbilityDuration), | ||
duration_scale_multiply = get_attr_scale_multiply(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 = get_attr_scale(ability.AbilityCooldown), | ||
cooldown_scale_type = get_attr_scale_type(ability.AbilityCooldown), | cooldown_scale_type = get_attr_scale_type(ability.AbilityCooldown), | ||
charge_cooldown = ability.AbilityCooldownBetweenCharge and ability.AbilityCooldownBetweenCharge.Value, | cooldown_scale_multiply = get_attr_scale_multiply(ability.AbilityCooldown), | ||
charge_cooldown = ability.AbilityCooldownBetweenCharge and ability.AbilityCooldownBetweenCharge.Value ~= -1 and ability.AbilityCooldownBetweenCharge.Value, | |||
charge_cooldown_scale = get_attr_scale(ability.AbilityCooldownBetweenCharge), | charge_cooldown_scale = get_attr_scale(ability.AbilityCooldownBetweenCharge), | ||
charge_cooldown_scale_type = get_attr_scale_type(ability.AbilityCooldownBetweenCharge), | charge_cooldown_scale_type = get_attr_scale_type(ability.AbilityCooldownBetweenCharge), | ||
charge_cooldown_scale_multiply = get_attr_scale_multiply(ability.AbilityCooldownBetweenCharge), | |||
num_of_charges = ability.AbilityCharges and ability.AbilityCharges.Value, | num_of_charges = ability.AbilityCharges and ability.AbilityCharges.Value, | ||
} | } | ||
} | } | ||