Module:AbilityData

Revision as of 17:57, 13 September 2024 by Saag (talk | contribs)

Deprecated

This module is being replaced by multiple modules in Module:Abilities. Any new functions should be created there


local p = {};
local data = mw.loadJsonData("Data:ItemData.json")

-- returns the table of a specific item
function get_json_item(name)
	for i,v in pairs(data) do
		if (v["Name"] == name) then
			return v
		end
	end
	return nil
end

local abilities = {
    shoulderCharge = {
        name = "Shoulder Charge",
        duration = "1.2s",
        cooldown = "35s",
        description = "'''Charge forward''', colliding with enemies and dragging them along. Hitting a '''wall''' will '''Stun''' enemies caught by Abrams. Speed increased after colliding with enemy Heroes.",
        effect1 = "'''Damage:''' 40 {{ss|2.1}}",
        effect2 = "'''Stun Duration:''' 0.85s",
        upgrade1 = "'''-20s''' Cooldown",
        upgrade2 = "'''+0.5s''' Duration",
        upgrade3 = "'''+5.5''' Weapon Damage for '''8s''' after colliding with an enemy"
    }
}

--{{#invoke:ItemData|get_cost|ITEM_NAME}}--
p.test = function(frame)
    local abilityName = frame.args.abilityName
    local ability = abilities[abilityName]

    if ability then
    	return ability.name
        -- Pass the table fields to the template
        -- return frame:expandTemplate{
        --     title = "Ability card",
        --     args = {
        --         name = ability.name,
        --         duration = ability.duration,
        --         cooldown = ability.cooldown,
        --         description = ability.description,
        --         effect1 = ability.effect1,
        --         effect2 = ability.effect2,
        --         upgrade1 = ability.upgrade1,
        --         upgrade2 = ability.upgrade2,
        --         upgrade3 = ability.upgrade3
        --     }
        -- }
    else
        return "Ability data not found."
    end
end

return p