Jump to content
Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module:A: Difference between revisions

From Teriock
// via Wikitext Extension for VSCode
// via Wikitext Extension for VSCode
Tag: Reverted
Line 3: Line 3:
local aliases = {
local aliases = {
     keys = {
     keys = {
         pre = {
         pre = {'pre', 'premade'},
             'pre',
        maneuver = {'man', 'maneuver', 'm'},
             'premade',
        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'
        -- },
        flaw = {'flaw', 'fl', 'f'},
        special = {'special', 'sp', 's'},
        range = {'range', 'rng', 'r'},
        attribute = {'attribute', 'attr', 'a'},
        expansion = {'expansion', 'exp'},
        expansionRange = {'expansionRange', 'er'},
        expansionCount = {'expansionCount', 'ec'},
        expansionAttribute = {'expansionAttribute', 'ea'},
        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'
         },
         },
        gp = {'gp', 'gold', 'goldPieces', 'gold pieces'},
        gpx = {'gpx', 'goldx', 'goldPiecesx', 'gold piecesx'},
        matx = {'matx', 'materialx'},
        class = {'class'}
    },
    values = {
         maneuver = {
         maneuver = {
             'man',
             active = {'ac', 'active', 'a'},
             'maneuver',
             reactive = {'re', 'reaction', 'r'},
             'm'
             passive = {'ps', 'passive', 'p'},
            slow = {'sl', 'slow', 's'}
         },
         },
         interaction = {
         interaction = {
             'int',
             attack = {'atk', 'attack', 'a'},
             'interaction',
             block = {'blk', 'block', 'b'},
             'i'
             manifest = {'man', 'manifest', 'm'},
            feat = {'fea', 'feat', 'f'}
         },
         },
         delivery = {
         delivery = {
             'del',
             self = {'sel', 'self', 's'},
             'delivery',
             missile = {'mis', 'missile', 'm'},
             'd'
             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 = {
         target = {
             'tar',
             self = {'sel', 'self', 's'},
             'target',
            creature = {'cre', 'creature', 'c'},
             't'
            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'},
            cs = {'cs', 'sc', 'creatureSelf', 'selfCreature'}
         },
         },
         duration = {
         duration = {
             'dur',
             instant = {'0', 'in', 'instant', 'i'},
             'duration',
            always = {'always', 'forever', '4', 'inf'},
             'dr'
            noLimit = {'noLimit', '1', 'nl'},
             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 = {
         upgrade = {
             'upg',
             warded = {'wrd', 'warded', 'w'},
             'upgrade',
             absolute = {'abs', 'absolute', 'a'}
            'u'
         },
         },
         executionTime = {
         executionTime = {
             'executionTime',
             freeAction = {'0a', 'freeAction', 'fa'},
             'et',
             singleAction = {'1a', 'a', 'singleAction', 'sa'},
            'x'
            doubleAction = {'2a', 'doubleAction', 'da'},
        },
            tripleAction = {'3a', 'tripleAction', 'ta'},
        piercing = {
            freeReaction = {'0r', 'freeReaction', 'fr'},
            'prc',
            reaction = {'1r', 'reaction', 'r'},
            'piercing',
             shortRest = {'sr', 'shortRest', 's'},
            'p'
            longRest = {'lr', 'longRest', 'l'},
        },
             timeParse = {'^%d+[mhdwy]$'}
        -- nearRange = {
        --    'nearRange',
        --    'nr'
        -- },
        -- farRange = {
        --    'farRange',
        --    'fr'
        -- },
        flaw = {
             'flaw',
            'fl',
            'f'
        },
        special = {
            'special',
            'sp',
             's'
         },
         },
        piercing = {av0 = {'av0', 'a'}, unblockable = {'ub', 'u'}},
         range = {
         range = {
             'range',
             melee = {'melee', 'm'},
             'rng',
            weapon = {'weapon', 'weaponReach', 'w'},
             'r'
            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 = {
         attribute = {
             'attribute',
             int = {'int', 'INT', 'i'},
             'attr',
            str = {'str', 'STR', 's'},
             'a'
            mov = {'mov', 'MOV', 'm'},
            per = {'per', 'PER', 'p'},
            snk = {'snk', 'SNK', 's'},
             unp = {'unp', 'UNP', 'u'}
        },
        expansionAttribute = {
             int = {'int', 'INT', 'i'},
            str = {'str', 'STR', 's'},
            mov = {'mov', 'MOV', 'm'},
            per = {'per', 'PER', 'p'},
            snk = {'snk', 'SNK', 's'},
            unp = {'unp', 'UNP', 'u'}
         },
         },
         expansion = {
         expansion = {
             'expansion',
             detonate = {'det', 'detonate', 'd'},
            'exp',
            ripple = {'rip', 'ripple', 'r'},
        },
            cascade = {'cas', 'cascade', 'c'},
        expansionRange = {
             fork = {'for', 'fork', 'f'}
            'expansionRange',
            'er'
        },
        expansionCount = {
            'expansionCount',
            'ec'
        },
        expansionAttribute = {
            'expansionAttribute',
            'ea'
        },
        sustained = {
            'sustained',
             'sus'
        },
        requirement = {
            'req',
            'requirement',
            'rq'
         },
         },
        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 = {
         verbal = {
             'ver',
             text = 'Verbal',
             'verbal',
             link = 'Verbal component abilities',
         },
            symbol = '🗣️',
            color = '#f9f06b',
            class = 'component-tagged verbal'
         }
    },
    somatic = {
         somatic = {
         somatic = {
             'som',
             text = 'Somatic',
             'somatic',
            link = 'Somatic component abilities',
         },
             symbol = '👐',
         material = {
            color = '#f9f06b',
             'mat',
            class = 'component-tagged somatic'
             'material',
         }
         },
    },
    material = {
         material = {
             text = 'Material',
            link = 'Material component abilities',
            symbol = '💎',
             color = '#ff7800',
            class = 'component-tagged material'
         }
    },
    magelore = {
         magelore = {
         magelore = {
             'mag',
             text = 'Magelore',
             'magelore',
             link = 'Magelore component abilities',
             'ml'
            symbol = '🔮',
         },
            color = '#f9f06b',
             class = 'component-tagged magelore'
         }
    },
    invoked = {
         invoked = {
         invoked = {
             'inv',
             text = 'Invoked',
             'invoked',
             link = 'Invoked component abilities',
             'invoke',
             symbol = '🪄',
        },
             color = '#f9f06b',
        hp = {
             class = 'component-tagged invoked'
            'hp',
         }
             'health',
    },
             'hitpoints',
    flaw = {
            'hitPoints',
         flaw = {
            'hit points',
             text = 'Flaw',
         },
             link = 'Flaw abilities',
        hpx = {
             symbol = '',
            'hpx',
             color = '#e01b24',
            'healthx',
             class = 'flaw-tagged flaw'
            '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',
        },
        gp = {
            'gp',
            'gold',
            'goldPieces',
             'gold pieces',
        },
        gpx = {
            'gpx',
             'goldx',
            'goldPiecesx',
            'gold piecesx',
        },
        matx = {
            'matx',
             'materialx',
        },
        class = {
            'class',
         },
     },
     },
     values = {
     special = {
         maneuver = {
         special = {
             active = {
             text = 'Special',
                'ac',
            link = 'Special abilities',
                'active',
            symbol = '✴️',
                'a'
             color = '#9141AC',
            },
             class = 'special-tagged special'
             reactive = {
        }
                're',
    },
                'reaction',
    es = {
                'r'
         es = {
             },
             text = 'Elder Sorcery',
            passive = {
            link = 'Elder Sorcery abilities',
                'ps',
             symbol = '🌌',
                'passive',
             color = '#9141AC',
                'p'
             class = 'elderSorcery-tagged elderSorcery'
            },
        }
            slow = {
    },
                'sl',
    warded = {
                'slow',
        warded = {
                's'
             text = 'Warded',
            }
             link = 'Warded abilities',
         },
             symbol = '🏮',
        interaction = {
             color = '#f9f06b',
             attack = {
             class = 'warded-tagged warded'
                'atk',
        }
                'attack',
    },
                'a'
    elements = {
             },
        life = {
            block = {
             text = 'Life',
                'blk',
             link = 'Life element abilities',
                'block',
             symbol = '☀️',
                'b'
             color = '#ffffff',
            },
             class = 'element-tagged life'
             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 = {
         storm = {
             self = {
             text = 'Storm',
                'sel',
             link = 'Storm element abilities',
                'self',
             symbol = '💧',
                's'
             color = '#3584e4',
            },
             class = 'element-tagged storm'
            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',
             },
            cs = {
                'cs',
                'sc',
                'creatureSelf',
                'selfCreature',
            }
         },
         },
         duration = {
         necro = {
             instant = {
             text = 'Necromancy',
                '0',
             link = 'Necromancy element abilities',
                'in',
             symbol = '💀',
                'instant',
             color = '#3d3846',
                'i'
             class = 'element-tagged necromancy'
            },
            always = {
                'always',
                'forever',
                '4',
                'inf',
            },
            noLimit = {
                'noLimit',
                '1',
                'nl',
            },
            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 = {
         flame = {
             warded = {
             text = 'Flame',
                'wrd',
            link = 'Flame element abilities',
                'warded',
            symbol = '🔥',
                'w'
             color = '#e01b24',
            },
            class = 'element-tagged flame'
             absolute = {
                'abs',
                'absolute',
                'a'
            }
         },
         },
         executionTime = {
         nature = {
             freeAction = {
             text = 'Nature',
                '0a',
            link = 'Nature element abilities',
                'freeAction',
            symbol = '🌱',
                'fa'
             color = '#33d17a',
            },
             class = 'element-tagged nature'
             singleAction = {
        }
                '1a',
    },
                'a',
    class = {
                'singleAction',
        ber = {
                'sa',
             text = 'Berserker',
             },
             link = 'Berserker class abilities',
            doubleAction = {
             symbol = '🪓',
                '2a',
             class = 'class-tagged berserker'
                '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 = {
         due = {
             av0 = {
             text = 'Duelist',
                'av0',
            link = 'Duelist class abilities',
                'a'
             symbol = '🤺',
            },
            class = 'class-tagged duelist'
             unblockable = {
                'ub',
                'u'
            }
         },
         },
         range = {
         vet = {
             melee = {
             text = 'Veteran',
                'melee',
             link = 'Veteran class abilities',
                'm'
             symbol = '🪖',
            },
             class = 'class-tagged veteran'
            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 = {
         kni = {
             int = {
             text = 'Knight',
                'int',
             link = 'Knight class abilities',
                'INT',
             symbol = '⚔️',
                'i'
             class = 'class-tagged knight'
            },
             str = {
                'str',
                'STR',
                's'
             },
            mov = {
                'mov',
                'MOV',
                'm'
             },
            per = {
                'per',
                'PER',
                'p'
            },
            snk = {
                'snk',
                'SNK',
                's'
            },
            unp = {
                'unp',
                'UNP',
                'u'
            },
         },
         },
         expansionAttribute = {
         pal = {
             int = {
             text = 'Paladin',
                'int',
             link = 'Paladin class abilities',
                'INT',
             symbol = '🛡️',
                'i'
             class = 'class-tagged paladin'
            },
             str = {
                'str',
                'STR',
                's'
             },
            mov = {
                'mov',
                'MOV',
                'm'
             },
            per = {
                'per',
                'PER',
                'p'
            },
            snk = {
                'snk',
                'SNK',
                's'
            },
            unp = {
                'unp',
                'UNP',
                'u'
            },
         },
         },
         expansion = {
         ass = {
             detonate = {
             text = 'Assassin',
                'det',
             link = 'Assassin class abilities',
                'detonate',
             symbol = '🗡️',
                'd'
             class = 'class-tagged assassin'
            },
             ripple = {
                'rip',
                'ripple',
                'r'
            },
             cascade = {
                'cas',
                'cascade',
                'c'
            },
             fork = {
                'for',
                'fork',
                'f'
            }
         },
         },
         expansionRange = {
         cor = {
             distParse = {
             text = 'Corsair',
                '^%d+[fm]$'
            link = 'Corsair class abilities',
             }
            symbol = '🏴‍☠️',
             class = 'class-tagged corsair'
         },
         },
         expansionCount = {
         arc = {
             expansionCount = {
             text = 'Archer',
                'expansionCount',
            link = 'Archer class abilities',
                'ec',
            symbol = '🏹',
             }
             class = 'class-tagged archer'
         },
         },
         sustained = {
         thi = {
             sustained = {
             text = 'Thief',
                'sus',
            link = 'Thief class abilities',
                'sustained',
            symbol = '💰️',
                's',
            class = 'class-tagged thief'
                '1',
            }
         },
         },
         verbal = {
         ran = {
             verbal = {
             text = 'Ranger',
                'ver',
            link = 'Ranger class abilities',
                'verbal',
            symbol = '🐾',
                'v',
            class = 'class-tagged ranger'
                '1',
            }
         },
         },
         somatic = {
         fla = {
             somatic = {
             text = 'Flame Mage',
                'som',
            link = 'Flame Mage class abilities',
                'somatic',
            symbol = '🧙',
                's',
            class = 'class-tagged flameMage'
                '1',
            }
         },
         },
         material = {
         sto = {
             material = {
             text = 'Storm Mage',
                'mat',
            link = 'Storm Mage class abilities',
                'material',
            symbol = '🧙',
                'm',
            class = 'class-tagged stormMage'
                '1',
            }
         },
         },
         magelore = {
         lif = {
             magelore = {
             text = 'Life Mage',
                'mag',
            link = 'Life Mage class abilities',
                'magelore',
            symbol = '🧙',
                'ml',
            class = 'class-tagged lifeMage'
                '1',
         },
            }
         nec = {
         },
             text = 'Necromancer',
         invoked = {
            link = 'Necromancer class abilities',
             invoked = {
            symbol = '🧙',
                'inv',
            class = 'class-tagged necromancer'
                'invoked',
                'i',
                '1',
            }
         },
         },
         class = {
         nat = {
             ber = {
             text = 'Nature Mage',
                'ber',
             link = 'Nature Mage class abilities',
             },
             symbol = '🧙',
            due = {
             class = 'class-tagged natureMage'
                'due',
         }
             },
     },
            vet = {
     power = {
                'vet',
         divine = {
             },
             text = 'Divine',
            kni = {
             link = 'Divinely powered abilities',
                'kni',
             symbol = '🪽',
            },
            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',
             color = '#f9f06b',
             class = 'component-tagged verbal'
             class = 'power-tagged divine'
         },
         },
    },
        magic = {
    somatic = {
            text = 'Magical',
         somatic = {
            link = 'Magically powered abilities',
             text = 'Somatic',
            symbol = '✨',
             link = 'Somatic component abilities',
            color = '#9141ac',
             symbol = '👐',
            class = 'power-tagged magical'
             color = '#f9f06b',
        },
             class = 'component-tagged somatic'
         spirit = {
             text = 'Spiritual',
             link = 'Spiritually powered abilities',
             symbol = '🪭',
             color = '#9a9996',
             class = 'power-tagged spiritual'
         },
         },
    },
         martial = {
    material = {
             text = 'Martial',
         material = {
             link = 'Martially powered abilities',
             text = 'Material',
             symbol = '💪',
             link = 'Material component abilities',
             symbol = '💎',
             color = '#ff7800',
             color = '#ff7800',
             class = 'component-tagged material'
             class = 'power-tagged martial'
         },
         },
    },
         psionic = {
    magelore = {
             text = 'Psionic',
         magelore = {
             link = 'Psionically powered abilities',
             text = 'Magelore',
             symbol = '🤯',
             link = 'Magelore component abilities',
             color = '#3584e4',
             symbol = '🔮',
             class = 'power-tagged psionic'
             color = '#f9f06b',
             class = 'component-tagged magelore'
         },
         },
    },
         primal = {
    invoked = {
             text = 'Primal',
         invoked = {
             link = 'Primally powered abilities',
             text = 'Invoked',
             symbol = '⛰️',
             link = 'Invoked component abilities',
             color = '#986a44',
             symbol = '🪄',
             class = 'power-tagged primal'
             color = '#f9f06b',
             class = 'component-tagged invoked'
         },
         },
    },
        techo = {
    flaw = {
            text = 'Technological',
         flaw = {
            link = 'Technologically powered abilities',
             text = 'Flaw',
            symbol = '⚙️',
             link = 'Flaw abilities',
            color = '#e01b24',
             symbol = '',
            class = 'power-tagged technological'
             color = '#e01b24',
        },
             class = 'flaw-tagged flaw'
         finance = {
             text = 'Financial',
             link = 'Financially powered abilities',
             symbol = '🪙',
             color = '#fcc200',
             class = 'power-tagged financial'
         },
         },
    },
         alchemy = {
    special = {
             text = 'Alchemical',
        special = {
             link = 'Alchemically powered abilities',
            text = 'Special',
             symbol = '🧪',
            link = 'Special abilities',
             color = '#33d17a',
            symbol = '✴️',
             class = 'power-tagged alchemical'
            color = '#9141AC',
            class = 'special-tagged special'
        },
    },
    es = {
         es = {
             text = 'Elder Sorcery',
             link = 'Elder Sorcery abilities',
             symbol = '🌌',
             color = '#9141AC',
             class = 'elderSorcery-tagged elderSorcery'
         },
         },
        unknown = {
            text = 'Unknown',
            link = 'Unknown powered abilities',
            symbol = '❓',
            color = '#77767b',
            class = 'power-tagged unknown'
        }
     },
     },
     warded = {
     category = {
         warded = {
         skill = {
             text = 'Warded',
             text = 'Skill',
             link = 'Warded abilities',
             link = 'Skills',
             symbol = '🏮',
             symbol = '🤹',
            color = '#f9f06b',
             class = 'skill'
             class = 'warded-tagged warded'
         },
         },
    },
         spell = {
    elements = {
             text = 'Spell',
         life = {
             link = 'Spells',
             text = 'Life',
             symbol = '',
             link = 'Life element abilities',
             class = 'spell'
             symbol = '☀️',
            color = '#ffffff',
             class = 'element-tagged life'
         },
         },
         storm = {
         semblant = {
             text = 'Storm',
             text = 'Semblant',
             link = 'Storm element abilities',
             link = 'Semblant skills',
             symbol = '💧',
             symbol = '🎭',
            color = '#3584e4',
             class = 'standard-tagged semblant'
             class = 'element-tagged storm'
         },
         },
         necro = {
         conjure = {
             text = 'Necromancy',
             text = 'Conjured',
             link = 'Necromancy element abilities',
             link = 'Conjured spells',
             symbol = '💀',
             symbol = '🔮',
            color = '#3d3846',
             class = 'standard-tagged conjure'
             class = 'element-tagged necromancy'
         },
         },
         flame = {
         standard = {
             text = 'Flame',
             text = 'Standard',
             link = 'Flame element abilities',
             link = 'Standard abilities',
             symbol = '🔥',
             symbol = '🏁',
            color = '#e01b24',
             class = 'standard-tagged normal'
            class = 'element-tagged flame'
        },
        nature = {
            text = 'Nature',
            link = 'Nature element abilities',
            symbol = '🌱',
            color = '#33d17a',
             class = 'element-tagged nature'
         },
         },
        rotator = {
            text = 'Rotator',
            link = 'Rotator abilities',
            symbol = '🔄',
            class = 'rotator'
        }
     },
     },
     class = {
     effects = {
         ber = {
         mental = {
             text = 'Berserker',
             text = 'Mental',
             link = 'Berserker class abilities',
             link = 'Mental effects',
             symbol = '🪓',
            symbol = '🧠',
             class = 'class-tagged berserker'
            class = 'effect-tagged mental'
        },
        truth = {
            text = 'Truth detecting',
            link = 'Truth detecting effects',
             symbol = '⚖️',
             class = 'effect-tagged truthDetecting'
         },
         },
         due = {
         duelMod = {
             text = 'Duelist',
             text = 'Duel modifying',
             link = 'Duelist class abilities',
             link = 'Duel modifying effects',
             symbol = '🤺',
             symbol = '🤺',
             class = 'class-tagged duelist'
             class = 'effect-tagged duelModifying'
         },
         },
         vet = {
         movement = {
             text = 'Veteran',
             text = 'Movement',
             link = 'Veteran class abilities',
             link = 'Movement effects',
             symbol = '🪖',
             symbol = '👣',
             class = 'class-tagged veteran'
             class = 'effect-tagged movement'
         },
         },
         kni = {
         poison = {
             text = 'Knight',
             text = 'Poison',
             link = 'Knight class abilities',
             link = 'Poison effects',
             symbol = '⚔️',
             symbol = '☠️',
             class = 'class-tagged knight'
             class = 'effect-tagged poison'
         },
         },
         pal = {
         displacement = {
             text = 'Paladin',
             text = 'Displacement',
             link = 'Paladin class abilities',
             link = 'Displacement effects',
             symbol = '🛡️',
             symbol = '🌀',
             class = 'class-tagged paladin'
             class = 'effect-tagged displacement'
         },
         },
         ass = {
         transformation = {
             text = 'Assassin',
             text = 'Transformation',
             link = 'Assassin class abilities',
             link = 'Transformation effects',
             symbol = '🗡️',
             symbol = '🌳',
             class = 'class-tagged assassin'
             class = 'effect-tagged transformation'
         },
         },
         cor = {
         control = {
             text = 'Corsair',
             text = 'Control',
             link = 'Corsair class abilities',
             link = 'Control effects',
             symbol = '🏴‍☠️',
             symbol = '⛓️',
             class = 'class-tagged corsair'
             class = 'effect-tagged control'
         },
         },
         arc = {
         resist = {
             text = 'Archer',
             text = 'Resistance',
             link = 'Archer class abilities',
             link = 'Resistance effects',
             symbol = '🏹',
             symbol = '🚫',
             class = 'class-tagged archer'
             class = 'effect-tagged resistance'
         },
         },
         thi = {
         awaken = {
             text = 'Thief',
             text = 'Awakening',
             link = 'Thief class abilities',
             link = 'Awakening effects',
             symbol = '💰️',
             symbol = '🌞',
             class = 'class-tagged thief'
             class = 'effect-tagged awakening'
         },
         },
         ran = {
         immune = {
             text = 'Ranger',
             text = 'Immunity',
             link = 'Ranger class abilities',
             link = 'Immunity effects',
             symbol = '🐾',
             symbol = '🚫',
             class = 'class-tagged ranger'
             class = 'effect-tagged immunity'
         },
         },
         fla = {
         long = {
             text = 'Flame Mage',
             text = 'Long range',
             link = 'Flame Mage class abilities',
             link = 'Long range effects',
             symbol = '🧙',
             symbol = '📏',
             class = 'class-tagged flameMage'
             class = 'effect-tagged longRange'
         },
         },
         sto = {
         sense = {
             text = 'Storm Mage',
             text = 'Sensory',
             link = 'Storm Mage class abilities',
             link = 'Sensory effects',
             symbol = '🧙',
             symbol = '👁️',
             class = 'class-tagged stormMage'
             class = 'effect-tagged sensory'
         },
         },
         lif = {
         revive = {
             text = 'Life Mage',
             text = 'Revival',
             link = 'Life Mage class abilities',
             link = 'Revival effects',
             symbol = '🧙',
             symbol = '🤍',
             class = 'class-tagged lifeMage'
             class = 'effect-tagged revival'
         },
         },
         nec = {
         summon = {
             text = 'Necromancer',
             text = 'Summoning',
             link = 'Necromancer class abilities',
             link = 'Summoning effects',
             symbol = '🧙',
             symbol = '🖤',
             class = 'class-tagged necromancer'
             class = 'effect-tagged summoning'
         },
         },
         nat = {
         heal = {
             text = 'Nature Mage',
             text = 'Healing',
             link = 'Nature Mage class abilities',
             link = 'Healing effects',
             symbol = '🧙',
             symbol = '❤️',
             class = 'class-tagged natureMage'
             class = 'effect-tagged healing'
         },
         },
    },
         reanimate = {
    power = {
             text = 'Reanimation',
         divine = {
             link = 'Reanimation effects',
             text = 'Divine',
             symbol = '🩶',
             link = 'Divinely powered abilities',
             class = 'effect-tagged reanimation'
             symbol = '🪽',
            color = '#f9f06b',
             class = 'power-tagged divine'
         },
         },
         magic = {
         regenerate = {
             text = 'Magical',
             text = 'Regeneration',
             link = 'Magically powered abilities',
             link = 'Regeneration effects',
             symbol = '✨',
             symbol = '💚',
            color = '#9141ac',
             class = 'effect-tagged regeneration'
             class = 'power-tagged magical'
         },
         },
         spirit = {
         revitalize = {
             text = 'Spiritual',
             text = 'Revitalization',
             link = 'Spiritually powered abilities',
             link = 'Revitalization effects',
             symbol = '🪭',
             symbol = '🩵',
            color = '#9a9996',
             class = 'effect-tagged revitalization'
             class = 'power-tagged spiritual'
         },
         },
         martial = {
         kill = {
             text = 'Martial',
             text = 'Killing',
             link = 'Martially powered abilities',
             link = 'Killing effects',
             symbol = '💪',
             symbol = '☠️',
            color = '#ff7800',
             class = 'effect-tagged killing'
             class = 'power-tagged martial'
         },
         },
         psionic = {
         damage = {
             text = 'Psionic',
             text = 'Damaging',
             link = 'Psionically powered abilities',
             link = 'Damaging effects',
             symbol = '🤯',
             symbol = '💢',
            color = '#3584e4',
             class = 'effect-tagged damaging'
             class = 'power-tagged psionic'
         },
         },
         primal = {
         steal = {
             text = 'Primal',
             text = 'Stealing',
             link = 'Primally powered abilities',
             link = 'Stealing effects',
             symbol = '⛰️',
             symbol = '💰',
            color = '#986a44',
             class = 'effect-tagged stealing'
             class = 'power-tagged primal'
         },
         },
         techo = {
         loud = {
             text = 'Technological',
             text = 'Loud',
             link = 'Technologically powered abilities',
             link = 'Loud effects',
             symbol = '⚙️',
             symbol = '🔊',
            color = '#e01b24',
             class = 'effect-tagged loud'
             class = 'power-tagged technological'
         },
         },
         finance = {
         knockout = {
             text = 'Financial',
             text = 'Knockout',
             link = 'Financially powered abilities',
             link = 'Knockout effects',
             symbol = '🪙',
             symbol = '💤',
            color = '#fcc200',
             class = 'effect-tagged knockout'
             class = 'power-tagged financial'
         },
         },
         alchemy = {
         time = {
             text = 'Alchemical',
             text = 'Temporal',
             link = 'Alchemically powered abilities',
             link = 'Temporal effects',
             symbol = '🧪',
             symbol = '🕰️',
             color = '#33d17a',
            class = 'effect-tagged temporal'
             class = 'power-tagged alchemical'
        }
    },
    pre = {
        strike = {
            text = 'Strike',
             link = 'Strike delivery abilities',
            symbol = '⚔️',
             class = 'deliveryPackage-tagged strike'
         },
         },
         unknown = {
         ray = {
             text = 'Unknown',
             text = 'Ray',
             link = 'Unknown powered abilities',
             link = 'Ray delivery abilities',
             symbol = '❓',
             symbol = '⚡️',
            color = '#77767b',
             class = 'deliveryPackage-tagged ray'
             class = 'power-tagged unknown'
         },
         },
    },
         ball = {
    category = {
             text = 'Ball',
         skill = {
             link = 'Ball delivery abilities',
             text = 'Skill',
             symbol = '🔥',
             link = 'Skills',
             class = 'deliveryPackage-tagged ball'
             symbol = '🤹',
             class = 'skill'
         },
         },
         spell = {
         aura = {
             text = 'Spell',
             text = 'Aura',
             link = 'Spells',
             link = 'Aura delivery abilities',
             symbol = '',
             symbol = '🌟',
             class = 'spell'
             class = 'deliveryPackage-tagged aura'
         },
         },
         semblant = {
         ritual = {
             text = 'Semblant',
             text = 'Ritual',
             link = 'Semblant skills',
             link = 'Ritual delivery abilities',
             symbol = '🎭',
             symbol = '🕯️',
             class = 'standard-tagged semblant'
             class = 'deliveryPackage-tagged ritual'
         },
         },
         conjure = {
         touch = {
             text = 'Conjured',
             text = 'Touch',
             link = 'Conjured spells',
             link = 'Touch delivery abilities',
             symbol = '🔮',
             symbol = '👉️',
             class = 'standard-tagged conjure'
             class = 'deliveryPackage-tagged touch'
        }
    },
    maneuver = {
        active = {
            text = 'Active',
            link = 'Active abilities',
            symbol = '➡️',
            class = 'maneuver-tagged active'
         },
         },
         standard = {
         reactive = {
             text = 'Standard',
             text = 'Reactive',
             link = 'Standard abilities',
             link = 'Reactive abilities',
             symbol = '🏁',
             symbol = '↩️',
             class = 'standard-tagged normal'
             class = 'maneuver-tagged reactive'
         },
         },
         rotator = {
         passive = {
             text = 'Rotator',
             text = 'Passive',
             link = 'Rotator abilities',
             link = 'Passive abilities',
             symbol = '🔄',
             symbol = '🔁',
             class = 'rotator'
             class = 'maneuver-tagged passive'
         },
         },
        slow = {
            text = 'Slow',
            link = 'Slow abilities',
            symbol = '🐢',
            class = 'maneuver-tagged slow'
        }
     },
     },
     effects = {
     interaction = {
         mental = {
         attack = {
             text = 'Mental',
             text = 'Attack',
             link = 'Mental effects',
             link = 'Attack abilities',
             symbol = '🧠',
             symbol = '⚔️',
             class = 'effect-tagged mental'
            color = '#ff7800',
             class = 'interaction-tagged attack'
         },
         },
         truth = {
         block = {
             text = 'Truth detecting',
             text = 'Block',
             link = 'Truth detecting effects',
             link = 'Block abilities',
             symbol = '⚖️',
             symbol = '🛡️',
             class = 'effect-tagged truthDetecting'
            color = '#ff7800',
             class = 'interaction-tagged block'
         },
         },
         duelMod = {
         manifest = {
             text = 'Duel modifying',
             text = 'Manifest',
             link = 'Duel modifying effects',
             link = 'Manifest abilities',
             symbol = '🤺',
             symbol = '✳️',
             class = 'effect-tagged duelModifying'
            color = '#ff7800',
             class = 'interaction-tagged manifest'
         },
         },
         movement = {
         feat = {
             text = 'Movement',
             text = 'Feat',
             link = 'Movement effects',
             link = 'Feat abilities',
             symbol = '👣',
             symbol = '🎖️',
             class = 'effect-tagged movement'
            color = '#ff7800',
            class = 'interaction-tagged feat'
        }
    },
    delivery = {
        self = {
            text = 'Self',
            link = 'Self delivery abilities',
            symbol = '🤲',
            color = '#f6d32d',
             class = 'delivery-tagged self'
         },
         },
         poison = {
         missile = {
             text = 'Poison',
             text = 'Missile',
             link = 'Poison effects',
             link = 'Missile delivery abilities',
             symbol = '☠️',
             symbol = '🏹',
             class = 'effect-tagged poison'
            color = '#f6d32d',
             class = 'delivery-tagged missile'
         },
         },
         displacement = {
         hand = {
             text = 'Displacement',
             text = 'Hand',
             link = 'Displacement effects',
             link = 'Hand delivery abilities',
             symbol = '🌀',
             symbol = '🤚',
             class = 'effect-tagged displacement'
            color = '#f6d32d',
             class = 'delivery-tagged hand'
         },
         },
         transformation = {
         bite = {
             text = 'Transformation',
             text = 'Bite',
             link = 'Transformation effects',
             link = 'Bite delivery abilities',
             symbol = '🌳',
             symbol = '🦷',
             class = 'effect-tagged transformation'
            color = '#f6d32d',
             class = 'delivery-tagged bite'
         },
         },
         control = {
         item = {
             text = 'Control',
             text = 'Item',
             link = 'Control effects',
             link = 'Item delivery abilities',
             symbol = '⛓️',
             symbol = '📦',
             class = 'effect-tagged control'
            color = '#f6d32d',
             class = 'delivery-tagged item'
         },
         },
         resist = {
         magelore = {
             text = 'Resistance',
             text = 'Magelore',
             link = 'Resistance effects',
             link = 'Magelore delivery abilities',
             symbol = '🚫',
             symbol = '🔮',
             class = 'effect-tagged resistance'
            color = '#f6d32d',
             class = 'delivery-tagged magelore'
         },
         },
         awaken = {
         weapon = {
             text = 'Awakening',
             text = 'Weapon',
             link = 'Awakening effects',
             link = 'Weapon delivery abilities',
             symbol = '🌞',
             symbol = '🗡️',
             class = 'effect-tagged awakening'
            color = '#f6d32d',
             class = 'delivery-tagged weapon'
         },
         },
         immune = {
         shield = {
             text = 'Immunity',
             text = 'Shield',
             link = 'Immunity effects',
             link = 'Shield delivery abilities',
             symbol = '🚫',
             symbol = '🛡️',
             class = 'effect-tagged immunity'
            color = '#f6d32d',
             class = 'delivery-tagged shield'
         },
         },
         long = {
         armor = {
             text = 'Long range',
             text = 'Armor',
             link = 'Long range effects',
             link = 'Armor delivery abilities',
             symbol = '📏',
             symbol = '🪖',
             class = 'effect-tagged longRange'
            color = '#f6d32d',
             class = 'delivery-tagged armor'
         },
         },
         sense = {
         sight = {
             text = 'Sensory',
             text = 'Sight',
             link = 'Sensory effects',
             link = 'Sight delivery abilities',
             symbol = '👁️',
             symbol = '👁️',
             class = 'effect-tagged sensory'
            color = '#f6d32d',
             class = 'delivery-tagged sight'
         },
         },
         revive = {
         aura = {
             text = 'Revival',
             text = 'Aura',
             link = 'Revival effects',
             link = 'Aura delivery abilities',
             symbol = '🤍',
             symbol = '🌟',
             class = 'effect-tagged revival'
            color = '#f6d32d',
             class = 'delivery-tagged aura'
         },
         },
         summon = {
         cone = {
             text = 'Summoning',
             text = 'Cone',
             link = 'Summoning effects',
             link = 'Cone delivery abilities',
             symbol = '🖤',
             symbol = '🐲',
             class = 'effect-tagged summoning'
            color = '#f6d32d',
             class = 'delivery-tagged cone'
         },
         },
         heal = {
         other = {
             text = 'Healing',
             text = 'Other',
             link = 'Healing effects',
             link = 'Other delivery abilities',
             symbol = '❤️',
             symbol = '❓',
             class = 'effect-tagged healing'
            color = '#f6d32d',
            class = 'delivery-tagged other'
        }
    },
    target = {
        self = {
            text = 'Self',
            link = 'Self target abilities',
            symbol = '🤲',
            color = '#f6d32d',
             class = 'target-tagged self'
         },
         },
         reanimate = {
         creature = {
             text = 'Reanimation',
             text = 'Creature',
             link = 'Reanimation effects',
             link = 'Creature target abilities',
             symbol = '🩶',
             symbol = '👤',
             class = 'effect-tagged reanimation'
            color = '#f6d32d',
             class = 'target-tagged creature'
         },
         },
         regenerate = {
         body = {
             text = 'Regeneration',
             text = 'Body',
             link = 'Regeneration effects',
             link = 'Body target abilities',
             symbol = '💚',
             symbol = '🧍',
             class = 'effect-tagged regeneration'
            color = '#f6d32d',
             class = 'target-tagged body'
         },
         },
         revitalize = {
         vitals = {
             text = 'Revitalization',
             text = 'Vitals',
             link = 'Revitalization effects',
             link = 'Vitals target abilities',
             symbol = '🩵',
             symbol = '🫀',
             class = 'effect-tagged revitalization'
            color = '#f6d32d',
             class = 'target-tagged vitals'
         },
         },
         kill = {
         limb = {
             text = 'Killing',
             text = 'Limb',
             link = 'Killing effects',
             link = 'Limb target abilities',
             symbol = '☠️',
             symbol = '🦾',
             class = 'effect-tagged killing'
            color = '#f6d32d',
             class = 'target-tagged limb'
         },
         },
         damage = {
         arm = {
             text = 'Damaging',
             text = 'Arm',
             link = 'Damaging effects',
             link = 'Arm target abilities',
             symbol = '💢',
             symbol = '💪',
             class = 'effect-tagged damaging'
            color = '#f6d32d',
             class = 'target-tagged arm'
         },
         },
         steal = {
         leg = {
             text = 'Stealing',
             text = 'Leg',
             link = 'Stealing effects',
             link = 'Leg target abilities',
             symbol = '💰',
             symbol = '🦵',
             class = 'effect-tagged stealing'
            color = '#f6d32d',
             class = 'target-tagged leg'
         },
         },
         loud = {
         item = {
             text = 'Loud',
             text = 'Item',
             link = 'Loud effects',
             link = 'Item target abilities',
             symbol = '🔊',
             symbol = '📦',
             class = 'effect-tagged loud'
            color = '#f6d32d',
             class = 'target-tagged item'
         },
         },
         knockout = {
         weapon = {
             text = 'Knockout',
             text = 'Weapon',
             link = 'Knockout effects',
             link = 'Weapon target abilities',
             symbol = '💤',
             symbol = '🗡️',
             class = 'effect-tagged knockout'
            color = '#f6d32d',
             class = 'target-tagged weapon'
         },
         },
         time = {
         shield = {
             text = 'Temporal',
             text = 'Shield',
             link = 'Temporal effects',
             link = 'Shield target abilities',
             symbol = '🕰️',
             symbol = '🛡️',
             class = 'effect-tagged temporal'
            color = '#f6d32d',
             class = 'target-tagged shield'
         },
         },
    },
         armor = {
    pre = {
             text = 'Armor',
         strike = {
             link = 'Armor target abilities',
             text = 'Strike',
             symbol = '🪖',
             link = 'Strike delivery abilities',
            color = '#f6d32d',
             symbol = '⚔️',
             class = 'target-tagged armor'
             class = 'deliveryPackage-tagged strike'
         },
         },
         ray = {
         ship = {
             text = 'Ray',
             text = 'Ship',
             link = 'Ray delivery abilities',
             link = 'Ship target abilities',
             symbol = '⚡️',
             symbol = '⛵️',
             class = 'deliveryPackage-tagged ray'
            color = '#f6d32d',
             class = 'target-tagged ship'
         },
         },
         ball = {
         attack = {
             text = 'Ball',
             text = 'Attack',
             link = 'Ball delivery abilities',
             link = 'Attack target abilities',
             symbol = '🔥',
             symbol = '⚔️',
             class = 'deliveryPackage-tagged ball'
            color = '#f6d32d',
             class = 'target-tagged attack'
         },
         },
         aura = {
         ability = {
             text = 'Aura',
             text = 'Ability',
             link = 'Aura delivery abilities',
             link = 'Ability target abilities',
             symbol = '🌟',
             symbol = '🅰',
             class = 'deliveryPackage-tagged aura'
            color = '#f6d32d',
             class = 'target-tagged ability'
         },
         },
         ritual = {
         spell = {
             text = 'Ritual',
             text = 'Spell',
             link = 'Ritual delivery abilities',
             link = 'Spell target abilities',
             symbol = '🕯️',
             symbol = '💫',
             class = 'deliveryPackage-tagged ritual'
            color = '#f6d32d',
            class = 'target-tagged spell'
        },
        other = {
            text = 'Other',
            link = 'Other target abilities',
            symbol = '❓',
            color = '#f6d32d',
             class = 'target-tagged other'
         },
         },
         touch = {
         area = {
             text = 'Touch',
             text = 'Area',
             link = 'Touch delivery abilities',
             link = 'Area target abilities',
             symbol = '👉️',
             symbol = '🏕️',
             class = 'deliveryPackage-tagged touch'
            color = '#f6d32d',
             class = 'target-tagged area'
         },
         },
        ci = {tags = {'creature', 'item'}},
        ai = {tags = {'attack', 'item'}},
        aci = {tags = {'area', 'creature', 'item'}},
        ac = {tags = {'area', 'creature'}},
        al = {tags = {'arm', 'leg'}},
        cs = {tags = {'creature', 'self'}}
     },
     },
     maneuver = {
     upgrade = {
         active = {
         warded = {
             text = 'Active',
             text = 'Warded',
             link = 'Active abilities',
             link = 'Warded abilities',
            symbol = '➡️',
             class = 'upgrade-tagged warded'
             class = 'maneuver-tagged active'
         },
         },
         reactive = {
         absolute = {
             text = 'Reactive',
             text = 'Absolute',
             link = 'Reactive abilities',
             link = 'Absolute abilities',
             symbol = '↩️',
            class = 'upgrade-tagged absolute'
             class = 'maneuver-tagged reactive'
        }
    },
    executionTime = {
        freeAction = {
            text = 'Free action',
             symbol = '0️⃣',
            link = 'Free action abilities',
             class = 'executionTime-tagged a0'
         },
         },
         passive = {
         singleAction = {
             text = 'Passive',
             text = 'Single action',
             link = 'Passive abilities',
             symbol = '1️⃣',
             symbol = '🔁',
             link = 'Single action abilities',
             class = 'maneuver-tagged passive'
             class = 'executionTime-tagged a1'
         },
         },
         slow = {
         doubleAction = {
             text = 'Slow',
             text = 'Double action',
             link = 'Slow abilities',
             symbol = '2️⃣',
             symbol = '🐢',
             link = 'Double action abilities',
             class = 'maneuver-tagged slow'
             class = 'executionTime-tagged a2'
         },
         },
    },
         tripleAction = {
    interaction = {
             text = 'Triple action',
         attack = {
             symbol = '3️⃣',
             text = 'Attack',
             link = 'Triple action abilities',
            link = 'Attack abilities',
             class = 'executionTime-tagged a3'
             symbol = '⚔️',
             color = '#ff7800',
             class = 'interaction-tagged attack'
         },
         },
         block = {
         freeReaction = {
             text = 'Block',
             text = 'Free reaction',
             link = 'Block abilities',
            symbol = '0️⃣',
             symbol = '🛡️',
             link = 'Free reaction abilities',
             color = '#ff7800',
            class = 'executionTime-tagged r0'
             class = 'interaction-tagged block'
        },
        reaction = {
            text = 'Reaction',
             symbol = '1️⃣',
             link = 'Reaction abilities',
             class = 'executionTime-tagged r1'
         },
         },
         manifest = {
         shortRest = {
             text = 'Manifest',
             text = 'Short rest',
            link = 'Manifest abilities',
             symbol = '🌙',
             symbol = '✳️',
             link = 'Short rest abilities',
             color = '#ff7800',
             class = 'executionTime-tagged shortRest'
             class = 'interaction-tagged manifest'
         },
         },
         feat = {
         longRest = {
             text = 'Feat',
             text = 'Long rest',
            link = 'Feat abilities',
             symbol = '🌙',
             symbol = '🎖️',
             link = 'Long rest abilities',
             color = '#ff7800',
             class = 'executionTime-tagged longRest'
             class = 'interaction-tagged feat'
         }
         }
     },
     },
     piercing = {
     delivery = {
         av0 = {
         self = {
             text = 'AV0',
             text = 'Self',
             symbol = '🎯',
             link = 'Self delivery abilities',
             link = 'AV0 abilities',
             symbol = '🤲',
             color = '#33d17a',
             color = '#f6d32d',
             class = 'piercing-tagged av0'
             class = 'delivery-tagged self'
         },
         },
         missile = {
         unblockable = {
             text = 'Missile',
             text = 'UB',
             link = 'Missile delivery abilities',
             symbol = '🪨',
             symbol = '🏹',
             link = 'UB abilities',
             color = '#f6d32d',
             color = '#33d17a',
             class = 'delivery-tagged missile'
             class = 'piercing-tagged ub'
        }
    },
    duration = {
        instant = {
            text = 'Instant',
            link = 'Instant duration abilities',
            no = true
         },
         },
         hand = {
         always = {
             text = 'Hand',
             text = 'Always active',
             link = 'Hand delivery abilities',
             link = 'Always active duration abilities',
             symbol = '🤚',
             no = true
            color = '#f6d32d',
            class = 'delivery-tagged hand'
         },
         },
         bite = {
         noLimit = {
             text = 'Bite',
             text = 'No limit',
             link = 'Bite delivery abilities',
             link = 'No limit duration abilities',
             symbol = '🦷',
             no = true
            color = '#f6d32d',
            class = 'delivery-tagged bite'
         },
         },
         item = {
         whileUp = {
             text = 'Item',
             text = 'While up',
             link = 'Item delivery abilities',
             link = 'While up duration abilities',
             symbol = '📦',
             no = true
            color = '#f6d32d',
            class = 'delivery-tagged item'
         },
         },
         magelore = {
         whileDown = {
             text = 'Magelore',
             text = 'While down',
             link = 'Magelore delivery abilities',
             link = 'While down duration abilities',
             symbol = '🔮',
             no = true
            color = '#f6d32d',
            class = 'delivery-tagged magelore'
         },
         },
         weapon = {
         whileAlive = {
             text = 'Weapon',
             text = 'While alive',
             link = 'Weapon delivery abilities',
             link = 'While alive duration abilities',
             symbol = '🗡️',
             no = true
            color = '#f6d32d',
            class = 'delivery-tagged weapon'
         },
         },
         shield = {
         whileDead = {
             text = 'Shield',
             text = 'While dead',
             link = 'Shield delivery abilities',
             link = 'While dead duration abilities',
             symbol = '🛡️',
             no = true
            color = '#f6d32d',
            class = 'delivery-tagged shield'
         },
         },
         armor = {
         endOfTurn = {
             text = 'Armor',
             text = 'Until the end of the turn',
             link = 'Armor delivery abilities',
             link = 'Until end of turn duration abilities',
             symbol = '🪖',
             no = true
            color = '#f6d32d',
            class = 'delivery-tagged armor'
         },
         },
         sight = {
         dawn = {
             text = 'Sight',
             text = 'Until dawn',
             link = 'Sight delivery abilities',
             link = 'Until dawn duration abilities',
             symbol = '👁️',
             no = true
            color = '#f6d32d',
            class = 'delivery-tagged sight'
         },
         },
         aura = {
         startOfTargetNextTurn = {
             text = 'Aura',
             text = 'Until the start of target\'s next turn',
             link = 'Aura delivery abilities',
             link = 'Until start of target\'s next turn duration abilities',
             symbol = '🌟',
             no = true
             color = '#f6d32d',
        },
             class = 'delivery-tagged aura'
        endOfTargetNextTurn = {
            text = 'Until the end of target\'s next turn',
             link = 'Until end of target\'s next turn duration abilities',
             no = true
         },
         },
         cone = {
         startOfYourNextTurn = {
             text = 'Cone',
             text = 'Until the start of your next turn',
             link = 'Cone delivery abilities',
             link = 'Until start of your next turn duration abilities',
             symbol = '🐲',
             no = true
            color = '#f6d32d',
            class = 'delivery-tagged cone'
         },
         },
         other = {
         endOfYourNextTurn = {
             text = 'Other',
             text = 'Until the end of your next turn',
             link = 'Other delivery abilities',
             link = 'Until end of your next turn duration abilities',
             symbol = '',
             no = true
             color = '#f6d32d',
        },
             class = 'delivery-tagged other'
        endOfCombat = {
            text = 'Until the end of combat',
             link = 'Until end of combat duration abilities',
             no = true
         }
         }
     },
     },
     target = {
     range = {
         self = {
         melee = {
             text = 'Self',
             text = 'Your melee range',
             link = 'Self target abilities',
             -- link = 'Melee abilities',
             symbol = '🤲',
             no = true
            color = '#f6d32d',
            class = 'target-tagged self'
         },
         },
         creature = {
         weapon = {
             text = 'Creature',
             text = 'Your weapon\'s range',
             link = 'Creature target abilities',
             -- link = 'Weapon range abilities',
             symbol = '👤',
             no = true
            color = '#f6d32d',
            class = 'target-tagged creature'
         },
         },
         body = {
         hand = {
             text = 'Body',
             text = 'Your hand\'s range',
             link = 'Body target abilities',
             -- link = 'Hand range abilities',
             symbol = '🧍',
             no = true
            color = '#f6d32d',
            class = 'target-tagged body'
         },
         },
         vitals = {
         bite = {
             text = 'Vitals',
             text = 'Your bite\'s range',
             link = 'Vitals target abilities',
             -- link = 'Bite range abilities',
             symbol = '🫀',
             no = true
            color = '#f6d32d',
            class = 'target-tagged vitals'
         },
         },
         limb = {
         item = {
             text = 'Limb',
             text = 'Your item\'s range',
             link = 'Limb target abilities',
             -- link = 'Item range abilities',
             symbol = '🦾',
             no = true
            color = '#f6d32d',
            class = 'target-tagged limb'
         },
         },
         arm = {
         shield = {
             text = 'Arm',
             text = 'Your shield\'s range',
             link = 'Arm target abilities',
             -- link = 'Shield range abilities',
             symbol = '💪',
             no = true
            color = '#f6d32d',
            class = 'target-tagged arm'
         },
         },
         leg = {
         armor = {
             text = 'Leg',
             text = 'Your armor\'s range',
             link = 'Leg target abilities',
             -- link = 'Armor range abilities',
             symbol = '🦵',
            no = true
             color = '#f6d32d',
        }
             class = 'target-tagged leg'
    },
    attribute = {
        int = {
            text = 'Intelligence',
             symbol = 'INT',
             link = 'INT save abilities',
             class = 'saveAttribute-tagged int'
         },
         },
         item = {
         str = {
             text = 'Item',
             text = 'Strength',
            link = 'Item target abilities',
             symbol = 'STR',
             symbol = '📦',
             link = 'STR save abilities',
             color = '#f6d32d',
             class = 'saveAttribute-tagged str'
             class = 'target-tagged item'
         },
         },
         weapon = {
         mov = {
             text = 'Weapon',
             text = 'Movement',
            link = 'Weapon target abilities',
             symbol = 'MOV',
             symbol = '🗡️',
             link = 'MOV save abilities',
             color = '#f6d32d',
             class = 'saveAttribute-tagged mov'
             class = 'target-tagged weapon'
         },
         },
         shield = {
         per = {
             text = 'Shield',
             text = 'Perception',
            link = 'Shield target abilities',
             symbol = 'PER',
             symbol = '🛡️',
             link = 'PER save abilities',
             color = '#f6d32d',
             class = 'saveAttribute-tagged per'
             class = 'target-tagged shield'
         },
         },
         armor = {
         snk = {
             text = 'Armor',
             text = 'Sneak',
            link = 'Armor target abilities',
             symbol = 'SNK',
             symbol = '🪖',
             link = 'SNK save abilities',
             color = '#f6d32d',
             class = 'saveAttribute-tagged snk'
             class = 'target-tagged armor'
         },
         },
         ship = {
         unp = {
             text = 'Ship',
             text = 'Unused Presence',
            link = 'Ship target abilities',
             symbol = 'UNP',
             symbol = '⛵️',
             link = 'UNP save abilities',
             color = '#f6d32d',
             class = 'saveAttribute-tagged unp'
             class = 'target-tagged ship'
         }
         },
    },
         attack = {
    expansionAttribute = {
             text = 'Attack',
         int = {
            link = 'Attack target abilities',
             text = 'Intelligence',
             symbol = '⚔️',
             symbol = 'INT',
             color = '#f6d32d',
             link = 'INT save abilities',
             class = 'target-tagged attack'
             class = 'expansionAttribute-tagged int'
         },
         },
         ability = {
         str = {
        text = 'Ability',
            text = 'Strength',
        link = 'Ability target abilities',
            symbol = 'STR',
        symbol = '🅰',
            link = 'STR save abilities',
        color = '#f6d32d',
             class = 'expansionAttribute-tagged str'
             class = 'target-tagged ability'
         },
         },
         spell = {
         mov = {
             text = 'Spell',
             text = 'Movement',
            link = 'Spell target abilities',
             symbol = 'MOV',
             symbol = '💫',
             link = 'MOV save abilities',
             color = '#f6d32d',
             class = 'expansionAttribute-tagged mov'
             class = 'target-tagged spell'
         },
         },
         other = {
         per = {
             text = 'Other',
             text = 'Perception',
            link = 'Other target abilities',
             symbol = 'PER',
             symbol = '',
             link = 'PER save abilities',
             color = '#f6d32d',
             class = 'expansionAttribute-tagged per'
             class = 'target-tagged other'
         },
         },
         area = {
         snk = {
             text = 'Area',
             text = 'Sneak',
            link = 'Area target abilities',
             symbol = 'SNK',
             symbol = '🏕️',
             link = 'SNK save abilities',
             color = '#f6d32d',
             class = 'expansionAttribute-tagged snk'
             class = 'target-tagged area'
         },
         },
         ci = {
         unp = {
             tags = {
             text = 'Unused Presence',
                'creature',
            symbol = 'UNP',
                'item'
             link = 'UNP save abilities',
            }
            class = 'expansionAttribute-tagged unp'
        },
        }
        ai = {
    },
             tags = {
    expansion = {
                'attack',
         detonate = {
                'item'
             text = 'Detonate',
            }
            symbol = '💥',
        },
            link = 'Detonate expansion abilities',
         aci = {
             class = 'expansion-tagged detonate'
             tags = {
                'area',
                'creature',
                'item',
             }
        },
        ac = {
            tags = {
                'area',
                'creature',
            }
         },
         },
         al = {
         ripple = {
        tags = {
            text = 'Ripple',
        'arm',
            symbol = '🌊',
        'leg',
            link = 'Ripple expansion abilities',
        }
            class = 'expansion-tagged ripple'
         },
         },
         cs = {
         cascade = {
             tags = {
             text = 'Cascade',
                'creature',
            symbol = '',
                'self',
            link = 'Cascade expansion abilities',
             }
             class = 'expansion-tagged cascade'
         },
         },
        fork = {
            text = 'Fork',
            symbol = '🔱',
            link = 'Fork expansion abilities',
            class = 'expansion-tagged fork'
        }
     },
     },
     upgrade = {
     sustained = {
         warded = {
         sustained = {
             text = 'Warded',
             text = 'Sustained',
             link = 'Warded abilities',
             symbol = '⏳️',
            class = 'upgrade-tagged warded'
             link = 'Sustained abilities',
        },
             class = 'sustained'
        absolute = {
            text = 'Absolute',
             link = 'Absolute abilities',
             class = 'upgrade-tagged absolute'
         }
         }
    }
}
local premades = {
    strike = {
        maneuver = 'active',
        executionTime = '1a',
        interaction = 'attack',
        delivery = 'weapon',
        target = 'creature',
        duration = 'instant',
        range = 'weapon'
     },
     },
     executionTime = {
     ray = {
         freeAction = {
         maneuver = 'active',
            text = 'Free action',
        executionTime = '1a',
            symbol = '0️⃣',
        interaction = 'attack',
            link = 'Free action abilities',
        delivery = 'missile',
            class = 'executionTime-tagged a0'
         target = 'creature',
        },
        duration = 'instant',
         singleAction = {
        range = '60f',
            text = 'Single action',
        piercing = 'av0'
            symbol = '1️⃣',
    },
            link = 'Single action abilities',
    ball = {
            class = 'executionTime-tagged a1'
        maneuver = 'active',
        },
        executionTime = '1a',
        doubleAction = {
        interaction = 'attack',
            text = 'Double action',
        delivery = 'missile',
            symbol = '2️⃣',
         target = 'creature',
            link = 'Double action abilities',
        duration = 'instant',
            class = 'executionTime-tagged a2'
        range = '30f',
        },
        piercing = 'ub'
         tripleAction = {
    },
            text = 'Triple action',
    aura = {
            symbol = '3️⃣',
         skip = true,
            link = 'Triple action abilities',
        maneuver = 'active',
            class = 'executionTime-tagged a3'
        executionTime = '1a',
        },
        interaction = 'feat',
         freeReaction = {
        delivery = 'aura',
            text = 'Free reaction',
         target = 'creature',
            symbol = '0️⃣',
        duration = 'instant',
            link = 'Free reaction abilities',
        range = '10f',
            class = 'executionTime-tagged r0'
        attribute = 'mov'
        },
    },
         reaction = {
    ritual = {
            text = 'Reaction',
        maneuver = 'slow',
            symbol = '1️⃣',
        executionTime = '10m',
            link = 'Reaction abilities',
        interaction = 'manifest',
            class = 'executionTime-tagged r1'
        delivery = 'sight',
        },
         target = 'creature',
        shortRest = {
        duration = 'instant',
            text = 'Short rest',
        range = '5f'
            symbol = '🌙',
            link = 'Short rest abilities',
            class = 'executionTime-tagged shortRest'
        },
         longRest = {
            text = 'Long rest',
            symbol = '🌙',
            link = 'Long rest abilities',
            class = 'executionTime-tagged longRest'
        }
     },
     },
     piercing = {
     touch = {
         av0 = {
         maneuver = 'active',
            text = 'AV0',
        executionTime = '1a',
            symbol = '🎯',
        interaction = 'attack',
            link = 'AV0 abilities',
        delivery = 'hand',
            color = '#33d17a',
        target = 'creature',
            class = 'piercing-tagged av0'
        duration = 'instant',
         },
        range = 'hand',
         unblockable = {
        piercing = 'ub'
            text = 'UB',
    },
            symbol = '🪨',
    triumph = {
            link = 'UB abilities',
         skip = true,
            color = '#33d17a',
         maneuver = 'reactive',
            class = 'piercing-tagged ub'
        executionTime = '0r',
         }
        interaction = 'manifest',
        delivery = 'self',
        target = 'self',
        duration = 'instant',
         range = 'self'
     },
     },
     duration = {
     self = {
         instant = {
         skip = true,
            text = 'Instant',
        maneuver = 'active',
            link = 'Instant duration abilities',
        executionTime = '1a',
            no = true
        interaction = 'man',
         },
         delivery = 'self',
         always = {
         target = 'self',
            text = 'Always active',
        duration = 'instant',
            link = 'Always active duration abilities',
        range = 'self'
            no = true
    },
        },
    passive = {
        noLimit = {
        skip = true,
            text = 'No limit',
        maneuver = 'passive',
            link = 'No limit duration abilities',
        interaction = 'man',
            no = true
         delivery = 'self',
        },
        target = 'self',
         whileUp = {
         duration = '4',
            text = 'While up',
        range = 'self'
            link = 'While up duration abilities',
    },
            no = true
    crown = {
         },
         skip = true,
        whileDown = {
         maneuver = 'active',
            text = 'While down',
        executionTime = '1a',
            link = 'While down duration abilities',
        interaction = 'man',
            no = true
         delivery = 'self',
         },
        target = 'self',
         whileAlive = {
        duration = '8h',
            text = 'While alive',
         range = 'self',
            link = 'While alive duration abilities',
        sustained = 'sus'
            no = true
    }
        },
}
         whileDead = {
 
            text = 'While dead',
function noPlural(word)
            link = 'While dead duration abilities',
    -- Common irregular plural forms
            no = true
    local irregulars = {
        },
        ["children"] = "child",
         endOfTurn = {
        ["men"] = "man",
            text = 'Until the end of the turn',
        ["women"] = "woman",
            link = 'Until end of turn duration abilities',
         ["feet"] = "foot",
            no = true
         ["teeth"] = "tooth",
        },
        ["mice"] = "mouse",
        dawn = {
        ["geese"] = "goose"
            text = 'Until dawn',
    }
            link = 'Until dawn duration abilities',
 
            no = true
    -- Check for irregular forms
         },
    if irregulars[word] then return irregulars[word] end
         startOfTargetNextTurn = {
 
            text = 'Until the start of target\'s next turn',
    -- Regular pluralization rules
            link = 'Until start of target\'s next turn duration abilities',
    if word:match("ies$") then
            no = true
        -- Change words ending in 'ies' to 'y' (e.g., "parties" -> "party")
         },
         return word:sub(1, -4) .. "y"
         endOfTargetNextTurn = {
    elseif word:match("ves$") then
            text = 'Until the end of target\'s next turn',
         -- Change words ending in 'ves' to 'f' or 'fe' (e.g., "wolves" -> "wolf")
            link = 'Until end of target\'s next turn duration abilities',
         return word:sub(1, -4) .. "f"
            no = true
    elseif word:match("s$") and not word:match("ss$") then
         },
         -- Remove trailing 's' (e.g., "cats" -> "cat", but keep "boss")
         startOfYourNextTurn = {
        return word:sub(1, -2)
            text = 'Until the start of your next turn',
    else
            link = 'Until start of your next turn duration abilities',
         -- Return the word unchanged if no pluralization rule applies
            no = true
         return word
         },
    end
         endOfYourNextTurn = {
end
            text = 'Until the end of your next turn',
 
            link = 'Until end of your next turn duration abilities',
local function addCategory(category, key, val, skill, spell, addCats, noLower)
            no = true
    if addCats then
         },
         if not noLower then category = category:lower() end
         endOfCombat = {
         if tags[key] and tags[key][val] then
             text = 'Until the end of combat',
             if tags[key][val].tags then
            link = 'Until end of combat duration abilities',
                out = ''
            no = true
                for _, t in ipairs(tags[key][val].tags) do
        }
                    out = out ..
    },
                              addCategory(category, key, t, skill, spell,
    range = {
                                          addCats, true)
         melee = {
                end
             text = 'Your melee range',
                return out
            -- link = 'Melee abilities',
            else
             no = true
                category = tags[key][val].link
         },
            end
         weapon = {
        end
             text = 'Your weapon\'s range',
         if skill then
            -- link = 'Weapon range abilities',
             skillCategory = category:gsub('ability', 'skill'):gsub('abilities',
             no = true
                                                                  'skills')
         },
             skillCategory = skillCategory:gsub("^%l", string.upper)
         hand = {
         end
            text = 'Your hand\'s range',
         if spell then
             -- link = 'Hand range abilities',
             spellCategory = category:gsub('ability', 'spell'):gsub('abilities',
            no = true
                                                                  'spells')
         },
             spellCategory = spellCategory:gsub("^%l", string.upper)
         bite = {
         end
             text = 'Your bite\'s range',
         category = category:gsub("^%l", string.upper)
            -- link = 'Bite range abilities',
 
            no = true
        local c = '[[Category:' .. tostring(category) .. ']]'
         },
        if skill then
        item = {
             c = c .. '[[Category:' .. tostring(skillCategory) .. ']]'
             text = 'Your item\'s range',
         end
            -- link = 'Item range abilities',
         if spell then
             no = true
             c = c .. '[[Category:' .. tostring(spellCategory) .. ']]'
         },
        end
        shield = {
        return c
             text = 'Your shield\'s range',
    else
            -- link = 'Shield range abilities',
        return ''
            no = true
    end
         },
end
         armor = {
 
            text = 'Your armor\'s range',
local function makeTag(frame, key, value, makeCat, transparent)
            -- link = 'Armor range abilities',
    if not tags[key] or not tags[key][value] then
             no = true
         if value then
         },
            local out =
     },
                frame:preprocess("{{ucfirst:" .. tostring(value) .. "}}")
     attribute = {
             if not ('.' == out:sub(-1)) then out = out .. '.' end
         int = {
             return out
            text = 'Intelligence',
         else
            symbol = 'INT',
             return ''
            link = 'INT save abilities',
        end
            class = 'saveAttribute-tagged int'
    end
        },
    local tag = tags[key][value]
        str = {
    if tag.no then
            text = 'Strength',
         local out = frame:preprocess("{{ucfirst:" .. tag.text .. "}}")
            symbol = 'STR',
         if not ('.' == out:sub(-1)) then out = out .. '.' end
            link = 'STR save abilities',
        return out
            class = 'saveAttribute-tagged str'
    end
        },
    if tag.tags then
         mov = {
        local out = ''
            text = 'Movement',
        for _, t in ipairs(tag.tags) do
             symbol = 'MOV',
             out = out .. makeTag(frame, key, t, makeCat, transparent)
             link = 'MOV save abilities',
        end
            class = 'saveAttribute-tagged mov'
         return out
        },
    end
        per = {
     local tagText = "{{Tag|{{ucfirst:" .. tag.text .. "}}"
             text = 'Perception',
     if tag.symbol then tagText = tagText .. "|" .. tag.symbol end
            symbol = 'PER',
    if tag.link then
             link = 'PER save abilities',
         tagText = tagText .. "|l=:Category:{{ucfirst:" .. tag.link .. "}}"
             class = 'saveAttribute-tagged per'
    end
        },
    if tag.color then tagText = tagText .. "|c=" .. tag.color end
         snk = {
    if tag.class then tagText = tagText .. "|class=" .. tag.class end
             text = 'Sneak',
    if transparent then tagText = tagText .. "|o=1" end
             symbol = 'SNK',
    tagText = tagText .. "}}"
             link = 'SNK save abilities',
    -- out = frame:preprocess(tagText)
            class = 'saveAttribute-tagged snk'
    out = tagText
        },
    return out
        unp = {
end
            text = 'Unused Presence',
 
             symbol = 'UNP',
local function makeContent(frame, table, keys, makeCat)
            link = 'UNP save abilities',
    local content = ''
             class = 'saveAttribute-tagged unp'
    local subContent = ''
         },
    local hasPre = false
     },
    for _, key in ipairs(keys) do
     expansionAttribute = {
         if ('pre' == key and table['pre']) or
        int = {
             ('executionTime' == key and table['executionTime']) or
            text = 'Intelligence',
             ('target' == key) or ('duration' == key) or
            symbol = 'INT',
             ('invoked' == key and table['invoked']) then
            link = 'INT save abilities',
             hasPre = true
            class = 'expansionAttribute-tagged int'
             content = content ..
        },
                          frame:preprocess(
        str = {
                              makeTag(frame, key, table[key], makeCat))
            text = 'Strength',
         else
            symbol = 'STR',
             if hasPre then
            link = 'STR save abilities',
                subContent = subContent ..
            class = 'expansionAttribute-tagged str'
                                makeTag(frame, key, table[key], makeCat)
        },
             else
        mov = {
                content = content ..
            text = 'Movement',
                              frame:preprocess(
            symbol = 'MOV',
                                  makeTag(frame, key, table[key], makeCat))
            link = 'MOV save abilities',
             end
            class = 'expansionAttribute-tagged mov'
        end
        },
    end
        per = {
    if hasPre then
            text = 'Perception',
        content = content .. frame:preprocess('{{TagSub|' .. subContent .. '}}')
            symbol = 'PER',
        -- content = content .. '{{TagSub|' .. subContent .. '}}'
            link = 'PER save abilities',
    end
            class = 'expansionAttribute-tagged per'
    if content == '' then
        },
        for _, key in ipairs(keys) do
         snk = {
             if table[key] then
            text = 'Sneak',
                content = frame:preprocess(
             symbol = 'SNK',
                              '{{ucfirst:' .. content .. table[key] .. '}}')
            link = 'SNK save abilities',
             end
            class = 'expansionAttribute-tagged snk'
         end
         },
    end
        unp = {
     return content
            text = 'Unused Presence',
end
             symbol = 'UNP',
 
            link = 'UNP save abilities',
local function makeBar(frame, title, content, link, flags, bottom)
            class = 'expansionAttribute-tagged unp'
     if content == '' then return '' end
        },
    local barSpace = mw.html.create('span')
     },
    barSpace:wikitext(frame:preprocess(' ')):css('display', 'none')
     expansion = {
    local barTitle = mw.html.create('span')
        detonate = {
    local barTitleClass = "{{lc:" .. title .. "}}"
            text = 'Detonate',
    barTitleClass = barTitleClass:gsub(' ', '-')
            symbol = '💥',
    barTitleClass = barTitleClass:gsub('\'', '')
             link = 'Detonate expansion abilities',
    barTitleClass = barTitleClass:gsub('\"', '')
             class = 'expansion-tagged detonate'
    local barText = "{{ucfirst:" .. title .. "}}"
         },
    if link then barText = "[[" .. link .. "|" .. barText .. "]]" end
         ripple = {
    barText = barText .. ":"
             text = 'Ripple',
    barTitle:addClass('ability-bar-title'):wikitext(frame:preprocess(barText))
            symbol = '🌊',
        :css('font-weight', 'bold'):css('margin-right', '0.5em')
            link = 'Ripple expansion abilities',
    local barContent = mw.html.create('span')
            class = 'expansion-tagged ripple'
    barContent:addClass('ability-bar-content'):wikitext(content)
        },
    local output = mw.html.create('div')
        cascade = {
    if bottom then output = mw.html.create('span') end
            text = 'Cascade',
    if not flags then flags = {} end
            symbol = '➰',
    for k, v in pairs(flags) do
            link = 'Cascade expansion abilities',
         if type(v) == 'string' then
            class = 'expansion-tagged cascade'
             output:addClass('flag-' .. k .. '-' .. v)
        },
        end
        fork = {
    end
            text = 'Fork',
    output:addClass('ability-bar'):addClass('ability-bar-' .. barTitleClass)
            symbol = '🔱',
         :attr(flags):attr('test', 'out'):node(barSpace):node(barTitle):node(
            link = 'Fork expansion abilities',
             barSpace):node(barContent):css('display', 'block')
            class = 'expansion-tagged fork'
    -- if flags then
        }
    -- for k, v in ipairs(flags) do
    },
     --    output:attr(k, v)
    sustained = {
    -- end
        sustained = {
     -- end
            text = 'Sustained',
    return tostring(output)
             symbol = '⏳️',
end
            link = 'Sustained abilities',
 
            class = 'sustained'
local function nonempty(v)
        }
    if v == nil then return false end
    }
    if type(v) ~= 'string' then return true end
}
    return mw.text.trim(v) ~= ''
end
 
local function resolveAlias(args, aliases)
    local resolved = {}
 
    -- Resolve keys
    for canonicalKey, keyAliasList in pairs(aliases.keys) do
        for _, alias in ipairs(keyAliasList) do
             local v = args[alias]
             if nonempty(v) then
                resolved[canonicalKey] = v
                break
            end
        end
    end
 
    -- Resolve values
    for canonicalKey, canonicalValueTable in pairs(aliases.values) do
        local rawValue = resolved[canonicalKey]
 
         -- Treat empty/whitespace as false
         if rawValue ~= nil and not nonempty(rawValue) then
             resolved[canonicalKey] = false
        elseif rawValue ~= nil then
            for canonicalValue, valueAliasList in pairs(canonicalValueTable) do
                for _, alias in ipairs(valueAliasList) do
                    if rawValue == alias then
                        resolved[canonicalKey] = canonicalValue
                        break
                    elseif type(valueAliasList) == "table" and valueAliasList[1] and
                        type(rawValue) == "string" and
                        rawValue:match(valueAliasList[1]) then
                        -- (keep your existing time/range parsing here unchanged)
                        if canonicalKey == "duration" or canonicalKey ==
                            "executionTime" then
                            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"
                            }
                            resolved[canonicalKey] = unitMap[unit] and
                                                        (num .. " " ..
                                                            unitMap[unit] ..
                                                            (num > 1 and "s" or
                                                                "")) or
                                                        rawValue
                        elseif canonicalKey == "range" or canonicalKey ==
                            "expansionRange" then
                            local num = tonumber(rawValue:match("^(%d+)"))
                            local unit = rawValue:match("[%a]+$")
                            local unitMap = {f = "feet", m = "miles"}
                            resolved[canonicalKey] = unitMap[unit] and
                                                        (num .. " " ..
                                                            unitMap[unit]) or
                                                        rawValue
                        end
                    end
                end
             end
        end
    end
 
    return resolved
end
 
local classFixes = {bar = 'ber', sam = 'due', ama = 'cor'}


local premades = {
local classArchetypes = {
     strike = {
     ber = 'warr',
        maneuver = 'active',
    due = 'warr',
        executionTime = '1a',
    vet = 'warr',
        interaction = 'attack',
    kni = 'warr',
        delivery = 'weapon',
    pal = 'warr',
        target = 'creature',
    ass = 'semi',
        duration = 'instant',
    cor = 'semi',
        range = 'weapon',
     arc = 'semi',
     },
    thi = 'semi',
    ray = {
    ran = 'semi',
        maneuver = 'active',
    fla = 'mage',
        executionTime = '1a',
    sto = 'mage',
        interaction = 'attack',
    lif = 'mage',
        delivery = 'missile',
    nec = 'mage',
        target = 'creature',
    nat = 'mage'
        duration = 'instant',
}
        range = '60f',
 
        piercing = 'av0',
local className = {
    },
    ber = 'Berserker',
    ball = {
    due = 'Duelist',
        maneuver = 'active',
    vet = 'Veteran',
        executionTime = '1a',
    kni = 'Knight',
        interaction = 'attack',
    pal = 'Paladin',
        delivery = 'missile',
    ass = 'Assassin',
        target = 'creature',
    cor = 'Corsair',
        duration = 'instant',
    arc = 'Archer',
        range = '30f',
     thi = 'Thief',
        piercing = 'ub',
    ran = 'Ranger',
     },
    fla = 'Flame Mage',
    aura = {
    sto = 'Storm Mage',
        skip = true,
    lif = 'Life Mage',
        maneuver = 'active',
    nec = 'Necromancer',
        executionTime = '1a',
    nat = 'Nature Mage'
        interaction = 'feat',
}
        delivery = 'aura',
 
        target = 'creature',
local archetypeName = {warr = 'Warrior', semi = 'Semi', mage = 'Mage'}
        duration = 'instant',
 
        range = '10f',
function p.a(frame)
        attribute = 'mov',
 
    },
    makeCat = true
    ritual = {
 
        maneuver = 'slow',
    -- Figure out all the default values
        executionTime = '10m',
    -- Prefer parent args if invoked via a template
        interaction = 'manifest',
    local parent = frame:getParent()
        delivery = 'sight',
    local rawArgs = parent and parent.args or frame.args
        target = 'creature',
 
        duration = 'instant',
    -- Drop empty/whitespace-only values so "" behaves like false/nil
        range = '5f',
    local args = {}
     },
     for k, v in pairs(rawArgs) do if nonempty(v) then args[k] = v end end
     touch = {
     local resolved = {}
        maneuver = 'active',
    if args['pre'] then
         executionTime = '1a',
         local toResolve = resolveAlias(premades[args['pre']], aliases)
         interaction = 'attack',
         for k, v in pairs(toResolve) do resolved[k] = v end
        delivery = 'hand',
    end
        target = 'creature',
    local userResolve = resolveAlias(args, aliases)
        duration = 'instant',
    for k, v in pairs(userResolve) do resolved[k] = v end
        range = 'hand',
    if resolved['pre'] and premades[args['pre']]['skip'] then
         piercing = 'ub',
         resolved['pre'] = nil
     },
     end
     triumph = {
     if not resolved['duration'] then resolved['duration'] = 'instant' end
        skip = true,
 
        maneuver = 'reactive',
    if resolved['interaction'] == 'attack' then
        executionTime = '0r',
         local dc = "Hit target's {{AC}}"
        interaction = 'manifest',
         if resolved['target'] == 'limb' then
         delivery = 'self',
            dc = "Hit target's {{Var:ACLimb}}"
         target = 'self',
         end
        duration = 'instant',
         if resolved['target'] == 'arm' then
        range = 'self',
            dc = "Hit target's {{Var:ACLimb}}"
    },
         end
    self = {
         if resolved['target'] == 'leg' then
         skip = true,
            dc = "Hit target's {{Var:ACLimb}}"
         maneuver = 'active',
         end
        executionTime = '1a',
         if resolved['target'] == 'vitals' then
        interaction = 'man',
            dc = "Hit target's {{Var:ACVitals}}"
         delivery = 'self',
         end
         target = 'self',
         if resolved['target'] == 'item' then
        duration = 'instant',
            dc = "Hit DC [[Core:Item Target|depends on item]]"
        range = 'self',
         end
    },
         if resolved['target'] == 'shield' then
    passive = {
            dc = "Hit user's {{Var:ACWielded}}"
         skip = true,
         end
         maneuver = 'passive',
         if resolved['target'] == 'armor' then
        interaction = 'man',
            dc = "Hit user's {{Var:ACWorn}}"
        delivery = 'self',
         end
         target = 'self',
         if resolved['target'] == 'weapon' then
         duration = '4',
            dc = "Hit user's {{Var:ACWielded}}"
        range = 'self',
         end
    },
         resolved['hitDC'] = dc
    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
     end


     -- Regular pluralization rules
     if resolved['expansionCount'] then
    if word:match("ies$") then
        if resolved['expansionCount'] == '1' then
        -- Change words ending in 'ies' to 'y' (e.g., "parties" -> "party")
            resolved['expansionCount'] = '{{Space}}' ..
        return word:sub(1, -4) .. "y"
                                            resolved['expansionCount'] ..
    elseif word:match("ves$") then
                                            ' extra execution.'
         -- Change words ending in 'ves' to 'f' or 'fe' (e.g., "wolves" -> "wolf")
         else
         return word:sub(1, -4) .. "f"
            resolved['expansionCount'] = '{{Space}}' ..
     elseif word:match("s$") and not word:match("ss$") then
                                            resolved['expansionCount'] ..
         -- Remove trailing 's' (e.g., "cats" -> "cat", but keep "boss")
                                            ' extra executions.'
         return word:sub(1, -2)
         end
    else
    end
         -- Return the word unchanged if no pluralization rule applies
 
        return word
     if resolved['invoked'] then
         resolved['verbal'] = 'verbal'
         resolved['somatic'] = 'somatic'
         resolved['mage'] = 'magelore'
     end
     end
end


local function addCategory(category, key, val, skill, spell, addCats, noLower)
    local skill = false
     if addCats then
     local spell = false
        if not noLower then
    local standard = false
            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)
    local class = nil
     if not tags[key] or not tags[key][value] then
    local classFull = nil
        if value then
     local archetype = nil
            local out = frame:preprocess("{{ucfirst:" .. tostring(value) .. "}}")
    local archetypeFull = nil
            if not ('.' == out:sub(-1)) then
    local rank = nil
                out = out .. '.'
    if args['class'] then
            end
        class = args['class']
            return out
         if classFixes[class] then class = classFixes[class] end
        else
            return ''
         end
     end
     end
     local tag = tags[key][value]
     if args['class'] or args['arch'] then
    if tag.no then
        archetype = classArchetypes[class]
         local out = frame:preprocess("{{ucfirst:" .. tag.text .. "}}")
        if args['arch'] then archetype = args['arch'] end
         if not ('.' == out:sub(-1)) then
        classFull = className[class]
            out = out .. '.'
        archetypeFull = archetypeName[archetype]
        end
         standard = true
        return out
         if archetype == 'warr' or archetype == 'semi' then skill = true end
        if archetype == 'mage' then spell = true end
     end
     end
     if tag.tags then
    local costMP = nil
         local out = ''
    local costHP = nil
         for _, t in ipairs(tag.tags) do
    local costGP = nil
             out = out .. makeTag(frame, key, t, makeCat, transparent)
     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
        return out
     end
     end
     local tagText = "{{Tag|{{ucfirst:" .. tag.text .. "}}"
     if args['spell'] then
    if tag.symbol then
        spell = true
         tagText = tagText .. "|" .. tag.symbol
        if args['spell'] == '0' or args['spell'] == 'false' then
            spell = false
         end
     end
     end
     if tag.link then
     if args['standard'] then
         tagText = tagText .. "|l=:Category:{{ucfirst:" .. tag.link .. "}}"
         standard = true
        if args['standard'] == '0' or args['standard'] == 'false' then
            standard = false
        end
     end
     end
     if tag.color then
     if args['mp'] then costMP = args['mp'] end
        tagText = tagText .. "|c=" .. tag.color
     if args['hp'] then costHP = args['hp'] end
     end
     if args['gp'] then costGP = args['gp'] end
     if tag.class then
     if args['shatter'] then costShatter = args['shatter'] end
        tagText = tagText .. "|class=" .. tag.class
 
    end
    local basic = false
     if transparent then
    local journeyman = false
        tagText = tagText .. "|o=1"
     if args['basic'] then basic = true end
     end
     if args['journeyman'] or args['jm'] then journeyman = true end
     tagText = tagText .. "}}"
 
     -- out = frame:preprocess(tagText)
     -- Category string
     out = tagText
     local c = ''
    return out
end


local function makeContent(frame, table, keys, makeCat)
    local name = args['name']
     local content = ''
     local page = mw.title.getCurrentTitle().text
     local subContent = ''
     local namespace = frame:preprocess('{{NAMESPACE}}')
     local hasPre = false
     local addCats = ((namespace == 'Ability') and (page == name))
    for _, key in ipairs(keys) do
    c = c .. addCategory('Abilities', nil, nil, skill, spell, addCats)
        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
    if basic then
            hasPre = true
        c = c ..
            content = content .. frame:preprocess(makeTag(frame, key, table[key], makeCat))
                addCategory('Basic abilities', 'basic', nil, skill, spell,
        else
                            addCats)
            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
     end
     if hasPre then
     if journeyman then
         content = content .. frame:preprocess('{{TagSub|' .. subContent .. '}}')
         c = c ..
        -- content = content .. '{{TagSub|' .. subContent .. '}}'
                addCategory('Journeyman abilities', 'journeyman', nil, skill,
                            spell, addCats)
     end
     end
     if content == '' then
     if standard then
        for _, key in ipairs(keys) do
        c = c ..
            if table[key] then
                addCategory('Standard abilities', nil, nil, false, false,
                content = frame:preprocess('{{ucfirst:' .. content .. table[key] .. '}}')
                            addCats)
            end
        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
         end
    else
        c = c ..
                addCategory('Nonstandard abilities', nil, nil, skill, spell,
                            addCats)
     end
     end
     return content
     if args['ethereal'] then
end
        c = c ..
 
                addCategory('Ethereal abilities', nil, nil, skill, spell,
local function makeBar(frame, title, content, link, flags, bottom)
                            addCats)
     if content == '' then
    end
         return ''
     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
     end
     local barSpace = mw.html.create('span')
     if (archetype and archetypeFull) then
    barSpace
         c = c ..
         :wikitext(frame:preprocess(' '))
                addCategory(archetypeFull .. ' archetype abilities',
        :css('display', 'none')
                            'archetype', archetype, skill, spell, addCats)
    local barTitle = mw.html.create('span')
    local barTitleClass = "{{lc:" .. title .. "}}"
    barTitleClass = barTitleClass:gsub(' ', '-')
    barTitleClass = barTitleClass:gsub('\'', '')
    barTitleClass = barTitleClass:gsub('\"', '')
    local barText = "{{ucfirst:" .. title .. "}}"
    if link then
        barText = "[[" .. link .. "|" .. barText .. "]]"
     end
     end
     barText = barText .. ":"
     if (class and classFull) then
    barTitle
         c = c ..
        :addClass('ability-bar-title')
                addCategory(classFull .. ' class abilities', 'class', class,
        :wikitext(frame:preprocess(barText))
                            skill, spell, addCats, true)
        :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')
    if bottom then
        output = mw.html.create('span')
     end
     end
     if not flags then
     if (rank and (class and classFull)) then
         flags = {}
         if rank == '3' then rank = '3+' end
        c = c ..
                addCategory('Rank ' .. rank .. ' ' .. classFull .. ' abilities',
                            'rank', rank, skill, spell, addCats, true)
     end
     end
     for k, v in pairs(flags) do
     if resolved['pre'] then
         if type(v) == 'string' then
        c = c ..
            output:addClass('flag-' .. k .. '-' .. v)
                addCategory(resolved['pre'] .. 'abilities', 'pre',
         end
                            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
     end
     output
     -- if resolved['range'] then
        :addClass('ability-bar')
    --     c = c .. addCategory(resolved['range'] .. ' range abilities', 'range', resolved['range'], skill, spell, addCats)
        :addClass('ability-bar-' .. barTitleClass)
        :attr(flags)
        :attr('test', 'out')
        :node(barSpace)
        :node(barTitle)
        :node(barSpace)
        :node(barContent)
        :css('display', 'block')
    -- if flags then
        -- for k, v in ipairs(flags) do
        --    output:attr(k, v)
        -- end
     -- end
     -- end
     return tostring(output)
     if resolved['expansion'] then
end
        c = c ..
 
                addCategory(resolved['expansion'] .. ' expansion abilities',
local function resolveAlias(args, aliases)
                            'expansion', resolved['expansion'], skill, spell,
    local resolved = {}
                            addCats)
 
    -- 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
     end
 
    -- if resolved['expansionRange'] then
     -- Resolve values
     --    c = c .. addCategory(resolved['expansionRange'] .. ' expansion range abilities', 'expansionRange', resolved['expansionRange'], skill, spell, addCats)
     for canonicalKey, canonicalValueTable in pairs(aliases.values) do
    -- end
         local rawValue = resolved[canonicalKey]
    if resolved['attribute'] then
 
         c = c ..
        if rawValue then
                addCategory(resolved['attribute'] .. ' save abilities',
            for canonicalValue, valueAliasList in pairs(canonicalValueTable) do
                            'attribute', resolved['attribute'], skill, spell,
                for _, alias in ipairs(valueAliasList) do
                            addCats)
                    if rawValue == '' then
    end
                        resolved[canonicalKey] = false
    if resolved['piercing'] then
                        break
        c = c .. addCategory(resolved['piercing'] .. ' abilities', 'piercing',
                    elseif rawValue == alias then
                            resolved['piercing'], skill, spell, addCats)
                        resolved[canonicalKey] = canonicalValue
    end
                        break
    if resolved['sustained'] then
                    -- Handle patterns like timeParse or distParse
        c = c ..
                    elseif rawValue and type(valueAliasList) == "table" and valueAliasList[1] and rawValue:match(valueAliasList[1]) then
                addCategory('Sustained abilities', 'sustained',
                        if canonicalKey == "duration" or canonicalKey == "executionTime" then
                            resolved['sustained'], skill, spell, addCats)
                            -- Parse time duration (e.g., 5d -> "5 days")
    end
                            local num = tonumber(rawValue:match("^(%d+)"))
    if resolved['upgrade'] then
                            local unit = rawValue:match("[%a]+$")
        c = c ..
                            local unitMap = {m = "minute", h = "hour", d = "day", w = "week", y = "year", r = "round", s = "second"}
                addCategory(resolved['upgrade'] .. ' abilities', 'upgrade',
                            if unitMap[unit] then
                            resolved['upgrade'], skill, spell, addCats)
                                local parsedValue = num .. " " .. unitMap[unit] .. (num > 1 and "s" or "")
    end
                                resolved[canonicalKey] = parsedValue
    if resolved['executionTime'] then
                             else
        c = c ..
                                resolved[canonicalKey] = rawValue
                addCategory(
                            end
                    noPlural(resolved['executionTime']) ..
                        elseif canonicalKey == "range" or canonicalKey == "expansionRange" then
                        ' execution time abilities', 'executionTime',
                            -- Parse distance (e.g., 30f -> "30 feet")
                    resolved['executionTime'], skill, spell, addCats)
                            local num = tonumber(rawValue:match("^(%d+)"))
    end
                             local unit = rawValue:match("[%a]+$")
    if resolved['maneuver'] then
                            local unitMap = {f = "feet", m = "miles"}
        c = c .. addCategory(resolved['maneuver'] .. ' abilities', 'maneuver',
                            if unitMap[unit] then
                            resolved['maneuver'], skill, spell, addCats)
                                local parsedValue = num .. " " .. unitMap[unit]
    end
                                resolved[canonicalKey] = parsedValue
    if resolved['verbal'] then
                             else
        c = c ..
                                resolved[canonicalKey] = rawValue
                addCategory('Verbal component abilities', 'verbal',
                            end
                             resolved['verbal'], skill, spell, addCats)
                        end
    end
                    end
    if resolved['somatic'] then
                 end
        c = c ..
            end
                addCategory('Somatic component abilities', 'somatic',
        end
                             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
     end


     return resolved
     local flawContent = ''
end
    if args['flaw'] or args['f'] or args['fl'] then
 
        flawContent = flawContent .. makeTag(frame, 'flaw', 'flaw', makeCat)
local classFixes = {
        c = c ..
     bar = 'ber',
                addCategory('Flaw abilities', 'flaw', 'flaw', skill, spell,
     sam = 'due',
                            addCats)
    ama = 'cor'
    end
}
    local specialContent = ''
    if args['special'] or args['s'] or args['sp'] then
        specialContent = specialContent ..
                            makeTag(frame, 'special', 'special', makeCat)
        c = c ..
                addCategory('Special abilities', 'special', 'special', skill,
                            spell, addCats)
    end
    local esContent = ''
     if args['es'] then
        esContent = esContent .. makeTag(frame, 'es', 'es', makeCat)
        c = c ..
                addCategory('Elder Sorcery abilities', 'es', 'es', skill, spell,
                            addCats)
     end
    local wardedContent = ''
    if args['warded'] then
        wardedContent = wardedContent ..
                            makeTag(frame, 'warded', 'warded', makeCat)
        c = c ..
                addCategory('Warded abilities', 'warded', 'warded', skill,
                            spell, addCats)
    end


local classArchetypes = {
    local elementContent = ''
     ber = 'warr',
     if args['life'] then
    due = 'warr',
        elementContent = elementContent ..
     vet = 'warr',
                            makeTag(frame, 'elements', 'life', makeCat)
    kni = 'warr',
        c = c ..
     pal = 'warr',
                addCategory('Life element abilities', 'elements', 'life', skill,
    ass = 'semi',
                            spell, addCats)
     cor = 'semi',
    end
    arc = 'semi',
     if args['storm'] then
    thi = 'semi',
        elementContent = elementContent ..
     ran = 'semi',
                            makeTag(frame, 'elements', 'storm', makeCat)
    fla = 'mage',
        c = c ..
    sto = 'mage',
                addCategory('Storm element abilities', 'elements', 'storm',
    lif = 'mage',
                            skill, spell, addCats)
    nec = 'mage',
    end
    nat = 'mage'
     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 className = {
    local powerContent = ''
    ber = 'Berserker',
     if args['magic'] then
     due = 'Duelist',
        powerContent = powerContent .. makeTag(frame, 'power', 'magic', makeCat)
    vet = 'Veteran',
        c = c ..
    kni = 'Knight',
                addCategory('Magically powered abilities', 'power', 'magic',
    pal = 'Paladin',
                            skill, spell, addCats) ..
    ass = 'Assassin',
                addCategory('Magical effects', nil, nil, false, false, addCats)
    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
     end
     local userResolve = resolveAlias(args, aliases)
     if args['divine'] then
    for k, v in pairs(userResolve) do
        powerContent = powerContent ..
        resolved[k] = v
                          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
     end
     if resolved['pre'] and premades[args['pre']]['skip'] then
     if args['spirit'] then
         resolved['pre'] = nil
        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 class then
        classContent = makeContent(frame, resolved, {'class'}, makeCat)
        powerContent = powerContent .. classContent
    end
    if args['rotator'] then
        powerContent = powerContent ..
                          makeTag(frame, 'category', 'rotator', makeCat)
    end
    powerContent = powerContent .. elementContent
    if skill then
        powerContent = powerContent ..
                          makeTag(frame, 'category', 'skill', makeCat)
     end
     end
     if not resolved['duration'] then
     if spell then
         resolved['duration'] = 'instant'
         powerContent = powerContent ..
                          makeTag(frame, 'category', 'spell', makeCat)
     end
     end


     if resolved['interaction'] == 'attack' then
     local deliveryContent = ''
        local dc = "Hit target's {{AC}}"
    if standard and skill then
        if resolved['target'] == 'limb' then
         deliveryContent = deliveryContent ..
            dc = "Hit target's {{Var:ACLimb}}"
                              makeTag(frame, 'category', 'semblant', makeCat)
        end
    end
        if resolved['target'] == 'arm' then
    if standard and spell then
            dc = "Hit target's {{Var:ACLimb}}"
         deliveryContent = deliveryContent ..
        end
                              makeTag(frame, 'category', 'conjure', makeCat)
         if resolved['target'] == 'leg' then
            dc = "Hit target's {{Var:ACLimb}}"
        end
        if resolved['target'] == 'vitals' then
            dc = "Hit target's {{Var:ACVitals}}"
        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
     end


     if resolved['expansionCount'] then
    local effectContent = ''
         if resolved['expansionCount'] == '1' then
     if args['mental'] then
            resolved['expansionCount'] = '{{Space}}' .. resolved['expansionCount'] .. ' extra execution.'
         effectContent = effectContent ..
        else
                            makeTag(frame, 'effects', 'mental', makeCat)
            resolved['expansionCount'] = '{{Space}}' .. resolved['expansionCount'] .. ' extra executions.'
        c = c ..
        end
                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',
                            'truthDetecting', skill, spell, addCats)
     end
     end
 
     if args['duelMod'] then
     if resolved['invoked'] then
         effectContent = effectContent ..
         resolved['verbal'] = 'verbal'
                            makeTag(frame, 'effects', 'duelModifying', makeCat)
         resolved['somatic'] = 'somatic'
         c = c ..
        resolved['mage'] = 'magelore'
                addCategory('Duel modifying effects', 'effect', 'duelModifying',
                            skill, spell, addCats)
     end
     end
 
     if args['movement'] then
    local skill = false
         effectContent = effectContent ..
    local spell = false
                            makeTag(frame, 'effects', 'movement', makeCat)
    local standard = false
         c = c ..
 
                addCategory('Movement effects', 'effect', 'movement', skill,
    local class = nil
                            spell, addCats)
    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
     end
     if args['class'] or args['arch'] then
     if args['poison'] then
         archetype = classArchetypes[class]
         effectContent = effectContent ..
        if args['arch'] then
                            makeTag(frame, 'effects', 'poison', makeCat)
            archetype = args['arch']
        c = c ..
        end
                addCategory('Poison effects', 'effect', 'poison', skill, spell,
        classFull = className[class]
                            addCats)
         archetypeFull = archetypeName[archetype]
    end
         standard = true
    if args['displacement'] then
        if archetype == 'warr' or archetype == 'semi' then
         effectContent = effectContent ..
            skill = true
                            makeTag(frame, 'effects', 'displacement', makeCat)
        end
         c = c ..
        if archetype == 'mage' then
                addCategory('Displacement effects', 'effect', 'displacement',
            spell = true
                            skill, spell, addCats)
        end
     end
     end
    local costMP = nil
     if args['transformation'] then
    local costHP = nil
        effectContent = effectContent ..
    local costGP = nil
                            makeTag(frame, 'effects', 'transformation', makeCat)
     if args['pre'] == 'crown' then
         c = c ..
         spell = true
                addCategory('Transformation effects', 'effect',
        costMP = '1'
                            'transformation', skill, spell, addCats)
        rank = '2'
     end
     end
     if args['rank'] then
     if args['control'] then
         rank = args['rank']
         effectContent = effectContent ..
                            makeTag(frame, 'effects', 'control', makeCat)
        c = c ..
                addCategory('Control effects', 'effect', 'control', skill,
                            spell, addCats)
     end
     end
   
     if args['resist'] then
     if args['skill'] then
         effectContent = effectContent ..
         skill = true
                            makeTag(frame, 'effects', 'resist', makeCat)
        if args['skill'] == '0' or args['skill'] == 'false' then
        c = c ..
            skill = false
                addCategory('Resistance effects', 'effect', 'resist', skill,
        end
                            spell, addCats)
     end
     end
     if args['spell'] then
     if args['awaken'] then
         spell = true
         effectContent = effectContent ..
        if args['spell'] == '0' or args['spell'] == 'false' then
                            makeTag(frame, 'effects', 'awaken', makeCat)
            spell = false
        c = c ..
        end
                addCategory('Awakening effects', 'effect', 'awaken', skill,
                            spell, addCats)
     end
     end
     if args['standard'] then
     if args['immune'] then
         standard = true
         effectContent = effectContent ..
        if args['standard'] == '0' or args['standard'] == 'false' then
                            makeTag(frame, 'effects', 'immune', makeCat)
            standard = false
        c = c ..
        end
                addCategory('Immunity effects', 'effect', 'immune', skill,
                            spell, addCats)
     end
     end
     if args['mp'] then
     if args['long'] then
         costMP = args['mp']
         effectContent = effectContent ..
                            makeTag(frame, 'effects', 'long', makeCat)
        c = c ..
                addCategory('Long range effects', 'effect', 'long', skill,
                            spell, addCats)
     end
     end
     if args['hp'] then
     if args['sense'] then
         costHP = args['hp']
         effectContent = effectContent ..
                            makeTag(frame, 'effects', 'sense', makeCat)
        c = c ..
                addCategory('Sensory effects', 'effect', 'sense', skill, spell,
                            addCats)
     end
     end
     if args['gp'] then
     if args['revive'] or args['rev'] then
         costGP = args['gp']
         effectContent = effectContent ..
                            makeTag(frame, 'effects', 'revive', makeCat)
        c = c ..
                addCategory('Revival effects', 'effect', 'revive', skill, spell,
                            addCats)
     end
     end
     if args['shatter'] then
     if args['summon'] then
    costShatter = args['shatter']
        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
     end
 
     if args['reanimate'] or args['rean'] then
    local basic = false
         effectContent = effectContent ..
    local journeyman = false
                            makeTag(frame, 'effects', 'reanimate', makeCat)
     if args['basic'] then
        c = c ..
         basic = true
                addCategory('Reanimation effects', 'effect', 'reanimate', skill,
                            spell, addCats)
     end
     end
     if args['journeyman'] or args['jm'] then
     if args['regenerate'] or args['regen'] then
         journeyman = true
         effectContent = effectContent ..
                            makeTag(frame, 'effects', 'regenerate', makeCat)
        c = c ..
                addCategory('Regeneration effects', 'effect', 'regenerate',
                            skill, spell, addCats)
     end
     end
 
     if args['revitalize'] or args['revit'] then
     -- Category string
        effectContent = effectContent ..
    local c = ''
                            makeTag(frame, 'effects', 'revitalize', makeCat)
 
        c = c ..
    local name = args['name']
                addCategory('Revitalization effects', 'effect', 'revitalize',
    local page = mw.title.getCurrentTitle().text
                            skill, spell, addCats)
    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
     end
     if journeyman then
     if args['kill'] then
         c = c .. addCategory('Journeyman abilities', 'journeyman', nil, skill, spell, addCats)
        effectContent = effectContent ..
                            makeTag(frame, 'effects', 'kill', makeCat)
         c = c ..
                addCategory('Killing effects', 'effect', 'kill', skill, spell,
                            addCats)
     end
     end
     if standard then
     if args['damage'] then
         c = c .. addCategory('Standard abilities', nil, nil, false, false, addCats)
         effectContent = effectContent ..
         if skill then
                            makeTag(frame, 'effects', 'damage', makeCat)
            c = c .. addCategory('Semblant skills', nil, nil, skill, spell, addCats)
         c = c ..
        end
                addCategory('Damaging effects', 'effect', 'damage', skill,
        if spell then
                            spell, addCats)
            c = c .. addCategory('Conjured spells', nil, nil, skill, spell, addCats)
        end
    else
        c = c .. addCategory('Nonstandard abilities', nil, nil, skill, spell, addCats)
     end
     end
     if args['ethereal'] then
     if args['steal'] then
         c = c .. addCategory('Ethereal abilities', nil, nil, skill, spell, addCats)
        effectContent = effectContent ..
                            makeTag(frame, 'effects', 'steal', makeCat)
         c = c ..
                addCategory('Stealing effects', 'effect', 'steal', skill, spell,
                            addCats)
     end
     end
     if args['av'] then
     if args['loud'] then
    c = c .. addCategory('AV granting abilities', nil, nil, skill, spell, addCats, true)
        effectContent = effectContent ..
    c = c .. addCategory('AV' .. args['av'] .. ' granting abilities', nil, nil, skill, spell, addCats, true)
                            makeTag(frame, 'effects', 'loud', makeCat)
        c = c ..
                addCategory('Loud effects', 'effect', 'loud', skill, spell,
                            addCats)
     end
     end
     if (archetype and archetypeFull) then
     if args['knockout'] then
         c = c .. addCategory(archetypeFull .. ' archetype abilities', 'archetype', archetype, skill, spell, addCats)
        effectContent = effectContent ..
                            makeTag(frame, 'effects', 'knockout', makeCat)
         c = c ..
                addCategory('Knockout effects', 'effect', 'knockout', skill,
                            spell, addCats)
     end
     end
     if (class and classFull) then
     if args['time'] then
         c = c .. addCategory(classFull .. ' class abilities', 'class', class, skill, spell, addCats, true)
        effectContent = effectContent ..
                            makeTag(frame, 'effects', 'time', makeCat)
         c = c ..
                addCategory('Temporal effects', 'effect', 'time', skill, spell,
                            addCats)
     end
     end
     if (rank and (class and classFull)) then
 
         if rank == '3' then
    local costContent = ''
             rank = '3+'
     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|class=cost-tagged mpx}}")
            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|class=cost-tagged mp" ..
                                  costMP .. "}}")
            c = c ..
                    addCategory(costMP .. ' MP cost abilities', 'costMP',
                                costMP, skill, spell, addCats, true)
         end
         end
        c = c .. addCategory('Rank ' .. rank .. ' ' .. classFull .. ' abilities', 'rank', rank, skill, spell, addCats, true)
     end
     end
     if resolved['pre'] then
     if costHP then
         c = c .. addCategory(resolved['pre'] .. 'abilities', 'pre', resolved['pre'], skill, spell, addCats)
         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|class=cost-tagged hpx}}")
            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|class=cost-tagged hp" ..
                                  costHP .. "}}")
            c = c ..
                    addCategory(costHP .. ' HP cost abilities', 'costHP',
                                costHP, skill, spell, addCats, true)
        end
     end
     end
     if resolved['interaction'] then
     if costGP then
         c = c .. addCategory(resolved['interaction'] .. ' interaction abilities', 'interaction', resolved['interaction'], skill, spell, addCats)
         c = c ..
                addCategory('GP cost abilities', 'costGP', costGP, skill, spell,
                            addCats, true)
        if costGP == 'x' then
            costContent = costContent .. frame:preprocess(
                              "{{Tag|X GP|🪙|l=:Category:GP cost abilities|c=#F6D32D|class=cost-tagged gpx}}")
            c = c ..
                    addCategory('Variable GP cost abilities', 'costGP', 'x',
                                skill, spell, addCats, true)
        else
            costContent = costContent .. frame:preprocess(
                              "{{Tag|" .. costGP ..
                                  " GP|🪙|l=:Category:GP cost abilities|c=#F6D32D|class=cost-tagged gp" ..
                                  costGP .. "}}")
            c = c ..
                    addCategory(costGP .. ' GP cost abilities', 'costGP',
                                costGP, skill, spell, addCats, true)
        end
     end
     end
     if resolved['delivery'] then
     if costShatter then
         c = c .. addCategory(resolved['delivery'] .. ' delivery abilities', 'delivery', resolved['delivery'], skill, spell, addCats)
         c = c ..
                addCategory('Shatter cost abilities', 'costShatter',
                            costShatter, skill, spell, addCats)
        costContent = costContent .. frame:preprocess(
                          "{{Tag|Shatter|💥|l=:Category:Shatter cost abilities|class=cost-tagged shatter}}")
     end
     end
     if resolved['target'] then
     if args['cost'] then
         c = c .. addCategory(resolved['target'] .. ' target abilities', 'target', resolved['target'], skill, spell, addCats)
         costContent = costContent .. frame:preprocess(args['cost'])
     end
     end
     if resolved['duration'] then
 
        c = c .. addCategory(noPlural(resolved['duration']) .. ' duration abilities', 'duration', resolved['duration'], skill, spell, addCats)
    local executionTimeTitle = 'Execution time'
     end
    if spell then executionTimeTitle = 'Casting time' end
     -- if resolved['range'] then
 
     --    c = c .. addCategory(resolved['range'] .. ' range abilities', 'range', resolved['range'], skill, spell, addCats)
    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
     -- end
     if resolved['expansion'] then
 
         c = c .. addCategory(resolved['expansion'] .. ' expansion abilities', 'expansion', resolved['expansion'], skill, spell, addCats)
    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
     end
    -- if resolved['expansionRange'] then
 
     --    c = c .. addCategory(resolved['expansionRange'] .. ' expansion range abilities', 'expansionRange', resolved['expansionRange'], skill, spell, addCats)
     local proficiencyContent = ''
    -- end
     if args['pro'] then
     if resolved['attribute'] then
         proficiencyContent = proficiencyContent .. frame:preprocess(args['pro'])
         c = c .. addCategory(resolved['attribute'] .. ' save abilities', 'attribute', resolved['attribute'], skill, spell, addCats)
     end
     end
     if resolved['piercing'] then
 
         c = c .. addCategory(resolved['piercing'] .. ' abilities', 'piercing', resolved['piercing'], skill, spell, addCats)
    local fluencyContent = ''
     if args['flu'] then
         fluencyContent = fluencyContent .. frame:preprocess(args['flu'])
     end
     end
     if resolved['sustained'] then
 
         c = c .. addCategory('Sustained abilities', 'sustained', resolved['sustained'], skill, spell, addCats)
    local restrictionContent = ''
     if args['restrict'] then
         restrictionContent = restrictionContent ..
                                frame:preprocess(args['restrict'])
     end
     end
     if resolved['upgrade'] then
 
         c = c .. addCategory(resolved['upgrade'] .. ' abilities', 'upgrade', resolved['upgrade'], skill, spell, addCats)
    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
     end
     if resolved['executionTime'] then
    local f = 'proficiency'
         c = c .. addCategory(noPlural(resolved['executionTime']) .. ' execution time abilities', 'executionTime', resolved['executionTime'], skill, spell, addCats)
     if args['fflu'] then f = 'fluency' end
    if args['fstat'] and (args['fflu'] or args['fpro']) then
        local fstat = frame:preprocess("{{uc:" .. args['fstat'] .. "}}")
        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
     end
     if resolved['maneuver'] then
     if args['rotator'] then
         c = c .. addCategory(resolved['maneuver'] .. ' abilities', 'maneuver', resolved['maneuver'], skill, spell, addCats)
         c = c ..
                addCategory('Rotator abilities', 'rotator', args['rotator'],
                            skill, spell, addCats)
     end
     end
     if resolved['verbal'] then
     if args['style'] then
         c = c .. addCategory('Verbal component abilities', 'verbal', resolved['verbal'], skill, spell, addCats)
         c = c ..
                addCategory('Casting style abilities', 'style', args['style'],
                            skill, spell, addCats)
     end
     end
     if resolved['somatic'] then
     if args['weapon'] then
         c = c .. addCategory('Somatic component abilities', 'somatic', resolved['somatic'], skill, spell, addCats)
         c = c ..
                addCategory('Weapon fighting style abilities', 'weapon',
                            args['weapon'], skill, spell, addCats)
     end
     end
     if resolved['material'] then
 
        c = c .. addCategory('Material component abilities', 'material', resolved['material'], skill, spell, addCats)
     -- Remove range from self targeted abilities
    end
     if resolved['target'] == 'self' or resolved['range'] == 'self' then
     if resolved['magelore'] then
         resolved['range'] = nil
        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
     end


     local flawContent = ''
     local barsTop = {
     if args['flaw'] or args['f'] or args['fl'] then
        -- {
         flawContent = flawContent .. makeTag(frame, 'flaw', 'flaw', makeCat)
        --     title = 'elements',
         c = c .. addCategory('Flaw abilities', 'flaw', 'flaw', skill, spell, addCats)
         --    content = frame:preprocess(elementContent)
    end
         -- },
    local specialContent = ''
        {
    if args['special'] or args['s'] or args['sp'] then
            title = 'power sources',
        specialContent = specialContent .. makeTag(frame, 'special', 'special', makeCat)
            content = frame:preprocess(esContent .. powerContent),
        c = c .. addCategory('Special abilities', 'special', 'special', skill, spell, addCats)
            link = ':Category:Powered abilities'
    end
        }, {
    local esContent = ''
            title = 'effect types',
    if args['es'] then
            content = frame:preprocess(flawContent .. specialContent ..
        esContent = esContent .. makeTag(frame, 'es', 'es', makeCat)
                                          effectContent),
         c = c .. addCategory('Elder Sorcery abilities', 'es', 'es', skill, spell, addCats)
            link = ':Category:Effects'
    end
         }, {
    local wardedContent = ''
            title = 'delivery',
    if args['warded'] then
            content = frame:preprocess(wardedContent .. deliveryContent) ..
        wardedContent = wardedContent .. makeTag(frame, 'warded', 'warded', makeCat)
                makeContent(frame, resolved, {
        c = c .. addCategory('Warded abilities', 'warded', 'warded', skill, spell, addCats)
                    'expansion', 'pre', 'upgrade', 'piercing', 'delivery',
    end
                    'interaction'
 
                }, makeCat),
    local elementContent = ''
            link = ':Category:Delivery abilities'
    if args['life'] then
        }, {
        elementContent = elementContent .. makeTag(frame, 'elements', 'life', makeCat)
            title = 'save attribute',
        c = c .. addCategory('Life element abilities', 'elements', 'life', skill, spell, addCats)
            content = makeContent(frame, resolved, {'attribute'}, makeCat),
    end
            link = 'Core:Feat Interaction'
    if args['storm'] then
        }, {
        elementContent = elementContent .. makeTag(frame, 'elements', 'storm', makeCat)
            title = 'expansion save attribute',
        c = c .. addCategory('Storm element abilities', 'elements', 'storm', skill, spell, addCats)
            content = makeContent(frame, resolved, {'expansionAttribute'},
    end
                                  makeCat)
    if args['necro'] then
         }, {
        elementContent = elementContent .. makeTag(frame, 'elements', 'necro', makeCat)
            title = 'target',
         c = c .. addCategory('Necromancy element abilities', 'elements', 'necro', skill, spell, addCats)
            content = makeContent(frame, resolved, {'target', 'hitDC'}, makeCat),
    end
            link = ':Category:Target abilities'
    if args['flame'] then
        }, {
        elementContent = elementContent .. makeTag(frame, 'elements', 'flame', makeCat)
            title = executionTimeTitle,
        c = c .. addCategory('Flame element abilities', 'elements', 'flame', skill, spell, addCats)
            content = makeContent(frame, resolved,
    end
                                  {'executionTime', 'maneuver'}, makeCat),
    if args['nature'] then
            link = 'Core:Maneuvers'
        elementContent = elementContent .. makeTag(frame, 'elements', 'nature', makeCat)
        }, {
        c = c .. addCategory('Nature element abilities', 'elements', 'nature', skill, spell, addCats)
            title = 'trigger',
    end
            content = args['trigger'] or '',
 
            link = 'Core:Reactive Maneuvers'
    local powerContent = ''
        }, {
    if args['magic'] then
            title = 'cost and components',
        powerContent = powerContent .. makeTag(frame, 'power', 'magic', makeCat)
            content = frame:preprocess(costContent) ..
        c = c .. addCategory('Magically powered abilities', 'power', 'magic', skill, spell, addCats) .. addCategory('Magical effects', nil, nil, false, false, addCats)
                makeContent(frame, resolved, {
    end
                    'material', 'invoked', 'verbal', 'somatic', 'magelore'
    if args['divine'] then
                }, makeCat),
        powerContent = powerContent .. makeTag(frame, 'power', 'divine', makeCat)
            link = ':Category:Cost abilities'
        c = c .. addCategory('Divinely powered abilities', 'power', 'divine', skill, spell, addCats) .. addCategory('Divine effects', nil, nil, false, false, addCats)
        }, {
    end
            title = 'Mana cost',
    if args['spirit'] then
            content = args['mpx'] or '',
        powerContent = powerContent .. makeTag(frame, 'power', 'spirit', makeCat)
            link = ':Category:MP cost abilities'
        c = c .. addCategory('Spiritually powered abilities', 'power', 'spirit', skill, spell, addCats) .. addCategory('Spiritual effects', nil, nil, false, false, addCats)
        }, {
    end
            title = 'Hit cost',
    if args['primal'] then
            content = args['hpx'] or '',
        powerContent = powerContent .. makeTag(frame, 'power', 'primal', makeCat)
            link = ':Category:HP cost abilities'
        c = c .. addCategory('Primally powered abilities', 'power', 'primal', skill, spell, addCats) .. addCategory('Primal effects', nil, nil, false, false, addCats)
        }, {
    end
            title = 'Gold cost',
    if args['martial'] then
            content = args['gpx'] or '',
        powerContent = powerContent .. makeTag(frame, 'power', 'martial', makeCat)
            link = ':Category:GP cost abilities'
        c = c .. addCategory('Martially powered abilities', 'power', 'martial', skill, spell, addCats)
        }, {
    end
            title = 'Material cost',
    if args['psionic'] then
            content = makeContent(frame, resolved, {'matx'}, makeCat),
        powerContent = powerContent .. makeTag(frame, 'power', 'psionic', makeCat)
            link = ':Category:Material component abilities'
        c = c .. addCategory('Psionically powered abilities', 'power', 'psionic', skill, spell, addCats) .. addCategory('Mental effects', nil, nil, false, false, addCats)
        }, {
    end
            title = 'duration',
    if args['techo'] then
            content = makeContent(frame, resolved, {'duration', 'sustained'},
        powerContent = powerContent .. makeTag(frame, 'power', 'techo', makeCat)
                                  makeCat),
        c = c .. addCategory('Technologically powered abilities', 'power', 'techo', skill, spell, addCats) .. addCategory('Technological effects', nil, nil, false, false, addCats)
            link = ':Category:Duration abilities'
    end
        }, {
    if args['finance'] then
            title = 'range',
        powerContent = powerContent .. makeTag(frame, 'power', 'finance', makeCat)
            content = makeContent(frame, resolved, {'range'}, makeCat),
        c = c .. addCategory('Financially powered abilities', 'power', 'finance', skill, spell, addCats) .. addCategory('Financial effects', nil, nil, false, false, addCats)
            link = 'Core:Range'
    end
        }, -- {
    if args['alchemy'] then
        --     title = 'expansion',
        powerContent = powerContent .. makeTag(frame, 'power', 'alchemy', makeCat)
         --    content = makeContent(frame, resolved, {'expansion'}, 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
            title = 'expansion range',
         powerContent = powerContent .. makeTag(frame, 'power', 'unknown', makeCat)
            content = makeContent(frame, resolved,
         c = c .. addCategory('Unknown powered abilities', 'power', 'unknown', skill, spell, addCats)
                                  {'expansionRange', 'expansionCount'}, makeCat),
    end
            link = 'Core:Expansions'
    if class then
        }, -- {
        classContent = makeContent(frame, resolved, {'class'}, makeCat)
        --     title = 'expansion count',
        powerContent = powerContent .. classContent
         --    content = frame:preprocess('TEST')
    end
        -- },
     if args['rotator'] then
        {
         powerContent = powerContent .. makeTag(frame, 'category', 'rotator', makeCat)
            title = 'Requirements',
    end
            content = makeContent(frame, resolved, {'requirement'}, makeCat)
    powerContent = powerContent .. elementContent
        }
    if skill then
     }
        powerContent = powerContent .. makeTag(frame, 'category', 'skill', makeCat)
    end
    if spell then
        powerContent = powerContent .. makeTag(frame, 'category', 'spell', makeCat)
     end


     local deliveryContent = ''
     local barsBottom = {
    if standard and skill then
        {title = 'End condition', content = args['end'] or ''},
         deliveryContent = deliveryContent .. makeTag(frame, 'category', 'semblant', makeCat)
         {title = 'On critical hit', content = args['crithit'] or ''},
    end
         {title = 'On hit', content = args['hit'] or ''},
    if standard and spell then
        {title = 'On miss', content = args['miss'] or ''},
         deliveryContent = deliveryContent .. makeTag(frame, 'category', 'conjure', makeCat)
         {title = 'On critically miss', content = args['critmiss'] or ''},
    end
         {title = 'On critical fail', content = args['critfail'] or ''},
 
        {title = 'On fail', content = args['fail'] or ''},
    local effectContent = ''
        {title = 'On success', content = args['success'] or ''},
    if args['mental'] then
         {title = 'On critical success', content = args['critsuccess'] or ''}, {
         effectContent = effectContent .. makeTag(frame, 'effects', 'mental', makeCat)
            title = 'Heightened',
         c = c .. addCategory('Mental effects', 'effect', 'mental', skill, spell, addCats)
            content = frame:preprocess(heightenedContent),
    end
            link = ':Category:Heightened abilities'
    if args['truth'] then
         }, {
         effectContent = effectContent .. makeTag(frame, 'effects', 'truth', makeCat)
            title = 'If proficient',
         c = c .. addCategory('Truth detecting effects', 'effect', 'truthDetecting', skill, spell, addCats)
            content = proficiencyContent,
    end
            link = 'Core:Proficiency Bonus'
    if args['duelMod'] then
        },
        effectContent = effectContent .. makeTag(frame, 'effects', 'duelModifying', makeCat)
        {
        c = c .. addCategory('Duel modifying effects', 'effect', 'duelModifying', skill, spell, addCats)
            title = 'If fluent',
    end
            content = fluencyContent,
    if args['movement'] then
            link = 'Core:Fluency Bonus'
        effectContent = effectContent .. makeTag(frame, 'effects', 'movement', makeCat)
        }, {
         c = c .. addCategory('Movement effects', 'effect', 'movement', skill, spell, addCats)
            title = 'Attribute improvement',
            content = frame:preprocess(statValContent),
            link = 'Core:Attributes',
            flags = {
                attribute = args['vstat'] and
                    frame:preprocess('{{lc:' .. args['vstat'] .. '}}') or "",
                value = args['val']
            }
        }, {
            title = 'Feat save improvement',
            content = frame:preprocess(statFeatContent),
            link = 'Core:Feat Interaction',
            flags = {
                attribute = args['fstat'] and
                    frame:preprocess('{{lc:' .. args['fstat'] .. '}}'),
                value = f
            }
        }
    }
 
    local outputTop = ''
    for _, bar in ipairs(barsTop) do
         outputTop = outputTop ..
                        makeBar(frame, bar['title'], bar['content'],
                                bar['link'], bar['flags'], false)
     end
     end
    if args['poison'] then
     local outputBottom = ''
        effectContent = effectContent .. makeTag(frame, 'effects', 'poison', makeCat)
 
        c = c .. addCategory('Poison effects', 'effect', 'poison', skill, spell, addCats)
     for _, bar in ipairs(barsBottom) do
    end
         outputBottom = outputBottom ..
    if args['displacement'] then
                          makeBar(frame, bar['title'], bar['content'],
        effectContent = effectContent .. makeTag(frame, 'effects', 'displacement', makeCat)
                                  bar['link'], bar['flags'], true)
        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['awaken'] then
        effectContent = effectContent .. makeTag(frame, 'effects', 'awaken', makeCat)
        c = c .. addCategory('Awakening effects', 'effect', 'awaken', 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|class=cost-tagged mpx}}")
            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|class=cost-tagged mp" .. costMP .. "}}")
            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|class=cost-tagged hpx}}")
            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|class=cost-tagged hp" .. costHP .. "}}")
            c = c .. addCategory(costHP .. ' HP cost abilities', 'costHP', costHP, skill, spell, addCats, true)
        end
    end
    if costGP then
        c = c .. addCategory('GP cost abilities', 'costGP', costGP, skill, spell, addCats, true)
        if costGP == 'x' then
            costContent = costContent .. frame:preprocess("{{Tag|X GP|🪙|l=:Category:GP cost abilities|c=#F6D32D|class=cost-tagged gpx}}")
            c = c .. addCategory('Variable GP cost abilities', 'costGP', 'x', skill, spell, addCats, true)
        else
            costContent = costContent .. frame:preprocess("{{Tag|" .. costGP .. " GP|🪙|l=:Category:GP cost abilities|c=#F6D32D|class=cost-tagged gp" .. costGP .. "}}")
            c = c .. addCategory(costGP .. ' GP cost abilities', 'costGP', costGP, 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|class=cost-tagged shatter}}")
    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
    local f = 'proficiency'
    if args['fflu'] then
        f = 'fluency'
    end
    if args['fstat'] and (args['fflu'] or args['fpro']) then
        local fstat = frame:preprocess("{{uc:" .. args['fstat'] .. "}}")
        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(esContent .. powerContent),
            link = ':Category:Powered abilities'
        },
        {
            title = 'effect types',
            content = frame:preprocess(flawContent .. specialContent .. effectContent),
            link = ':Category:Effects'
        },
        {
            title = 'delivery',
            content = frame:preprocess(wardedContent .. deliveryContent) .. makeContent(frame, resolved, {'expansion', 'pre', 'upgrade', 'piercing', 'delivery', 'interaction'}, makeCat),
            link = ':Category:Delivery abilities'
        },
        {
            title = 'save attribute',
            content = makeContent(frame, resolved, {'attribute'}, makeCat),
            link = 'Core:Feat Interaction'
        },
        {
            title = 'expansion save attribute',
            content = makeContent(frame, resolved, {'expansionAttribute'}, makeCat),
        },
        {
            title = 'target',
            content = makeContent(frame, resolved, {'target', 'hitDC'}, makeCat),
            link = ':Category:Target abilities'
        },
        {
            title = executionTimeTitle,
            content = makeContent(frame, resolved, {'executionTime', 'maneuver'}, makeCat),
            link = 'Core:Maneuvers'
        },
        {
            title = 'trigger',
            content = args['trigger'] or '',
            link = 'Core:Reactive Maneuvers'
        },
        {
            title = 'cost and components',
            content = frame:preprocess(costContent) .. makeContent(frame, resolved, {'material', 'invoked', 'verbal', 'somatic', 'magelore'}, makeCat),
            link = ':Category:Cost abilities'
        },
        {
            title = 'Mana cost',
            content = args['mpx'] or '',
            link = ':Category:MP cost abilities'
        },
        {
            title = 'Hit cost',
            content = args['hpx'] or '',
            link = ':Category:HP cost abilities'
        },
        {
            title = 'Gold cost',
            content = args['gpx'] or '',
            link = ':Category:GP cost abilities'
        },
        {
            title = 'Material cost',
            content = makeContent(frame, resolved, {'matx'}, makeCat),
            link = ':Category:Material component abilities'
        },
        {
            title = 'duration',
            content = makeContent(frame, resolved, {'duration', 'sustained'}, makeCat),
            link = ':Category:Duration abilities'
        },
        {
            title = 'range',
            content = makeContent(frame, resolved, {'range'}, makeCat),
            link = 'Core:Range'
        },
        -- {
        --    title = 'expansion',
        --    content = makeContent(frame, resolved, {'expansion'}, makeCat)
        -- },
        {
            title = 'expansion range',
            content = makeContent(frame, resolved, {'expansionRange', 'expansionCount'}, makeCat),
            link = 'Core:Expansions'
        },
        -- {
        --    title = 'expansion count',
        --    content = frame:preprocess('TEST')
        -- },
        {
            title = 'Requirements',
            content = makeContent(frame, resolved, {'requirement'}, makeCat)
        },
    }
 
    local barsBottom = {
        {
            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),
            link = ':Category:Heightened abilities'
        },
        {
            title = 'If proficient',
            content = proficiencyContent,
            link = 'Core:Proficiency Bonus'
        },
        {
            title = 'If fluent',
            content = fluencyContent,
            link = 'Core:Fluency Bonus'
        },
        {
            title = 'Attribute improvement',
            content = frame:preprocess(statValContent),
            link = 'Core:Attributes',
            flags = {
                attribute = args['vstat'] and frame:preprocess('{{lc:' .. args['vstat'] .. '}}') or "",
                value = args['val']
            }
        },
        {
            title = 'Feat save improvement',
            content = frame:preprocess(statFeatContent),
            link = 'Core:Feat Interaction',
            flags = {
                attribute = args['fstat'] and frame:preprocess('{{lc:' .. args['fstat'] .. '}}'),
                value = f
            }
        },
    }
 
    local outputTop = ''
    for _, bar in ipairs(barsTop) do
        outputTop = outputTop .. makeBar(frame, bar['title'], bar['content'], bar['link'], bar['flags'], false)
    end
     local outputBottom = ''
 
     for _, bar in ipairs(barsBottom) do
         outputBottom = outputBottom .. makeBar(frame, bar['title'], bar['content'], bar['link'], bar['flags'], true)
     end
     end


     local outputMiddle = ''
     local outputMiddle = ''
     if args['e'] then
     if args['e'] then outputMiddle = frame:preprocess(args['e']) end
        outputMiddle = frame:preprocess(args['e'])
 
    end
     local output = mw.html.create('span')
 
     output:addClass('ability-variables')
     local output = mw.html.create('span')
     if args['basic'] then output:addClass('ability-basic') end
     output
     output:wikitext(outputTop)
        :addClass('ability-variables')
 
     if args['basic'] then
        output
            :addClass('ability-basic')
    end
     output:wikitext(outputTop)
   
     if outputMiddle ~= '' then
     if outputMiddle ~= '' then
         output
         output:wikitext('<hr>'):wikitext(
            :wikitext('<hr>')
            '<span class="ability-overview-base">' .. outputMiddle .. '</span>')
            :wikitext('<span class="ability-overview-base">' .. outputMiddle .. '</span>')
     end
     end


     if outputBottom ~= '' then
     if outputBottom ~= '' then output:wikitext('<hr>'):wikitext(outputBottom) end
        output
            :wikitext('<hr>')
            :wikitext(outputBottom)
    end


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



