Valkyrie Crusade Wiki
Advertisement

Documentation for this module may be created at Module:Skill/doc

local p = {}

-- checks if the skill has an optional Defense section
local function hasDef(skill)
    return skill:find('/ def') or skill:find('• def') or skill:find('・def')
end

-- when generating the categories, Wikia will auto
-- category this page if it finds an exact string
-- that looks like a category. for that reason, I
-- have used a function to prevent the Wikia
-- string parser from finding it.
local function newCat(catName)
    return '[[' .. 'Category:' .. catName .. ']]'
end

-- actually parse the skill name here and generate categories
function p.categories(frame)
    if not frame or not frame.args then
        return ''
    end
    
    local args = frame.args
    -- force skill text to lowercase to ensure easier comparisons
    local skill = string.lower(args[1])
    
    -- if the skill is empty or not a string just return
    if not skill or skill == '' or type(skill) ~= 'string' then
        return ''
    end
    
    local cat = ''
    
   if skill:find('near defeat') then
        cat = cat .. newCat('Near Defeat')
    end
    if skill:find('battle start') then
        cat = cat .. newCat('Battle Start')
    end
    
    -- skill types
    
    if not skill:find('【autoskill】') then
        -- Own ATK Up with optional DEF
        if skill:find('own atk') then
            cat = cat .. newCat('ATK Up (Own)')
            if hasDef(skill) then
                cat = cat .. newCat('DEF Up (Own)')
            end
        -- Team ATK Up with optional DEF
        elseif skill:find('all allies\' atk') or skill:find('all allies atk') then
            cat = cat .. newCat('ATK Up (Team)')
            if hasDef(skill) then
                cat = cat .. newCat('DEF Up (Team)')
            end
        -- Element ATK Up with optional DEF buf
        elseif skill:find('allies\' atk') or skill:find('allies\' element atk') then
            if skill:find('passion_icon') then
                cat = cat .. newCat('ATK Up (Passion)') .. newCat('ATK Up (Element)')
                if hasDef(skill) then
                    cat = cat .. newCat('DEF Up (Passion)') .. newCat('DEF Up (Element)')
                end
            elseif skill:find('cool_icon') then
                cat = cat .. newCat('ATK Up (Cool)') .. newCat('ATK Up (Element)')
                if hasDef(skill) then
                    cat = cat .. newCat('DEF Up (Cool)') .. newCat('DEF Up (Element)')
                end
            elseif skill:find('light_icon') then
                cat = cat .. newCat('ATK Up (Light)') .. newCat('ATK Up (Element)')
                if hasDef(skill) then
                    cat = cat .. newCat('DEF Up (Light)') .. newCat('DEF Up (Element)')
                end
            elseif skill:find('dark_icon') then
                cat = cat .. newCat('ATK Up (Dark)') .. newCat('ATK Up (Element)')
                if hasDef(skill) then
                    cat = cat .. newCat('DEF Up (Dark)') .. newCat('DEF Up (Element)')
                end
            end
        end
        -- Resurrect
        if skill:find('resurrect') then
            cat = cat .. newCat('Resurrect')
        end
        -- Heal
        if skill:find('recover') then
            if skill:find('all allies recover') then
                cat = cat .. newCat('Heal (Team)')
            elseif skill:find('own') then
                cat = cat .. newCat('Heal (Own)')
            elseif skill:find('single') then
                cat = cat .. newCat('Heal (Single)')
            else
                cat = cat .. newCat('Heal (Team)')
            end
        end
    end
    -- Single ATK up with optional DEF
    if skill:find('single ally\'s atk') then
        cat = cat .. newCat('ATK Up (Single)')
        if hasDef(skill) then
            cat = cat .. newCat('DEF Up (Single)')
        end
    end
    -- Auto ATK+ and DEF+, Snowball
    if skill:find('up after every attack') then
        if skill:find('atk') then
            cat = cat .. newCat('Autoskill (+ATK on attack)')
        end
        if skill:find('def') then
            cat = cat .. newCat('Autoskill (+DEF on attack)')
        end
    end
    -- Auto ATK+ and DEF+, Automatic
    if skill:find('up during every turn') then
        if skill:find('atk') then
            cat = cat .. newCat('Autoskill (+ATK)')
        end
        if skill:find('def') then
            cat = cat .. newCat('Autoskill (+DEF)')
        end
    end
    -- Auto Heal
    if skill:find('when own soldiers fall below a certain amount') then
        if skill:find('of own soldiers') then
            cat = cat .. newCat('Autoskill (Heal Own)')
        end
        if skill:find('recover all allies') or skill:find('all allies recover') then
            cat = cat .. newCat('Autoskill (Heal Team)')
        end
        if skill:find('resurrect') then
            cat = cat .. newCat('Autoskill (Resurrect)')
        end
        if skill:find('atk') then
            cat = cat .. newCat('Autoskill (+ATK)')
        end
        if skill:find('def') then
            cat = cat .. newCat('Autoskill (+DEF)')
        end
    end
    -- Element Auto Heal
    if skill:find('soldiers fall below a certain amount') and skill:find('when the unit') then
        if skill:find('passion_icon') then
            cat = cat .. newCat('Autoskill (Heal Passion)') .. newCat('Autoskill (Heal Element)')
        elseif skill:find('cool_icon') then
            cat = cat .. newCat('Autoskill (Heal Cool)') .. newCat('Autoskill (Heal Element)')
        elseif skill:find('light_icon') then
            cat = cat .. newCat('Autoskill (Heal Light)') .. newCat('Autoskill (Heal Element)')
        elseif skill:find('dark_icon') then
            cat = cat .. newCat('Autoskill (Heal Dark)') .. newCat('Autoskill (Heal Element)')
        end
    end
    -- Auto Rez V1
    if skill:find('if an ally has died in battle') and skill:find('resurrect') then
        cat = cat .. newCat('Autoskill (Resurrect)')
    end
    -- ATK Down with optional DEF Down
    if skill:find('enemies atk') or skill:find('enemies\' atk') then
        cat = cat .. newCat('ATK Down (All)')
        if hasDef(skill) then
            cat = cat .. newCat('DEF Down (All)')
        end
    end
    -- DEF UP
    if skill:find('all allies\' def') then
        cat = cat .. newCat('DEF Up (Team)')
    end
    if skill:find('ally\'s def') then
        cat = cat .. newCat('DEF Up (Single)')
    end
    if skill:find('own def') then
        cat = cat .. newCat('DEF Up (Own)')
    end
    -- DEF Down
    if skill:find('enemy\'s def') then
        cat = cat .. newCat('DEF Down (Single)')
    end
    if skill:find('enemies def') or skill:find('enemies\' def') then
        cat = cat .. newCat('DEF Down (All)')
    end
    -- DMG types
    -- Critical damage types
    if skill:find('critical') then
        if skill:find('all enemies') then
            cat = cat .. newCat('Critical DMG (All)')
        elseif skill:find('times to the enemy') then
            cat = cat .. newCat('Critical DMG (Multiple)')
        else
            cat = cat .. newCat('Critical DMG (Single)')
        end
    -- Non-critical damage
    else
        if skill:find('dmg to all enemies') or skill:find('dmg to each enemy') then
            cat = cat .. newCat('Deal DMG (All)')
        end
        if skill:find('enemy\'s remaining soldiers') then
            cat = cat .. newCat('Soldier Reduction')
        end
        if skill:find('dmg to a single') or skill:find('dmg to the enemy') then
            if skill:find('simultaneous attack') then 
                cat = cat .. newCat('Deal DMG (Salvo)')
            else
                cat = cat .. newCat('Deal DMG (Single)')
            end
        end
        if skill:find('times to the enemy') then
            cat = cat .. newCat('Deal DMG (Multi-Hit)')
        end
        if skill:find('with the highest attack power') then
            cat = cat .. newCat('Deal DMG (Highest ATK)')
        end
    end
    -- Suck/Absorb
    if skill:find('absorb') or skill:find('suck') then
        cat = cat .. newCat('Absorb Damage')
    end
    -- Turn Skip
    if skill:find('can\'t move') or skill:find('unable to move') then
        cat = cat .. newCat('Turn Skip')
        if skill:find('atk all enemies') or skill:find('dmg to all enemies') then
            cat = cat .. newCat('Turn Skip + Damage')
        end
    end
    -- Nullification
    if skill:find('nullification') then
        if skill:find('non.attacking') then
            cat = cat .. newCat('Skill Nullify_(Non-Attack)')
        elseif skill:find('attacking') then
            cat = cat .. newCat('Skill Nullify_(Attack)')
        else
            cat = cat .. newCat('Skill Nullify')
        end
    end
    if skill:find('can\'t be nullified') then
        cat = cat .. newCat('Nullify Immune')
    end
    -- Unleash options
    if skill:find('activate awoken burst') then
        cat = cat .. newCat('Burst Unleash')
    end
    if skill:find('awoken burst') and skill:find('effect will last') then
        cat = cat .. newCat('Extended Awoken Burst')
    end
    if skill:find('unleash') then
        if not skill:find('random') and skill:find('skill') then
            if skill:find('single') then
                cat = cat .. newCat('Skill Unleash_(Single)')
            elseif skill:find('passion_icon') then
                cat = cat .. newCat('Skill Unleash_(Passion)') .. newCat('Skill Unleash (Element)')
            elseif skill:find('cool_icon') then
                cat = cat .. newCat('Skill Unleash_(Cool)') .. newCat('Skill Unleash (Element)')
            elseif skill:find('light_icon') then
                cat = cat .. newCat('Skill Unleash_(Light)') .. newCat('Skill Unleash (Element)')
            elseif skill:find('dark_icon') then
                cat = cat .. newCat('Skill Unleash_(Dark)') .. newCat('Skill Unleash (Element)')
            else
                cat = cat .. newCat('Skill Unleash')
            end
        end
    end
    -- Counter
    if skill:find('counter attack') then
        cat = cat .. newCat('Counter Attack')
    end
    -- Auto Skill
    if skill:find('battle exp') then
        cat = cat .. newCat('Autoskill (EXP)')
    end
    if skill:find('unit atk') then
        cat = cat .. newCat('Autoskill (ATK)')
        if hasDef(skill) then
            cat = cat .. newCat('Autoskill (DEF)')
        end
    end
    if skill:find('unit def') then
        cat = cat .. newCat('Autoskill (DEF)')
    end
    -- Witch Hunt
    if skill:find('damage against all archwitches') then
        cat = cat .. newCat('Witch Hunt')
    end
    -- Great Damage
    if skill:find('dmg to archwitches') or skill:find('dmg to the archwitches') or skill:find('against archwitches') then
        cat = cat .. newCat('Archwitch Great DMG')
    end
    -- AW Point +
    if skill:find('subjugation points') or skill:find('hunt point') then
        cat = cat .. newCat('Archwitch Point+')
    end
    -- AUB Boosters
    if skill:find('during alliance battles') then
        cat = cat .. newCat('Alliance Battle Booster')
    end
    -- Thor Skills
    if skill:find('thor\'s hammer attack') then
        cat = cat .. newCat('Thor Skill Boost')
    end
    -- Chimry booster
    if skill:find('chimry coin') then
        cat = cat .. newCat('Chimry Coin Booster')
    end
    -- KO Gague in tower events
    if skill:find('ko gauge') then
        cat = cat .. newCat('KO Gauge Booster')
    end
    if skill:find('pass %d+%% up') then
        cat = cat .. newCat('Tower Floor Pass Booster')
    end
    
    return cat
end

return p
Advertisement