Dota 2 Wiki
Advertisement
Dota 2 Wiki
20,117
pages

Documentation for Module:Ability Jump to code ↴ [ edit | purge ]

Reality Rift icon.png
▶️ Planeshift.
The documentation for this module can be found at Template:Ability.
You may be forwarded to another wiki language, in case a translation is not available.


Dependencies

local symbol = require( 'Module:Symbol' )._main
local symbol_aghs = symbol({ 'Aghanim' })
local symbol_shard = symbol({ 'Aghshard' })
local symbol_tal = symbol({ 'Talent' })
local color = require( 'Module:Color' )._main
local color_aghs = color({ 'aghanims' })
local color_shard = color({ 'aghshard' })
local color_tal = color({ 'talent' })
local getArgs = require( 'Module:Arguments' ).getArgs
local p = {}


-- Implements the mechanics symbols in the header.
function p.symbols(frame)
  local args = getArgs(frame, {
    wrappers = {
      'Template:Ability'
    }
  })
  local default_size = '20px'
  local symbols = {}
  if args['oncastproc'] then table.insert( symbols, symbol({ 'on cast proc', size=default_size }) ) end
  if args['rootdisables'] then table.insert( symbols, symbol({ 'root', args['rootdisables'], size=default_size }) ) end
  if args['illusionuse'] then table.insert( symbols, symbol({ 'illusion', args['illusionuse'], size=default_size }) ) end
  if args['disjointable'] then table.insert( symbols, symbol({ 'disjoint', args['disjointable'], size=default_size }) ) end
  if args['breakable'] then table.insert( symbols, symbol({ 'break', args['breakable'], size=default_size }) ) end
  if args['linkenblock'] then table.insert( symbols, symbol({ 'linken', args['linkenblock'], size=default_size }) ) end
  if args['bkbblock'] then table.insert( symbols, symbol({ 'bkb', args['bkbblock'], size=default_size }) ) end
  
  return table.concat( symbols, ' ' ) .. ' '
end

