Welcome to the Umamusume Wiki! If you want to contribute, please read the guidelines.

Module:Game/Skills/Data/Effects/Values

From Umamusume Wiki
Jump to navigation Jump to search

Documentation for this module may be created at Module:Game/Skills/Data/Effects/Values/doc

--[[
    !! THIS PAGE IS MANAGED BY GITLAB !!
    ANY EDITS TO PAGE CONTENT WILL BE OVERWRITTEN
    TO MAKE CHANGES, PLEASE SUBMIT A MERGE REQUEST AT https://gitlab.com/umamusume-wiki/lua-modules
]]

local Values = {}

Values.abilityTypeMap = {
    ['1'] = { "Speed Stat Gain", "dec" },
    ['2'] = { "Stamina Stat Gain", "dec" },
    ['3'] = { "Power Stat Gain", "dec" },
    ['4'] = { "Guts Stat Gain", "dec" },
    ['5'] = { "Wit Stat Gain", "dec" },
    ['6'] = { "Oonige", "none" },
    ['7'] = { "Stamina Drain Rate", "dec" },
    ['8'] = { "Visibility Up", "dec" },
    ['9'] = { "Stamina Recovery", "pct" },
    ['10'] = { "Reaction Time", "dec" },
    ['11'] = { "Force Overtake In", "dec" },
    ['12'] = { "Force Overtake Out", "dec" },
    ['13'] = { "Panic Duration", "dec" },
    ['14'] = { "Start Delay", "dec" },
    ['21'] = { "Current Speed", "dec" },
    ['22'] = { "Current Speed + Decel", "dec" },
    ['27'] = { "Target Speed", "dec" },
    ['28'] = { "Lane Speed", "dec" },
    ['29'] = { "Panic Chance", "dec" },
    ['30'] = { "Push Chance", "dec" },
    ['31'] = { "Acceleration", "dec" },
    ['32'] = { "All Stat Gain", "dec" },
    ['35'] = { "Lane Target", "dec" },
    ['36'] = { "Random Skill Activation", "dec" },
    ['37'] = { "Random Rare Skill Activation", "dec" },
    ['38'] = { "Debuff Immunity", "dec" },
    ['39'] = { "Debuff Value Multiply", "dec" },
    ['40'] = { "Debuff Value Multiply Other Activate", "dec" },
    ['501'] = { "Challenge Match Bonus (Old)", "dec" },
    ['502'] = { "Challenge Match Bonus (Status)", "dec" },
    ['503'] = { "Challenge Match Bonus (Motivation)", "dec" }
}

---Get the descriptor for an Ability Type value
---@param type string the ability type
---@return string|nil ability, string|nil format Ability name and format ("dec", "pct", or "none")
function Values.getAbilityType(type)
    if type == '0' then return nil, nil end

    local val = Values.abilityTypeMap[type]
    if val == nil then
        return string.format("Ability Type %s", type), "dec"
    end
    return val[1], val[2]
end

