Template:Primary-Dmg: Difference between revisions

From Epic Path
Jump to navigation Jump to search
No edit summary
No edit summary
Line 17: Line 17:
</pre>
</pre>
</noinclude><includeonly>
</noinclude><includeonly>
<!-- If adjusted base damage - average dice damage for adjusted CR = 0 : -->
{{#ifexpr:
  {{#expr: ((
      {{MonsterDamage-Base|transcludesection=
        {{#ifexpr: ({{#var:CR}}
            {{#switch: {{{3|}}}|mult = *|div = /|#default = +
            }} {{{1|0}}}) < 1 | 1 |
            {{#ifexpr: ({{#var:CR}}
              {{#switch: {{{3|}}}|mult = *|div = /|#default = +
              }} {{{1|0}}}) > 44 | 44 |
              {{#expr: ({{#var:CR}}
                  {{#switch: {{{3|}}}|mult = *|div = /|#default = +
                  }} {{{1|0}}})
              }}
            }}
        }}
      }}) * {{#ifeq:
        {{#var:MeleeOrNatural|Natural
        }}|Natural|0.6666|0.5
      }} * {{#switch:
        {{#if:{{#var:Role|}}|
            {{Monster Role|transcludesection={{#var:Role}}DmgMult
            }}|Single
        }}-{{#if: {{#var:Role|}}|
              {{#ifeq:{{Monster Role|transcludesection={{#var:Role}}DmgMult}}|Single|Damage|{{#var:MultipliedDamageType|Hybrid}}
              }}|Damage
            }} | Single-Attacks  | Single-Damage | Single-Hybrid | Double-Attacks | Triple-Attacks = 1 | Double-Damage = 2 | Double-Hybrid = 1.33333 | Triple-Damage = 3 | Triple-Hybrid = 1.5 | #default = 1
      }} round 0)
      {{#ifexpr: {{{2|}}}|
        {{#switch: {{{3|}}}|mult = *|div = /|#default = +
        }} {{{2}}} round 0 |
      }}
  }} - {{#expr: ceil
      {{#switch:
        {{#ifexpr: ({{#var:CR}}
            {{#switch: {{{3|}}}|mult = *|div = /|#default = +
            }} {{{1|0}}}) < 1 | 1 |
            {{#ifexpr: ({{#var:CR}}
              {{#switch: {{{3|}}}|mult = *|div = /|#default = +
              }} {{{1|0}}}) > 44 | 44 |
              {{#expr: ({{#var:CR}}
                  {{#switch: {{{3|}}}|mult = *|div = /|#default = +
                  }} {{{1|0}}})
              }}
            }}
        }} |1|2|3|4|5 = 1|6|7|8|9|10 = 2|11|12|13|14|15 = 3|16|17|18|19|20 = 4|21|22|23|24|25 = 5|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42|43|44 = 6|#default = 1
      }} * {{#if: {{{4|}}}|
        {{#switch: {{{4|}}}|d4 = 2.5|d6 = 3.5|d8 = 4.5|d10 = 5.5|d12 = 6.5|#default = 4.5
        }}|
        {{#ifeq:{{#var:MeleeOrNatural}}|Melee|4.5|5.5
        }}
      }}
  }} = 0 |
  <!-- then print the result with just pure dice: --->
      {{#switch:
        {{#ifexpr: ({{#var:CR}}
            {{#switch: {{{3|}}}|mult = *|div = /|#default = +
            }} {{{1|0}}}) < 1 | 1 |
            {{#ifexpr: ({{#var:CR}}
              {{#switch: {{{3|}}}|mult = *|div = /|#default = +
              }} {{{1|0}}}) > 44 | 44 |
              {{#expr: ({{#var:CR}}
                  {{#switch: {{{3|}}}|mult = *|div = /|#default = +
                  }} {{{1|0}}})
              }}
            }}
        }} |1|2|3|4|5 = 1|6|7|8|9|10 = 2|11|12|13|14|15 = 3|16|17|18|19|20 = 4|21|22|23|24|25 = 5|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42|43|44 = 6|#default = 1
      }}{{#if: {{{4|}}}|{{{4|}}}|
        {{#ifeq:{{#var:MeleeOrNatural}}|Melee|d8|d10
        }}
      }} |
  <!--- else, if adjusted base damage - average dice damage for adjusted CR < 0 -->
{{#ifexpr:
  {{#expr: ((
      {{MonsterDamage-Base|transcludesection=
        {{#ifexpr: ({{#var:CR}}
            {{#switch: {{{3|}}}|mult = *|div = /|#default = +
            }} {{{1|0}}}) < 1 | 1 |
            {{#ifexpr: ({{#var:CR}}
              {{#switch: {{{3|}}}|mult = *|div = /|#default = +
              }} {{{1|0}}}) > 44 | 44 |
              {{#expr: ({{#var:CR}}
                  {{#switch: {{{3|}}}|mult = *|div = /|#default = +
                  }} {{{1|0}}})
              }}
            }}
        }}
      }}) * {{#ifeq:
        {{#var:MeleeOrNatural|Natural
        }}|Natural|0.6666|0.5
      }} * {{#switch:
        {{#if:{{#var:Role|}}|
            {{Monster Role|transcludesection={{#var:Role}}DmgMult
            }}|Single
        }}-{{#if: {{#var:Role|}}|
              {{#ifeq:{{Monster Role|transcludesection={{#var:Role}}DmgMult}}|Single|Damage|{{#var:MultipliedDamageType|Hybrid}}
              }}|Damage
            }} | Single-Attacks  | Single-Damage | Single-Hybrid | Double-Attacks | Triple-Attacks = 1 | Double-Damage = 2 | Double-Hybrid = 1.33333 | Triple-Damage = 3 | Triple-Hybrid = 1.5 | #default = 1
      }} round 0)
      {{#ifexpr: {{{2|}}}|
        {{#switch: {{{3|}}}|mult = *|div = /|#default = +
        }} {{{2}}} round 0 |
      }}
  }} - {{#expr: ceil
      {{#switch:
        {{#ifexpr: ({{#var:CR}}
            {{#switch: {{{3|}}}|mult = *|div = /|#default = +
            }} {{{1|0}}}) < 1 | 1 |
            {{#ifexpr: ({{#var:CR}}
              {{#switch: {{{3|}}}|mult = *|div = /|#default = +
              }} {{{1|0}}}) > 44 | 44 |
              {{#expr: ({{#var:CR}}
                  {{#switch: {{{3|}}}|mult = *|div = /|#default = +
                  }} {{{1|0}}})
              }}
            }}
        }} |1|2|3|4|5 = 1|6|7|8|9|10 = 2|11|12|13|14|15 = 3|16|17|18|19|20 = 4|21|22|23|24|25 = 5|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42|43|44 = 6|#default = 1
      }} * {{#if: {{{4|}}}|
        {{#switch: {{{4|}}}|d4 = 2.5|d6 = 3.5|d8 = 4.5|d10 = 5.5|d12 = 6.5|#default = 4.5
        }}|
        {{#ifeq:{{#var:MeleeOrNatural}}|Melee|4.5|5.5
        }}
      }}
  }} < 0 |
  <!-- then just look up the number using the old d6-dmg template (or whatever die size was specified). -->
{{
{{
   {{#if: {{{4|}}}|
   {{#if: {{{4|}}}|
Line 158: Line 25:
   }}-Dmg|transcludesection=
   }}-Dmg|transcludesection=
   {{#expr: ((
   {{#expr: ((
      {{MonsterDamage-Base|transcludesection=
        {{#ifexpr: ({{#var:CR}}
            {{#switch: {{{3|}}}|mult = *|div = /|#default = +
            }} {{{1|0}}}) < 1 | 1 |
            {{#ifexpr: ({{#var:CR}}
              {{#switch: {{{3|}}}|mult = *|div = /|#default = +
              }} {{{1|0}}}) > 44 | 44 |
              {{#expr: ({{#var:CR}}
                  {{#switch: {{{3|}}}|mult = *|div = /|#default = +
                  }} {{{1|0}}})
              }}
            }}
        }}
      }}) * {{#ifeq:
        {{#var:MeleeOrNatural|Natural
        }}|Natural|0.6666|0.5
      }} * {{#switch:
        {{#if:{{#var:Role|}}|
            {{Monster Role|transcludesection={{#var:Role}}DmgMult
            }}|Single
        }}-{{#if: {{#var:Role|}}|
              {{#ifeq:{{Monster Role|transcludesection={{#var:Role}}DmgMult}}|Single|Damage|{{#var:MultipliedDamageType|Hybrid}}
              }}|Damage
            }} | Single-Attacks  | Single-Damage | Single-Hybrid | Double-Attacks | Triple-Attacks = 1 | Double-Damage = 2 | Double-Hybrid = 1.33333 | Triple-Damage = 3 | Triple-Hybrid = 1.5 | #default = 1
      }} round 0)
      {{#ifexpr: {{{2|}}}|
        {{#switch: {{{3|}}}|mult = *|div = /|#default = +
        }} {{{2}}} round 0 |
      }}
  }}
}} |
  <!-- else, adjusted base damage - average dice damage for adjusted CR > 1, therefore print the desired dice plus the remainder -->
      {{#switch:
        {{#ifexpr: ({{#var:CR}}
            {{#switch: {{{3|}}}|mult = *|div = /|#default = +
            }} {{{1|0}}}) < 1 | 1 |
            {{#ifexpr: ({{#var:CR}}
              {{#switch: {{{3|}}}|mult = *|div = /|#default = +
              }} {{{1|0}}}) > 44 | 44 |
              {{#expr: ({{#var:CR}}
                  {{#switch: {{{3|}}}|mult = *|div = /|#default = +
                  }} {{{1|0}}})
              }}
            }}
        }} |1|2|3|4|5 = 1|6|7|8|9|10 = 2|11|12|13|14|15 = 3|16|17|18|19|20 = 4|21|22|23|24|25 = 5|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42|43|44 = 6|#default = 1
      }}{{#if: {{{4|}}}|{{{4|}}}|
        {{#ifeq:{{#var:MeleeOrNatural}}|Melee|d8|d10
        }}
      }} + {{#expr: ((
       {{MonsterDamage-Base|transcludesection=
       {{MonsterDamage-Base|transcludesection=
         {{#ifexpr: ({{#var:CR}}  
         {{#ifexpr: ({{#var:CR}}  
Line 240: Line 55:
         {{#switch: {{{3|}}}|mult = *|div = /|#default = +
         {{#switch: {{{3|}}}|mult = *|div = /|#default = +
         }} {{{2}}} round 0 |
         }} {{{2}}} round 0 |
       }} - ceil(
       }}
      {{#switch:
        {{#ifexpr: ({{#var:CR}}
            {{#switch: {{{3|}}}|mult = *|div = /|#default = +
            }} {{{1|0}}}) < 1 | 1 |
            {{#ifexpr: ({{#var:CR}}
              {{#switch: {{{3|}}}|mult = *|div = /|#default = +
              }} {{{1|0}}}) > 44 | 44 |
              {{#expr: ({{#var:CR}}
                  {{#switch: {{{3|}}}|mult = *|div = /|#default = +
                  }} {{{1|0}}})
              }}
            }}
        }} |1|2|3|4|5 = 1|6|7|8|9|10 = 2|11|12|13|14|15 = 3|16|17|18|19|20 = 4|21|22|23|24|25 = 5|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42|43|44 = 6|#default = 1
      }} *
      {{#if: {{{4|}}}|
        {{#switch: {{{4|}}}|d4 = 2.5|d6 = 3.5|d8 = 4.5|d10 = 5.5|d12 = 6.5|#default = 4.5
        }}|
        {{#ifeq:{{#var:MeleeOrNatural}}|Melee|4.5|5.5
        }}
      }})
   }}
   }}
}}
}}
}}
</includeonly>
</includeonly>

Revision as of 20:14, 12 December 2017

Outputs the damage string of a primary melee or bite attack (e.g. 3d6+2) when called, based on the CR of the monster. Primarily used inside the Monster template. Call as follows:

{{Primary-Dmg}}

Parameters (all are optional):
1: modify CR with a positive or negative number. -2 lowers CR by two before outputting damage value.
2: modify numeric value with a positive or negative number. -2 lowers damage value by 2 before outputting the damage value.
3: modify the operand. Addition is used by default (with negative numbers subtracting). Values are "mult" and "div", allowing parameters 1 and 2 to multiply or divide their values.
4: modify the die size. Primary damage, if melee, uses a d8 by default. Primary damage, if natural, uses a d10 by default. Values are: d4, d6, d8, d10, d12.

Examples:

{{Primary-Dmg|-2}} - outputs damage as though CR was two lower than actual.
{{Primary-Dmg||2|mult|d10}} - outputs damage double normal value, expressed as using d10's.