Revision as of 04:49, 13 August 2025

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'
        -- },
        flaw = {'flaw', 'fl', 'f'},
        special = {'special', 'sp', 's'},
        range = {'range', 'rng', 'r'},
        attribute = {'attribute', 'attr', 'a'},
        expansion = {'expansion', 'exp'},
        expansionRange = {'expansionRange', 'er'},
        expansionCount = {'expansionCount', 'ec'},
        expansionAttribute = {'expansionAttribute', 'ea'},
        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'
        },
        gp = {'gp', 'gold', 'goldPieces', 'gold pieces'},
        gpx = {'gpx', 'goldx', 'goldPiecesx', 'gold piecesx'},
        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'},
            cs = {'cs', 'sc', 'creatureSelf', 'selfCreature'}
        },
        duration = {
            instant = {'0', 'in', 'instant', 'i'},
            always = {'always', 'forever', '4', 'inf'},
            noLimit = {'noLimit', '1', 'nl'},
            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'},
            unp = {'unp', 'UNP', 'u'}
        },
        expansionAttribute = {
            int = {'int', 'INT', 'i'},
            str = {'str', 'STR', 's'},
            mov = {'mov', 'MOV', 'm'},
            per = {'per', 'PER', 'p'},
            snk = {'snk', 'SNK', 's'},
            unp = {'unp', 'UNP', 'u'}
        },
        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',
            class = 'component-tagged verbal'
        }
    },
    somatic = {
        somatic = {
            text = 'Somatic',
            link = 'Somatic component abilities',
            symbol = '👐',
            color = '#f9f06b',
            class = 'component-tagged somatic'
        }
    },
    material = {
        material = {
            text = 'Material',
            link = 'Material component abilities',
            symbol = '💎',
            color = '#ff7800',
            class = 'component-tagged material'
        }
    },
    magelore = {
        magelore = {
            text = 'Magelore',
            link = 'Magelore component abilities',
            symbol = '🔮',
            color = '#f9f06b',
            class = 'component-tagged magelore'
        }
    },
    invoked = {
        invoked = {
            text = 'Invoked',
            link = 'Invoked component abilities',
            symbol = '🪄',
            color = '#f9f06b',
            class = 'component-tagged invoked'
        }
    },
    flaw = {
        flaw = {
            text = 'Flaw',
            link = 'Flaw abilities',
            symbol = '❌',
            color = '#e01b24',
            class = 'flaw-tagged flaw'
        }
    },
    special = {
        special = {
            text = 'Special',
            link = 'Special abilities',
            symbol = '✴️',
            color = '#9141AC',
            class = 'special-tagged special'
        }
    },
    es = {
        es = {
            text = 'Elder Sorcery',
            link = 'Elder Sorcery abilities',
            symbol = '🌌',
            color = '#9141AC',
            class = 'elderSorcery-tagged elderSorcery'
        }
    },
    warded = {
        warded = {
            text = 'Warded',
            link = 'Warded abilities',
            symbol = '🏮',
            color = '#f9f06b',
            class = 'warded-tagged warded'
        }
    },
    elements = {
        life = {
            text = 'Life',
            link = 'Life element abilities',
            symbol = '☀️',
            color = '#ffffff',
            class = 'element-tagged life'
        },
        storm = {
            text = 'Storm',
            link = 'Storm element abilities',
            symbol = '💧',
            color = '#3584e4',
            class = 'element-tagged storm'
        },
        necro = {
            text = 'Necromancy',
            link = 'Necromancy element abilities',
            symbol = '💀',
            color = '#3d3846',
            class = 'element-tagged necromancy'
        },
        flame = {
            text = 'Flame',
            link = 'Flame element abilities',
            symbol = '🔥',
            color = '#e01b24',
            class = 'element-tagged flame'
        },
        nature = {
            text = 'Nature',
            link = 'Nature element abilities',
            symbol = '🌱',
            color = '#33d17a',
            class = 'element-tagged nature'
        }
    },
    class = {
        ber = {
            text = 'Berserker',
            link = 'Berserker class abilities',
            symbol = '🪓',
            class = 'class-tagged berserker'
        },
        due = {
            text = 'Duelist',
            link = 'Duelist class abilities',
            symbol = '🤺',
            class = 'class-tagged duelist'
        },
        vet = {
            text = 'Veteran',
            link = 'Veteran class abilities',
            symbol = '🪖',
            class = 'class-tagged veteran'
        },
        kni = {
            text = 'Knight',
            link = 'Knight class abilities',
            symbol = '⚔️',
            class = 'class-tagged knight'
        },
        pal = {
            text = 'Paladin',
            link = 'Paladin class abilities',
            symbol = '🛡️',
            class = 'class-tagged paladin'
        },
        ass = {
            text = 'Assassin',
            link = 'Assassin class abilities',
            symbol = '🗡️',
            class = 'class-tagged assassin'
        },
        cor = {
            text = 'Corsair',
            link = 'Corsair class abilities',
            symbol = '🏴‍☠️',
            class = 'class-tagged corsair'
        },
        arc = {
            text = 'Archer',
            link = 'Archer class abilities',
            symbol = '🏹',
            class = 'class-tagged archer'
        },
        thi = {
            text = 'Thief',
            link = 'Thief class abilities',
            symbol = '💰️',
            class = 'class-tagged thief'
        },
        ran = {
            text = 'Ranger',
            link = 'Ranger class abilities',
            symbol = '🐾',
            class = 'class-tagged ranger'
        },
        fla = {
            text = 'Flame Mage',
            link = 'Flame Mage class abilities',
            symbol = '🧙',
            class = 'class-tagged flameMage'
        },
        sto = {
            text = 'Storm Mage',
            link = 'Storm Mage class abilities',
            symbol = '🧙',
            class = 'class-tagged stormMage'
        },
        lif = {
            text = 'Life Mage',
            link = 'Life Mage class abilities',
            symbol = '🧙',
            class = 'class-tagged lifeMage'
        },
        nec = {
            text = 'Necromancer',
            link = 'Necromancer class abilities',
            symbol = '🧙',
            class = 'class-tagged necromancer'
        },
        nat = {
            text = 'Nature Mage',
            link = 'Nature Mage class abilities',
            symbol = '🧙',
            class = 'class-tagged natureMage'
        }
    },
    power = {
        divine = {
            text = 'Divine',
            link = 'Divinely powered abilities',
            symbol = '🪽',
            color = '#f9f06b',
            class = 'power-tagged divine'
        },
        magic = {
            text = 'Magical',
            link = 'Magically powered abilities',
            symbol = '✨',
            color = '#9141ac',
            class = 'power-tagged magical'
        },
        spirit = {
            text = 'Spiritual',
            link = 'Spiritually powered abilities',
            symbol = '🪭',
            color = '#9a9996',
            class = 'power-tagged spiritual'
        },
        martial = {
            text = 'Martial',
            link = 'Martially powered abilities',
            symbol = '💪',
            color = '#ff7800',
            class = 'power-tagged martial'
        },
        psionic = {
            text = 'Psionic',
            link = 'Psionically powered abilities',
            symbol = '🤯',
            color = '#3584e4',
            class = 'power-tagged psionic'
        },
        primal = {
            text = 'Primal',
            link = 'Primally powered abilities',
            symbol = '⛰️',
            color = '#986a44',
            class = 'power-tagged primal'
        },
        techo = {
            text = 'Technological',
            link = 'Technologically powered abilities',
            symbol = '⚙️',
            color = '#e01b24',
            class = 'power-tagged technological'
        },
        finance = {
            text = 'Financial',
            link = 'Financially powered abilities',
            symbol = '🪙',
            color = '#fcc200',
            class = 'power-tagged financial'
        },
        alchemy = {
            text = 'Alchemical',
            link = 'Alchemically powered abilities',
            symbol = '🧪',
            color = '#33d17a',
            class = 'power-tagged alchemical'
        },
        unknown = {
            text = 'Unknown',
            link = 'Unknown powered abilities',
            symbol = '❓',
            color = '#77767b',
            class = 'power-tagged unknown'
        }
    },
    category = {
        skill = {
            text = 'Skill',
            link = 'Skills',
            symbol = '🤹',
            class = 'skill'
        },
        spell = {
            text = 'Spell',
            link = 'Spells',
            symbol = '✨',
            class = 'spell'
        },
        semblant = {
            text = 'Semblant',
            link = 'Semblant skills',
            symbol = '🎭',
            class = 'standard-tagged semblant'
        },
        conjure = {
            text = 'Conjured',
            link = 'Conjured spells',
            symbol = '🔮',
            class = 'standard-tagged conjure'
        },
        standard = {
            text = 'Standard',
            link = 'Standard abilities',
            symbol = '🏁',
            class = 'standard-tagged normal'
        },
        rotator = {
            text = 'Rotator',
            link = 'Rotator abilities',
            symbol = '🔄',
            class = 'rotator'
        }
    },
    effects = {
        mental = {
            text = 'Mental',
            link = 'Mental effects',
            symbol = '🧠',
            class = 'effect-tagged mental'
        },
        truth = {
            text = 'Truth detecting',
            link = 'Truth detecting effects',
            symbol = '⚖️',
            class = 'effect-tagged truthDetecting'
        },
        duelMod = {
            text = 'Duel modifying',
            link = 'Duel modifying effects',
            symbol = '🤺',
            class = 'effect-tagged duelModifying'
        },
        movement = {
            text = 'Movement',
            link = 'Movement effects',
            symbol = '👣',
            class = 'effect-tagged movement'
        },
        poison = {
            text = 'Poison',
            link = 'Poison effects',
            symbol = '☠️',
            class = 'effect-tagged poison'
        },
        displacement = {
            text = 'Displacement',
            link = 'Displacement effects',
            symbol = '🌀',
            class = 'effect-tagged displacement'
        },
        transformation = {
            text = 'Transformation',
            link = 'Transformation effects',
            symbol = '🌳',
            class = 'effect-tagged transformation'
        },
        control = {
            text = 'Control',
            link = 'Control effects',
            symbol = '⛓️',
            class = 'effect-tagged control'
        },
        resist = {
            text = 'Resistance',
            link = 'Resistance effects',
            symbol = '🚫',
            class = 'effect-tagged resistance'
        },
        awaken = {
            text = 'Awakening',
            link = 'Awakening effects',
            symbol = '🌞',
            class = 'effect-tagged awakening'
        },
        immune = {
            text = 'Immunity',
            link = 'Immunity effects',
            symbol = '🚫',
            class = 'effect-tagged immunity'
        },
        long = {
            text = 'Long range',
            link = 'Long range effects',
            symbol = '📏',
            class = 'effect-tagged longRange'
        },
        sense = {
            text = 'Sensory',
            link = 'Sensory effects',
            symbol = '👁️',
            class = 'effect-tagged sensory'
        },
        revive = {
            text = 'Revival',
            link = 'Revival effects',
            symbol = '🤍',
            class = 'effect-tagged revival'
        },
        summon = {
            text = 'Summoning',
            link = 'Summoning effects',
            symbol = '🖤',
            class = 'effect-tagged summoning'
        },
        heal = {
            text = 'Healing',
            link = 'Healing effects',
            symbol = '❤️',
            class = 'effect-tagged healing'
        },
        reanimate = {
            text = 'Reanimation',
            link = 'Reanimation effects',
            symbol = '🩶',
            class = 'effect-tagged reanimation'
        },
        regenerate = {
            text = 'Regeneration',
            link = 'Regeneration effects',
            symbol = '💚',
            class = 'effect-tagged regeneration'
        },
        revitalize = {
            text = 'Revitalization',
            link = 'Revitalization effects',
            symbol = '🩵',
            class = 'effect-tagged revitalization'
        },
        kill = {
            text = 'Killing',
            link = 'Killing effects',
            symbol = '☠️',
            class = 'effect-tagged killing'
        },
        damage = {
            text = 'Damaging',
            link = 'Damaging effects',
            symbol = '💢',
            class = 'effect-tagged damaging'
        },
        steal = {
            text = 'Stealing',
            link = 'Stealing effects',
            symbol = '💰',
            class = 'effect-tagged stealing'
        },
        loud = {
            text = 'Loud',
            link = 'Loud effects',
            symbol = '🔊',
            class = 'effect-tagged loud'
        },
        knockout = {
            text = 'Knockout',
            link = 'Knockout effects',
            symbol = '💤',
            class = 'effect-tagged knockout'
        },
        time = {
            text = 'Temporal',
            link = 'Temporal effects',
            symbol = '🕰️',
            class = 'effect-tagged temporal'
        }
    },
    pre = {
        strike = {
            text = 'Strike',
            link = 'Strike delivery abilities',
            symbol = '⚔️',
            class = 'deliveryPackage-tagged strike'
        },
        ray = {
            text = 'Ray',
            link = 'Ray delivery abilities',
            symbol = '⚡️',
            class = 'deliveryPackage-tagged ray'
        },
        ball = {
            text = 'Ball',
            link = 'Ball delivery abilities',
            symbol = '🔥',
            class = 'deliveryPackage-tagged ball'
        },
        aura = {
            text = 'Aura',
            link = 'Aura delivery abilities',
            symbol = '🌟',
            class = 'deliveryPackage-tagged aura'
        },
        ritual = {
            text = 'Ritual',
            link = 'Ritual delivery abilities',
            symbol = '🕯️',
            class = 'deliveryPackage-tagged ritual'
        },
        touch = {
            text = 'Touch',
            link = 'Touch delivery abilities',
            symbol = '👉️',
            class = 'deliveryPackage-tagged touch'
        }
    },
    maneuver = {
        active = {
            text = 'Active',
            link = 'Active abilities',
            symbol = '➡️',
            class = 'maneuver-tagged active'
        },
        reactive = {
            text = 'Reactive',
            link = 'Reactive abilities',
            symbol = '↩️',
            class = 'maneuver-tagged reactive'
        },
        passive = {
            text = 'Passive',
            link = 'Passive abilities',
            symbol = '🔁',
            class = 'maneuver-tagged passive'
        },
        slow = {
            text = 'Slow',
            link = 'Slow abilities',
            symbol = '🐢',
            class = 'maneuver-tagged slow'
        }
    },
    interaction = {
        attack = {
            text = 'Attack',
            link = 'Attack abilities',
            symbol = '⚔️',
            color = '#ff7800',
            class = 'interaction-tagged attack'
        },
        block = {
            text = 'Block',
            link = 'Block abilities',
            symbol = '🛡️',
            color = '#ff7800',
            class = 'interaction-tagged block'
        },
        manifest = {
            text = 'Manifest',
            link = 'Manifest abilities',
            symbol = '✳️',
            color = '#ff7800',
            class = 'interaction-tagged manifest'
        },
        feat = {
            text = 'Feat',
            link = 'Feat abilities',
            symbol = '🎖️',
            color = '#ff7800',
            class = 'interaction-tagged feat'
        }
    },
    delivery = {
        self = {
            text = 'Self',
            link = 'Self delivery abilities',
            symbol = '🤲',
            color = '#f6d32d',
            class = 'delivery-tagged self'
        },
        missile = {
            text = 'Missile',
            link = 'Missile delivery abilities',
            symbol = '🏹',
            color = '#f6d32d',
            class = 'delivery-tagged missile'
        },
        hand = {
            text = 'Hand',
            link = 'Hand delivery abilities',
            symbol = '🤚',
            color = '#f6d32d',
            class = 'delivery-tagged hand'
        },
        bite = {
            text = 'Bite',
            link = 'Bite delivery abilities',
            symbol = '🦷',
            color = '#f6d32d',
            class = 'delivery-tagged bite'
        },
        item = {
            text = 'Item',
            link = 'Item delivery abilities',
            symbol = '📦',
            color = '#f6d32d',
            class = 'delivery-tagged item'
        },
        magelore = {
            text = 'Magelore',
            link = 'Magelore delivery abilities',
            symbol = '🔮',
            color = '#f6d32d',
            class = 'delivery-tagged magelore'
        },
        weapon = {
            text = 'Weapon',
            link = 'Weapon delivery abilities',
            symbol = '🗡️',
            color = '#f6d32d',
            class = 'delivery-tagged weapon'
        },
        shield = {
            text = 'Shield',
            link = 'Shield delivery abilities',
            symbol = '🛡️',
            color = '#f6d32d',
            class = 'delivery-tagged shield'
        },
        armor = {
            text = 'Armor',
            link = 'Armor delivery abilities',
            symbol = '🪖',
            color = '#f6d32d',
            class = 'delivery-tagged armor'
        },
        sight = {
            text = 'Sight',
            link = 'Sight delivery abilities',
            symbol = '👁️',
            color = '#f6d32d',
            class = 'delivery-tagged sight'
        },
        aura = {
            text = 'Aura',
            link = 'Aura delivery abilities',
            symbol = '🌟',
            color = '#f6d32d',
            class = 'delivery-tagged aura'
        },
        cone = {
            text = 'Cone',
            link = 'Cone delivery abilities',
            symbol = '🐲',
            color = '#f6d32d',
            class = 'delivery-tagged cone'
        },
        other = {
            text = 'Other',
            link = 'Other delivery abilities',
            symbol = '❓',
            color = '#f6d32d',
            class = 'delivery-tagged other'
        }
    },
    target = {
        self = {
            text = 'Self',
            link = 'Self target abilities',
            symbol = '🤲',
            color = '#f6d32d',
            class = 'target-tagged self'
        },
        creature = {
            text = 'Creature',
            link = 'Creature target abilities',
            symbol = '👤',
            color = '#f6d32d',
            class = 'target-tagged creature'
        },
        body = {
            text = 'Body',
            link = 'Body target abilities',
            symbol = '🧍',
            color = '#f6d32d',
            class = 'target-tagged body'
        },
        vitals = {
            text = 'Vitals',
            link = 'Vitals target abilities',
            symbol = '🫀',
            color = '#f6d32d',
            class = 'target-tagged vitals'
        },
        limb = {
            text = 'Limb',
            link = 'Limb target abilities',
            symbol = '🦾',
            color = '#f6d32d',
            class = 'target-tagged limb'
        },
        arm = {
            text = 'Arm',
            link = 'Arm target abilities',
            symbol = '💪',
            color = '#f6d32d',
            class = 'target-tagged arm'
        },
        leg = {
            text = 'Leg',
            link = 'Leg target abilities',
            symbol = '🦵',
            color = '#f6d32d',
            class = 'target-tagged leg'
        },
        item = {
            text = 'Item',
            link = 'Item target abilities',
            symbol = '📦',
            color = '#f6d32d',
            class = 'target-tagged item'
        },
        weapon = {
            text = 'Weapon',
            link = 'Weapon target abilities',
            symbol = '🗡️',
            color = '#f6d32d',
            class = 'target-tagged weapon'
        },
        shield = {
            text = 'Shield',
            link = 'Shield target abilities',
            symbol = '🛡️',
            color = '#f6d32d',
            class = 'target-tagged shield'
        },
        armor = {
            text = 'Armor',
            link = 'Armor target abilities',
            symbol = '🪖',
            color = '#f6d32d',
            class = 'target-tagged armor'
        },
        ship = {
            text = 'Ship',
            link = 'Ship target abilities',
            symbol = '⛵️',
            color = '#f6d32d',
            class = 'target-tagged ship'
        },
        attack = {
            text = 'Attack',
            link = 'Attack target abilities',
            symbol = '⚔️',
            color = '#f6d32d',
            class = 'target-tagged attack'
        },
        ability = {
            text = 'Ability',
            link = 'Ability target abilities',
            symbol = '🅰',
            color = '#f6d32d',
            class = 'target-tagged ability'
        },
        spell = {
            text = 'Spell',
            link = 'Spell target abilities',
            symbol = '💫',
            color = '#f6d32d',
            class = 'target-tagged spell'
        },
        other = {
            text = 'Other',
            link = 'Other target abilities',
            symbol = '❓',
            color = '#f6d32d',
            class = 'target-tagged other'
        },
        area = {
            text = 'Area',
            link = 'Area target abilities',
            symbol = '🏕️',
            color = '#f6d32d',
            class = 'target-tagged area'
        },
        ci = {tags = {'creature', 'item'}},
        ai = {tags = {'attack', 'item'}},
        aci = {tags = {'area', 'creature', 'item'}},
        ac = {tags = {'area', 'creature'}},
        al = {tags = {'arm', 'leg'}},
        cs = {tags = {'creature', 'self'}}
    },
    upgrade = {
        warded = {
            text = 'Warded',
            link = 'Warded abilities',
            class = 'upgrade-tagged warded'
        },
        absolute = {
            text = 'Absolute',
            link = 'Absolute abilities',
            class = 'upgrade-tagged absolute'
        }
    },
    executionTime = {
        freeAction = {
            text = 'Free action',
            symbol = '0️⃣',
            link = 'Free action abilities',
            class = 'executionTime-tagged a0'
        },
        singleAction = {
            text = 'Single action',
            symbol = '1️⃣',
            link = 'Single action abilities',
            class = 'executionTime-tagged a1'
        },
        doubleAction = {
            text = 'Double action',
            symbol = '2️⃣',
            link = 'Double action abilities',
            class = 'executionTime-tagged a2'
        },
        tripleAction = {
            text = 'Triple action',
            symbol = '3️⃣',
            link = 'Triple action abilities',
            class = 'executionTime-tagged a3'
        },
        freeReaction = {
            text = 'Free reaction',
            symbol = '0️⃣',
            link = 'Free reaction abilities',
            class = 'executionTime-tagged r0'
        },
        reaction = {
            text = 'Reaction',
            symbol = '1️⃣',
            link = 'Reaction abilities',
            class = 'executionTime-tagged r1'
        },
        shortRest = {
            text = 'Short rest',
            symbol = '🌙',
            link = 'Short rest abilities',
            class = 'executionTime-tagged shortRest'
        },
        longRest = {
            text = 'Long rest',
            symbol = '🌙',
            link = 'Long rest abilities',
            class = 'executionTime-tagged longRest'
        }
    },
    piercing = {
        av0 = {
            text = 'AV0',
            symbol = '🎯',
            link = 'AV0 abilities',
            color = '#33d17a',
            class = 'piercing-tagged av0'
        },
        unblockable = {
            text = 'UB',
            symbol = '🪨',
            link = 'UB abilities',
            color = '#33d17a',
            class = 'piercing-tagged ub'
        }
    },
    duration = {
        instant = {
            text = 'Instant',
            link = 'Instant duration abilities',
            no = true
        },
        always = {
            text = 'Always active',
            link = 'Always active duration abilities',
            no = true
        },
        noLimit = {
            text = 'No limit',
            link = 'No limit 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',
            class = 'saveAttribute-tagged int'
        },
        str = {
            text = 'Strength',
            symbol = 'STR',
            link = 'STR save abilities',
            class = 'saveAttribute-tagged str'
        },
        mov = {
            text = 'Movement',
            symbol = 'MOV',
            link = 'MOV save abilities',
            class = 'saveAttribute-tagged mov'
        },
        per = {
            text = 'Perception',
            symbol = 'PER',
            link = 'PER save abilities',
            class = 'saveAttribute-tagged per'
        },
        snk = {
            text = 'Sneak',
            symbol = 'SNK',
            link = 'SNK save abilities',
            class = 'saveAttribute-tagged snk'
        },
        unp = {
            text = 'Unused Presence',
            symbol = 'UNP',
            link = 'UNP save abilities',
            class = 'saveAttribute-tagged unp'
        }
    },
    expansionAttribute = {
        int = {
            text = 'Intelligence',
            symbol = 'INT',
            link = 'INT save abilities',
            class = 'expansionAttribute-tagged int'
        },
        str = {
            text = 'Strength',
            symbol = 'STR',
            link = 'STR save abilities',
            class = 'expansionAttribute-tagged str'
        },
        mov = {
            text = 'Movement',
            symbol = 'MOV',
            link = 'MOV save abilities',
            class = 'expansionAttribute-tagged mov'
        },
        per = {
            text = 'Perception',
            symbol = 'PER',
            link = 'PER save abilities',
            class = 'expansionAttribute-tagged per'
        },
        snk = {
            text = 'Sneak',
            symbol = 'SNK',
            link = 'SNK save abilities',
            class = 'expansionAttribute-tagged snk'
        },
        unp = {
            text = 'Unused Presence',
            symbol = 'UNP',
            link = 'UNP save abilities',
            class = 'expansionAttribute-tagged unp'
        }
    },
    expansion = {
        detonate = {
            text = 'Detonate',
            symbol = '💥',
            link = 'Detonate expansion abilities',
            class = 'expansion-tagged detonate'
        },
        ripple = {
            text = 'Ripple',
            symbol = '🌊',
            link = 'Ripple expansion abilities',
            class = 'expansion-tagged ripple'
        },
        cascade = {
            text = 'Cascade',
            symbol = '➰',
            link = 'Cascade expansion abilities',
            class = 'expansion-tagged cascade'
        },
        fork = {
            text = 'Fork',
            symbol = '🔱',
            link = 'Fork expansion abilities',
            class = 'expansion-tagged fork'
        }
    },
    sustained = {
        sustained = {
            text = 'Sustained',
            symbol = '⏳️',
            link = 'Sustained abilities',
            class = 'sustained'
        }
    }
}

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 tag.class then tagText = tagText .. "|class=" .. tag.class 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, flags, bottom)
    if content == '' then return '' end
    local barSpace = mw.html.create('span')
    barSpace:wikitext(frame:preprocess('&nbsp;')):css('display', 'none')
    local barTitle = mw.html.create('span')
    local barTitleClass = "{{lc:" .. title .. "}}"
    barTitleClass = barTitleClass:gsub(' ', '-')
    barTitleClass = barTitleClass:gsub('\'', '')
    barTitleClass = barTitleClass:gsub('\"', '')
    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')
    if bottom then output = mw.html.create('span') end
    if not flags then flags = {} end
    for k, v in pairs(flags) do
        if type(v) == 'string' then
            output:addClass('flag-' .. k .. '-' .. v)
        end
    end
    output:addClass('ability-bar'):addClass('ability-bar-' .. barTitleClass)
        :attr(flags):attr('test', 'out'):node(barSpace):node(barTitle):node(
            barSpace):node(barContent):css('display', 'block')
    -- if flags then
    -- for k, v in ipairs(flags) do
    --     output:attr(k, v)
    -- end
    -- end
    return tostring(output)