function p.target(frame)
  local args = getArgs(frame, {
    wrappers = {
      'Template:Ability'
    }
  })
  local target_dict = {
    ["No Target"] = '[[Abilities#No Target|No Target]]',
    ["No Target aghs"] = ''.. symbol_aghs .. '&nbsp;[[Abilities#No Target|<span style="color:' .. color_aghs .. '; font-weight:bold">No Target</span>]]',
    ["No Target shard"] = ''.. symbol_shard .. '&nbsp;[[Abilities#No Target|<span style="color:' .. color_shard .. '; font-weight:bold">No Target</span>]]',
    ["No Target tal"] = ''.. symbol_tal .. '&nbsp;[[Abilities#No Target|<span style="color:' .. color_tal .. '; font-weight:bold">No Target</span>]]',
    ["Target Unit"] = '[[Abilities#Target Unit|Target Unit]]',
    ["Target Unit aghs"] = ''.. symbol_aghs .. '&nbsp;[[Abilities#Target Unit|<span style="color:' .. color_aghs .. '; font-weight:bold">Target Unit</span>]]',
    ["Target Unit shard"] = ''.. symbol_shard .. '&nbsp;[[Abilities#Target Unit|<span style="color:' .. color_shard .. '; font-weight:bold">Target Unit</span>]]',
    ["Target Unit tal"] = ''.. symbol_tal .. '&nbsp;[[Abilities#Target Unit|<span style="color:' .. color_tal .. '; font-weight:bold">Target Unit</span>]]',
    ["Target Point"] = '[[Abilities#Target Point|Target Point]]',
    ["Target Point or Unit"] = '[[Abilities#Target Point|Target Point]] / [[Abilities#Target Unit|Target Unit]]', --Specifically for Boulder Smash
    ["Target Point aghs"] = ''.. symbol_aghs .. '&nbsp;[[Abilities#Target Point|<span style="color:' .. color_aghs .. '; font-weight:bold">Target Point</span>]]',
    ["Target Point shard"] = ''.. symbol_shard .. '&nbsp;[[Abilities#Target Point|<span style="color:' .. color_shard .. '; font-weight:bold">Target Point</span>]]',
    ["Target Point tal"] = ''.. symbol_tal .. '&nbsp;[[Abilities#Target Point|<span style="color:' .. color_tal .. '; font-weight:bold">Target Point</span>]]',
    ["Target Area"] = '[[Abilities#Target Area|Target Area]]',
    ["Target Area aghs"] = ''.. symbol_aghs .. '&nbsp;[[Abilities#Target Area|<span style="color:' .. color_aghs .. '; font-weight:bold">Target Area</span>]]',
    ["Target Area shard"] = ''.. symbol_shard .. '&nbsp;[[Abilities#Target Area|<span style="color:' .. color_shard .. '; font-weight:bold">Target Area</span>]]',
    ["Target Area tal"] = ''.. symbol_tal .. '&nbsp;[[Abilities#Target Area|<span style="color:' .. color_tal .. '; font-weight:bold">Target Area</span>]]',
    ["Passive"] = '[[Passive]]',
    ["Passive aghs"] = ''.. symbol_aghs .. '&nbsp;[[Passive|<span style="color:' .. color_aghs .. '; font-weight:bold">Passive</span>]]',
    ["Passive shard"] = ''.. symbol_shard .. '&nbsp;[[Passive|<span style="color:' .. color_shard .. '; font-weight:bold">Passive</span>]]',
    ["Passive tal"] = ''.. symbol_tal .. '&nbsp;[[Passive|<span style="color:' .. color_tal .. '; font-weight:bold">Passive</span>]]',
    ["Aura"] = '[[Aura]]',
    ["Aura aghs"] = ''.. symbol_aghs .. '&nbsp;[[Aura|<span style="color:' .. color_aghs .. '; font-weight:bold">Aura</span>]]',
    ["Aura shard"] = ''.. symbol_shard .. '&nbsp;[[Aura|<span style="color:' .. color_shard .. '; font-weight:bold">Aura</span>]]',
    ["Aura tal"] = ''.. symbol_tal .. '&nbsp;[[Aura|<span style="color:' .. color_tal .. '; font-weight:bold">Aura</span>]]',
    ["Toggle"] = '[[Toggle]]',
    ["Toggle aghs"] = ''.. symbol_aghs .. '&nbsp;[[Toggle|<span style="color:' .. color_aghs .. '; font-weight:bold">Toggle</span>]]',
    ["Toggle shard"] = ''.. symbol_shard .. '&nbsp;[[Toggle|<span style="color:' .. color_shard .. '; font-weight:bold">Toggle</span>]]',
    ["Toggle tal"] = ''.. symbol_tal .. '&nbsp;[[Toggle|<span style="color:' .. color_tal .. '; font-weight:bold">Toggle</span>]]',
  }
  local target2_dict = {
    ["No Target"] = ' / [[Abilities#No Target|No Target]]',
    ["No Target aghs"] = '<br>(' .. symbol_aghs .. '&nbsp;[[Abilities#No Target|<span style="color:' .. color_aghs .. '; font-weight:bold">No Target</span>]])',
    ["No Target shard"] = '<br>(' .. symbol_shard .. '&nbsp;[[Abilities#No Target|<span style="color:' .. color_shard .. '; font-weight:bold">No Target</span>]])',
    ["No Target tal"] = '<br>(' .. symbol_tal .. '&nbsp;[[Abilities#No Target|<span style="color:' .. color_tal.. '; font-weight:bold">No Target</span>]])',
    ["Target Unit"] = ' / [[Abilities#Target Unit|Target Unit]]',
    ["Target Unit aghs"] = '<br>(' .. symbol_aghs .. '&nbsp;[[Abilities#Target Unit|<span style="color:' .. color_aghs .. '; font-weight:bold">Target Unit</span>]])',
    ["Target Unit shard"] = '<br>(' .. symbol_shard .. '&nbsp;[[Abilities#Target Unit|<span style="color:' .. color_shard .. '; font-weight:bold">Target Unit</span>]])',
    ["Target Unit tal"] = '<br>(' .. symbol_tal .. '&nbsp;[[Abilities#Target Unit|<span style="color:' .. color_tal.. '; font-weight:bold">Target Unit</span>]])',
    ["Target Point"] = ' / [[Abilities#Target Point|Target Point]]',
    ["Target Point aghs"] = '<br>(' .. symbol_aghs .. '&nbsp;[[Abilities#Target Point|<span style="color:' .. color_aghs .. '; font-weight:bold">Target Point</span>]])',
    ["Target Point shard"] = '<br>(' .. symbol_shard .. '&nbsp;[[Abilities#Target Point|<span style="color:' .. color_shard .. '; font-weight:bold">Target Point</span>]])',
    ["Target Point tal"] = '<br>(' .. symbol_tal .. '&nbsp;[[Abilities#Target Point|<span style="color:' .. color_tal.. '; font-weight:bold">Target Point</span>]])',
    ["Target Area"] = ' / [[Abilities#Target Area|Target Area]]',
    ["Target Area aghs"] = '<br>(' .. symbol_aghs .. '&nbsp;[[Abilities#Target Area|<span style="color:' .. color_aghs .. '; font-weight:bold">Target Area</span>]])',
    ["Target Area shard"] = '<br>(' .. symbol_shard .. '&nbsp;[[Abilities#Target Area|<span style="color:' .. color_shard .. '; font-weight:bold">Target Area</span>]])',
    ["Target Area tal"] = '<br>(' .. symbol_tal .. '&nbsp;[[Abilities#Target Area|<span style="color:' .. color_tal.. '; font-weight:bold">Target Area</span>]])',
    ["Passive"] = ' / [[Passive]]',
    ["Passive aghs"] = '<br>(' .. symbol_aghs .. '&nbsp;[[Passive|<span style="color:' .. color_aghs .. '; font-weight:bold">Passive</span>]])',
    ["Passive shard"] = '<br>(' .. symbol_shard .. '&nbsp;[[Passive|<span style="color:' .. color_shard .. '; font-weight:bold">Passive</span>]])',
    ["Passive tal"] = '<br>(' .. symbol_tal .. '&nbsp;[[Passive|<span style="color:' .. color_tal.. '; font-weight:bold">Passive</span>]])',
    ["Aura"] = ' / [[Aura]]',
    ["Aura aghs"] = '<br>(' .. symbol_aghs .. '&nbsp;[[Aura|<span style="color:' .. color_aghs .. '; font-weight:bold">Aura</span>]])',
    ["Aura shard"] = '<br>(' .. symbol_shard .. '&nbsp;[[Aura|<span style="color:' .. color_shard .. '; font-weight:bold">Aura</span>]])',
    ["Aura tal"] = '<br>(' .. symbol_tal .. '&nbsp;[[Aura|<span style="color:' .. color_tal.. '; font-weight:bold">Aura</span>]])',
    ["Channeled"] = ' / [[Channeled]]', -- Should always be 2nd.
    ["Channeled aghs"] = '<br>(' .. symbol_aghs .. '&nbsp;[[Channeling|<span style="color:' .. color_aghs .. '; font-weight:bold">Channeled</span>]])',
    ["Channeled shard"] = '<br>(' .. symbol_shard .. '&nbsp;[[Channeling|<span style="color:' .. color_shard .. '; font-weight:bold">Channeled</span>]])',
    ["Channeled tal"] = '<br>(' .. symbol_tal .. '&nbsp;[[Channeling|<span style="color:' .. color_tal.. '; font-weight:bold">Channeled</span>]])',
    ["Autocast"] = ' / [[Autocast]]', --Should always be 2nd.
    ["Autocast aghs"] = '<br>(' .. symbol_aghs .. '&nbsp;[[Autocast|<span style="color:' .. color_aghs .. '; font-weight:bold">Autocast</span>]])',
    ["Autocast shard"] = '<br>(' .. symbol_shard .. '&nbsp;[[Autocast|<span style="color:' .. color_shard .. '; font-weight:bold">Autocast</span>]])',
    ["Autocast tal"] = '<br>(' .. symbol_tal .. '&nbsp;[[Autocast|<span style="color:' .. color_tal.. '; font-weight:bold">Autocast</span>]])',
    ["Toggle"] = ' / [[Toggle]]',
    ["Toggle aghs"] = '<br>(' .. symbol_aghs .. '&nbsp;[[Toggle|<span style="color:' .. color_aghs .. '; font-weight:bold">Toggle</span>]])',
    ["Toggle shard"] = '<br>(' .. symbol_shard .. '&nbsp;[[Toggle|<span style="color:' .. color_shard .. '; font-weight:bold">Toggle</span>]])',
    ["Toggle tal"] = '<br>(' .. symbol_tal .. '&nbsp;[[Toggle|<span style="color:' .. color_tal.. '; font-weight:bold">Toggle</span>]])',
    ["Target Unit / Channeled"] = ' / [[Abilities#Target Unit|Target Unit]] / [[Channeled]]', --Specifically for travel boots/tp scrolls.
    ["Target Unit aghs / Channeled"] = '<br>(' .. symbol_aghs .. '&nbsp;[[Abilities#Target Unit|<span style="color:' .. color_aghs .. '; font-weight:bold">Target Unit</span>]]) / [[Channeled]]', --Specifically for Tricks of the Trade.
    ["Target Area aghs / Channeled"] = '<br>(' .. symbol_aghs .. '&nbsp;[[Abilities#Target Area|<span style="color:' .. color_aghs .. '; font-weight:bold">Target Area</span>]]) / [[Channeled]]', --Specifically for Sinister Gaze.
    ["No Target shard / Channeled shard"] = '<br>(' .. symbol_shard .. '&nbsp;[[Abilities#No Target|<span style="color:' .. color_shard .. '; font-weight:bold">No Target</span>]] / [[Channeling|<span style="color:' .. color_shard .. '; font-weight:bold">Channeled</span>]])', --Specifically for Essence Flux.
    ["Target Unit or Area aghs"] = '<br>(' .. symbol_aghs .. '&nbsp;[[Abilities#Target Unit|<span style="color:' .. color_aghs .. '; font-weight:bold">Target Unit</span>]] / [[Abilities#Target Area|<span style="color:' .. color_aghs .. '; font-weight:bold">Target Area</span>]])', --Specifically for Eclipse.
    ["Target Unit / Target Area tal"] = ' / [[Abilities#Target Unit|Target Unit]]<br>(' .. symbol_tal .. '&nbsp;[[Abilities#Target Area|<span style="color:' .. color_tal.. '; font-weight:bold">Target Area</span>]])', --Specifically for Living Armor and Lightning Bolt.
    ["Channeled / Autocast shard"] = ' / [[Channeled]]<br>(' .. symbol_shard .. '&nbsp;[[Autocast|<span style="color:' .. color_shard .. '; font-weight:bold">Autocast</span>]])', --Specifically for Elder Titan Shard.
    ["Target Unit / Autocast shard"] = '<br>(' .. symbol_shard .. '&nbsp;[[Abilities#Target Unit|<span style="color:' .. color_shard .. '; font-weight:bold">Target Unit</span>]] / [[Autocast|<span style="color:' .. color_shard .. '; font-weight:bold">Autocast</span>]])', --Specifically for Necromastery
    ["Autocast / Passive tal"] = ' / [[Autocast]]<br>(' .. symbol_tal .. '&nbsp;[[Passive|<span style="color:' .. color_tal.. '; font-weight:bold">Passive</span>]])', --Specifically for Walrus Punch
    ["Vector"] = ' / [[Vector Targeting]]',
    ["Vector aghs"] = '<br>(' .. symbol_aghs .. '&nbsp;[[Vector Targeting|<span style="color:' .. color_aghs .. '; font-weight:bold">Vector Targeting</span>]])',
    ["Vector shard"] = '<br>(' .. symbol_shard .. '&nbsp;[[Vector Targeting|<span style="color:' .. color_shard .. '; font-weight:bold">Vector Targeting</span>]])',
    ["Vector tal"] = '<br>(' .. symbol_tal .. '&nbsp;[[Vector Targeting|<span style="color:' .. color_tal.. '; font-weight:bold">Vector Targeting</span>]])',
  }
  
  local target = target_dict[args['target']] or 'N/A'
  if args['target'] and args['target2'] then
    local target2 = target2_dict[args['target2']] or 'N/A'
    target = target .. ' ' .. target2
  end
  
  return target
