Module:Ability

local symbol = require( 'Module:Symbol' )._main local symbol_aghs = symbol({ 'Aghanim' }) local symbol_tal = symbol({ '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"] = 'No Target', ["Target Unit"] = 'Target Unit', ["Target Point"] = 'Target Point', ["Target Area"] = 'Target Area', ["Passive"] = 'Passive', ["Aura"] = 'Aura', ["Toggle"] = 'Toggle', } local target2_dict = { ["No Target"] = ' / No Target', ["No Target aghs"] = ' (' .. symbol_aghs .. ' No Target )', ["No Target tal"] = ' (' .. symbol_tal .. ' No Target)', ["Target Unit"] = ' / Target Unit', ["Target Unit aghs"] = ' (' .. symbol_aghs .. ' Target Unit )', ["Target Unit tal"] = ' (' .. symbol_tal .. ' Target Unit)', ["Target Point"] = ' / Target Point', ["Target Point aghs"] = ' (' .. symbol_aghs .. ' Target Point )', ["Target Point tal"] = ' (' .. symbol_tal .. ' Target Point)', ["Target Area"] = ' / Target Area', ["Target Area aghs"] = ' (' .. symbol_aghs .. ' Target Area )', ["Target Area tal"] = ' (' .. symbol_tal .. ' Target Area)', ["Passive"] = ' / Passive', ["Passive aghs"] = ' (' .. symbol_aghs .. ' Passive )', ["Passive tal"] = ' (' .. symbol_tal .. ' Passive)', ["Aura"] = ' / Aura', ["Aura aghs"] = ' (' .. symbol_aghs .. ' Aura )', ["Aura tal"] = ' (' .. symbol_tal .. ' Aura)', ["Channeled"] = ' / Channeled', -- Should always be 2nd. ["Channeled aghs"] = ' (' .. symbol_aghs .. ' Channeled )', ["Channeled tal"] = ' (' .. symbol_tal .. ' Channeled)', ["Autocast"] = ' / Autocast', --Should always be 2nd. ["Autocast aghs"] = ' (' .. symbol_aghs .. ' Autocast )', ["Autocast tal"] = ' (' .. symbol_tal .. ' Autocast)', ["Toggle"] = ' / Toggle', ["Toggle aghs"] = ' (' .. symbol_aghs .. ' Toggle )', ["Toggle tal"] = ' (' .. symbol_tal .. ' Toggle)', ["Target Unit / Channeled"] = ' / Target Unit / Channeled', --Specifically for travel boots/tp scrolls. ["Target Unit aghs / Channeled"] = ' (' .. symbol_aghs .. ' Target Unit ) / Channeled ', --Specifically for Tricks of the Trade. ["Target Unit or Area aghs"] = ' (' .. symbol_aghs .. ' Target Unit  /  Target Area ) ', --Specifically for Eclipse. ["Target Unit / Target Area tal"] = ' / Target Unit (' .. symbol_tal .. ' Target Area) ', --Specifically for Living Armor. ["Vector"] = ' / Vector Targeting', } 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', ["Enemy Heroes"] = 'Enemy Heroes', ["Allied Heroes"] = 'Allied Heroes', ["Units"] = 'Units', ["Enemy Units"] = 'Enemy Units', ["Allied Units"] = 'Allied Units', ["Self"] = zet_easteregg, ["Enemies"] = 'Enemies', ["Allies"] = 'Allies', ["Trees"] = 'Trees', ["Pumpkin Basket"] = 'Pumpkin Basket', } local affects2_dict = { ["Heroes"] = ' / Heroes', ["Heroes aghs"] = ' (' .. symbol_aghs .. ' Heroes )', ["Heroes tal"] = ' (' .. symbol_tal .. ' Heroes)', ["Enemy Heroes"] = ' / Enemy Heroes', ["Enemy Heroes aghs"] = ' (' .. symbol_aghs .. ' Enemy Heroes )', ["Enemy Heroes tal"] = ' (' .. symbol_tal .. ' Enemy Heroes)', ["Allied Heroes"] = ' / Allied Heroes', ["Allied Heroes aghs"] = ' (' .. symbol_aghs .. ' Allied Heroes )', ["Allied Heroes tal"] = ' (' .. symbol_tal .. ' Allied Heroes)', ["Units"] = ' / Units', ["Units aghs"] = ' (' .. symbol_aghs .. ' Units )', ["Units tal"] = ' (' .. symbol_tal .. ' Units)', ["Enemy Units"] = ' / Enemy Units', ["Enemy Units aghs"] = ' (' .. symbol_aghs .. ' Enemy Units )', ["Enemy Units tal"] = ' (' .. symbol_tal .. ' Enemy Units)', ["Allied Units"] = ' / Allied Units', ["Allied Units aghs"] = ' (' .. symbol_aghs .. ' Allied Units )', ["Allied Units tal"] = ' (' .. symbol_tal .. ' Allied Units)', ["Self"] = ' / Self', ["Self aghs"] = ' (' .. symbol_aghs .. ' Self )', ["Self tal"] = ' (' .. symbol_tal .. ' Self)', ["Enemies"] = ' / Enemies', ["Enemies aghs"] = ' (' .. symbol_aghs .. ' Enemies )', ["Enemies tal"] = ' (' .. symbol_tal .. ' Enemies)', ["Allies"] = ' / Allies', ["Allies aghs"] = ' (' .. symbol_aghs .. ' Allies )', ["Allies tal"] = ' (' .. symbol_tal .. ' Allies)', ["Trees"] = ' / Trees', ["Trees aghs"] = ' (' .. symbol_aghs .. ' Trees )', ["Trees tal"] = ' (' .. symbol_tal .. ' Trees)', } if args['affects'] then local affects = affects_dict[args['affects']] if args['affects2'] then affects = affects .. ' ' .. affects2_dict[args['affects2']] end return "Affects " .. affects end end

-- Implements the damagetypes. function p.damagetype(frame) local args = getArgs(frame, {   wrappers = {      'Template:Ability'    }  }) local damagetype_dict = { ["Physical"] = ' Physical ', ["Magical"] = ' Magical ', ["Pure"] = ' Pure ', ["Instant Attack"] = ' Instant Attack ', ["Instant Attack tal"] = '' .. symbol_tal .. ' Instant Attack ', ["Instant Kill"] = ' Instant Kill ', ["Composite"] = ' Composite ', -- Use only for old abilities. ["Universal"] = ' Universal ', -- Use only for old abilities. ["HP Removal"] = 'HP Removal', -- Use only for old abilities. } local damagetype2_dict = { ["Physical"] = ' / Physical ', ["Physical aghs"] = ' (' .. symbol_aghs .. ' Physical )', ["Physical tal"] = ' (' .. symbol_tal .. ' Physical )', ["Magical"] = ' / Magical ', ["Magical aghs"] = ' (' .. symbol_aghs .. ' Magical )', ["Magical tal"] = ' (' .. symbol_tal .. ' Magical )', ["Pure"] = ' / Pure ', ["Pure aghs"] = ' (' .. symbol_aghs .. ' Pure )', ["Pure tal"] = ' (' .. symbol_tal .. ' Pure )', ["Instant Attack"] = ' / Instant Attack ', ["Instant Kill"] = ' / Instant Kill ', ["Instant Attack aghs"] = ' (' .. symbol_aghs .. ' Instant Attack )', ["Instant Kill aghs"] = ' (' .. symbol_aghs .. ' Instant Kill )', ["Instant Attack tal"] = ' (' .. symbol_tal .. ' Instant Attack )', ["Instant Kill tal"] = ' (' .. symbol_tal .. ' Instant Kill )', ["HP Removal"] = ' (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 " .. damagetype end end

return p