Ad placeholder

Template:Damage info: Difference between revisions

Jump to navigation Jump to search
Slightly better parsing to avoid catching on 'd's when specifying a non-die value
(Tighten up the check for flat value)
(Slightly better parsing to avoid catching on 'd's when specifying a non-die value)
 
Line 1: Line 1:
<includeonly>{{#switch: {{{1}}}
<includeonly>{{#lvardef: die | {{{die|}}} }}{{#lvardef: count | {{{count|}}} }}{{#if: {{#pos: {{lc:{{{1|}}}}} | d20}} | {{#lvardef: die | 20}}{{#lvardef: count | {{#sub: {{{1}}} | 0 | {{#pos: {{lc:{{{1|}}}}} | d20}} }} }} | {{#if: {{#pos: {{lc:{{{1|}}}}} | d12}} | {{#lvardef: die | 12}}{{#lvardef: count | {{#sub: {{{1}}} | 0 | {{#pos: {{lc:{{{1|}}}}} | d12}} }} }} | {{#if: {{#pos: {{lc:{{{1|}}}}} | d10}} | {{#lvardef: die | 10}}{{#lvardef: count | {{#sub: {{{1}}} | 0 | {{#pos: {{lc:{{{1|}}}}} | d10}} }} }} | {{#if: {{#pos: {{lc:{{{1|}}}}} | d8}} | {{#lvardef: die | 8}}{{#lvardef: count | {{#sub: {{{1}}} | 0 | {{#pos: {{lc:{{{1|}}}}} | d8}} }} }} | {{#if: {{#pos: {{lc:{{{1|}}}}} | d6}} | {{#lvardef: die | 6}}{{#lvardef: count | {{#sub: {{{1}}} | 0 | {{#pos: {{lc:{{{1|}}}}} | d6}} }} }} | {{#if: {{#pos: {{lc:{{{1|}}}}} | d4}} | {{#lvardef: die | 4}}{{#lvardef: count | {{#sub: {{{1}}} | 0 | {{#pos: {{lc:{{{1|}}}}} | d4}} }} }} | }} }} }} }} }} }}{{#switch: {{{1}}}
| unarmed = {{InfoBlob | [[Unarmed Strike|Unarmed damage]] {{DamageType|Bludgeoning}} }}
| unarmed = {{InfoBlob | [[Unarmed Strike|Unarmed damage]] {{DamageType|Bludgeoning}} }}
| weapon = {{InfoBlob | Normal weapon damage }}
| weapon = {{InfoBlob | Normal weapon damage }}
Line 10: Line 10:
   | proficiency = proficiency  
   | proficiency = proficiency  
   | #default =  
   | #default =  
     {{#if: {{#pos: {{{1|}}} | d4 }}{{#pos: {{{1|}}} | d6 }}{{#pos: {{{1|}}} | d8 }}{{#pos: {{{1|}}} | d10 }}{{#pos: {{{1|}}} | d12 }}{{#pos: {{{1|}}} | d20 }}
     {{#if: {{#lvar: die }}
     | <!--nothing-->
     | <!--nothing-->
     | {{{1|}}}  
     | {{{1|}}}  
     }}
     }}
   }}
   }}
| count = {{{count |
| count = {{#lvar: count }}
  {{#if: {{#pos: {{{1}}} | d }} |
| die = {{#lvar: die }}
    {{#explode: {{lc: {{{1}}} }} | d | 0 }}
  }}
}}}
| die = {{{die |
  {{#if: {{#pos: {{{1}}} | d }} |
    <!-- To get the die out of e.g. "2d6 + 3", we turn it into "2+6 + 3", use '+' as the #explode separator. -->
    {{#explode: {{#replace: {{lc: {{{1}}} }} | d | + }} | + | 1 }}
  }}
}}}
| plus = {{{plus |
| plus = {{{plus |
   {{#if: {{#pos: {{{1}}} | + }}
   {{#if: {{#pos: {{{1}}} | + }}

Navigation menu