end

function p.affects(frame)
  local args = getArgs(frame, {
    wrappers = {
      'Template:Ability'
    }
  })
  
  -- Implements the Arc Warden easteregg.
  zet_easteregg = function()
    if mw.title.getCurrentTitle().text == 'Arc Warden' then
      return 'The Self'
    else
      return 'Self'
    end
  end
  
  local affects_dict = {
    ["Heroes"] = '[[Heroes]]',
    ["Heroes aghs"] = ''.. symbol_aghs .. '&nbsp;[[Heroes|<span style="color:' .. color_aghs .. '; font-weight:bold">Heroes</span>]]',
    ["Heroes shard"] = ''.. symbol_shard .. '&nbsp;[[Heroes|<span style="color:' .. color_shard .. '; font-weight:bold">Heroes</span>]]',
    ["Heroes tal"] = ''.. symbol_tal .. '&nbsp;[[Heroes|<span style="color:' .. color_tal .. '; font-weight:bold">Heroes</span>]]',
    ["Enemy Heroes"] = '[[Heroes|Enemy Heroes]]',
    ["Enemy Heroes aghs"] = ''.. symbol_aghs .. '&nbsp;[[Heroes|<span style="color:' .. color_aghs .. '; font-weight:bold">Enemy Heroes</span>]]',
    ["Enemy Heroes shard"] = ''.. symbol_shard .. '&nbsp;[[Heroes|<span style="color:' .. color_shard .. '; font-weight:bold">Enemy Heroes</span>]]',
    ["Enemy Heroes tal"] = ''.. symbol_tal .. '&nbsp;[[Heroes|<span style="color:' .. color_tal .. '; font-weight:bold">Enemy Heroes</span>]]',
    ["Allied Heroes"] = '[[Heroes|Allied Heroes]]',
    ["Allied Heroes aghs"] = ''.. symbol_aghs .. '&nbsp;[[Heroes|<span style="color:' .. color_aghs .. '; font-weight:bold">Allied Heroes</span>]]',
    ["Allied Heroes shard"] = ''.. symbol_shard .. '&nbsp;[[Heroes|<span style="color:' .. color_shard .. '; font-weight:bold">Allied Heroes</span>]]',
    ["Allied Heroes tal"] = ''.. symbol_tal .. '&nbsp;[[Heroes|<span style="color:' .. color_tal .. '; font-weight:bold">Allied Heroes</span>]]',
    ["Units"] = 'Units',
    ["Units aghs"] = ''.. symbol_aghs .. '&nbsp;<span style="color:' .. color_aghs .. '; font-weight:bold">Units</span>',
    ["Units shard"] = ''.. symbol_shard .. '&nbsp;<span style="color:' .. color_shard .. '; font-weight:bold">Units</span>',
    ["Units tal"] = ''.. symbol_tal .. '&nbsp;<span style="color:' .. color_tal .. '; font-weight:bold">Units</span>',
    ["Enemy Units"] = 'Enemy Units',
    ["Enemy Units aghs"] = ''.. symbol_aghs .. '&nbsp;<span style="color:' .. color_aghs .. '; font-weight:bold">Enemy Units</span>',
    ["Enemy Units shard"] = ''.. symbol_shard .. '&nbsp;<span style="color:' .. color_shard .. '; font-weight:bold">Enemy Units</span>',
    ["Enemy Units tal"] = ''.. symbol_tal .. '&nbsp;<span style="color:' .. color_tal .. '; font-weight:bold">Enemy Units</span>',
    ["Allied Units"] = 'Allied Units',
    ["Allied Units aghs"] = ''.. symbol_aghs .. '&nbsp;<span style="color:' .. color_aghs .. '; font-weight:bold">Allied Units</span>',
    ["Allied Units shard"] = ''.. symbol_shard .. '&nbsp;<span style="color:' .. color_shard .. '; font-weight:bold">Allied Units</span>',
    ["Allied Units tal"] = ''.. symbol_tal .. '&nbsp;<span style="color:' .. color_tal .. '; font-weight:bold">Allied Units</span>',
    ["Self"] = zet_easteregg(),
    ["Self aghs"] = ''.. symbol_aghs .. '&nbsp;<span style="color:' .. color_aghs .. '; font-weight:bold">' .. zet_easteregg() .. '</span>',
    ["Self shard"] = ''.. symbol_shard .. '&nbsp;<span style="color:' .. color_shard .. '; font-weight:bold">' .. zet_easteregg() .. '</span>',
    ["Self tal"] = ''.. symbol_tal .. '&nbsp;<span style="color:' .. color_tal .. '; font-weight:bold">' .. zet_easteregg() .. '</span>',
    ["Enemies"] = 'Enemies',
    ["Enemies aghs"] = ''.. symbol_aghs .. '&nbsp;<span style="color:' .. color_aghs .. '; font-weight:bold">Enemies</span>',
    ["Enemies shard"] = ''.. symbol_shard .. '&nbsp;<span style="color:' .. color_shard .. '; font-weight:bold">Enemies</span>',
    ["Enemies tal"] = ''.. symbol_tal .. '&nbsp;<span style="color:' .. color_tal .. '; font-weight:bold">Enemies</span>',
    ["Allies"] = 'Allies',
    ["Allies aghs"] = ''.. symbol_aghs .. '&nbsp;<span style="color:' .. color_aghs .. '; font-weight:bold">Allies</span>',
    ["Allies shard"] = ''.. symbol_shard .. '&nbsp;<span style="color:' .. color_shard .. '; font-weight:bold">Allies</span>',
    ["Allies tal"] = ''.. symbol_tal .. '&nbsp;<span style="color:' .. color_tal .. '; font-weight:bold">Allies</span>',
    ["Trees"] = '[[Trees]]',
    ["Trees aghs"] = ''.. symbol_aghs .. '&nbsp;[[Trees|<span style="color:' .. color_aghs .. '; font-weight:bold">Trees</span>]]',
    ["Trees shard"] = ''.. symbol_shard .. '&nbsp;[[Trees|<span style="color:' .. color_shard .. '; font-weight:bold">Trees</span>]]',
    ["Trees tal"] = ''.. symbol_tal .. '&nbsp;[[Trees|<span style="color:' .. color_tal .. '; font-weight:bold">Trees</span>]]',
    ["Pumpkin Basket"] = 'Pumpkin Basket',
  }
  local affects2_dict = {
    ["Heroes"] = ' / [[Heroes]]',
    ["Heroes aghs"] = '<br>(' .. symbol_aghs .. '&nbsp;[[Heroes|<span style="color:' .. color_aghs .. '; font-weight:bold">Heroes</span>]])',
    ["Heroes shard"] = '<br>(' .. symbol_shard .. '&nbsp;[[Heroes|<span style="color:' .. color_shard .. '; font-weight:bold">Heroes</span>]])',
    ["Heroes tal"] = '<br>(' .. symbol_tal .. '&nbsp;[[Heroes|<span style="color:' .. color_tal.. '; font-weight:bold">Heroes</span>]])',
    ["Enemy Heroes"] = ' / [[Heroes|Enemy Heroes]]',
    ["Enemy Heroes aghs"] = '<br>(' .. symbol_aghs .. '&nbsp;[[Heroes|<span style="color:' .. color_aghs .. '; font-weight:bold">Enemy Heroes</span>]])',
    ["Enemy Heroes shard"] = '<br>(' .. symbol_shard .. '&nbsp;[[Heroes|<span style="color:' .. color_shard .. '; font-weight:bold">Enemy Heroes</span>]])',
    ["Enemy Heroes tal"] = '<br>(' .. symbol_tal .. '&nbsp;[[Heroes|<span style="color:' .. color_tal.. '; font-weight:bold">Enemy Heroes</span>]])',
    ["Allied Heroes"] = ' / [[Heroes|Allied Heroes]]',
    ["Allied Heroes aghs"] = '<br>(' .. symbol_aghs .. '&nbsp;[[Heroes|<span style="color:' .. color_aghs .. '; font-weight:bold">Allied Heroes</span>]])',
    ["Allied Heroes shard"] = '<br>(' .. symbol_shard .. '&nbsp;[[Heroes|<span style="color:' .. color_shard .. '; font-weight:bold">Allied Heroes</span>]])',
    ["Allied Heroes tal"] = '<br>(' .. symbol_tal .. '&nbsp;[[Heroes|<span style="color:' .. color_tal.. '; font-weight:bold">Allied Heroes</span>]])',
    ["Units"] = ' / Units',
    ["Units aghs"] = '<br>(' .. symbol_aghs .. '&nbsp;<span style="color:' .. color_aghs .. '; font-weight:bold">Units</span>)',
    ["Units shard"] = '<br>(' .. symbol_shard .. '&nbsp;<span style="color:' .. color_shard .. '; font-weight:bold">Units</span>)',
    ["Units tal"] = '<br>(' .. symbol_tal .. '&nbsp;<span style="color:' .. color_tal.. '; font-weight:bold">Units</span>)',
    ["Enemy Units"] = ' / Enemy Units',
    ["Enemy Units aghs"] = '<br>(' .. symbol_aghs .. '&nbsp;<span style="color:' .. color_aghs .. '; font-weight:bold">Enemy Units</span>)',
    ["Enemy Units shard"] = '<br>(' .. symbol_shard .. '&nbsp;<span style="color:' .. color_shard .. '; font-weight:bold">Enemy Units</span>)',
    ["Enemy Units tal"] = '<br>(' .. symbol_tal .. '&nbsp;<span style="color:' .. color_tal.. '; font-weight:bold">Enemy Units</span>)',
    ["Allied Units"] = ' / Allied Units',
    ["Allied Units aghs"] = '<br>(' .. symbol_aghs .. '&nbsp;<span style="color:' .. color_aghs .. '; font-weight:bold">Allied Units</span>)',
    ["Allied Units shard"] = '<br>(' .. symbol_shard .. '&nbsp;<span style="color:' .. color_shard .. '; font-weight:bold">Allied Units</span>)',
    ["Allied Units tal"] = '<br>(' .. symbol_tal .. '&nbsp;<span style="color:' .. color_tal.. '; font-weight:bold">Allied Units</span>)',
    ["Self"] = ' / Self',
    ["Self aghs"] = '<br>(' .. symbol_aghs .. '&nbsp;<span style="color:' .. color_aghs .. '; font-weight:bold">Self</span>)',
    ["Self shard"] = '<br>(' .. symbol_shard .. '&nbsp;<span style="color:' .. color_shard .. '; font-weight:bold">Self</span>)',
    ["Self tal"] = '<br>(' .. symbol_tal .. '&nbsp;<span style="color:' .. color_tal.. '; font-weight:bold">Self</span>)',
    ["Enemies"] = ' / Enemies',
    ["Enemies aghs"] = '<br>(' .. symbol_aghs .. '&nbsp;<span style="color:' .. color_aghs .. '; font-weight:bold">Enemies</span>)',
    ["Enemies shard"] = '<br>(' .. symbol_shard .. '&nbsp;<span style="color:' .. color_shard .. '; font-weight:bold">Enemies</span>)',
    ["Enemies tal"] = '<br>(' .. symbol_tal .. '&nbsp;<span style="color:' .. color_tal.. '; font-weight:bold">Enemies</span>)',
    ["Allies"] = ' / Allies',
    ["Allies aghs"] = '<br>(' .. symbol_aghs .. '&nbsp;<span style="color:' .. color_aghs .. '; font-weight:bold">Allies</span>)',
    ["Allies shard"] = '<br>(' .. symbol_shard .. '&nbsp;<span style="color:' .. color_shard .. '; font-weight:bold">Allies</span>)',
    ["Allies tal"] = '<br>(' .. symbol_tal .. '&nbsp;<span style="color:' .. color_tal.. '; font-weight:bold">Allies</span>)',
    ["Trees"] = ' / [[Trees]]',
    ["Trees aghs"] = '<br>(' .. symbol_aghs .. '&nbsp;[[Trees|<span style="color:' .. color_aghs .. '; font-weight:bold">Trees</span>]])',
    ["Trees shard"] = '<br>(' .. symbol_shard .. '&nbsp;[[Trees|<span style="color:' .. color_shard .. '; font-weight:bold">Trees</span>]])',
    ["Trees tal"] = '<br>(' .. symbol_tal .. '&nbsp;[[Trees|<span style="color:' .. color_tal.. '; font-weight:bold">Trees</span>]])',
  }
  if args['affects'] then
    local affects = affects_dict[args['affects']]
    if args['affects2'] then
      affects = affects .. ' ' .. affects2_dict[args['affects2']]
    end
    return "'''Affects'''<br>" .. affects
  end