---Get the descriptor for a Target Type and Target Value
---@param type string the target type
---@param value string the target value
---@return SkillEffectAbilityTarget|nil
function Values.getAbilityTarget(type, value)
    if type == '0' then return nil end

    local target = nil
    local maxTargets = nil
    local valueNum = tonumber(value) or 0

    if type == '1' then
        return nil -- Targets Self
    elseif type == '2' then
        target = "All"
    elseif type == '3' then
        target = "All Others"
    elseif type == '4' then
        target = "In FoV"
        maxTargets = valueNum
    elseif type == '5' then
        target = "Random Others"
        maxTargets = valueNum
    elseif type == '6' then
        target = string.format("Position %s", value)
    elseif type == '7' then
        target = string.format("Ahead of Position %s", value)
    elseif type == '8' then
        target = string.format("Behind Position %s", value)
    elseif type == '9' then
        target = "Ahead"
        maxTargets = valueNum
    elseif type == '10' then
        target = "Behind"
        maxTargets = valueNum
    elseif type == '11' then
        target = "Team Members"
    elseif type == '12' then
        target = "Near"
        maxTargets = valueNum
    elseif type == '13' then
        target = "Self and Front Blocker"
    elseif type == '14' then
        target = "Side Block"
    elseif type == '15' then
        target = "Near and Ahead"
        maxTargets = valueNum
    elseif type == '16' then
        target = "Near and Behind"
        maxTargets = valueNum
    elseif type == '17' or type == '18' then
        if value == '1' then
            target = "Front Runners"
        elseif value == '2' then
            target = "Pace Chasers"
        elseif value == '3' then
            target = "Late Surgers"
        elseif value == '4' then
            target = "End Closers"
        end
    elseif type == '19' then
        target = "Ahead and Panicked"
        maxTargets = valueNum
    elseif type == '20' then
        target = "Behind and Panicked"
        maxTargets = valueNum
    elseif type == '21' then
        if value == '1' then
            target = "Panicked Front Runners"
        elseif value == '2' then
            target = "Panicked Pace Chasers"
        elseif value == '3' then
            target = "Panicked Late Surgers"
        elseif value == '4' then
            target = "Panicked End Closers"
        end
    elseif type == '22' then
        target = string.format("Character ID %s", value)
    elseif type == '23' then
        target = "Activating Heal"
        maxTargets = valueNum
    end

    if target ~= nil then
        return { ---@type SkillEffectAbilityTarget
            target = target,
            maxTargets = maxTargets,
            targetId = type,
            targetValue = valueNum,
        }
    end
    return { ---@type SkillEffectAbilityTarget
        target = string.format("Target Type %s", type),
        targetId = type,
        targetValue = valueNum
    }
end

Values.effectDurationScalingMap = {
    ['2'] = "Distance From Front",
    ['3'] = "Remaining Stamina",
    ['4'] = "Number of Passed Runners",
    ['5'] = "Time Blocked From Side",
    ['6'] = "Time Blocked From Side",
    ['7'] = "Remaining Stamina",
}

---Get the descriptor for the given effect duration scaling ID
---@param type string the effect duration scaling type
---@return string|nil
function Values.getEffectDurationScaling(type)
    if type == '0' or type == '1' then return nil end

    local val = Values.effectDurationScalingMap[type]
    if val ~= nil then return val end
    return string.format("Scaling Type %s", type)
end

Values.abilityValueScalingMap = {
    ['2'] = "Acquired Skills",
    ['3'] = "Team Speed",
    ['4'] = "Team Stamina",
    ['5'] = "Team Power",
    ['6'] = "Team Guts",
    ['7'] = "Team Wit",
    ['8'] = "Random Roll",
    ['9'] = "Random Roll",
    ['10'] = "Race Wins",
    ['11'] = "Final Corner Place Change",
    ['12'] = "Fan Count",
    ['13'] = "Maximum Raw Stats",
    ['14'] = "Activated Passive Skills",
    ['15'] = "Activated Heal Skills",
    ['16'] = "Position at Final Corner",
    ['17'] = "Number of Team Members",
    ['18'] = "Base Wit",
    ['19'] = "Number of Passed Runners",
    ['20'] = "Blocked Time in Middle Phase",
    ['21'] = "Blocked Time in Middle Phase",
    ['22'] = "Speed Stat",
    ['23'] = "Speed Stat",
    ['24'] = "Overseas Aptitude",
    ['25'] = "Leading Amount",
    ['26'] = "UAF Final Win Count",
    ['30'] = "Love Received"
}

---Get the descriptor for the given effect ability value scaling ID
---@param type string the value scaling
---@return string|nil
function Values.getAbilityValueScaling(type)
    if type == '0' or type == '1' then return nil end

    local val = Values.abilityValueScalingMap[type]
    if val ~= nil then return val end
    return string.format("Scaling Type %s", type)
end

Values.abilityAdditionalActivationMap = {
    ['1'] = "Approaching Behind",
    ['2'] = "Activate Skills, Up to 2",
    ['3'] = "Activate Skills, Up to 3"
}

---Get the descriptor for the given ability additional activation type
---@param type string the additional activation type
---@return string|nil
function Values.getAbilityAdditionalActivation(type)
    if type == '0' then return nil end

    local val = Values.abilityAdditionalActivationMap[type]
    if val ~= nil then return val end
    return string.format("Scaling Type %s", type)
end

return Values