Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.
Revision as of 18:40, 27 March 2025 by Gpe (talk | contribs) (// via Wikitext Extension for VSCode)

Module:A Parameter Documentation

This page details all the parameters and their aliases accepted by the Module:A Scribunto module for formatting TTRPG abilities. Call the module using:

{{#invoke:A|a|name=Example Ability|<other parameters>}}

Core Parameters

Basic Information

  • name - The name of the ability (required)
  • e - The effect/description of the ability
  • trigger - What triggers the ability to activate

Type Flags

  • skill - Flag to mark this as a skill ability
    • Setting a warrior or semi class will automatically set this flag to true. This can be overridden by setting it to 0 or false.
  • spell - Flag to mark this as a spell ability
    • Setting a mage class will automatically set this flag to true. This can be overridden by setting it to 0 or false.
  • standard - Flag to mark this as a standard ability
    • Setting a class will automatically set this flag to true. This can be overridden by setting it to 0 or false.
    • Note that abilities that are provided by other class abilities are not always considered standard abilities nor abilities of that class. The main exceptions are crowns and other mage rotators.

Class Information

  • class - The class this ability belongs to
    Supported values:
    • bar/ber (Berserker)
    • sam/due (Duelist)
    • vet (Veteran)
    • kni (Knight)
    • pal (Paladin)
    • ass (Assassin)
    • ama/cor (Corsair)
    • arc (Archer)
    • thi (Thief)
    • ran (Ranger)
    • fla (Flame Mage)
    • sto (Storm Mage)
    • lif (Life Mage)
    • nec (Necromancer)
    • nat (Nature Mage)
  • arch - Override the default archetype for a class
    Supported values:
    • warr (Warrior)
    • semi (Semi)
    • mage (Mage)
  • rank - The rank requirement for the ability
    Supported values:
    • 1 (Rank 1)
    • 2 (Rank 2)
    • 3 (Rank 3+)

Ability Properties

Maneuver Type (maneuver/man/m)

  • active/ac/a - Active maneuver
  • reactive/re/r - Reactive maneuver
  • passive/ps/p - Passive maneuver
  • slow/sl/s - Slow maneuver
Execution Time (executionTime/time/et/x)
  • 0a/freeAction/fa - Free action
  • 1a/a/singleAction/sa - Single action
  • 2a/doubleAction/da - Double action
  • 3a/tripleAction/ta - Triple action
  • 0r/freeReaction/fr - Free reaction
  • 1r/reaction/r - Reaction
  • sr/shortRest/s - Short rest
  • lr/longRest/l - Long rest
  • Time duration format: XmXhXdXwXy (minutes, hours, days, weeks, years)

Interaction Type (interaction/int/i)

  • attack/atk/a - Attack interaction
  • block/blk/b - Block interaction
  • manifest/man/m - Manifest interaction
  • feat/fea/f - Feat interaction

Delivery Method (delivery/del/d)

  • self/sel/s - Self delivery
  • missile/mis/m - Missile delivery
  • hand/han/h/claw - Hand delivery
  • bite/bit/b/mouth - Bite delivery
  • item/itm/i - Item delivery
  • magelore/mag/ml - Magelore delivery
  • weapon/wep/w - Weapon delivery
  • shield/shl/sh - Shield delivery
  • armor/rmr/r - Armor delivery
  • sight/sit/eye/e - Sight delivery
  • aura/aur/a - Aura delivery
  • cone/con/c - Cone delivery
  • other/oth/o - Other delivery

Target Type (target/tar/t)

  • self/sel/s - Self target
  • creature/cre/c - Creature target
  • body/bod/b - Body target
  • vitals/vit/v - Vitals target
  • limb/lim/l - Limb target
  • arm - Arm target
  • leg - Leg target
  • item/itm/i - Item target
  • weapon/wep/w - Weapon target
  • shield/shl/sh - Shield target
  • armor/rmr/r - Armor target
  • attack/atk/a - Attack target
  • other/oth/o - Other target

Duration (duration/dur/dr)

  • instant/in/i/0 - Instant duration
  • always/forever/4/inf - Always active
    • Note: Use one of the aliases. Entering always is currently bugged.
  • whileUp/up/u - While up
  • whileDown/dn/d - While down
  • whileAlive/al/a - While alive
  • whileDead/dd - While dead
  • endOfTurn/end/e - Until end of turn
  • dawn/d - Until dawn
  • startOfTargetNextTurn/tStart/ts - Until start of target's next turn
  • endOfTargetNextTurn/tEnd/te - Until end of target's next turn
  • startOfYourNextTurn/uStart/us - Until start of your next turn
  • endOfYourNextTurn/uEnd/ue - Until end of your next turn
  • endOfCombat/ec - Until end of combat
  • Time duration format: XmXhXdXwXy (minutes, hours, days, weeks, years)
Sustained Flag
  • sustained/sus/s - Ability is sustained

Range (range/rng/r)

  • melee/m - Melee range
  • weapon/w - Weapon range
  • hand/h - Hand range
  • bite/b - Bite range
  • item/i - Item range
  • shield/sh - Shield range
  • armor/a - Armor range
  • sight/eye/e - Sight range
  • self/s - Self range
  • Distance format: Xf or Xm (feet or miles)

Attribute Saves (attribute/attr/a)

  • int/INT/i - Intelligence save
  • str/STR/s - Strength save
  • mov/MOV/m - Movement save
  • per/PER/p - Perception save
  • snk/SNK/s - Sneak save

Expansion Type (expansion/exp)

  • detonate/det/d - Detonate expansion
  • ripple/rip/r - Ripple expansion
  • cascade/cas/c - Cascade expansion
  • fork/for/f - Fork expansion

Piercing (piercing/prc/p)

  • av0/a - AV0 piercing
  • unblockable/ub/u - Unblockable

Component Flags

  • verbal/ver/v - Verbal component
  • somatic/som/s - Somatic component
  • material/mat/m - Material component
  • magelore/mag/ml - Magelore component
  • invoked/inv/i - Invoked component

Resource Costs

  • mp - Mana point cost
  • mpx - Variable mana point cost description
  • hp - Hit point cost
  • hpx - Variable hit point cost description
  • matx - Material component cost description

Element Flags

  • life - Life element
  • storm - Storm element
  • necro - Necro element
  • flame - Flame element
  • nature - Nature element

Power Source Flags

  • magic - Magical power source
  • divine - Divine power source
  • spirit - Spirit power source
  • primal - Primal power source
  • martial - Martial power source
  • psionic - Psionic power source
  • techo - Techno power source

Effect Type Flags

  • mental - Mental effect
  • truth - Truth detection effect
  • duelMod - Duel modification effect
  • movement - Movement effect
  • displacement - Displacement effect
  • transformation - Transformation effect
  • control - Control effect
  • resist - Resistance effect
  • immune - Immunity effect
  • long - Long range effect
  • sense - Sensory effect
  • revive - Revival effect
  • summon - Summoning effect
  • heal - Healing effect

State Parameters

  • end - The condition under which the ability ends

Results Parameters

  • crithit - Critical hit effect
  • hit - Hit effect
  • miss - Miss effect
  • critmiss - Critical miss effect
  • critfail - Critical fail effect
  • fail - Fail effect
  • save - Save effect
  • critsave - Critical save effect

Attribute Modification

  • vstat - Attribute to modify
  • val - New minimum value for the attribute
  • fstat - Feat save attribute to modify
  • flu - Flag for fluency in feat save
  • pro - Flag for proficiency in feat save

Premade Templates

The module includes several premade templates that can be used as a base for abilities:

Strike Template (pre=strike)

{
    maneuver = 'active',
    executionTime = '1a',
    interaction = 'attack',
    delivery = 'weapon',
    target = 'creature',
    duration = 'instant',
    range = 'weapon',
}

Ray Template (pre=ray)

{
    maneuver = 'active',
    executionTime = '1a',
    interaction = 'attack',
    delivery = 'missile',
    target = 'creature',
    duration = 'instant',
    range = '60f',
    piercing = 'av0',
}

Ball Template (pre=ball)

{
    maneuver = 'active',
    executionTime = '1a',
    interaction = 'attack',
    delivery = 'missile',
    target = 'creature',
    duration = 'instant',
    range = '30f',
    piercing = 'ub',
}

Touch Template (pre=touch)

{
    maneuver = 'active',
    executionTime = '1a',
    interaction = 'attack',
    delivery = 'hand',
    target = 'creature',
    duration = 'instant',
    range = 'hand',
    piercing = 'ub',
}

Ritual Template (pre=ritual)

{
    maneuver = 'slow',
    executionTime = '10m',
    interaction = 'manifest',
    delivery = 'sight',
    target = 'creature',
    duration = 'instant',
    range = '5f',
}

Additional Features

The module automatically handles:

  • Adding AC modifiers for limb (+2), vitals (+5), and other specific targets
  • Managing item interaction DCs
  • Handling class archetypes and their hierarchies
  • Processing time and distance formats
  • Managing component requirements for invoked abilities



local p = {}

local aliases = {
    keys = {
        pre = {
            'pre',
            'premade',
        },
        maneuver = {
            'man',
            'maneuver',
            'm'
        },
        interaction = {
            'int',
            'interaction',
            'i'
        },
        delivery = {
            'del',
            'delivery',
            'd'
        },
        target = {
            'tar',
            'target',
            't'
        },
        duration = {
            'dur',
            'duration',
            'dr'
        },
        upgrade = {
            'upg',
            'upgrade',
            'u'
        },
        executionTime = {
            'executionTime',
            'et',
            'x'
        },
        piercing = {
            'prc',
            'piercing',
            'p'
        },
        -- nearRange = {
        --     'nearRange',
        --     'nr'
        -- },
        -- farRange = {
        --     'farRange',
        --     'fr'
        -- },
        range = {
            'range',
            'rng',
            'r'
        },
        attribute = {
            'attribute',
            'attr',
            'a'
        },
        expansion = {
            'expansion',
            'exp',
        },
        expansionRange = {
            'expansionRange',
            'er'
        },
        expansionCount = {
            'expansionCount',
            'ec'
        },
        sustained = {
            'sustained',
            'sus'
        },
        requirement = {
            'req',
            'requirement',
            'rq'
        },
        verbal = {
            'ver',
            'verbal',
        },
        somatic = {
            'som',
            'somatic',
        },
        material = {
            'mat',
            'material',
        },
        magelore = {
            'mag',
            'magelore',
            'ml'
        },
        invoked = {
            'inv',
            'invoked',
            'invoke',
        },
        hp = {
            'hp',
            'health',
            'hitpoints',
            'hitPoints',
            'hit points',
        },
        hpx = {
            'hpx',
            'healthx',
            'hitpointsx',
            'hitPointsx',
            'hit pointsx',
        },
        mp = {
            'mp',
            'mana',
            'magic',
            'magick',
            'magik',
            'mana points',
            'magic points',
            'magick points',
            'magik points',
        },
        mpx = {
            'mpx',
            'manax',
            'manapointsx',
            'mana pointsx',
            'magic pointsx',
            'magick pointsx',
            'magik pointsx',
        },
        matx = {
            'matx',
            'materialx',
        },
        class = {
            'class',
        },
    },
    values = {
        maneuver = {
            active = {
                'ac',
                'active',
                'a'
            },
            reactive = {
                're',
                'reaction',
                'r'
            },
            passive = {
                'ps',
                'passive',
                'p'
            },
            slow = {
                'sl',
                'slow',
                's'
            }
        },
        interaction = {
            attack = {
                'atk',
                'attack',
                'a'
            },
            block = {
                'blk',
                'block',
                'b'
            },
            manifest = {
                'man',
                'manifest',
                'm'
            },
            feat = {
                'fea',
                'feat',
                'f'
            }
        },
        delivery = {
            self = {
                'sel',
                'self',
                's'
            },
            missile = {
                'mis',
                'missile',
                'm'
            },
            hand = {
                'han',
                'hand',
                'h',
                'claw'
            },
            bite = {
                'bit',
                'bite',
                'b',
                'mouth'
            },
            item = {
                'itm',
                'item',
                'i'
            },
            magelore = {
                'mag',
                'magelore',
                'ml'
            },
            weapon = {
                'wep',
                'weapon',
                'w'
            },
            shield = {
                'shl',
                'shield',
                'sh'
            },
            armor = {
                'rmr',
                'armor',
                'r'
            },
            sight = {
                'sit',
                'sight',
                'eye',
                'e'
            },
            aura = {
                'aur',
                'aura',
                'a'
            },
            cone = {
                'con',
                'cone',
                'c'
            },
            other = {
                'oth',
                'other',
                'o'
            }
        },
        target = {
            self = {
                'sel',
                'self',
                's'
            },
            creature = {
                'cre',
                'creature',
                'c'
            },
            body = {
                'bod',
                'body',
                'b'
            },
            vitals = {
                'vit',
                'vitals',
                'v'
            },
            limb = {
                'lim',
                'limb',
                'l'
            },
            arm = {
                'arm',
            },
            leg = {
                'leg',
            },
            item = {
                'itm',
                'item',
                'i'
            },
            weapon = {
                'wep',
                'weapon',
                'w'
            },
            shield = {
                'shl',
                'shield',
                'sh'
            },
            armor = {
                'rmr',
                'armor',
                'r'
            },
            ship = {
                'ship',
            },
            attack = {
                'atk',
                'attack',
                'a'
            },
            ability = {
            	'ab',
            	'ability'
            },
            spell = {
                'spl',
                'spell',
            },
            other = {
                'oth',
                'other',
                'o'
            },
            ci = {
                'ci',
                'creatureItem',
                'itemCreature',
                'ic'
            },
            ai = {
                'ai',
                'attackItem',
                'itemAttack',
                'ia'
            },
            area = {
                'area',
                'ar'
            },
            aci = {
                'cia',
                'iac',
                'aci',
                'ica',
                'cai',
                'aic',
                'creatureItemArea',
                'itemCreatureArea',
                'AreaCreatureItem',
                'itemAreaCreature',
                'creatureAreaItem',
                'AreaItemCreature',
            },
            ac = {
                'ac',
                'ca',
                'areaCreature',
                'creatureArea',
            },
            al = {
            	'al',
            	'la',
            	'armLeg',
            	'legArm',
            },
        },
        duration = {
            instant = {
                '0',
                'in',
                'instant',
                'i'
            },
            always = {
                'always',
                'forever',
                '4',
                'inf',
            },
            whileUp = {
                'up',
                'whileUp',
                'u'
            },
            whileDown = {
                'dn',
                'whileDown',
                'd'
            },
            whileAlive = {
                'al',
                'whileAlive',
                'a'
            },
            whileDead = {
                'dd',
                'whileDead',
            },
            endOfTurn = {
                'end',
                'endOfTurn',
                'e'
            },
            dawn = {
                'dawn',
                'd'
            },
            startOfTargetNextTurn = {
                'tStart',
                'startOfTargetNextTurn',
                'ts'
            },
            endOfTargetNextTurn = {
                'tEnd',
                'endOfTargetNextTurn',
                'te'
            },
            startOfYourNextTurn = {
                'uStart',
                'startOfYourNextTurn',
                'us'
            },
            endOfYourNextTurn = {
                'uEnd',
                'endOfYourNextTurn',
                'ue'
            },
            endOfCombat = {
                'endOfCombat',
                'ec'
            },
            timeParse = {
                '^%d+[mhdwys]$'
            }
        },
        upgrade = {
            warded = {
                'wrd',
                'warded',
                'w'
            },
            absolute = {
                'abs',
                'absolute',
                'a'
            }
        },
        executionTime = {
            freeAction = {
                '0a',
                'freeAction',
                'fa'
            },
            singleAction = {
                '1a',
                'a',
                'singleAction',
                'sa',
            },
            doubleAction = {
                '2a',
                'doubleAction',
                'da'
            },
            tripleAction = {
                '3a',
                'tripleAction',
                'ta'
            },
            freeReaction = {
                '0r',
                'freeReaction',
                'fr'
            },
            reaction = {
                '1r',
                'reaction',
                'r'
            },
            shortRest = {
                'sr',
                'shortRest',
                's'
            },
            longRest = {
                'lr',
                'longRest',
                'l'
            },
            timeParse = {
                '^%d+[mhdwy]$'
            }
        },
        piercing = {
            av0 = {
                'av0',
                'a'
            },
            unblockable = {
                'ub',
                'u'
            }
        },
        range = {
            melee = {
                'melee',
                'm'
            },
            weapon = {
                'weapon',
                'weaponReach',
                'w'
            },
            hand = {
                'hand',
                'handReach',
                'h'
            },
            bite = {
                'bite',
                'biteReach',
                'b'
            },
            item = {
                'item',
                'itemReach',
                'i'
            },
            shield = {
                'shield',
                'shieldReach',
                'sh'
            },
            armor = {
                'armor',
                'armorReach',
                'r'
            },
            sight = {
                'sight',
                'sightReach',
                'eye',
                'e'
            },
            self = {
                'self',
                's'
            },
            distParse = {
                '^%d+[fm]$'
            },
            other = {
                'other',
                'o'
            }
        },
        attribute = {
            int = {
                'int',
                'INT',
                'i'
            },
            str = {
                'str',
                'STR',
                's'
            },
            mov = {
                'mov',
                'MOV',
                'm'
            },
            per = {
                'per',
                'PER',
                'p'
            },
            snk = {
                'snk',
                'SNK',
                's'
            }
        },
        expansion = {
            detonate = {
                'det',
                'detonate',
                'd'
            },
            ripple = {
                'rip',
                'ripple',
                'r'
            },
            cascade = {
                'cas',
                'cascade',
                'c'
            },
            fork = {
                'for',
                'fork',
                'f'
            }
        },
        expansionRange = {
            distParse = {
                '^%d+[fm]$'
            }
        },
        expansionCount = {
            expansionCount = {
                'expansionCount',
                'ec',
            }
        },
        sustained = {
            sustained = {
                'sus',
                'sustained',
                's',
                '1',
            }
        },
        verbal = {
            verbal = {
                'ver',
                'verbal',
                'v',
                '1',
            }
        },
        somatic = {
            somatic = {
                'som',
                'somatic',
                's',
                '1',
            }
        },
        material = {
            material = {
                'mat',
                'material',
                'm',
                '1',
            }
        },
        magelore = {
            magelore = {
                'mag',
                'magelore',
                'ml',
                '1',
            }
        },
        invoked = {
            invoked = {
                'inv',
                'invoked',
                'i',
                '1',
            }
        },
        class = {
            ber = {
                'ber',
            },
            due = {
                'due',
            },
            vet = {
                'vet',
            },
            kni = {
                'kni',
            },
            pal = {
                'pal',
            },
            ass = {
                'ass',
            },
            cor = {
                'cor',
            },
            arc = {
                'arc',
            },
            thi = {
                'thi',
            },
            ran = {
                'ran',
            },
            fla = {
                'fla',
            },
            sto = {
                'sto',
            },
            lif = {
                'lif',
            },
            nec = {
                'nec',
            },
            nat = {
                'nat',
            },
        }
    }
}

local tags = {
    verbal = {
        verbal = {
            text = 'Verbal',
            link = 'Verbal component abilities',
            symbol = '🗣️',
            color = '#f9f06b'
        },
    },
    somatic = {
        somatic = {
            text = 'Somatic',
            link = 'Somatic component abilities',
            symbol = '👐',
            color = '#f9f06b'
        },
    },
    material = {
        material = {
            text = 'Material',
            link = 'Material component abilities',
            symbol = '💎',
            color = '#ff7800'
        },
    },
    magelore = {
        magelore = {
            text = 'Magelore',
            link = 'Magelore component abilities',
            symbol = '🔮',
            color = '#f9f06b'
        },
    },
    invoked = {
        invoked = {
            text = 'Invoked',
            link = 'Invoked component abilities',
            symbol = '🪄',
            color = '#f9f06b'
        },
    },
    elements = {
        life = {
            text = 'Life',
            link = 'Life element abilities',
            symbol = '☀️',
            color = '#ffffff'
        },
        storm = {
            text = 'Storm',
            link = 'Storm element abilities',
            symbol = '💧',
            color = '#3584e4'
        },
        necro = {
            text = 'Necro',
            link = 'Necromancy element abilities',
            symbol = '💀',
            color = '#3d3846'
        },
        flame = {
            text = 'Flame',
            link = 'Flame element abilities',
            symbol = '🔥',
            color = '#e01b24'
        },
        nature = {
            text = 'Nature',
            link = 'Nature element abilities',
            symbol = '🌱',
            color = '#33d17a'
        },
    },
    class = {
        ber = {
            text = 'Berserker',
            link = 'Berserker class abilities',
            symbol = '🪓',
        },
        due = {
            text = 'Duelist',
            link = 'Duelist class abilities',
            symbol = '🤺',
        },
        vet = {
            text = 'Veteran',
            link = 'Veteran class abilities',
            symbol = '🪖',
        },
        kni = {
            text = 'Knight',
            link = 'Knight class abilities',
            symbol = '⚔️',
        },
        pal = {
            text = 'Paladin',
            link = 'Paladin class abilities',
            symbol = '🛡️',
        },
        ass = {
            text = 'Assassin',
            link = 'Assassin class abilities',
            symbol = '🗡️',
        },
        cor = {
            text = 'Corsair',
            link = 'Corsair class abilities',
            symbol = '🏴‍☠️',
        },
        arc = {
            text = 'Archer',
            link = 'Archer class abilities',
            symbol = '🏹',
        },
        thi = {
            text = 'Thief',
            link = 'Thief class abilities',
            symbol = '💰️',
        },
        ran = {
            text = 'Ranger',
            link = 'Ranger class abilities',
            symbol = '🐾',
        },
        fla = {
            text = 'Flame Mage',
            link = 'Flame Mage class abilities',
            symbol = '🧙',
        },
        sto = {
            text = 'Storm Mage',
            link = 'Storm Mage class abilities',
            symbol = '🧙',
        },
        lif = {
            text = 'Life Mage',
            link = 'Life Mage class abilities',
            symbol = '🧙',
        },
        nec = {
            text = 'Necromancer',
            link = 'Necromancer class abilities',
            symbol = '🧙',
        },
        nat = {
            text = 'Nature Mage',
            link = 'Nature Mage class abilities',
            symbol = '🧙',
        },
    },
    power = {
        divine = {
            text = 'Divine',
            link = 'Divinely powered abilities',
            symbol = '🪽',
            color = '#f9f06b'
        },
        magic = {
            text = 'Magical',
            link = 'Magically powered abilities',
            symbol = '✨',
            color = '#9141ac'
        },
        spirit = {
            text = 'Spiritual',
            link = 'Spiritually powered abilities',
            symbol = '🪭',
            color = '#9a9996'
        },
        martial = {
            text = 'Martial',
            link = 'Martially powered abilities',
            symbol = '💪',
            color = '#ff7800'
        },
        psionic = {
            text = 'Psionic',
            link = 'Psionically powered abilities',
            symbol = '🤯',
            color = '#3584e4'
        },
        primal = {
            text = 'Primal',
            link = 'Primally powered abilities',
            symbol = '⛰️',
            color = '#986a44'
        },
        techo = {
            text = 'Techno',
            link = 'Technologically powered abilities',
            symbol = '⚙️',
            color = '#e01b24'
        },
        finance = {
            text = 'Financial',
            link = 'Financially powered abilities',
            symbol = '🪙',
            color = '#fcc200'
        },
        alchemy = {
            text = 'Alchemical',
            link = 'Alchemically powered abilities',
            symbol = '🧪',
            color = '#33d17a'
        },
        unknown = {
            text = 'Unknown',
            link = 'Unknown powered abilities',
            symbol = '❓',
            color = '#77767b'
        }
    },
    category = {
        skill = {
            text = 'Skill',
            link = 'Skills',
            symbol = '🤹'
        },
        spell = {
            text = 'Spell',
            link = 'Spells',
            symbol = '✨'
        },
        semblant = {
            text = 'Semblant',
            link = 'Semblant skills',
            symbol = '🎭'
        },
        conjure = {
            text = 'Conjured',
            link = 'Conjured spells',
            symbol = '🔮'
        },
        standard = {
            text = 'Standard',
            link = 'Standard abilities',
            symbol = '🏁'
        },
    },
    effects = {
        mental = {
            text = 'Mental',
            link = 'Mental effects',
            symbol = '🧠'
        },
        truth = {
            text = 'Truth',
            link = 'Truth detecting effects',
            symbol = '⚖️'
        },
        duelMod = {
            text = 'Duel mod',
            link = 'Duel modifying effects',
            symbol = '🤺'
        },
        movement = {
            text = 'Movement',
            link = 'Movement effects',
            symbol = '👣'
        },
        displacement = {
            text = 'Displacement',
            link = 'Displacement effects',
            symbol = '🌀'
        },
        transformation = {
            text = 'Transformation',
            link = 'Transformation effects',
            symbol = '🌳'
        },
        control = {
            text = 'Control',
            link = 'Control effects',
            symbol = '⛓️'
        },
        resist = {
            text = 'Resistance',
            link = 'Resistance effects',
            symbol = '🚫'
        },
        immune = {
            text = 'Immunity',
            link = 'Immunity effects',
            symbol = '🚫'
        },
        long = {
            text = 'Long range',
            link = 'Long range effects',
            symbol = '📏'
        },
        sense = {
            text = 'Sensory',
            link = 'Sensory effects',
            symbol = '👁️'
        },
        revive = {
            text = 'Revival',
            link = 'Revival effects',
            symbol = '🤍'
        },
        summon = {
            text = 'Summoning',
            link = 'Summoning effects',
            symbol = '🖤'
        },
        heal = {
            text = 'Healing',
            link = 'Healing effects',
            symbol = '❤️'
        },
        reanimate = {
            text = 'Reanimation',
            link = 'Reanimation effects',
            symbol = '🩶'
        },
        regenerate = {
            text = 'Regeneration',
            link = 'Regeneration effects',
            symbol = '💚'
        },
        revitalize = {
            text = 'Revitalization',
            link = 'Revitalization effects',
            symbol = '🩵'
        },
        kill = {
            text = 'Killing',
            link = 'Killing effects',
            symbol = '☠️'
        },
        damage = {
            text = 'Damaging',
            link = 'Damaging effects',
            symbol = '💢'
        },
        steal = {
            text = 'Stealing',
            link = 'Stealing effects',
            symbol = '💰'
        },
        loud = {
            text = 'Loud',
            link = 'Loud effects',
            symbol = '🔊'
        },
        knockout = {
            text = 'Knockout',
            link = 'Knockout effects',
            symbol = '💤'
        },
        time = {
            text = 'Temporal',
            link = 'Temporal effects',
            symbol = '🕰️'
        },
    },
    pre = {
        strike = {
            text = 'Strike',
            link = 'Strike delivery abilities',
            symbol = '⚔️'
        },
        ray = {
            text = 'Ray',
            link = 'Ray delivery abilities',
            symbol = '⚡️'
        },
        ball = {
            text = 'Ball',
            link = 'Ball delivery abilities',
            symbol = '🔥'
        },
        aura = {
            text = 'Aura',
            link = 'Aura delivery abilities',
            symbol = '🌟'
        },
        ritual = {
            text = 'Ritual',
            link = 'Ritual delivery abilities',
            symbol = '🕯️'
        },
        touch = {
            text = 'Touch',
            link = 'Touch delivery abilities',
            symbol = '👉️'
        },
    },
    maneuver = {
        active = {
            text = 'Active',
            link = 'Active abilities',
            symbol = '➡️'
        },
        reactive = {
            text = 'Reactive',
            link = 'Reactive abilities',
            symbol = '↩️'
        },
        passive = {
            text = 'Passive',
            link = 'Passive abilities',
            symbol = '🔁'
        },
        slow = {
            text = 'Slow',
            link = 'Slow abilities',
            symbol = '🐢'
        },
    },
    interaction = {
        attack = {
            text = 'Attack',
            link = 'Attack abilities',
            symbol = '⚔️',
            color = '#ff7800'
        },
        block = {
            text = 'Block',
            link = 'Block abilities',
            symbol = '🛡️',
            color = '#ff7800'
        },
        manifest = {
            text = 'Manifest',
            link = 'Manifest abilities',
            symbol = '✳️',
            color = '#ff7800'
        },
        feat = {
            text = 'Feat',
            link = 'Feat abilities',
            symbol = '🎖️',
            color = '#ff7800'
        }
    },
    delivery = {
        self = {
            text = 'Self',
            link = 'Self delivery abilities',
            symbol = '🤲',
            color = '#f6d32d'
        },
        missile = {
            text = 'Missile',
            link = 'Missile delivery abilities',
            symbol = '🏹',
            color = '#f6d32d'
        },
        hand = {
            text = 'Hand',
            link = 'Hand delivery abilities',
            symbol = '🤚',
            color = '#f6d32d'
        },
        bite = {
            text = 'Bite',
            link = 'Bite delivery abilities',
            symbol = '🦷',
            color = '#f6d32d'
        },
        item = {
            text = 'Item',
            link = 'Item delivery abilities',
            symbol = '📦',
            color = '#f6d32d'
        },
        magelore = {
            text = 'Magelore',
            link = 'Magelore delivery abilities',
            symbol = '🔮',
            color = '#f6d32d'
        },
        weapon = {
            text = 'Weapon',
            link = 'Weapon delivery abilities',
            symbol = '🗡️',
            color = '#f6d32d'
        },
        shield = {
            text = 'Shield',
            link = 'Shield delivery abilities',
            symbol = '🛡️',
            color = '#f6d32d'
        },
        armor = {
            text = 'Armor',
            link = 'Armor delivery abilities',
            symbol = '🪖',
            color = '#f6d32d'
        },
        sight = {
            text = 'Sight',
            link = 'Sight delivery abilities',
            symbol = '👁️',
            color = '#f6d32d'
        },
        aura = {
            text = 'Aura',
            link = 'Aura delivery abilities',
            symbol = '🌟',
            color = '#f6d32d'
        },
        cone = {
            text = 'Cone',
            link = 'Cone delivery abilities',
            symbol = '🐲',
            color = '#f6d32d'
        },
        other = {
            text = 'Other',
            link = 'Other delivery abilities',
            symbol = '❓',
            color = '#f6d32d'
        }
    },
    target = {
        self = {
            text = 'Self',
            link = 'Self target abilities',
            symbol = '🤲',
            color = '#f6d32d'
        },
        creature = {
            text = 'Creature',
            link = 'Creature target abilities',
            symbol = '👤',
            color = '#f6d32d'
        },
        body = {
            text = 'Body',
            link = 'Body target abilities',
            symbol = '🧍',
            color = '#f6d32d'
        },
        vitals = {
            text = 'Vitals',
            link = 'Vitals target abilities',
            symbol = '🫀',
            color = '#f6d32d'
        },
        limb = {
            text = 'Limb',
            link = 'Limb target abilities',
            symbol = '🦾',
            color = '#f6d32d'
        },
        arm = {
            text = 'Arm',
            link = 'Arm target abilities',
            symbol = '💪',
            color = '#f6d32d'
        },
        leg = {
            text = 'Leg',
            link = 'Leg target abilities',
            symbol = '🦵',
            color = '#f6d32d'
        },
        item = {
            text = 'Item',
            link = 'Item target abilities',
            symbol = '📦',
            color = '#f6d32d'
        },
        weapon = {
            text = 'Weapon',
            link = 'Weapon target abilities',
            symbol = '🗡️',
            color = '#f6d32d'
        },
        shield = {
            text = 'Shield',
            link = 'Shield target abilities',
            symbol = '🛡️',
            color = '#f6d32d'
        },
        armor = {
            text = 'Armor',
            link = 'Armor target abilities',
            symbol = '🪖',
            color = '#f6d32d'
        },
        ship = {
            text = 'Ship',
            link = 'Ship target abilities',
            symbol = '⛵️',
            color = '#f6d32d'
        },
        attack = {
            text = 'Attack',
            link = 'Attack target abilities',
            symbol = '⚔️',
            color = '#f6d32d'
        },
        ability = {
        	text = 'Ability',
        	link = 'Ability target abilities',
        	symbol = '🅰',
        	color = '#f6d32d'
        },
        spell = {
            text = 'Spell',
            link = 'Spell target abilities',
            symbol = '💫',
            color = '#f6d32d'
        },
        other = {
            text = 'Other',
            link = 'Other target abilities',
            symbol = '❓',
            color = '#f6d32d'
        },
        area = {
            text = 'Area',
            link = 'Area target abilities',
            symbol = '🏕️',
            color = '#f6d32d',
        },
        ci = {
            tags = {
                'creature',
                'item'
            }
        },
        ai = {
            tags = {
                'attack',
                'item'
            }
        },
        aci = {
            tags = {
                'area',
                'creature',
                'item',
            }
        },
        ac = {
            tags = {
                'area',
                'creature',
            }
        },
        al = {
        	tags = {
        		'arm',
        		'leg',
        	}
        },
    },
    upgrade = {
        warded = {
            text = 'Warded',
            link = 'Warded abilities',
        },
        absolute = {
            text = 'Absolute',
            link = 'Absolute abilities',
        }
    },
    executionTime = {
        freeAction = {
            text = 'Free action',
            symbol = '0️⃣',
            link = 'Free action abilities',
        },
        singleAction = {
            text = 'Single action',
            symbol = '1️⃣',
            link = 'Single action abilities',
        },
        doubleAction = {
            text = 'Double action',
            symbol = '2️⃣',
            link = 'Double action abilities',
        },
        tripleAction = {
            text = 'Triple action',
            symbol = '3️⃣',
            link = 'Triple action abilities',
        },
        freeReaction = {
            text = 'Free reaction',
            symbol = '0️⃣',
            link = 'Free reaction abilities',
        },
        reaction = {
            text = 'Reaction',
            symbol = '1️⃣',
            link = 'Reaction abilities',
        },
        shortRest = {
            text = 'Short rest',
            symbol = '🌙',
            link = 'Short rest abilities',
        },
        longRest = {
            text = 'Long rest',
            symbol = '🌙',
            link = 'Long rest abilities',
        }
    },
    piercing = {
        av0 = {
            text = 'AV0',
            symbol = '🎯',
            link = 'AV0 abilities',
            color = '#33d17a'
        },
        unblockable = {
            text = 'UB',
            symbol = '🪨',
            link = 'UB abilities',
            color = '#33d17a'
        }
    },
    duration = {
        instant = {
            text = 'Instant',
            link = 'Instant duration abilities',
            no = true
        },
        always = {
            text = 'Always active',
            link = 'Always active duration abilities',
            no = true
        },
        whileUp = {
            text = 'While up',
            link = 'While up duration abilities',
            no = true
        },
        whileDown = {
            text = 'While down',
            link = 'While down duration abilities',
            no = true
        },
        whileAlive = {
            text = 'While alive',
            link = 'While alive duration abilities',
            no = true
        },
        whileDead = {
            text = 'While dead',
            link = 'While dead duration abilities',
            no = true
        },
        endOfTurn = {
            text = 'Until the end of the turn',
            link = 'Until end of turn duration abilities',
            no = true
        },
        dawn = {
            text = 'Until dawn',
            link = 'Until dawn duration abilities',
            no = true
        },
        startOfTargetNextTurn = {
            text = 'Until the start of target\'s next turn',
            link = 'Until start of target\'s next turn duration abilities',
            no = true
        },
        endOfTargetNextTurn = {
            text = 'Until the end of target\'s next turn',
            link = 'Until end of target\'s next turn duration abilities',
            no = true
        },
        startOfYourNextTurn = {
            text = 'Until the start of your next turn',
            link = 'Until start of your next turn duration abilities',
            no = true
        },
        endOfYourNextTurn = {
            text = 'Until the end of your next turn',
            link = 'Until end of your next turn duration abilities',
            no = true
        },
        endOfCombat = {
            text = 'Until the end of combat',
            link = 'Until end of combat duration abilities',
            no = true
        }
    },
    range = {
        melee = {
            text = 'Your melee range',
            -- link = 'Melee abilities',
            no = true
        },
        weapon = {
            text = 'Your weapon\'s range',
            -- link = 'Weapon range abilities',
            no = true
        },
        hand = {
            text = 'Your hand\'s range',
            -- link = 'Hand range abilities',
            no = true
        },
        bite = {
            text = 'Your bite\'s range',
            -- link = 'Bite range abilities',
            no = true
        },
        item = {
            text = 'Your item\'s range',
            -- link = 'Item range abilities',
            no = true
        },
        shield = {
            text = 'Your shield\'s range',
            -- link = 'Shield range abilities',
            no = true
        },
        armor = {
            text = 'Your armor\'s range',
            -- link = 'Armor range abilities',
            no = true
        },
    },
    attribute = {
        int = {
            text = 'Intelligence',
            symbol = 'INT',
            link = 'INT save abilities',
        },
        str = {
            text = 'Strength',
            symbol = 'STR',
            link = 'STR save abilities',
        },
        mov = {
            text = 'Movement',
            symbol = 'MOV',
            link = 'MOV save abilities',
        },
        per = {
            text = 'Perception',
            symbol = 'PER',
            link = 'PER save abilities',
        },
        snk = {
            text = 'Sneak',
            symbol = 'SNK',
            link = 'SNK save abilities',
        }
    },
    expansion = {
        detonate = {
            text = 'Detonate',
            symbol = '💥',
            link = 'Detonate expansion abilities',
        },
        ripple = {
            text = 'Ripple',
            symbol = '🌊',
            link = 'Ripple expansion abilities',
        },
        cascade = {
            text = 'Cascade',
            symbol = '➰',
            link = 'Cascade expansion abilities',
        },
        fork = {
            text = 'Fork',
            symbol = '🔱',
            link = 'Fork expansion abilities',
        }
    },
    sustained = {
        sustained = {
            text = 'Sustained',
            symbol = '⏳️',
            link = 'Sustained abilities',
        }
    }
}

local premades = {
    strike = {
        maneuver = 'active',
        executionTime = '1a',
        interaction = 'attack',
        delivery = 'weapon',
        target = 'creature',
        duration = 'instant',
        range = 'weapon',
    },
    ray = {
        maneuver = 'active',
        executionTime = '1a',
        interaction = 'attack',
        delivery = 'missile',
        target = 'creature',
        duration = 'instant',
        range = '60f',
        piercing = 'av0',
    },
    ball = {
        maneuver = 'active',
        executionTime = '1a',
        interaction = 'attack',
        delivery = 'missile',
        target = 'creature',
        duration = 'instant',
        range = '30f',
        piercing = 'ub',
    },
    aura = {
        skip = true,
        maneuver = 'active',
        executionTime = '1a',
        interaction = 'feat',
        delivery = 'aura',
        target = 'creature',
        duration = 'instant',
        range = '10f',
        attribute = 'mov',
    },
    ritual = {
        maneuver = 'slow',
        executionTime = '10m',
        interaction = 'manifest',
        delivery = 'sight',
        target = 'creature',
        duration = 'instant',
        range = '5f',
    },
    touch = {
        maneuver = 'active',
        executionTime = '1a',
        interaction = 'attack',
        delivery = 'hand',
        target = 'creature',
        duration = 'instant',
        range = 'hand',
        piercing = 'ub',
    },
    triumph = {
        skip = true,
        maneuver = 'reactive',
        executionTime = '0r',
        interaction = 'manifest',
        delivery = 'self',
        target = 'self',
        duration = 'instant',
        range = 'self',
    },
    self = {
        skip = true,
        maneuver = 'active',
        executionTime = '1a',
        interaction = 'man',
        delivery = 'self',
        target = 'self',
        duration = 'instant',
        range = 'self',
    },
    passive = {
        skip = true,
        maneuver = 'passive',
        interaction = 'man',
        delivery = 'self',
        target = 'self',
        duration = '4',
        range = 'self',
    },
    crown = {
        skip = true,
        maneuver = 'active',
        executionTime = '1a',
        interaction = 'man',
        delivery = 'self',
        target = 'self',
        duration = '8h',
        range = 'self',
        sustained = 'sus',
    }
}

function noPlural(word)
    -- Common irregular plural forms
    local irregulars = {
        ["children"] = "child",
        ["men"] = "man",
        ["women"] = "woman",
        ["feet"] = "foot",
        ["teeth"] = "tooth",
        ["mice"] = "mouse",
        ["geese"] = "goose"
    }

    -- Check for irregular forms
    if irregulars[word] then
        return irregulars[word]
    end

    -- Regular pluralization rules
    if word:match("ies$") then
        -- Change words ending in 'ies' to 'y' (e.g., "parties" -> "party")
        return word:sub(1, -4) .. "y"
    elseif word:match("ves$") then
        -- Change words ending in 'ves' to 'f' or 'fe' (e.g., "wolves" -> "wolf")
        return word:sub(1, -4) .. "f"
    elseif word:match("s$") and not word:match("ss$") then
        -- Remove trailing 's' (e.g., "cats" -> "cat", but keep "boss")
        return word:sub(1, -2)
    else
        -- Return the word unchanged if no pluralization rule applies
        return word
    end
end

local function addCategory(category, key, val, skill, spell, addCats, noLower)
    if addCats then
        if not noLower then
            category = category:lower()
        end
        if tags[key] and tags[key][val] then
            if tags[key][val].tags then
                out = ''
                for _, t in ipairs(tags[key][val].tags) do
                    out = out .. addCategory(category, key, t, skill, spell, addCats, true)
                end
                return out
            else
                category = tags[key][val].link
            end
        end
        if skill then
            skillCategory = category:gsub('ability', 'skill'):gsub('abilities', 'skills')
            skillCategory = skillCategory:gsub("^%l", string.upper)
        end
        if spell then
            spellCategory = category:gsub('ability', 'spell'):gsub('abilities', 'spells')
            spellCategory = spellCategory:gsub("^%l", string.upper)
        end
        category = category:gsub("^%l", string.upper)
        
        local c = '[[Category:' .. tostring(category) .. ']]'
        if skill then
            c = c .. '[[Category:' .. tostring(skillCategory) .. ']]'
        end
        if spell then
            c = c .. '[[Category:' .. tostring(spellCategory) .. ']]'
        end
        return c
    else
        return ''
    end
end

local function makeTag(frame, key, value, makeCat, transparent)
    if not tags[key] or not tags[key][value] then
        if value then
            local out = frame:preprocess("{{ucfirst:" .. tostring(value) .. "}}")
            if not ('.' == out:sub(-1)) then
                out = out .. '.'
            end
            return out
        else
            return ''
        end
    end
    local tag = tags[key][value]
    if tag.no then
        local out = frame:preprocess("{{ucfirst:" .. tag.text .. "}}")
        if not ('.' == out:sub(-1)) then
            out = out .. '.'
        end
        return out
    end
    if tag.tags then
        local out = ''
        for _, t in ipairs(tag.tags) do
            out = out .. makeTag(frame, key, t, makeCat, transparent)
        end
        return out
    end
    local tagText = "{{Tag|{{ucfirst:" .. tag.text .. "}}"
    if tag.symbol then
        tagText = tagText .. "|" .. tag.symbol
    end
    if tag.link then
        tagText = tagText .. "|l=:Category:{{ucfirst:" .. tag.link .. "}}"
    end
    if tag.color then
        tagText = tagText .. "|c=" .. tag.color
    end
    if transparent then
        tagText = tagText .. "|o=1"
    end
    tagText = tagText .. "}}"
    -- out = frame:preprocess(tagText)
    out = tagText
    return out
end

local function makeContent(frame, table, keys, makeCat)
    local content = ''
    local subContent = ''
    local hasPre = false
    for _, key in ipairs(keys) do
        if ('pre' == key and table['pre']) or ('executionTime' == key and table['executionTime']) or ('target' == key) or ('duration' == key) or ('invoked' == key and table['invoked']) then
            hasPre = true
            content = content .. frame:preprocess(makeTag(frame, key, table[key], makeCat))
        else
            if hasPre then
                subContent = subContent .. makeTag(frame, key, table[key], makeCat)
            else
                content = content .. frame:preprocess(makeTag(frame, key, table[key], makeCat))
            end
        end
    end
    if hasPre then
        content = content .. frame:preprocess('{{TagSub|' .. subContent .. '}}')
        -- content = content .. '{{TagSub|' .. subContent .. '}}'
    end
    if content == '' then
        for _, key in ipairs(keys) do
            if table[key] then
                content = frame:preprocess('{{ucfirst:' .. content .. table[key] .. '}}')
            end
        end
    end
    return content
end

local function makeBar(frame, title, content, link)
    if content == '' then
        return ''
    end
    local barTitle = mw.html.create('span')
    local barText = "{{ucfirst:" .. title .. "}}"
    if link then
        barText = "[[" .. link .. "|" .. barText .. "]]"
    end
    barText = barText .. ":"
    barTitle
        :addClass('ability-bar-title')
        :wikitext(frame:preprocess(barText))
        :css('font-weight', 'bold')
        :css('margin-right', '0.5em')
    local barContent = mw.html.create('span')
    barContent
        :addClass('ability-bar-content')
        :wikitext(content)
    local output = mw.html.create('div')
    output
        :addClass('ability-bar')
        :node(barTitle)
        :node(barContent)
    return tostring(output)
end

local function resolveAlias(args, aliases)
    local resolved = {}

    -- Resolve keys
    for canonicalKey, keyAliasList in pairs(aliases.keys) do
        for _, alias in ipairs(keyAliasList) do
            if args[alias] then
                resolved[canonicalKey] = args[alias]
                break
            end
        end
    end

    -- Resolve values
    for canonicalKey, canonicalValueTable in pairs(aliases.values) do
        local rawValue = resolved[canonicalKey]

        if rawValue then
            for canonicalValue, valueAliasList in pairs(canonicalValueTable) do
                for _, alias in ipairs(valueAliasList) do
                    if rawValue == '' then
                        resolved[canonicalKey] = false
                        break
                    elseif rawValue == alias then
                        resolved[canonicalKey] = canonicalValue
                        break
                    -- Handle patterns like timeParse or distParse
                    elseif rawValue and type(valueAliasList) == "table" and valueAliasList[1] and rawValue:match(valueAliasList[1]) then
                        if canonicalKey == "duration" or canonicalKey == "executionTime" then
                            -- Parse time duration (e.g., 5d -> "5 days")
                            local num = tonumber(rawValue:match("^(%d+)"))
                            local unit = rawValue:match("[%a]+$")
                            local unitMap = {m = "minute", h = "hour", d = "day", w = "week", y = "year", r = "round", s = "second"}
                            local parsedValue = num .. " " .. (unitMap[unit] or "unit") .. (num > 1 and "s" or "")
                            resolved[canonicalKey] = parsedValue
                        elseif canonicalKey == "range" or canonicalKey == "expansionRange" then
                            -- Parse distance (e.g., 30f -> "30 feet")
                            local num = tonumber(rawValue:match("^(%d+)"))
                            local unit = rawValue:match("[%a]+$")
                            local unitMap = {f = "feet", m = "miles"}
                            local parsedValue = num .. " " .. (unitMap[unit] or "unit")
                            resolved[canonicalKey] = parsedValue
                        end
                    end
                end
            end
        end
    end

    return resolved
end

local classFixes = {
    bar = 'ber',
    sam = 'due',
    ama = 'cor'
}

local classArchetypes = {
    ber = 'warr',
    due = 'warr',
    vet = 'warr',
    kni = 'warr',
    pal = 'warr',
    ass = 'semi',
    cor = 'semi',
    arc = 'semi',
    thi = 'semi',
    ran = 'semi',
    fla = 'mage',
    sto = 'mage',
    lif = 'mage',
    nec = 'mage',
    nat = 'mage'
}

local className = {
    ber = 'Berserker',
    due = 'Duelist',
    vet = 'Veteran',
    kni = 'Knight',
    pal = 'Paladin',
    ass = 'Assassin',
    cor = 'Corsair',
    arc = 'Archer',
    thi = 'Thief',
    ran = 'Ranger',
    fla = 'Flame Mage',
    sto = 'Storm Mage',
    lif = 'Life Mage',
    nec = 'Necromancer',
    nat = 'Nature Mage',
}

local archetypeName = {
    warr = 'Warrior',
    semi = 'Semi',
    mage = 'Mage',
}

function p.a ( frame )

    makeCat = true

    -- Figure out all the default values
    local args = frame.args
    local resolved = {}
    if args['pre'] then
        local toResolve = resolveAlias(premades[args['pre']], aliases)
        for k, v in pairs(toResolve) do
            resolved[k] = v
        end
    end
    local userResolve = resolveAlias(args, aliases)
    for k, v in pairs(userResolve) do
        resolved[k] = v
    end
    if resolved['pre'] and premades[args['pre']]['skip'] then
        resolved['pre'] = nil
    end

    if resolved['interaction'] == 'attack' then
        local dc = "Hit target's AC"
        if resolved['target'] == 'limb' then
            dc = dc .. ' + 2'
        end
        if resolved['target'] == 'arm' then
            dc = dc .. ' + 2'
        end
        if resolved['target'] == 'leg' then
            dc = dc .. ' + 2'
        end
        if resolved['target'] == 'vitals' then
            dc = dc .. ' + 5'
        end
        if resolved['target'] == 'item' then
            dc = "Hit DC [[Core:Item Target|depends on item]]"
        end
        if resolved['target'] == 'shield' then
            dc = "Hit user's {{Var:ACWielded}}"
        end
        if resolved['target'] == 'armor' then
            dc = "Hit user's {{Var:ACWorn}}"
        end
        if resolved['target'] == 'weapon' then
            dc = "Hit user's {{Var:ACWielded}}"
        end
        resolved['hitDC'] = dc
    end

    if resolved['expansionCount'] then
        if resolved['expansionCount'] == '1' then
            resolved['expansionCount'] = '{{Space}}' .. resolved['expansionCount'] .. ' extra execution.'
        else
            resolved['expansionCount'] = '{{Space}}' .. resolved['expansionCount'] .. ' extra executions.'
        end
    end

    if resolved['invoked'] then
        resolved['verbal'] = 'verbal'
        resolved['somatic'] = 'somatic'
        resolved['mage'] = 'magelore'
    end

    local skill = false
    local spell = false
    local standard = false

    local class = nil
    local classFull = nil
    local archetype = nil
    local archetypeFull = nil
    local rank = nil
    if args['class'] then
        class = args['class']
        if classFixes[class] then
            class = classFixes[class]
        end
    end
    if args['class'] or args['arch'] then
        archetype = classArchetypes[class]
        if args['arch'] then
            archetype = args['arch']
        end
        classFull = className[class]
        archetypeFull = archetypeName[archetype]
        standard = true
        if archetype == 'warr' or archetype == 'semi' then
            skill = true
        end
        if archetype == 'mage' then
            spell = true
        end
    end
    local costMP = nil
    local costHP = nil
    if args['pre'] == 'crown' then
        spell = true
        costMP = '1'
        rank = '2'
    end
    if args['rank'] then
        rank = args['rank']
    end
    
    if args['skill'] then
        skill = true
        if args['skill'] == '0' or args['skill'] == 'false' then
            skill = false
        end
    end
    if args['spell'] then
        spell = true
        if args['spell'] == '0' or args['spell'] == 'false' then
            spell = false
        end
    end
    if args['standard'] then
        standard = true
        if args['standard'] == '0' or args['standard'] == 'false' then
            standard = false
        end
    end
    if args['mp'] then
        costMP = args['mp']
    end
    if args['hp'] then
        costHP = args['hp']
    end
    if args['shatter'] then
    	costShatter = args['shatter']
    end

    local basic = false
    local journeyman = false
    if args['basic'] then
        basic = true
    end
    if args['journeyman'] or args['jm'] then
        journeyman = true
    end

    -- Category string
    local c = ''

    local name = args['name']
    local page = mw.title.getCurrentTitle().text
    local namespace = frame:preprocess('{{NAMESPACE}}')
    local addCats = ((namespace == 'Ability') and (page == name))
    c = c .. addCategory('Abilities', nil, nil, skill, spell, addCats)
    if basic then
        c = c .. addCategory('Basic abilities', 'basic', nil, skill, spell, addCats)
    end
    if journeyman then
        c = c .. addCategory('Journeyman abilities', 'journeyman', nil, skill, spell, addCats)
    end
    if standard then
        c = c .. addCategory('Standard abilities', nil, nil, false, false, addCats)
        if skill then
            c = c .. addCategory('Semblant skills', nil, nil, skill, spell, addCats)
        end
        if spell then
            c = c .. addCategory('Conjured spells', nil, nil, skill, spell, addCats)
        end
    else
        c = c .. addCategory('Nonstandard abilities', nil, nil, skill, spell, addCats)
    end
    if args['ethereal'] then
        c = c .. addCategory('Ethereal abilities', nil, nil, skill, spell, addCats)
    end
    if args['av'] then
    	c = c .. addCategory('AV granting abilities', nil, nil, skill, spell, addCats, true)
    	c = c .. addCategory('AV' .. args['av'] .. ' granting abilities', nil, nil, skill, spell, addCats, true)
    end
    if (archetype and archetypeFull) then
        c = c .. addCategory(archetypeFull .. ' archetype abilities', 'archetype', archetype, skill, spell, addCats)
    end
    if (class and classFull) then
        c = c .. addCategory(classFull .. ' class abilities', 'class', class, skill, spell, addCats, true)
    end
    if (rank and (class and classFull)) then
        if rank == '3' then
            rank = '3+'
        end
        c = c .. addCategory('Rank ' .. rank .. ' ' .. classFull .. ' abilities', 'rank', rank, skill, spell, addCats, true)
    end
    if resolved['pre'] then
        c = c .. addCategory(resolved['pre'] .. 'abilities', 'pre', resolved['pre'], skill, spell, addCats)
    end
    if resolved['interaction'] then
        c = c .. addCategory(resolved['interaction'] .. ' interaction abilities', 'interaction', resolved['interaction'], skill, spell, addCats)
    end
    if resolved['delivery'] then
        c = c .. addCategory(resolved['delivery'] .. ' delivery abilities', 'delivery', resolved['delivery'], skill, spell, addCats)
    end
    if resolved['target'] then
        c = c .. addCategory(resolved['target'] .. ' target abilities', 'target', resolved['target'], skill, spell, addCats)
    end
    if resolved['duration'] then
        c = c .. addCategory(noPlural(resolved['duration']) .. ' duration abilities', 'duration', resolved['duration'], skill, spell, addCats)
    end
    -- if resolved['range'] then
    --     c = c .. addCategory(resolved['range'] .. ' range abilities', 'range', resolved['range'], skill, spell, addCats)
    -- end
    if resolved['expansion'] then
        c = c .. addCategory(resolved['expansion'] .. ' expansion abilities', 'expansion', resolved['expansion'], skill, spell, addCats)
    end
    -- if resolved['expansionRange'] then
    --     c = c .. addCategory(resolved['expansionRange'] .. ' expansion range abilities', 'expansionRange', resolved['expansionRange'], skill, spell, addCats)
    -- end
    if resolved['attribute'] then
        c = c .. addCategory(resolved['attribute'] .. ' save abilities', 'attribute', resolved['attribute'], skill, spell, addCats)
    end
    if resolved['piercing'] then
        c = c .. addCategory(resolved['piercing'] .. ' abilities', 'piercing', resolved['piercing'], skill, spell, addCats)
    end
    if resolved['sustained'] then
        c = c .. addCategory('Sustained abilities', 'sustained', resolved['sustained'], skill, spell, addCats)
    end
    if resolved['upgrade'] then
        c = c .. addCategory(resolved['upgrade'] .. ' abilities', 'upgrade', resolved['upgrade'], skill, spell, addCats)
    end
    if resolved['executionTime'] then
        c = c .. addCategory(noPlural(resolved['executionTime']) .. ' execution time abilities', 'executionTime', resolved['executionTime'], skill, spell, addCats)
    end
    if resolved['maneuver'] then
        c = c .. addCategory(resolved['maneuver'] .. ' abilities', 'maneuver', resolved['maneuver'], skill, spell, addCats)
    end
    if resolved['verbal'] then
        c = c .. addCategory('Verbal component abilities', 'verbal', resolved['verbal'], skill, spell, addCats)
    end
    if resolved['somatic'] then
        c = c .. addCategory('Somatic component abilities', 'somatic', resolved['somatic'], skill, spell, addCats)
    end
    if resolved['material'] then
        c = c .. addCategory('Material component abilities', 'material', resolved['material'], skill, spell, addCats)
    end
    if resolved['magelore'] then
        c = c .. addCategory('Magelore component abilities', 'magelore', resolved['magelore'], skill, spell, addCats)
    end
    if resolved['invoked'] then
        c = c .. addCategory('Invoke component abilities', 'invoked', resolved['invoked'], skill, spell, addCats)
    end

    local elementContent = ''
    if args['life'] then
        elementContent = elementContent .. makeTag(frame, 'elements', 'life', makeCat)
        c = c .. addCategory('Life element abilities', 'elements', 'life', skill, spell, addCats)
    end
    if args['storm'] then
        elementContent = elementContent .. makeTag(frame, 'elements', 'storm', makeCat)
        c = c .. addCategory('Storm element abilities', 'elements', 'storm', skill, spell, addCats)
    end
    if args['necro'] then
        elementContent = elementContent .. makeTag(frame, 'elements', 'necro', makeCat)
        c = c .. addCategory('Necromancy element abilities', 'elements', 'necro', skill, spell, addCats)
    end
    if args['flame'] then
        elementContent = elementContent .. makeTag(frame, 'elements', 'flame', makeCat)
        c = c .. addCategory('Flame element abilities', 'elements', 'flame', skill, spell, addCats)
    end
    if args['nature'] then
        elementContent = elementContent .. makeTag(frame, 'elements', 'nature', makeCat)
        c = c .. addCategory('Nature element abilities', 'elements', 'nature', skill, spell, addCats)
    end

    local powerContent = ''
    if args['magic'] then
        powerContent = powerContent .. makeTag(frame, 'power', 'magic', makeCat)
        c = c .. addCategory('Magically powered abilities', 'power', 'magic', skill, spell, addCats) .. addCategory('Magical effects', nil, nil, false, false, addCats)
    end
    if args['divine'] then
        powerContent = powerContent .. makeTag(frame, 'power', 'divine', makeCat)
        c = c .. addCategory('Divinely powered abilities', 'power', 'divine', skill, spell, addCats) .. addCategory('Divine effects', nil, nil, false, false, addCats)
    end
    if args['spirit'] then
        powerContent = powerContent .. makeTag(frame, 'power', 'spirit', makeCat)
        c = c .. addCategory('Spiritually powered abilities', 'power', 'spirit', skill, spell, addCats) .. addCategory('Spiritual effects', nil, nil, false, false, addCats)
    end
    if args['primal'] then
        powerContent = powerContent .. makeTag(frame, 'power', 'primal', makeCat)
        c = c .. addCategory('Primally powered abilities', 'power', 'primal', skill, spell, addCats) .. addCategory('Primal effects', nil, nil, false, false, addCats)
    end
    if args['martial'] then
        powerContent = powerContent .. makeTag(frame, 'power', 'martial', makeCat)
        c = c .. addCategory('Martially powered abilities', 'power', 'martial', skill, spell, addCats)
    end
    if args['psionic'] then
        powerContent = powerContent .. makeTag(frame, 'power', 'psionic', makeCat)
        c = c .. addCategory('Psionically powered abilities', 'power', 'psionic', skill, spell, addCats) .. addCategory('Mental effects', nil, nil, false, false, addCats)
    end
    if args['techo'] then
        powerContent = powerContent .. makeTag(frame, 'power', 'techo', makeCat)
        c = c .. addCategory('Technologically powered abilities', 'power', 'techo', skill, spell, addCats) .. addCategory('Technological effects', nil, nil, false, false, addCats)
    end
    if args['finance'] then
        powerContent = powerContent .. makeTag(frame, 'power', 'finance', makeCat)
        c = c .. addCategory('Financially powered abilities', 'power', 'finance', skill, spell, addCats) .. addCategory('Financial effects', nil, nil, false, false, addCats)
    end
    if args['alchemy'] then
        powerContent = powerContent .. makeTag(frame, 'power', 'alchemy', makeCat)
        c = c .. addCategory('Alchemically powered abilities', 'power', 'alchemy', skill, spell, addCats) .. addCategory('Alchemical effects', nil, nil, false, false, addCats)
    end
    if args['unknown'] then
        powerContent = powerContent .. makeTag(frame, 'power', 'unknown', makeCat)
        c = c .. addCategory('Unknown powered abilities', 'power', 'unknown', skill, spell, addCats)
    end
    if standard and skill then
        powerContent = powerContent .. makeTag(frame, 'category', 'semblant', makeCat)
    end
    powerContent = powerContent .. elementContent
    if class then
        classContent = makeContent(frame, resolved, {'class'}, makeCat)
        powerContent = powerContent .. classContent
    end
    if skill then
        powerContent = powerContent .. makeTag(frame, 'category', 'skill', makeCat)
    end
    if standard and spell then
        powerContent = powerContent .. makeTag(frame, 'category', 'conjure', makeCat)
    end
    if spell then
        powerContent = powerContent .. makeTag(frame, 'category', 'spell', makeCat)
    end

    local effectContent = ''
    if args['mental'] then
        effectContent = effectContent .. makeTag(frame, 'effects', 'mental', makeCat)
        c = c .. addCategory('Mental effects', 'effect', 'mental', skill, spell, addCats)
    end
    if args['truth'] then
        effectContent = effectContent .. makeTag(frame, 'effects', 'truth', makeCat)
        c = c .. addCategory('Truth detecting effects', 'effect', 'truth', skill, spell, addCats)
    end
    if args['duelMod'] then
        effectContent = effectContent .. makeTag(frame, 'effects', 'duelMod', makeCat)
        c = c .. addCategory('Duel modifying effects', 'effect', 'duelMod', skill, spell, addCats)
    end
    if args['movement'] then
        effectContent = effectContent .. makeTag(frame, 'effects', 'movement', makeCat)
        c = c .. addCategory('Movement effects', 'effect', 'movement', skill, spell, addCats)
    end
    if args['displacement'] then
        effectContent = effectContent .. makeTag(frame, 'effects', 'displacement', makeCat)
        c = c .. addCategory('Displacement effects', 'effect', 'displacement', skill, spell, addCats)
    end
    if args['transformation'] then
        effectContent = effectContent .. makeTag(frame, 'effects', 'transformation', makeCat)
        c = c .. addCategory('Transformation effects', 'effect', 'transformation', skill, spell, addCats)
    end
    if args['control'] then
        effectContent = effectContent .. makeTag(frame, 'effects', 'control', makeCat)
        c = c .. addCategory('Control effects', 'effect', 'control', skill, spell, addCats)
    end
    if args['resist'] then
        effectContent = effectContent .. makeTag(frame, 'effects', 'resist', makeCat)
        c = c .. addCategory('Resistance effects', 'effect', 'resist', skill, spell, addCats)
    end
    if args['immune'] then
        effectContent = effectContent .. makeTag(frame, 'effects', 'immune', makeCat)
        c = c .. addCategory('Immunity effects', 'effect', 'immune', skill, spell, addCats)
    end
    if args['long'] then
        effectContent = effectContent .. makeTag(frame, 'effects', 'long', makeCat)
        c = c .. addCategory('Long range effects', 'effect', 'long', skill, spell, addCats)
    end
    if args['sense'] then
        effectContent = effectContent .. makeTag(frame, 'effects', 'sense', makeCat)
        c = c .. addCategory('Sensory effects', 'effect', 'sense', skill, spell, addCats)
    end
    if args['revive'] or args['rev'] then
        effectContent = effectContent .. makeTag(frame, 'effects', 'revive', makeCat)
        c = c .. addCategory('Revival effects', 'effect', 'revive', skill, spell, addCats)
    end
    if args['summon'] then
        effectContent = effectContent .. makeTag(frame, 'effects', 'summon', makeCat)
        c = c .. addCategory('Summoning effects', 'effect', 'summon', skill, spell, addCats)
    end
    if args['heal'] then
        effectContent = effectContent .. makeTag(frame, 'effects', 'heal', makeCat)
        c = c .. addCategory('Healing effects', 'effect', 'heal', skill, spell, addCats)
    end
    if args['reanimate'] or args['rean'] then
        effectContent = effectContent .. makeTag(frame, 'effects', 'reanimate', makeCat)
        c = c .. addCategory('Reanimation effects', 'effect', 'reanimate', skill, spell, addCats)
    end
    if args['regenerate'] or args['regen'] then
        effectContent = effectContent .. makeTag(frame, 'effects', 'regenerate', makeCat)
        c = c .. addCategory('Regeneration effects', 'effect', 'regenerate', skill, spell, addCats)
    end
    if args['revitalize'] or args['revit'] then
        effectContent = effectContent .. makeTag(frame, 'effects', 'revitalize', makeCat)
        c = c .. addCategory('Revitalization effects', 'effect', 'revitalize', skill, spell, addCats)
    end
    if args['kill'] then
        effectContent = effectContent .. makeTag(frame, 'effects', 'kill', makeCat)
        c = c .. addCategory('Killing effects', 'effect', 'kill', skill, spell, addCats)
    end
    if args['damage'] then
        effectContent = effectContent .. makeTag(frame, 'effects', 'damage', makeCat)
        c = c .. addCategory('Damaging effects', 'effect', 'damage', skill, spell, addCats)
    end
    if args['steal'] then
        effectContent = effectContent .. makeTag(frame, 'effects', 'steal', makeCat)
        c = c .. addCategory('Stealing effects', 'effect', 'steal', skill, spell, addCats)
    end
    if args['loud'] then
        effectContent = effectContent .. makeTag(frame, 'effects', 'loud', makeCat)
        c = c .. addCategory('Loud effects', 'effect', 'loud', skill, spell, addCats)
    end
    if args['knockout'] then
        effectContent = effectContent .. makeTag(frame, 'effects', 'knockout', makeCat)
        c = c .. addCategory('Knockout effects', 'effect', 'knockout', skill, spell, addCats)
    end
    if args['time'] then
        effectContent = effectContent .. makeTag(frame, 'effects', 'time', makeCat)
        c = c .. addCategory('Temporal effects', 'effect', 'time', skill, spell, addCats)
    end

    local costContent = ''
    if costMP then
        c = c .. addCategory('MP cost abilities', 'costMP', costMP, skill, spell, addCats, true)
        if costMP == 'x' then
            costContent = costContent .. frame:preprocess("{{Tag|X MP|🩵|l=:Category:MP cost abilities|c=#3584e4}}")
            c = c .. addCategory('Variable MP cost abilities', 'costMP', 'x', skill, spell, addCats, true)
        else
            costContent = costContent .. frame:preprocess("{{Tag|" .. costMP .. " MP|🩵|l=:Category:MP cost abilities|c=#3584e4}}")
            c = c .. addCategory(costMP .. ' MP cost abilities', 'costMP', costMP, skill, spell, addCats, true)
        end
    end
    if costHP then
        c = c .. addCategory('HP cost abilities', 'costHP', costHP, skill, spell, addCats, true)
        if costHP == 'x' then
            costContent = costContent .. frame:preprocess("{{Tag|X HP|❤️|l=:Category:HP cost abilities|c=#e01b24}}")
            c = c .. addCategory('Variable HP cost abilities', 'costHP', 'x', skill, spell, addCats, true)
        else
            costContent = costContent .. frame:preprocess("{{Tag|" .. costHP .. " HP|❤️|l=:Category:HP cost abilities|c=#e01b24}}")
            c = c .. addCategory(costHP .. ' HP cost abilities', 'costHP', costHP, skill, spell, addCats, true)
        end
    end
    if costShatter then
        c = c .. addCategory('Shatter cost abilities', 'costShatter', costShatter, skill, spell, addCats)
        costContent = costContent .. frame:preprocess("{{Tag|Shatter|💥|l=:Category:Shatter cost abilities}}")
    end
    if args['cost'] then
        costContent = costContent .. frame:preprocess(args['cost'])
    end

    local executionTimeTitle = 'Execution time'
    if spell then
        executionTimeTitle = 'Casting time'
    end

    local expansionContent = 'TEST'
    -- if args['ec'] or args['expCount'] or args['expansionCount'] then
    --     -- local ec = args['ec'] or args['expCount'] or args['expansionCount']
    --     -- ec = tostring(ec)
    --     local ec = '1'
    --     expansionContent = 'This ability expands ' .. ec .. ' time' .. (tonumber(ec) > 1 and 's' or '') .. '.'
    -- end

    local heightenedContent = ''
    if args['heightened'] then
        heightenedContent = heightenedContent .. 'For each additional {{L|Core|MP}} spent, ' .. args['heightened']
        -- heightenedContent = heightenedContent .. ' You can only {{L|Core|Heightening|Heighten}} if you are {{L|Core|Proficiency Bonus|Proficient}} or {{L|Core|Fluency Bonus|Fluent}} in ' .. args['name'] .. ' and only up to the corresponding bonus.'
        c = c .. addCategory('Heightened abilities', 'heightened', args['heightened'], skill, spell, addCats, true)
    end

    local proficiencyContent = ''
    if args['pro'] then
        proficiencyContent = proficiencyContent .. frame:preprocess(args['pro'])
    end

    local fluencyContent = ''
    if args['flu'] then
        fluencyContent = fluencyContent .. frame:preprocess(args['flu'])
    end

    local restrictionContent = ''
    if args['restrict'] then
        restrictionContent = restrictionContent .. frame:preprocess(args['restrict'])
    end

    local statValContent = ''
    local statFeatContent = ''
    if args['vstat'] and args['val'] then
        local vstat = frame:preprocess("{{uc:" .. args['vstat'] .. "}}")
        statValContent = 'This ability sets your {{L|Core|' .. vstat .. '}}' .. ' score to a minimum of ' .. args['val'] .. '.'
        c = c .. addCategory('Attribute setting abilities', 'val', args['val'], skill, spell, addCats, true)
        c = c .. addCategory(vstat .. ' setting abilities', 'vstat', args['vstat'], skill, spell, addCats, true)
        c = c .. addCategory(vstat .. ' value of ' .. args['val'] .. ' setting abilities', 'val', args['val'], skill, spell, addCats, true)
    end
    if args['fstat'] and (args['fflu'] or args['fpro']) then
        local f = 'proficiency'
        local fstat = frame:preprocess("{{uc:" .. args['fstat'] .. "}}")
        if args['fflu'] then
            f = 'fluency'
        end
        statFeatContent = 'This ability gives {{L|Core|' .. f .. ' Bonus|' .. f .. '}} in {{L|Core|' .. fstat .. '}} {{L|Core|Feat Interaction|Feat Saves}}.'
        c = c .. addCategory('Feat save improvement abilities', 'flu', args['fflu'], skill, spell, addCats)
        c = c .. addCategory('Feat save ' .. f .. ' granting abilities', 'fstat', args['fstat'], skill, spell, addCats, true)
        c = c .. addCategory(fstat .. ' feat save ' .. f .. ' granting abilities', 'fstat', args['fstat'], skill, spell, addCats, true)
    end
    if args['rotator'] then
        c = c .. addCategory('Rotator abilities', 'rotator', args['rotator'], skill, spell, addCats)
    end
    if args['style'] then
        c = c .. addCategory('Casting style abilities', 'style', args['style'], skill, spell, addCats)
    end
    if args['weapon'] then
        c = c .. addCategory('Weapon fighting style abilities', 'weapon', args['weapon'], skill, spell, addCats)
    end

    -- Remove range from self targeted abilities
    if resolved['target'] == 'self' or resolved['range'] == 'self' then
        resolved['range'] = nil
    end

    local barsTop = {
        -- {
        --     title = 'elements',
        --     content = frame:preprocess(elementContent)
        -- },
        {
            title = 'power sources',
            content = frame:preprocess(powerContent),
            link = 'Core:Power Sources'
        },
        {
            title = 'effect types',
            content = frame:preprocess(effectContent)
        },
        {
            title = 'delivery',
            content = makeContent(frame, resolved, {'expansion', 'pre', 'upgrade', 'piercing', 'delivery', 'interaction'}, makeCat)
        },
        {
            title = 'saving feature',
            content = makeContent(frame, resolved, {'attribute'}, makeCat)
        },
        {
            title = 'target',
            content = makeContent(frame, resolved, {'target', 'hitDC'}, makeCat)
        },
        {
            title = executionTimeTitle,
            content = makeContent(frame, resolved, {'executionTime', 'maneuver'}, makeCat)
        },
        {
            title = 'trigger',
            content = args['trigger'] or ''
        },
        {
            title = 'cost and components',
            content = frame:preprocess(costContent) .. makeContent(frame, resolved, {'material', 'invoked', 'verbal', 'somatic', 'magelore'}, makeCat)
        },
        {
            title = 'Mana cost',
            content = args['mpx'] or ''
        },
        {
            title = 'Hit cost',
            content = args['hpx'] or ''
        },
        {
            title = 'Material cost',
            content = makeContent(frame, resolved, {'matx'}, makeCat)
        },
        {
            title = 'duration',
            content = makeContent(frame, resolved, {'duration', 'sustained'}, makeCat)
        },
        {
            title = 'range',
            content = makeContent(frame, resolved, {'range'}, makeCat)
        },
        -- {
        --     title = 'expansion',
        --     content = makeContent(frame, resolved, {'expansion'}, makeCat)
        -- },
        {
            title = 'expansion range',
            content = makeContent(frame, resolved, {'expansionRange', 'expansionCount'}, makeCat)
        },
        -- {
        --     title = 'expansion count',
        --     content = frame:preprocess('TEST')
        -- },
    }

    local barsBottom = {
        {
            title = 'Requirements',
            content = makeContent(frame, resolved, {'requirement'}, makeCat)
        },
        {
            title = 'End condition',
            content = args['end'] or ''
        },
        {
            title = 'On critical hit',
            content = args['crithit'] or ''
        },
        {
            title = 'On hit',
            content = args['hit'] or ''
        },
        {
            title = 'On miss',
            content = args['miss'] or ''
        },
        {
            title = 'On critically miss',
            content = args['critmiss'] or ''
        },
        {
            title = 'On critical fail',
            content = args['critfail'] or ''
        },
        {
            title = 'On fail',
            content = args['fail'] or ''
        },
        {
            title = 'On success',
            content = args['success'] or ''
        },
        {
            title = 'On critical success',
            content = args['critsuccess'] or ''
        },
        {
            title = 'Heightened',
            content = frame:preprocess(heightenedContent)
        },
        {
            title = 'If proficient',
            content = proficiencyContent
        },
        {
            title = 'If fluent',
            content = fluencyContent
        },
        {
            title = 'Attribute improvement',
            content = frame:preprocess(statValContent)
        },
        {
            title = 'Feat save improvement',
            content = frame:preprocess(statFeatContent)
        }
    }

    local outputTop = ''
    for _, bar in ipairs(barsTop) do
        outputTop = outputTop .. makeBar(frame, bar['title'], bar['content'], bar['link'])
    end
    local outputBottom = ''

    for _, bar in ipairs(barsBottom) do
        outputBottom = outputBottom .. makeBar(frame, bar['title'], bar['content'], bar['link'])
    end

    local outputMiddle = ''
    if args['e'] then
        outputMiddle = frame:preprocess(args['e'])
    end

    local output = mw.html.create('span')
    output
        :addClass('ability-variables')
        :wikitext(outputTop)
    
    if outputMiddle ~= '' then
        output
            :wikitext('<hr>')
            :wikitext(outputMiddle)
    end

    if outputBottom ~= '' then
        output
            :wikitext('<hr>')
            :wikitext(outputBottom)
    end
    output = tostring(output) .. c
    output = output .. frame:preprocess('<templatestyles src="Template:Ability/styles.css" />')
    if not name then
        output = output .. '<span style="color: red;>NO NAME PROVIDED VERY BAD EVERY ABILITY NEEDS A NAME OKAY</span>'
    end

    return output
end

return p