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

Module:Game/Supports/Data/Effects

From Umamusume Wiki
Jump to navigation Jump to search

Documentation for this module may be created at Module:Game/Supports/Data/Effects/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 Effects = {}
local Game = require("Module:Game")

---@param typeId string
---@param value number
---@param values number[]
---@return SupportDataEffectUniqueBonus[]
function Effects.getUniqueBonuses(typeId, value, values)
    local bonuses = {}

    ---@param bonusTypeId string|number
    ---@param bonusValue string|number
    ---@param hint string|nil
    local function bonus(bonusTypeId, bonusValue, hint)
        table.insert(bonuses, {
            typeId = tostring(bonusTypeId),
            value = tonumber(bonusValue),
            hint = hint
        })
    end

    if typeId == '101' then
        local hint = string.format("If bond is %s or higher", value)
        bonus(values[1], values[2], hint)
        if values[3] > 0 then bonus(values[3], values[4], hint) end
    elseif typeId == '102' then
        local hint = string.format("If bond is %s or higher, and not training in specialty", value)
        bonus(8, values[1], hint)
    elseif typeId == '103' then
        local hint = string.format("If deck has at least %s different types of Support Cards", value)
        bonus(8, values[1], hint)
    elseif typeId == '104' then
        local hint = string.format("Scaling every %s fans, up to %s fans", value, value * values[1])
        bonus(8, values[1], hint)
    elseif typeId == '105' then
        local hint = string.format("Friend and group cards are worth %s to each stat", values[1])
        bonus(105, value, hint)
    elseif typeId == '106' then
        local hint = string.format("Increases by %s for every friendship training, up to %s times", values[2], value)
        bonus(values[1], values[2] * value, hint)
    elseif typeId == '107' then
        local hint = string.format("Scales from %s to %s as energy approaches %s or lower (Set to 0 above 100 energy)",
            values[4], values[3], values[2])
        bonus(value, values[3], hint)
    elseif typeId == '108' then
        local hint = string.format("Scales from %s to %s as max energy approaches 120", values[3], values[4])
        bonus(value, values[4], hint)
    elseif typeId == '109' then
        local hint = string.format("Increases by 1 for every %s bond on all supports", values[1])
        bonus(value, (6 * 100) / values[1], hint)
    elseif typeId == '110' then
        local hint = string.format("Gains %s for every other support card on the same training", values[1])
        bonus(value, values[1] * 5, hint)
    elseif typeId == '111' then
        local hint = string.format("Gains %s for every level of the current training facility", values[1])
        bonus(value, values[1] * 5, hint)
    elseif typeId == '112' then
        bonus(112, value)
    elseif typeId == '113' then
        local hint = string.format("When participating in Friendship training")
        bonus(value, values[1], hint)
    elseif typeId == '114' then
        local hint = string.format("Increases by 1 for every %s energy, up to %s energy", values[1],
            values[1] * values[2])
        bonus(value, values[2], hint)
    elseif typeId == '115' then
        local hint = string.format("Applies to every support card in the deck")
        bonus(value, values[1], hint)
    elseif typeId == '116' then
        local skillCategories = {
            [1] = "Speed",
            [2] = "Acceleration",
            [3] = "Recovery"
        }
        local cat = skillCategories[value] or ('Category#' .. value)
        local hint = string.format("Increases by %s for every learned %s skill, up to %s skills", values[2], cat,
            values[3])
        bonus(values[1], values[2] * values[3], hint)
    elseif typeId == '117' then
        local hint = string.format("Scales to %s with level of all training facilities, up to combined level of %s",
            values[2], values[1])
        bonus(value, values[2], hint)
    elseif typeId == '118' then
        local hint = string.format("If bond is %s or higher", values[1])
        bonus(118, value, hint)
    elseif typeId == '119' then
        local hint = string.format("Applies to every support card in the deck, if bond is %s or higher", values[2])
        bonus(19, value, hint)
    elseif typeId == '120' then
        local hint = string.format("If bond is %s or higher", values[1])
        bonus(120, value, hint)
    elseif typeId == '121' then
        bonus(121, value, "When not training with")
        bonus(121, values[1], "When training with")
    elseif typeId == '122' then
        bonus(value, values[1], "To other supports on the same facility, on the following turn")
    elseif typeId == '0' then
    else
        bonus(typeId, value)
    end

    return bonuses
end

---@param typeId string
---@return string
function Effects.getPrettyName(typeId)
    if typeId == '1' then
        return "Friendship Bonus"
    elseif typeId == '2' then
        return "Mood Effect"
    elseif typeId == '3' then
        return "Speed Bonus"
    elseif typeId == '4' then
        return "Stamina Bonus"
    elseif typeId == '5' then
        return "Power Bonus"
    elseif typeId == '6' then
        return "Guts Bonus"
    elseif typeId == '7' then
        return "Wit Bonus"
    elseif typeId == '8' then
        return "Training Effectiveness"
    elseif typeId == '9' then
        return "Initial Speed"
    elseif typeId == '10' then
        return "Initial Stamina"
    elseif typeId == '11' then
        return "Initial Power"
    elseif typeId == '12' then
        return "Initial Guts"
    elseif typeId == '13' then
        return "Initial Wit"
    elseif typeId == '14' then
        return "Initial Friendship Gauge"
    elseif typeId == '15' then
        return "Race Bonus"
    elseif typeId == '16' then
        return "Fan Bonus"
    elseif typeId == '17' then
        return "Hint Levels"
    elseif typeId == '18' then
        return "Hint Frequency"
    elseif typeId == '19' then
        return "Specialty Priority"
    elseif typeId == '20' then
        return "Max Speed"
    elseif typeId == '21' then
        return "Max Stamina"
    elseif typeId == '22' then
        return "Max Power"
    elseif typeId == '23' then
        return "Max Guts"
    elseif typeId == '24' then
        return "Max Wit"
    elseif typeId == '25' then
        return "Event Recovery"
    elseif typeId == '26' then
        return "Event Effectiveness"
    elseif typeId == '27' then
        return "Failure Protection"
    elseif typeId == '28' then
        return "Energy Cost Reduction"
    elseif typeId == '29' then
        return "Minigame Effectiveness"
    elseif typeId == '30' then
        return "Skill Point Bonus"
    elseif typeId == '31' then
        return "Wit Friendship Recovery"
    elseif typeId == '32' then
        return "Initial Skill Points"
    elseif typeId == '41' then
        return "Special: All Stats Training Bonus"
    elseif typeId == '105' then
        return "Unique: Starting Stats for Every Support Type in Deck"
    elseif typeId == '112' then
        return "Unique: Chance to Set Failure Rate to 0%"
    elseif typeId == '118' then
        return "Unique: Extra Training Location Appearances"
    elseif typeId == '120' then
        return "Unique: Parameter Bonus for Every Support Type in Deck"
    elseif typeId == '121' then
        return "Unique: Extra Bond Gain"
    end
    return string.format("Effect#%s", typeId)
end

return Effects