Template:Infobox creature: Difference between revisions

From bg3.wiki
Jump to navigation Jump to search
(Improve variable names, pass "init bonus" to internal template, showcase use of "extra init" parameters.)
(Code cleanup using new templates.)
Line 1: Line 1:
<includeonly>{{#if: {{{image|}}}
<includeonly>{{hidden code|
 
<!-- Set page image -->
{{#if: {{{image|}}}
| {{#seo: image = {{{page image | {{{image}}} }}} }}
| {{#seo: image = {{{page image | {{{image}}} }}} }}
}}{{trim|
}}


<!-- Movement and weight in ft and lb -->
<!-- Movement and weight in ft and lb -->
Line 11: Line 14:


<!-- Ability score modifiers -->
<!-- Ability score modifiers -->
{{#lvardef: str_mod | {{#ifexpr: {{{str}}} > 11 | + }}{{#expr: floor({{{str}}} / 2) - 5 }} }}
{{#lvardef: str_mod | {{plus if pos | {{#expr: floor({{{str}}} / 2) - 5 }} }} }}
{{#lvardef: dex_mod | {{#ifexpr: {{{dex}}} > 11 | + }}{{#expr: floor({{{dex}}} / 2) - 5 }} }}
{{#lvardef: dex_mod | {{plus if pos | {{#expr: floor({{{dex}}} / 2) - 5 }} }} }}
{{#lvardef: con_mod | {{#ifexpr: {{{con}}} > 11 | + }}{{#expr: floor({{{con}}} / 2) - 5 }} }}
{{#lvardef: con_mod | {{plus if pos | {{#expr: floor({{{con}}} / 2) - 5 }} }} }}
{{#lvardef: int_mod | {{#ifexpr: {{{int}}} > 11 | + }}{{#expr: floor({{{int}}} / 2) - 5 }} }}
{{#lvardef: int_mod | {{plus if pos | {{#expr: floor({{{int}}} / 2) - 5 }} }} }}
{{#lvardef: wis_mod | {{#ifexpr: {{{wis}}} > 11 | + }}{{#expr: floor({{{wis}}} / 2) - 5 }} }}
{{#lvardef: wis_mod | {{plus if pos | {{#expr: floor({{{wis}}} / 2) - 5 }} }} }}
{{#lvardef: cha_mod | {{#ifexpr: {{{cha}}} > 11 | + }}{{#expr: floor({{{cha}}} / 2) - 5 }} }}
{{#lvardef: cha_mod | {{plus if pos | {{#expr: floor({{{cha}}} / 2) - 5 }} }} }}


<!-- Initiative bonus -->
<!-- Initiative bonus -->
{{#lvardef: init_bonus |
{{#lvardef: init_bonus | {{plus if pos |
   {{{initiative |
   {{{initiative |
     {{#if: {{{dex|}}} |
     {{#if: {{{dex|}}} |
Line 25: Line 28:
     }}
     }}
   }}}
   }}}
}}
}} }}


<!-- Proficiency bonus -->
<!-- Proficiency bonus -->
Line 43: Line 46:
{{#lvardef: cha_save_val | {{#expr: {{#lvar:cha_mod}} {{#if: {{{cha save prof|}}} | {{#lvar:prof_bonus}} }} }} }}
{{#lvardef: cha_save_val | {{#expr: {{#lvar:cha_mod}} {{#if: {{{cha save prof|}}} | {{#lvar:prof_bonus}} }} }} }}


{{#lvardef: str_save | {{#ifexpr: {{#lvar:str_save_val}} > 0 | +}}{{#lvar:str_save_val}} }}
{{#lvardef: str_save | {{plus if pos | {{#lvar:str_save_val}} }} }}
{{#lvardef: dex_save | {{#ifexpr: {{#lvar:dex_save_val}} > 0 | +}}{{#lvar:dex_save_val}} }}
{{#lvardef: dex_save | {{plus if pos | {{#lvar:dex_save_val}} }} }}
{{#lvardef: con_save | {{#ifexpr: {{#lvar:con_save_val}} > 0 | +}}{{#lvar:con_save_val}} }}
{{#lvardef: con_save | {{plus if pos | {{#lvar:con_save_val}} }} }}
{{#lvardef: int_save | {{#ifexpr: {{#lvar:int_save_val}} > 0 | +}}{{#lvar:int_save_val}} }}
{{#lvardef: int_save | {{plus if pos | {{#lvar:int_save_val}} }} }}
{{#lvardef: wis_save | {{#ifexpr: {{#lvar:wis_save_val}} > 0 | +}}{{#lvar:wis_save_val}} }}
{{#lvardef: wis_save | {{plus if pos | {{#lvar:wis_save_val}} }} }}
{{#lvardef: cha_save | {{#ifexpr: {{#lvar:cha_save_val}} > 0 | +}}{{#lvar:cha_save_val}} }}
{{#lvardef: cha_save | {{plus if pos | {{#lvar:cha_save_val}} }} }}


<!--  
<!--  
Line 73: Line 76:


<!-- Explorer ability score modifiers -->
<!-- Explorer ability score modifiers -->
{{#lvardef: e_str_mod | {{#ifexpr: {{#lvar:e_str}} > 11 | + }}{{#expr: floor({{#lvar:e_str}} / 2) - 5 }} }}
{{#lvardef: e_str_mod | {{plus if pos | {{#expr: floor({{#lvar:e_str}} / 2) - 5 }} }} }}
{{#lvardef: e_dex_mod | {{#ifexpr: {{#lvar:e_dex}} > 11 | + }}{{#expr: floor({{#lvar:e_dex}} / 2) - 5 }} }}
{{#lvardef: e_dex_mod | {{plus if pos | {{#expr: floor({{#lvar:e_dex}} / 2) - 5 }} }} }}
{{#lvardef: e_con_mod | {{#ifexpr: {{#lvar:e_con}} > 11 | + }}{{#expr: floor({{#lvar:e_con}} / 2) - 5 }} }}
{{#lvardef: e_con_mod | {{plus if pos | {{#expr: floor({{#lvar:e_con}} / 2) - 5 }} }} }}
{{#lvardef: e_int_mod | {{#ifexpr: {{#lvar:e_int}} > 11 | + }}{{#expr: floor({{#lvar:e_int}} / 2) - 5 }} }}
{{#lvardef: e_int_mod | {{plus if pos | {{#expr: floor({{#lvar:e_int}} / 2) - 5 }} }} }}
{{#lvardef: e_wis_mod | {{#ifexpr: {{#lvar:e_wis}} > 11 | + }}{{#expr: floor({{#lvar:e_wis}} / 2) - 5 }} }}
{{#lvardef: e_wis_mod | {{plus if pos | {{#expr: floor({{#lvar:e_wis}} / 2) - 5 }} }} }}
{{#lvardef: e_cha_mod | {{#ifexpr: {{#lvar:e_cha}} > 11 | + }}{{#expr: floor({{#lvar:e_cha}} / 2) - 5 }} }}
{{#lvardef: e_cha_mod | {{plus if pos | {{#expr: floor({{#lvar:e_cha}} / 2) - 5 }} }} }}


<!-- Explorer initiative bonus -->
<!-- Explorer initiative bonus -->
{{#lvardef: e_extra_init | {{{e extra init | {{{extra init|}}} }}} }}
{{#lvardef: e_extra_init | {{{e extra init | {{{extra init|}}} }}} }}
{{#lvardef: e_init_bonus |
{{#lvardef: e_init_bonus | {{plus if pos |
   {{{e initiative |
   {{{e initiative |
     {{{initiative |
     {{{initiative |
Line 90: Line 93:
     }}}
     }}}
   }}}
   }}}
}}
}} }}


<!-- Explorer level -->
<!-- Explorer level -->
Line 119: Line 122:
{{#lvardef: e_cha_save_val | {{#expr: {{#lvar:e_cha_mod}} {{#if: {{#lvar:e_cha_save_prof}} | {{#lvar:e_prof_bonus}} }} }} }}
{{#lvardef: e_cha_save_val | {{#expr: {{#lvar:e_cha_mod}} {{#if: {{#lvar:e_cha_save_prof}} | {{#lvar:e_prof_bonus}} }} }} }}


{{#lvardef: e_str_save | {{#ifexpr: {{#lvar:e_str_save_val}} > 0 | +}}{{#lvar:e_str_save_val}} }}
{{#lvardef: e_str_save | {{plus if pos | {{#lvar:e_str_save_val}} }} }}
{{#lvardef: e_dex_save | {{#ifexpr: {{#lvar:e_dex_save_val}} > 0 | +}}{{#lvar:e_dex_save_val}} }}
{{#lvardef: e_dex_save | {{plus if pos | {{#lvar:e_dex_save_val}} }} }}
{{#lvardef: e_con_save | {{#ifexpr: {{#lvar:e_con_save_val}} > 0 | +}}{{#lvar:e_con_save_val}} }}
{{#lvardef: e_con_save | {{plus if pos | {{#lvar:e_con_save_val}} }} }}
{{#lvardef: e_int_save | {{#ifexpr: {{#lvar:e_int_save_val}} > 0 | +}}{{#lvar:e_int_save_val}} }}
{{#lvardef: e_int_save | {{plus if pos | {{#lvar:e_int_save_val}} }} }}
{{#lvardef: e_wis_save | {{#ifexpr: {{#lvar:e_wis_save_val}} > 0 | +}}{{#lvar:e_wis_save_val}} }}
{{#lvardef: e_wis_save | {{plus if pos | {{#lvar:e_wis_save_val}} }} }}
{{#lvardef: e_cha_save | {{#ifexpr: {{#lvar:e_cha_save_val}} > 0 | +}}{{#lvar:e_cha_save_val}} }}
{{#lvardef: e_cha_save | {{plus if pos | {{#lvar:e_cha_save_val}} }} }}


<!-- Explorer resistances, actions, conditions, passives -->
<!-- Explorer resistances, actions, conditions, passives -->
Line 155: Line 158:


<!-- Tactician ability score modifiers -->
<!-- Tactician ability score modifiers -->
{{#lvardef: t_str_mod | {{#ifexpr: {{#lvar:t_str}} > 11 | + }}{{#expr: floor({{#lvar:t_str}} / 2) - 5 }} }}
{{#lvardef: t_str_mod | {{plus if pos | {{#expr: floor({{#lvar:t_str}} / 2) - 5 }} }} }}
{{#lvardef: t_dex_mod | {{#ifexpr: {{#lvar:t_dex}} > 11 | + }}{{#expr: floor({{#lvar:t_dex}} / 2) - 5 }} }}
{{#lvardef: t_dex_mod | {{plus if pos | {{#expr: floor({{#lvar:t_dex}} / 2) - 5 }} }} }}
{{#lvardef: t_con_mod | {{#ifexpr: {{#lvar:t_con}} > 11 | + }}{{#expr: floor({{#lvar:t_con}} / 2) - 5 }} }}
{{#lvardef: t_con_mod | {{plus if pos | {{#expr: floor({{#lvar:t_con}} / 2) - 5 }} }} }}
{{#lvardef: t_int_mod | {{#ifexpr: {{#lvar:t_int}} > 11 | + }}{{#expr: floor({{#lvar:t_int}} / 2) - 5 }} }}
{{#lvardef: t_int_mod | {{plus if pos | {{#expr: floor({{#lvar:t_int}} / 2) - 5 }} }} }}
{{#lvardef: t_wis_mod | {{#ifexpr: {{#lvar:t_wis}} > 11 | + }}{{#expr: floor({{#lvar:t_wis}} / 2) - 5 }} }}
{{#lvardef: t_wis_mod | {{plus if pos | {{#expr: floor({{#lvar:t_wis}} / 2) - 5 }} }} }}
{{#lvardef: t_cha_mod | {{#ifexpr: {{#lvar:t_cha}} > 11 | + }}{{#expr: floor({{#lvar:t_cha}} / 2) - 5 }} }}
{{#lvardef: t_cha_mod | {{plus if pos | {{#expr: floor({{#lvar:t_cha}} / 2) - 5 }} }} }}


<!-- Tactician initiative bonus -->
<!-- Tactician initiative bonus -->
{{#lvardef: t_extra_init | {{{t extra init | {{{extra init|}}} }}} }}
{{#lvardef: t_extra_init | {{{t extra init | {{{extra init|}}} }}} }}
{{#lvardef: t_init_bonus |
{{#lvardef: t_init_bonus | {{plus if pos |
   {{{t initiative |
   {{{t initiative |
     {{{initiative |
     {{{initiative |
Line 172: Line 175:
     }}}
     }}}
   }}}
   }}}
}}
}} }}


<!-- Tactician level -->
<!-- Tactician level -->
Line 246: Line 249:
<!-- Honour initiative bonus -->
<!-- Honour initiative bonus -->
{{#lvardef: h_extra_init | {{{h extra init | {{#lvar:t_extra_init}} }}} }}
{{#lvardef: h_extra_init | {{{h extra init | {{#lvar:t_extra_init}} }}} }}
{{#lvardef: h_init_bonus |
{{#lvardef: h_init_bonus | {{plus if pos |
   {{{h initiative |
   {{{h initiative |
     {{{t initiative |
     {{{t initiative |
Line 256: Line 259:
     }}}
     }}}
   }}}
   }}}
}}
}} }}


<!-- Honour level -->
<!-- Honour level -->
Line 302: Line 305:
}}
}}


}}{{Infobox creature/internal
}}
 
{{Infobox creature/internal
| name = {{{name|}}}
| name = {{{name|}}}
| title = {{{title|}}}
| title = {{{title|}}}
Line 491: Line 496:
| h passives = {{#lvar:h_passives}}
| h passives = {{#lvar:h_passives}}


}}</includeonly><noinclude>{{Infobox creature
}}</includeonly><noinclude>
{{Infobox creature
| name = Test
| name = Test
| title = Title
| title = Title

Revision as of 01:28, 7 June 2024

This is the main creature infobox template. It does a bunch of processing on its parameters before passing on all the results to Template:Infobox creature/internal for displaying.

List of helper sub-templates:

Usage tips:

  • To override stats for Explorer, Tactician, or Honour mode, use parameters starting with e, t, or h, respectively. E.g. use t hp to specify the HP value for Tactician difficulty. Explorer and Tactician fall back to Balanced (default) stats when a stat isn't overridden; Honour falls abck to Tactician stats.
  • The passives list may contain elements of the format Passive name @ Item name to specify the item that grants the passive. This will make that item's icon be used if the passive itself doesn't have an icon.
  • The image property may contain a <gallery>...</gallery>.
  • The provided image will be automatically set as the page image (as if using Template:PageSeo), unless it's a gallery. If it's a gallery, you can use the page image property instead to set the page image.

Example use:

{{Infobox creature
| name = Test
| title = Title
| image =
<gallery>
Steel Watcher Ranged.png|Ranged
Steel Watcher Model.png|Model
</gallery>
| full name = Duke Wellington
| va = Keanu Reeves
| role = Mascot
| faction = Gondor
| family = The Reeves'
| hometown = The Shire

| size = Smol
| type = Mammal
| race = Cat
| class = Felinid
| background = Outlander

| level = 10
| hp = 10
| ac = 10
| initiative = +5
| prof bonus = +4
| movement m = 9
| weight kg = 600

| str = 11
| dex = 12
| con = 13
| int = 14
| wis = 15
| cha = 16

| dex save prof = yes
| con save prof = yes

| resistances = fire resistant, cold resistant, lightning vulnerable
| conditions = Aura of Protection, Aura of Hate
| passives = Agile Chassis, Cull the Weak (Drider)

| e level = 8
| e hp = 8
| e ac = 8
| e initiative = +4
| e prof bonus = +3

| e str = 10
| e dex = 11
| e con = 12
| e int = 13
| e wis = 14
| e cha = 15

| e resistances = cold resistant
| e conditions = Aura of Protection
| e passives = Agile Chassis

| t level = 12
| t hp = 12
| t ac = 12
| t initiative = +6
| t prof bonus = +5
| t movement m = 12
| t weight kg = 800

| t str = 13
| t dex = 14
| t con = 15
| t int = 16
| t wis = 17
| t cha = 18

| t resistances = fire immune, cold resistant, slashing immune nm, piercing immune nm, bludgeoning immune nm
| t conditions = Aura of Protection, Aura of Hate, Unstoppable
| t passives = Agile Chassis, Cull the Weak (Drider), Adamantine Shield @ Adamantine Shield

| h level = 14
| h hp = 14
| h ac = 14
| h initiative = +7
| h prof bonus = +6

| h str = 14
| h dex = 15
| h con = 16
| h int = 17
| h wis = 18
| h cha = 19

| h resistances = fire immune, cold immune, slashing immune nm, piercing immune nm, bludgeoning immune nm
| h conditions = Aura of Protection, Aura of Hate, Unstoppable, Legendary Resistance: Incapacitation
| h passives = Agile Chassis, Cull the Weak (Drider), Adamantine Shield @ Adamantine Shield, Fast Hands
}}