Template:Stat Block: Difference between revisions

From Deez Nuts' Sword Coast Campaign
Jump to navigation Jump to search
Create 5e stat block template with inline CSS — no stylesheet dependency
 
Rewrite template without ParserFunctions — use only core MediaWiki syntax
 
Line 26: Line 26:
<div style="padding: 4px 12px 6px 12px; border-bottom: 1px solid #822b24; font-size: 0.9em; color: #822b24;">
<div style="padding: 4px 12px 6px 12px; border-bottom: 1px solid #822b24; font-size: 0.9em; color: #822b24;">
   <b>Armor Class</b> {{{ac|—}}}<br>
   <b>Armor Class</b> {{{ac|—}}}<br>
   <b>Hit Points</b> {{{hp|—}}}
   <b>Hit Points</b> {{{hp|—}}}<br>
  {{#if: {{{ward|}}} | <br><i>Ward:</i> {{{ward|}}} |}}
  <br>
   <b>Speed</b> {{{speed|—}}}
   <b>Speed</b> {{{speed|—}}}
</div>
</div>
Line 41: Line 39:
     font-size: 0.85em;
     font-size: 0.85em;
">
">
   <div><b>STR</b><br>{{{str|10}}}
   <div><b>STR</b><br>{{{str|10}}}<br><small>{{{strmod|+0}}}</small></div>
 
   <div><b>DEX</b><br>{{{dex|10}}}<br><small>{{{dexmod|+0}}}</small></div>
  <small>({{#expr: floor(({{{str|10}}}-10)/2)}}{{#ifexpr: ({{{str|10}}}-10)/2 >= 0 |+}})</small></div>
   <div><b>CON</b><br>{{{con|10}}}<br><small>{{{conmod|+0}}}</small></div>
   <div><b>DEX</b><br>{{{dex|10}}}
   <div><b>INT</b><br>{{{int|10}}}<br><small>{{{intmod|+0}}}</small></div>
 
   <div><b>WIS</b><br>{{{wis|10}}}<br><small>{{{wismod|+0}}}</small></div>
  <small>({{#expr: floor(({{{dex|10}}}-10)/2)}}{{#ifexpr: ({{{dex|10}}}-10)/2 >= 0|+}})</small></div>
   <div><b>CHA</b><br>{{{cha|10}}}<br><small>{{{chamod|+0}}}</small></div>
   <div><b>CON</b><br>{{{con|10}}}
 
  <small>({{#expr: floor(({{{con|10}}}-10)/2)}}{{#ifexpr: ({{{con|10}}}-10)/2 >= 0|+}})</small></div>
   <div><b>INT</b><br>{{{int|10}}}
 
  <small>({{#expr: floor(({{{int|10}}}-10)/2)}}{{#ifexpr: ({{{int|10}}}-10)/2 >= 0|+}})</small></div>
   <div><b>WIS</b><br>{{{wis|10}}}
 
  <small>({{#expr: floor(({{{wis|10}}}-10)/2)}}{{#ifexpr: ({{{wis|10}}}-10)/2 >= 0|+}})</small></div>
   <div><b>CHA</b><br>{{{cha|10}}}
 
  <small>({{#expr: floor(({{{cha|10}}}-10)/2)}}{{#ifexpr: ({{{cha|10}}}-10)/2 >= 0|+}})</small></div>
</div>
</div>


<!-- Secondary stats -->
<!-- Secondary stats -->
<div style="padding: 4px 12px 4px 12px; border-bottom: 1px solid #822b24; font-size: 0.9em; color: #333;">
<div style="padding: 4px 12px 4px 12px; border-bottom: 1px solid #822b24; font-size: 0.9em; color: #333;">
   {{#if: {{{saves|}}} | <b>Saving Throws</b> {{{saves|}}}<br>|}}
   <b>Saving Throws</b> {{{saves|}}}<br>
   {{#if: {{{skills|}}} | <b>Skills</b> {{{skills|}}}<br>|}}
   <b>Skills</b> {{{skills|}}}<br>
  {{#if: {{{damage_vuln|}}} | <b>Damage Vulnerabilities</b> {{{damage_vuln|}}}<br>|}}
   <b>Senses</b> {{{senses|—}}}
  {{#if: {{{damage_res|}}} | <b>Damage Resistances</b> {{{damage_res|}}}<br>|}}
  {{#if: {{{damage_imm|}}} | <b>Damage Immunities</b> {{{damage_imm|}}}<br>|}}
  {{#if: {{{cond_imm|}}} | <b>Condition Immunities</b> {{{cond_imm|}}}<br>|}}
   <b>Senses</b> {{{senses|—}}}<br>
  {{#if: {{{languages|}}} | <b>Languages</b> {{{languages|}}}<br>|}}
  {{#if: {{{cr|}}} | <b>Challenge</b> {{{cr|}}}<br>|}}
</div>
</div>


<!-- Features / Traits -->
<!-- Features / Traits -->
{{#if: {{{traits|}}}
<div style="padding: 6px 12px; border-bottom: 1px solid #822b24; font-size: 0.9em;">
| <div style="padding: 6px 12px; border-bottom: 1px solid #822b24; font-size: 0.9em;">
     {{{traits|}}}
     {{{traits|}}}
  </div>
</div>
|}}


<!-- Actions -->
<!-- Actions -->
{{#if: {{{actions|}}}
<div style="padding: 6px 12px; border-bottom: 1px solid #822b24; font-size: 0.9em;">
| <div style="padding: 6px 12px; border-bottom: 1px solid #822b24; font-size: 0.9em;">
     <div style="color: #822b24; font-weight: bold; font-size: 1.1em; border-bottom: 1px dotted #822b24; margin-bottom: 4px;">Actions</div>
     <div style="color: #822b24; font-weight: bold; font-size: 1.1em; border-bottom: 1px dotted #822b24; margin-bottom: 4px;">Actions</div>
     {{{actions|}}}
     {{{actions|}}}
  </div>
</div>
|}}


<!-- Bonus Actions -->
<!-- Bonus Actions -->
{{#if: {{{bonus_actions|}}}
<div style="padding: 6px 12px; border-bottom: 1px solid #822b24; font-size: 0.9em;">
| <div style="padding: 6px 12px; border-bottom: 1px solid #822b24; font-size: 0.9em;">
     <div style="color: #822b24; font-weight: bold; font-size: 1.1em; border-bottom: 1px dotted #822b24; margin-bottom: 4px;">Bonus Actions</div>
     <div style="color: #822b24; font-weight: bold; font-size: 1.1em; border-bottom: 1px dotted #822b24; margin-bottom: 4px;">Bonus Actions</div>
     {{{bonus_actions|}}}
     {{{bonus_actions|}}}
  </div>
</div>
|}}


<!-- Reactions -->
<!-- Reactions -->
{{#if: {{{reactions|}}}
<div style="padding: 6px 12px; border-bottom: 1px solid #822b24; font-size: 0.9em;">
| <div style="padding: 6px 12px; border-bottom: 1px solid #822b24; font-size: 0.9em;">
     <div style="color: #822b24; font-weight: bold; font-size: 1.1em; border-bottom: 1px dotted #822b24; margin-bottom: 4px;">Reactions</div>
     <div style="color: #822b24; font-weight: bold; font-size: 1.1em; border-bottom: 1px dotted #822b24; margin-bottom: 4px;">Reactions</div>
     {{{reactions|}}}
     {{{reactions|}}}
  </div>
</div>
|}}


<!-- Legendary Actions -->
<!-- Legendary Actions -->
{{#if: {{{legendary|}}}
<div style="padding: 6px 12px; border-bottom: 1px solid #822b24; font-size: 0.9em;">
| <div style="padding: 6px 12px; border-bottom: 1px solid #822b24; font-size: 0.9em;">
     <div style="color: #822b24; font-weight: bold; font-size: 1.1em; border-bottom: 1px dotted #822b24; margin-bottom: 4px;">Legendary Actions</div>
     <div style="color: #822b24; font-weight: bold; font-size: 1.1em; border-bottom: 1px dotted #822b24; margin-bottom: 4px;">Legendary Actions</div>
     {{{legendary|}}}
     {{{legendary|}}}
  </div>
</div>
|}}


<!-- Freeform blocks for custom sections -->
<!-- Freeform blocks -->
{{#if: {{{block1|}}}
<div style="padding: 6px 12px; font-size: 0.9em; color: #333;">
| <div style="padding: 6px 12px; font-size: 0.9em; color: #333;">
     {{{block1|}}}
     {{{block1|}}}
  </div>
</div>
|}}
<div style="padding: 6px 12px; font-size: 0.9em; color: #333; border-top: 1px solid #822b24;">
{{#if: {{{block2|}}}
| <div style="padding: 6px 12px; font-size: 0.9em; color: #333; border-top: 1px solid #822b24;">
     {{{block2|}}}
     {{{block2|}}}
  </div>
</div>
|}}


<!-- Footer -->
<!-- Footer -->
Line 130: Line 96:
</includeonly><noinclude>
</includeonly><noinclude>
== 5e Stat Block Template ==
== 5e Stat Block Template ==
Produces a D&amp;D 5e-style stat block using inline CSS (no stylesheet dependency). Designed for DM-facing NPC and enemy pages.
Produces a D&amp;D 5e-style stat block using inline CSS. No extensions required — works on any MediaWiki install.


=== Parameters ===
=== Parameters ===
All parameters are optional except `name`.
All parameters are optional except `name`. Modifier parameters must be entered manually (e.g., `strmod=+4`).
 
| Parameter | Description |
|-----------|-------------|
| `name` | Creature name (default: page name) |
| `ac` | Armor Class |
| `hp` | Hit Points (e.g. "84 (7d10+21)") |
| `ward` | Additional HP pool, e.g. Arcane Ward |
| `speed` | Speed |
| `str`, `dex`, `con`, `int`, `wis`, `cha` | Ability scores (modifiers auto-calculated) |
| `saves` | Saving throw bonuses |
| `skills` | Skill bonuses |
| `damage_vuln` | Damage vulnerabilities |
| `damage_res` | Damage resistances |
| `damage_imm` | Damage immunities |
| `cond_imm` | Condition immunities |
| `senses` | Senses (passive Perception included here) |
| `languages` | Languages |
| `cr` | Challenge rating |
| `traits` | Special traits/features (freeform wikitext) |
| `actions` | Actions section |
| `bonus_actions` | Bonus actions section |
| `reactions` | Reactions section |
| `legendary` | Legendary actions section |
| `block1`, `block2` | Extra freeform blocks at bottom |


=== Example ===
{| class="wikitable"
<pre>
! Parameter !! Description !! Example
{{Stat Block
|-
| name = Vex Ironjaw
| `name` || Creature name || Vex Ironjaw
| ac = 20 (plate, shield)
|-
| hp = 84 (7d10+21)
| `ac` || Armor Class || 20 (plate, shield)
| speed = 25 ft
|-
| str = 18 | dex = 10 | con = 16 | int = 10 | wis = 14 | cha = 8
| `hp` || Hit Points || 84 (7d10+21)
| saves = STR +7, CON +6
|-
| skills = Athletics +7, Perception +5
| `speed` || Speed || 25 ft
| senses = Darkvision 60 ft, passive Perception 15
|-
| actions =
| `str` / `strmod` || STR score / modifier || 18 / +4
  '''Multiattack.''' Two warhammer attacks.<br>
|-
  '''Warhammer.''' ''Melee Weapon Attack:'' +7 to hit, 5 ft, one target. ''Hit:'' 8 (1d8+4) bludgeoning.
| `dex` / `dexmod` || DEX score / modifier || 10 / +0
| reactions =
|-
  '''Protection.''' Impose disadvantage on an attack against an ally within 5 ft.
| `con` / `conmod` || CON score / modifier || 16 / +3
}}
|-
</pre>
| `int` / `intmod` || INT score / modifier || 10 / +0
|-
| `wis` / `wismod` || WIS score / modifier || 14 / +2
|-
| `cha` / `chamod` || CHA score / modifier || 8 / -1
|-
| `saves` || Saving throw bonuses || STR +7, CON +6
|-
| `skills` || Skill bonuses || Athletics +7, Perception +5
|-
| `senses` || Senses || Darkvision 60 ft, passive Perception 15
|-
| `traits` || Special traits (freeform wikitext) || '''Sentinel.''' When Vex hits...
|-
| `actions` || Actions section || '''Multiattack.''' Two warhammer attacks.
|-
| `bonus_actions` || Bonus actions section || '''Second Wind.''' Regain 1d10+7 HP.
|-
| `reactions` || Reactions section || '''Protection.''' Impose disadvantage...
|-
| `legendary` || Legendary actions section || '''Detect.''' The creature makes...
|-
| `block1` || Extra freeform block (below legendary) || Spellcasting or class features
|-
| `block2` || Extra freeform block (bottom) || Upgrade paths or notes
|}


=== Notes ===
=== Notes ===
* Uses only inline CSS — works without `MediaWiki:Common.css` edits.
* Uses only inline CSS — no `MediaWiki:Common.css` or ParserFunctions extension required.
* Modifier signs (+/-) are auto-calculated from ability scores.
* All sections always render their headers. If a section is empty, it shows as a bare header with no content — this is intentional to keep the template simple.
* All sections are optional and will not render if empty.
* Modifier values must be entered manually with sign (e.g., `+4`, `-1`, `+0`). There is no auto-calculation.
* For multi-section stat blocks (like the hit squad page), use `traits` for general features, `actions` for attacks, `reactions` for reactions, and `block1`/`block2` for bespoke sections like "Combat Superiority" or "Spellcasting."
* The template is compact (max-width 420px) and can sit inline alongside prose.
* The template is compact (max-width 420px) and can sit inline alongside prose.


[[Category:Templates]] [[Category:Combat Reference]]
[[Category:Templates]] [[Category:Combat Reference]]
</noinclude>
</noinclude>

Latest revision as of 00:44, 27 June 2026

5e Stat Block Template

Produces a D&D 5e-style stat block using inline CSS. No extensions required — works on any MediaWiki install.

Parameters

All parameters are optional except `name`. Modifier parameters must be entered manually (e.g., `strmod=+4`).

Parameter Description Example
`name` Creature name Vex Ironjaw
`ac` Armor Class 20 (plate, shield)
`hp` Hit Points 84 (7d10+21)
`speed` Speed 25 ft
`str` / `strmod` STR score / modifier 18 / +4
`dex` / `dexmod` DEX score / modifier 10 / +0
`con` / `conmod` CON score / modifier 16 / +3
`int` / `intmod` INT score / modifier 10 / +0
`wis` / `wismod` WIS score / modifier 14 / +2
`cha` / `chamod` CHA score / modifier 8 / -1
`saves` Saving throw bonuses STR +7, CON +6
`skills` Skill bonuses Athletics +7, Perception +5
`senses` Senses Darkvision 60 ft, passive Perception 15
`traits` Special traits (freeform wikitext) Sentinel. When Vex hits...
`actions` Actions section Multiattack. Two warhammer attacks.
`bonus_actions` Bonus actions section Second Wind. Regain 1d10+7 HP.
`reactions` Reactions section Protection. Impose disadvantage...
`legendary` Legendary actions section Detect. The creature makes...
`block1` Extra freeform block (below legendary) Spellcasting or class features
`block2` Extra freeform block (bottom) Upgrade paths or notes

Notes

  • Uses only inline CSS — no `MediaWiki:Common.css` or ParserFunctions extension required.
  • All sections always render their headers. If a section is empty, it shows as a bare header with no content — this is intentional to keep the template simple.
  • Modifier values must be entered manually with sign (e.g., `+4`, `-1`, `+0`). There is no auto-calculation.
  • The template is compact (max-width 420px) and can sit inline alongside prose.