end

local function nonempty(v)
    if v == nil then return false end
    if type(v) ~= 'string' then return true end
    return mw.text.trim(v) ~= ''
end

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

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

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

        -- Treat empty/whitespace as false
        if rawValue ~= nil and not nonempty(rawValue) then
            resolved[canonicalKey] = false
        elseif rawValue ~= nil then
            for canonicalValue, valueAliasList in pairs(canonicalValueTable) do
                for _, alias in ipairs(valueAliasList) do
                    if rawValue == alias then
                        resolved[canonicalKey] = canonicalValue
                        break
                    elseif type(valueAliasList) == "table" and valueAliasList[1] and
                        type(rawValue) == "string" and
                        rawValue:match(valueAliasList[1]) then
                        -- (keep your existing time/range parsing here unchanged)
                        if canonicalKey == "duration" or canonicalKey ==
                            "executionTime" then
                            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"
                            }
                            resolved[canonicalKey] = unitMap[unit] and
                                                         (num .. " " ..
                                                             unitMap[unit] ..
                                                             (num > 1 and "s" or
                                                                 "")) or
                                                         rawValue
                        elseif canonicalKey == "range" or canonicalKey ==
                            "expansionRange" then
                            local num = tonumber(rawValue:match("^(%d+)"))
                            local unit = rawValue:match("[%a]+$")
                            local unitMap = {f = "feet", m = "miles"}
                            resolved[canonicalKey] = unitMap[unit] and
                                                         (num .. " " ..
                                                             unitMap[unit]) or
                                                         rawValue
                        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
    -- Prefer parent args if invoked via a template
    local parent = frame:getParent()
    local rawArgs = parent and parent.args or frame.args

    -- Drop empty/whitespace-only values so "" behaves like false/nil
    local args = {}
    for k, v in pairs(rawArgs) do if nonempty(v) then args[k] = v end end
    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 not resolved['duration'] then resolved['duration'] = 'instant' end

    if resolved['interaction'] == 'attack' then
        local dc = "Hit target's {{AC}}"
        if resolved['target'] == 'limb' then
            dc = "Hit target's {{Var:ACLimb}}"
        end
        if resolved['target'] == 'arm' then
            dc = "Hit target's {{Var:ACLimb}}"
        end
        if resolved['target'] == 'leg' then
            dc = "Hit target's {{Var:ACLimb}}"
        end
        if resolved['target'] == 'vitals' then
            dc = "Hit target's {{Var:ACVitals}}"
        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
    local costGP = 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['gp'] then costGP = args['gp'] 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 flawContent = ''
    if args['flaw'] or args['f'] or args['fl'] then
        flawContent = flawContent .. makeTag(frame, 'flaw', 'flaw', makeCat)
        c = c ..
                addCategory('Flaw abilities', 'flaw', 'flaw', skill, spell,
                            addCats)
    end
    local specialContent = ''
    if args['special'] or args['s'] or args['sp'] then
        specialContent = specialContent ..
                             makeTag(frame, 'special', 'special', makeCat)
        c = c ..
                addCategory('Special abilities', 'special', 'special', skill,
                            spell, addCats)
    end
    local esContent = ''
    if args['es'] then
        esContent = esContent .. makeTag(frame, 'es', 'es', makeCat)
        c = c ..
                addCategory('Elder Sorcery abilities', 'es', 'es', skill, spell,
                            addCats)
    end
    local wardedContent = ''
    if args['warded'] then
        wardedContent = wardedContent ..
                            makeTag(frame, 'warded', 'warded', makeCat)
        c = c ..
                addCategory('Warded abilities', 'warded', 'warded', 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 class then
        classContent = makeContent(frame, resolved, {'class'}, makeCat)
        powerContent = powerContent .. classContent
    end
    if args['rotator'] then
        powerContent = powerContent ..
                           makeTag(frame, 'category', 'rotator', makeCat)
    end
    powerContent = powerContent .. elementContent
    if skill then
        powerContent = powerContent ..
                           makeTag(frame, 'category', 'skill', makeCat)
    end
    if spell then
        powerContent = powerContent ..
                           makeTag(frame, 'category', 'spell', makeCat)
    end

    local deliveryContent = ''
    if standard and skill then
        deliveryContent = deliveryContent ..
                              makeTag(frame, 'category', 'semblant', makeCat)
    end
    if standard and spell then
        deliveryContent = deliveryContent ..
                              makeTag(frame, 'category', 'conjure', 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',
                            'truthDetecting', skill, spell, addCats)
    end
    if args['duelMod'] then
        effectContent = effectContent ..
                            makeTag(frame, 'effects', 'duelModifying', makeCat)
        c = c ..
                addCategory('Duel modifying effects', 'effect', 'duelModifying',
                            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['poison'] then
        effectContent = effectContent ..
                            makeTag(frame, 'effects', 'poison', makeCat)
        c = c ..
                addCategory('Poison effects', 'effect', 'poison', 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['awaken'] then
        effectContent = effectContent ..
                            makeTag(frame, 'effects', 'awaken', makeCat)
        c = c ..
                addCategory('Awakening effects', 'effect', 'awaken', 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|class=cost-tagged mpx}}")
            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|class=cost-tagged mp" ..
                                  costMP .. "}}")
            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|class=cost-tagged hpx}}")
            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|class=cost-tagged hp" ..
                                  costHP .. "}}")
            c = c ..
                    addCategory(costHP .. ' HP cost abilities', 'costHP',
                                costHP, skill, spell, addCats, true)
        end
    end
    if costGP then
        c = c ..
                addCategory('GP cost abilities', 'costGP', costGP, skill, spell,
                            addCats, true)
        if costGP == 'x' then
            costContent = costContent .. frame:preprocess(
                              "{{Tag|X GP|🪙|l=:Category:GP cost abilities|c=#F6D32D|class=cost-tagged gpx}}")
            c = c ..
                    addCategory('Variable GP cost abilities', 'costGP', 'x',
                                skill, spell, addCats, true)
        else
            costContent = costContent .. frame:preprocess(
                              "{{Tag|" .. costGP ..
                                  " GP|🪙|l=:Category:GP cost abilities|c=#F6D32D|class=cost-tagged gp" ..
                                  costGP .. "}}")
            c = c ..
                    addCategory(costGP .. ' GP cost abilities', 'costGP',
                                costGP, 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|class=cost-tagged shatter}}")
    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
    local f = 'proficiency'
    if args['fflu'] then f = 'fluency' end
    if args['fstat'] and (args['fflu'] or args['fpro']) then
        local fstat = frame:preprocess("{{uc:" .. args['fstat'] .. "}}")
        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(esContent .. powerContent),
            link = ':Category:Powered abilities'
        }, {
            title = 'effect types',
            content = frame:preprocess(flawContent .. specialContent ..
                                           effectContent),
            link = ':Category:Effects'
        }, {
            title = 'delivery',
            content = frame:preprocess(wardedContent .. deliveryContent) ..
                makeContent(frame, resolved, {
                    'expansion', 'pre', 'upgrade', 'piercing', 'delivery',
                    'interaction'
                }, makeCat),
            link = ':Category:Delivery abilities'
        }, {
            title = 'save attribute',
            content = makeContent(frame, resolved, {'attribute'}, makeCat),
            link = 'Core:Feat Interaction'
        }, {
            title = 'expansion save attribute',
            content = makeContent(frame, resolved, {'expansionAttribute'},
                                  makeCat)
        }, {
            title = 'target',
            content = makeContent(frame, resolved, {'target', 'hitDC'}, makeCat),
            link = ':Category:Target abilities'
        }, {
            title = executionTimeTitle,
            content = makeContent(frame, resolved,
                                  {'executionTime', 'maneuver'}, makeCat),
            link = 'Core:Maneuvers'
        }, {
            title = 'trigger',
            content = args['trigger'] or '',
            link = 'Core:Reactive Maneuvers'
        }, {
            title = 'cost and components',
            content = frame:preprocess(costContent) ..
                makeContent(frame, resolved, {
                    'material', 'invoked', 'verbal', 'somatic', 'magelore'
                }, makeCat),
            link = ':Category:Cost abilities'
        }, {
            title = 'Mana cost',
            content = args['mpx'] or '',
            link = ':Category:MP cost abilities'
        }, {
            title = 'Hit cost',
            content = args['hpx'] or '',
            link = ':Category:HP cost abilities'
        }, {
            title = 'Gold cost',
            content = args['gpx'] or '',
            link = ':Category:GP cost abilities'
        }, {
            title = 'Material cost',
            content = makeContent(frame, resolved, {'matx'}, makeCat),
            link = ':Category:Material component abilities'
        }, {
            title = 'duration',
            content = makeContent(frame, resolved, {'duration', 'sustained'},
                                  makeCat),
            link = ':Category:Duration abilities'
        }, {
            title = 'range',
            content = makeContent(frame, resolved, {'range'}, makeCat),
            link = 'Core:Range'
        }, -- {
        --     title = 'expansion',
        --     content = makeContent(frame, resolved, {'expansion'}, makeCat)
        -- },
        {
            title = 'expansion range',
            content = makeContent(frame, resolved,
                                  {'expansionRange', 'expansionCount'}, makeCat),
            link = 'Core:Expansions'
        }, -- {
        --     title = 'expansion count',
        --     content = frame:preprocess('TEST')
        -- },
        {
            title = 'Requirements',
            content = makeContent(frame, resolved, {'requirement'}, makeCat)
        }
    }

    local barsBottom = {
        {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),
            link = ':Category:Heightened abilities'
        }, {
            title = 'If proficient',
            content = proficiencyContent,
            link = 'Core:Proficiency Bonus'
        },
        {
            title = 'If fluent',
            content = fluencyContent,
            link = 'Core:Fluency Bonus'
        }, {
            title = 'Attribute improvement',
            content = frame:preprocess(statValContent),
            link = 'Core:Attributes',
            flags = {
                attribute = args['vstat'] and
                    frame:preprocess('{{lc:' .. args['vstat'] .. '}}') or "",
                value = args['val']
            }
        }, {
            title = 'Feat save improvement',
            content = frame:preprocess(statFeatContent),
            link = 'Core:Feat Interaction',
            flags = {
                attribute = args['fstat'] and
                    frame:preprocess('{{lc:' .. args['fstat'] .. '}}'),
                value = f
            }
        }
    }

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

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

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

    local output = mw.html.create('span')
    output:addClass('ability-variables')
    if args['basic'] then output:addClass('ability-basic') end
    output:wikitext(outputTop)

    if outputMiddle ~= '' then
        output:wikitext('<hr>'):wikitext(
            '<span class="ability-overview-base">' .. outputMiddle .. '</span>')
    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