Template:Dice add to roll: Difference between revisions

no edit summary
(Created page with "<includeonly>{{#if:{{#pos:{{{1}}}|+}} |{{#explode:{{{1}}}|+|0}}+{{#expr:{{#explode:{{{1}}}|+|1}}+{{{2}}}}} |{{{1}}}+{{{2}}} }}</includeonly><noinclude> Adds an integer to a...")
 
No edit summary
 
Line 1: Line 1:
<includeonly>{{#if:{{#pos:{{{1}}}|+}}
<includeonly>{{#if:{{#pos:{{{1}}}|+}}
|{{#explode:{{{1}}}|+|0}}+{{#expr:{{#explode:{{{1}}}|+|1}}+{{{2}}}}}
  |{{#explode:{{{1}}}|+|0}}+{{#expr:{{#explode:{{{1}}}|+|1}}+{{{2}}}}}
|{{{1}}}+{{{2}}}
  |{{#if:{{#pos:{{{1}}}|-}}
    |{{#ifeq:{{#expr:0-{{#explode:{{{1}}}|-|1}}+{{{2}}}<0}}|1
      |{{#explode:{{{1}}}|-|0}}{{#expr:0-{{#explode:{{{1}}}|-|1}}+{{{2}}}}}
      |{{#ifeq:{{#expr:0-{{#explode:{{{1}}}|-|1}}+{{{2}}}>0}}|1
        |{{#explode:{{{1}}}|-|0}}+{{#expr:0-{{#explode:{{{1}}}|-|1}}+{{{2}}}}}
        |{{#explode:{{{1}}}|-|0}}
      }}
    }}
    |{{#if:{{#pos:{{{1}}}|d}}
      |{{{1}}}+{{{2}}}
      |{{#expr:{{{1}}}+{{{2}}}}}
    }}
  }}
}}</includeonly><noinclude>
}}</includeonly><noinclude>
Adds an integer to a dice roll, merging it into the existing added value if present.
Adds an integer to a dice roll, merging it into the existing added value if present.
Line 16: Line 28:
</pre>
</pre>
{{dice add to roll|3d2+1|1}}
{{dice add to roll|3d2+1|1}}
==Example 3==
<pre>
{{dice add to roll|2|1}}
</pre>
{{dice add to roll|2|1}}
==Example 4==
<pre>
{{dice add to roll|1d8-2|1}}
</pre>
{{dice add to roll|1d8-2|1}}
==Example 5==
<pre>
{{dice add to roll|1d12-1|1}}
</pre>
{{dice add to roll|1d12-1|1}}


[[Category:Dice Templates]]</noinclude>
[[Category:Dice Templates]]</noinclude>