Module:AbilityTable/Lists/doc: Difference between revisions

Vergir (talk | contribs)
create documentation page for Module:AbilityTable/Lists (with help from vergir-bot LLM)
 
Vergir (talk | contribs)
write documentation for Module:AbilityTable/Lists (with help from vergir-bot LLM)
Line 1: Line 1:
This page documents [[Module:AbilityTable/Lists]], which defines which abilities appear in each automatic ability table on the wiki.
== How to add a missing ability to a list ==


The module has two sections: '''lists''' (which abilities to include) and '''exclude_abilities''' (which abilities to suppress despite matching).
If an ability should appear in a table but doesn't, it means none of its data properties match the list's property keys. The recommended fix is to find a matching property in [[Data:AbilityData.json]] and add it to the list. Only use a raw ability name as a fallback if no suitable property exists.


== How to add a missing ability to a list ==
Before editing, read the comment above the list you want to change — it describes what kind of abilities belong there.
 
'''Finding the right property''': Open [[Data:AbilityData.json]] and search for the ability. Look through its properties for one that represents the relevant mechanic — for example, a silence ability might have <code>SilenceDuration</code>. A good property is one shared by many abilities with the same mechanic, not something unique to one ability.
 
After adding the property or ability name, test the table to make sure no unwanted extra abilities appeared. If they did, the property is too broad — consider using a raw ability name instead, or adding the extras to <code>exclude_abilities</code>.
 
If your new ability has special column values, you may also want to update [[Module:AbilityTable/ComplexRenderers]]. And if it needs a descriptive note, add it in [[Module:AbilityTable/Notes]].
 
=== Example: adding a missing ability to the healreduce list ===
 
Say {{AbilityIcon|Affliction}} is missing from the [[Heal Amp|heal reduction]] table. First, check the comment above <code>["healreduce"]</code> in the module — it says "Abilities that reduce healing on their targets", so Affliction belongs there.


If an ability should appear in a table but doesn't, it's because none of its data properties match the list's property keys. The fix is to add a raw ability name string directly to the list.
Open [[Data:AbilityData.json]] and search for <code>citadel_ability_affliction</code>. Looking through its properties, you find <code>"DisableHealing": 1</code> — that looks like exactly what we need.


Find the relevant list in the module (e.g. <code>["dispelmagic"]</code>) and add the ability name at the end, after the property keys, keeping the names in alphabetical order:
Check if <code>DisableHealing</code> is already in the <code>["healreduce"]</code> list. It isn't, so add it (keeping alphabetical order):


<pre>
<pre>
["dispelmagic"] = {
["healreduce"] = {
     "BleedDuration", "BurnDuration", ...,
     "DisableHealing", "HealAmpReceivePenaltyPercent", "HealAmpRegenPenaltyPercent",
    "Card Trick", "Essence Theft", "Life Drain", "My New Ability",
},
},
</pre>
</pre>


Make sure the ability name matches exactly as it appears on its wiki page.
Save and test the table with <code><nowiki>{{AbilityTable|healreduce}}</nowiki></code>. Affliction now appears — and no unexpected abilities were added, so the property was a good fit.


== How to exclude an ability from a list ==
== How to exclude an ability from a list ==


If an ability appears in a table but shouldn't (a false positive), add it to <code>exclude_abilities</code> under the relevant stat, with a comment explaining why:
If an ability appears in a table but shouldn't, first check whether the property causing the match actually belongs in the list. If several unrelated abilities are showing up as false positives, it's likely that a prop was added to the list by mistake — inspect the list carefully and consider removing it. Make sure to test after removing a prop to confirm you didn't accidentally drop any legitimate abilities.
 
If the false positive is a genuine exception — the prop belongs in the list but this one ability happens to match it incorrectly — then add the ability to <code>exclude_abilities</code> under the relevant list name with a comment explaining why:


<pre>
<pre>
["dispelmagic"] = {
["healreduce"] = {
     "Bookwyrm", -- has DebuffDuration for some reason
     "My Ability", -- has DisableHealing for some reason but doesn't actually reduce healing
    "My Ability", -- explain why it's a false positive here
},
},
</pre>
</pre>
Line 31: Line 41:
== How to add a new list ==
== How to add a new list ==


Adding a new list means a new ability table stat will become available via <code><nowiki>{{AbilityTable|statname}}</nowiki></code>.
Adding a new list makes a new ability table available via <code><nowiki>{{AbilityTable|listname}}</nowiki></code>.
 
'''Step 1''': Find matching properties in [[Data:AbilityData.json]]. Look at several abilities that should appear in the list and identify properties they share. Prefer broad reusable properties over raw ability names.


'''Step 1''': Add a new entry to the <code>lists</code> table in this module with the stat name and its matching property keys:
'''Step 2''': Add a new entry to the <code>lists</code> table with a descriptive comment above it:


<pre>
<pre>
-- Brief description of what this list represents
-- Brief description of what this list represents
["mystat"] = { "PropertyOne", "PropertyTwo" },
["mylist"] = { "PropertyOne", "PropertyTwo" },
</pre>
</pre>


'''Step 2''': Register the stat in [[Module:AbilityTable]] by adding it to <code>extra_columns</code> (or leave it out if no special columns are needed beyond Notes).
Test the result with <code><nowiki>{{AbilityTable|mylist}}</nowiki></code> and adjust until the list looks right — adding missing abilities and excluding false positives as described above.


'''Step 3''': Optionally add human notes for specific abilities in [[Module:AbilityTable/Notes]].
'''Step 3 (optional)''': If the table should have extra columns beyond Notes, register a renderer in [[Module:AbilityTable]] and implement it in [[Module:AbilityTable/ComplexRenderers]].


Note: property key names come from <code>Data:AbilityData.json</code>. If an ability's effect has no matching property, use a raw ability name string instead (see above).
'''Step 4 (optional)''': Add human notes for specific abilities in [[Module:AbilityTable/Notes]].