end

-- Implements the damagetypes.
function p.damagetype(frame)
  local args = getArgs(frame, {
    wrappers = {
      'Template:Ability'
    }
  })
  local damagetype_dict = {
    ["Physical"] = '[[Physical|<span style="color:#AE2F28; font-weight:bold">Physical</span>]]',
    ["Physical aghs"] = ''.. symbol_aghs .. '&nbsp;[[Physical|<span style="color:#AE2F28; font-weight:bold">Physical</span>]]',
    ["Physical shard"] = ''.. symbol_shard .. '&nbsp;[[Physical|<span style="color:#AE2F28; font-weight:bold">Physical</span>]]',
    ["Physical tal"] = ''.. symbol_tal .. '&nbsp;[[Physical|<span style="color:#AE2F28; font-weight:bold">Physical</span>]]',
    ["Magical"] = '[[Magical|<span style="color:#5B93D1; font-weight:bold">Magical</span>]]',
    ["Magical aghs"] = ''.. symbol_aghs .. '&nbsp;[[Magical|<span style="color:#5B93D1; font-weight:bold">Magical</span>]]',
    ["Magical shard"] = ''.. symbol_shard .. '&nbsp;[[Magical|<span style="color:#5B93D1; font-weight:bold">Magical</span>]]',
    ["Magical tal"] = ''.. symbol_tal .. '&nbsp;[[Magical|<span style="color:#5B93D1; font-weight:bold">Magical</span>]]',
    ["Pure"] = '[[Pure|<span style="color:#C29C4A; font-weight:bold">Pure</span>]]',
    ["Pure aghs"] = ''.. symbol_aghs .. '&nbsp;[[Pure|<span style="color:#C29C4A; font-weight:bold">Pure</span>]]',
    ["Pure shard"] = ''.. symbol_shard .. '&nbsp;[[Pure|<span style="color:#C29C4A; font-weight:bold">Pure</span>]]',
    ["Pure tal"] = ''.. symbol_tal .. '&nbsp;[[Pure|<span style="color:#C29C4A; font-weight:bold">Pure</span>]]',
    ["Instant Attack"] = '[[Instant Attack| <span style="color:#598307; font-weight:bold">Instant Attack</span>]]',
    ["Instant Attack aghs"] = ''.. symbol_aghs .. '&nbsp;[[Instant Attack| <span style="color:#598307; font-weight:bold">Instant Attack</span>]]',
    ["Instant Attack shard"] = '' .. symbol_shard .. '&nbsp;[[Instant Attack| <span style="color:#598307; font-weight:bold">Instant Attack</span>]]',
    ["Instant Attack tal"] = '' .. symbol_tal .. '&nbsp;[[Instant Attack| <span style="color:#598307; font-weight:bold">Instant Attack</span>]]',
    ["Instant Kill"] = '[[Instant Kill| <span style="color:#5B388F; font-weight:bold">Instant Kill</span>]]',
    ["Instant Kill aghs"] = ''.. symbol_aghs .. '&nbsp;[[Instant Kill| <span style="color:#5B388F; font-weight:bold">Instant Kill</span>]]',
    ["Instant Kill shard"] = ''.. symbol_shard .. '&nbsp;[[Instant Kill| <span style="color:#5B388F; font-weight:bold">Instant Kill</span>]]',
    ["Instant Kill tal"] = ''.. symbol_tal .. '&nbsp;[[Instant Kill| <span style="color:#5B388F; font-weight:bold">Instant Kill</span>]]',
    ["Composite"] = '[[Composite|<span style="color:#5BD199; font-weight:bold">Composite</span>]]', -- Use only for old abilities.
    ["Universal"] = '[[Universal|<span style="color:#8650AC; font-weight:bold">Universal</span>]]', -- Use only for old abilities.
    ["HP Removal"] = '[[HP Removal]]', -- Use only for old abilities.
  }
  local damagetype2_dict = {
    ["Physical"] = ' / [[Physical|<span style="color:#AE2F28; font-weight:bold">Physical</span>]]',
    ["Physical aghs"] = '<br>(' .. symbol_aghs .. '&nbsp;[[Physical|<span style="color:#AE2F28; font-weight:bold">Physical</span>]])',
    ["Physical shard"] = '<br>(' .. symbol_shard .. '&nbsp;[[Physical|<span style="color:#AE2F28; font-weight:bold">Physical</span>]])',
    ["Physical tal"] = '<br>(' .. symbol_tal .. '&nbsp;[[Physical|<span style="color:#AE2F28; font-weight:bold">Physical</span>]])',
    ["Magical"] = ' / [[Magical|<span style="color:#5B93D1; font-weight:bold">Magical</span>]]',
    ["Magical aghs"] = '<br>(' .. symbol_aghs .. '&nbsp;[[Magical|<span style="color:#5B93D1; font-weight:bold">Magical</span>]])',
    ["Magical shard"] = '<br>(' .. symbol_shard .. '&nbsp;[[Magical|<span style="color:#5B93D1; font-weight:bold">Magical</span>]])',
    ["Magical tal"] = '<br>(' .. symbol_tal .. '&nbsp;[[Magical|<span style="color:#5B93D1; font-weight:bold">Magical</span>]])',
    ["Pure"] = ' / [[Pure|<span style="color:#C29C4A; font-weight:bold">Pure</span>]]',
    ["Pure aghs"] = '<br>(' .. symbol_aghs .. '&nbsp;[[Pure|<span style="color:#C29C4A; font-weight:bold">Pure</span>]])',
    ["Pure shard"] = '<br>(' .. symbol_shard .. '&nbsp;[[Pure|<span style="color:#C29C4A; font-weight:bold">Pure</span>]])',
    ["Pure tal"] = '<br>(' .. symbol_tal .. '&nbsp;[[Pure|<span style="color:#C29C4A; font-weight:bold">Pure</span>]])',
    ["Instant Attack"] = ' / [[Instant Attack| <span style="color:#598307; font-weight:bold">Instant Attack</span>]]',
    ["Instant Attack aghs"] = '<br>(' .. symbol_aghs .. '&nbsp;[[Instant Attack|<span style="color:#598307; font-weight:bold">Instant Attack</span>]])',
    ["Instant Attack shard"] = '<br>(' .. symbol_shard .. '&nbsp;[[Instant Attack|<span style="color:#598307; font-weight:bold">Instant Attack</span>]])',
    ["Instant Attack tal"] = '<br>(' .. symbol_tal .. '&nbsp;[[Instant Attack|<span style="color:#598307; font-weight:bold">Instant Attack</span>]])',
    ["Instant Kill"] = ' / [[Instant Kill| <span style="color:#5B388F; font-weight:bold">Instant Kill</span>]]',
    ["Instant Kill aghs"] = '<br>(' .. symbol_aghs .. '&nbsp;[[Instant Kill|<span style="color:#5B388F; font-weight:bold">Instant Kill</span>]])',
    ["Instant Kill shard"] = '<br>(' .. symbol_shard .. '&nbsp;[[Instant Kill|<span style="color:#5B388F; font-weight:bold">Instant Kill</span>]])',
    ["Instant Kill tal"] = '<br>(' .. symbol_tal .. '&nbsp;[[Instant Kill|<span style="color:#5B388F; font-weight:bold">Instant Kill</span>]])',
    ["HP Removal"] = '<br>([[HP Removal]])', -- Not an actual damage type, so should always be used as 2nd.
  }
  if args['damagetype'] then
    local damagetype = damagetype_dict[args['damagetype']]
    if args['damagetype2'] then
      damagetype = damagetype .. ' ' .. damagetype2_dict[args['damagetype2']]
    end
    
    return "'''Damage'''<br>" .. damagetype
  end
end


return p
Advertisement