Anonymous

Module:Damage: Difference between revisions

From Elwiki
Undo revision 992616 by Ritsu (talk)
No edit summary
(Undo revision 992616 by Ritsu (talk))
Tag: Undo
 
(5 intermediate revisions by the same user not shown)
Line 163: Line 163:
                 value = passive_values[1],
                 value = passive_values[1],
                 value_pvp = passive_values[2],
                 value_pvp = passive_values[2],
                 alias = args['alias' .. passive_index] or (passive_index == OPTIONS.append_index and OPTIONS.append_name) or display_title,
                 alias = args['alias' .. passive_index] or (passive_index == OPTIONS.append_index and OPTIONS.append_name) or
                    display_title,
                 suffix = args['suffix' .. passive_index] and (' ' .. args['suffix' .. passive_index]) or '',
                 suffix = args['suffix' .. passive_index] and (' ' .. args['suffix' .. passive_index]) or '',
                 prefix = args['prefix' .. passive_index] and (args['prefix' .. passive_index] .. ' ') or '',
                 prefix = args['prefix' .. passive_index] and (args['prefix' .. passive_index] .. ' ') or '',
Line 580: Line 581:
                     local range_count = RANGE[damage_type .. '_count'] or 1;
                     local range_count = RANGE[damage_type .. '_count'] or 1;
                     -- If min count preset, use range_max for the multiplier.
                     -- If min count preset, use range_max for the multiplier.
                     local range_multiplier = RANGE[mode][damage_type] or (damage_type == 'min' and RANGE.min_count and RANGE[mode].max) or 1;
                     local range_multiplier = RANGE[mode][damage_type] or
                        (damage_type == 'min' and RANGE.min_count and RANGE[mode].max) or 1;
                     local final_range_multiplier = (1 + ((range_multiplier - 1) * range_count));
                     local final_range_multiplier = (1 + ((range_multiplier - 1) * range_count));
                     local perm_buff = OPTIONS.perm_buff[mode];
                     local perm_buff = OPTIONS.perm_buff[mode];
Line 630: Line 632:


         for passive_index, passive in ipairs(PASSIVES_WITH_COMBINED) do
         for passive_index, passive in ipairs(PASSIVES_WITH_COMBINED) do
             if (not OPTIONS.is_append or (OPTIONS.is_append and OPTIONS.append_index ~= passive_index)) and (not inArrayHasValue(passive_index, OPTIONS.combine or {}) or inArrayHasValue(passive_index, args.display_separated or {})) then
             -- Determine if passive should be skipped
            local skip_passive = false
            if passive.is_combined then
                -- Skip combined passive if any of its constituent passives are being appended
                if OPTIONS.is_append and OPTIONS.combine and inArrayHasValue(OPTIONS.append_index, OPTIONS.combine) then
                    skip_passive = true
                else
                    skip_passive = false
                end
            else
                -- Regular passive logic: skip if it's appended or part of combine (unless display_separated)
                skip_passive = (OPTIONS.is_append and OPTIONS.append_index == passive_index) or
                    (inArrayHasValue(passive_index, OPTIONS.combine or {}) and not inArrayHasValue(passive_index, args.display_separated or {}))
            end
 
            if not skip_passive then
                 if type(settings.action) == 'function' then
                 if type(settings.action) == 'function' then
                     settings.action(passive, output, passive_index)
                     settings.action(passive, output, passive_index)
Line 693: Line 710:
             text = {
             text = {
                 translate('Normal'),
                 translate('Normal'),
                 OPTIONS.is_append and
                 OPTIONS.is_append and (function()
                link(PASSIVES[OPTIONS.append_index].name,
                    -- Check if the appended passive is part of a combined passive
                    PASSIVES[OPTIONS.append_index].alias or OPTIONS.append_name or nil,
                    if OPTIONS.combine and inArrayHasValue(OPTIONS.append_index, OPTIONS.combine) then
                    PASSIVES[OPTIONS.append_index].prefix,
                        -- Handle combined passive in append
                    PASSIVES[OPTIONS.append_index].suffix,
                        local combo = {}
                    PASSIVES[OPTIONS.append_index].exist
                        for _, passive_key in ipairs(OPTIONS.combine) do
                 )
                            local passive = PASSIVES[passive_key]
                            table.insert(combo,
                                link(passive.name, passive.alias, passive.prefix, passive.suffix, passive.exist))
                        end
                        return table.concat(combo, '/') .. OPTIONS.combine_suffix
                    else
                        -- Handle single passive in append
                        return link(PASSIVES[OPTIONS.append_index].name,
                            PASSIVES[OPTIONS.append_index].alias or OPTIONS.append_name or nil,
                            PASSIVES[OPTIONS.append_index].prefix,
                            PASSIVES[OPTIONS.append_index].suffix,
                            PASSIVES[OPTIONS.append_index].exist
                        )
                    end
                 end)()
             },
             },
             keywords = { OPTIONS.is_append and ('passive' .. OPTIONS.append_index) or nil },
             keywords = { OPTIONS.is_append and (function()
                -- Generate appropriate keyword for appended passive
                if OPTIONS.combine and inArrayHasValue(OPTIONS.append_index, OPTIONS.combine) then
                    return sortPassives('passive' .. table.concat(OPTIONS.combine, '_passive'))
                else
                    return 'passive' .. OPTIONS.append_index
                end
            end)() or nil },
             is_visible = OPTIONS.is_append or false
             is_visible = OPTIONS.is_append or false
         },
         },
Line 709: Line 747:
                 if OPTIONS.dmp then
                 if OPTIONS.dmp then
                     return link('Dynamo Point System' .. OPTIONS.lang_suffix, 'Dynamo Configuration', args.awk_prefix,
                     return link('Dynamo Point System' .. OPTIONS.lang_suffix, 'Dynamo Configuration', args.awk_prefix,
                    OPTIONS.dmp ~= 'false' and (fillTemplate('({1} DMP)', { OPTIONS.dmp })) .. (args.awk_suffix and (' ' .. args.awk_suffix) or ''))
                        OPTIONS.dmp ~= 'false' and
                        (fillTemplate('({1} DMP)', { OPTIONS.dmp })) ..
                        (args.awk_suffix and (' ' .. args.awk_suffix) or ''))
                 elseif args.awk_alias then
                 elseif args.awk_alias then
                     return link(args.awk_alias[1], args.awk_alias[2], args.awk_prefix, args.awk_suffix)
                     return link(args.awk_alias[1], args.awk_alias[2], args.awk_prefix, args.awk_suffix)
                 end
                 end
                 return link('Awakening Mode' .. OPTIONS.lang_suffix, translate('Awakening Mode'), args.awk_prefix, args.awk_suffix)
                 return link('Awakening Mode' .. OPTIONS.lang_suffix, translate('Awakening Mode'), args.awk_prefix,
                    args.awk_suffix)
             end)()
             end)()
             },
             },
ElEditors, Administrators
71,273

edits