Difference between revisions of "Template:True Melee DPS Calculator"

From RimWorld Wiki
Jump to navigation Jump to search
 
(50 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{#vardefine:name | {{{ 1 | {{PAGENAME}}}}} }}{{#vardefine:material | {{{2|}}} }}{{#switch: {{lc:{{{ 3 |}}}}}
+
<includeonly><!--
| awful =      {{#vardefine:qualityFactor | 0.80}}
 
| poor =      {{#vardefine:qualityFactor | 0.90}}
 
| normal =    {{#vardefine:qualityFactor | 1.00}}
 
| good =      {{#vardefine:qualityFactor | 1.10}}
 
| excellent =  {{#vardefine:qualityFactor | 1.20}}
 
| masterwork = {{#vardefine:qualityFactor | 1.45}}
 
| legendary =  {{#vardefine:qualityFactor | 1.65}}
 
| #default  =  {{#vardefine:qualityFactor | 1.00}}
 
}}{{#vardefine: attack1InitialSelectionWeight|}}{{#vardefine: attack1SelectionCategory|}}{{#vardefine: attack2InitialSelectionWeight|}}{{#vardefine: attack2SelectionCategory|}}{{#vardefine: attack3InitialSelectionWeight|}}{{#vardefine: attack3SelectionCategory|}}{{#vardefine: attack4InitialSelectionWeight|}}{{#vardefine: attack4SelectionCategory|}}<noinclude>
 
  
{{#vardefine:name | Grizzly bear }}
+
!!! WARNINGS !!!
{{#vardefine:qualityFactor | 1.00}}
+
This template needs to be highly optimised since it's called more than 100 times on some pages. Always check the "Preprocessor visited node count" when editing.
  
{{#vardefine:name | Longsword }}
+
The following variables are reused by [[Template:Weapon Quality Table/Melee/Row]]. If you change them here you probably have to change them there as well:
{{#vardefine:qualityFactor | 1.10}}
+
* {{#var:trueAP}}
{{#vardefine:material | plasteel}}
+
* {{#var:attack1AP}}, {{#var:attack2AP}}, {{#var:attack3AP}}, {{#var:attack4AP}}
 +
* {{#var:attack1Cooldown}}, {{#var:attack2Cooldown}}, {{#var:attack3Cooldown}}, {{#var:attack4Cooldown}}
 +
* {{#var:attack1Damage}}, {{#var:attack2Damage}}, {{#var:attack3Damage}}, {{#var:attack4Damage}}
 +
* {{#var:attack1SelectionChance}}, {{#var:attack2SelectionChance}}, {{#var:attack3SelectionChance}}, {{#var:attack4SelectionChance}}
  
{{#vardefine:name | Gladius }}
+
1. VARIABLES
{{#vardefine:qualityFactor | 1.0}}
+
1.1 Important variables
{{#vardefine:material | steel}}
+
-->{{#vardefine:name          | {{{1|{{PAGENAME}} }}} }}<!--
 +
-->{{#switch: {{#show:{{#var:name}}|?Type|link=none}}
 +
| Animal | Mechanoid = {{#vardefine:pawn|{{#var:name}} }} {{#vardefine:weapon|}}
 +
| #default =          {{#vardefine:pawn|{{{4|}}} }}      {{#vardefine:weapon|{{#var:name}} }}
 +
}}<!--
 +
-->{{#vardefine:material      | {{{2|}}} }}<!--
 +
-->{{#vardefine:cooldownFactor | {{#show:{{#var:material}}|?Melee Cooldown Factor|link=none|default=1}} }}<!--
 +
-->{{#vardefine:quality        | {{{ 3|}}} }}<!--
 +
-->{{#vardefine:attack1Type    | {{#show:{{#var:weapon}}|?Attack 1 Type|link=none}} }}<!--
 +
-->{{#vardefine:attack2Type    | {{#show:{{#var:weapon}}|?Attack 2 Type|link=none}} }}<!--
 +
-->{{#vardefine:attack3Type    | {{#show:{{#var:weapon}}|?Attack 3 Type|link=none}} }}<!--
 +
-->{{#vardefine:attack4Type    | {{#show:{{#var:weapon}}|?Attack 4 Type|link=none}} }}<!--
 +
-->{{#vardefine: 5            | {{{ 5|}}} }}<!--
 +
-->{{#vardefine: 6            | {{{ 6|}}} }}<!--
 +
-->{{#vardefine: 7            | {{{ 7|}}} }}<!--
 +
-->{{#vardefine: 8            | {{{ 8|}}} }}<!--
 +
-->{{#vardefine: 9            | {{{ 9|}}} }}<!--
 +
-->{{#vardefine:10            | {{{10|}}} }}<!--
 +
-->{{#vardefine:11            | {{{11|}}} }}<!--
 +
-->{{#vardefine:12            | {{{12|}}} }}<!--
 +
-->{{#switch: {{lc:{{{3|}}} }}
 +
| awful      = {{#vardefine:sharpAndQualityFactor | {{#expr: 0.8  * {{#show:{{#var:material}}|?Melee Sharp Damage Factor|link=none|default=1}} }} }} {{#vardefine:bluntAndQualityFactor | {{#expr: 0.8  * {{#show:{{#var:material}}|?Melee Blunt Damage Factor|link=none|default=1}} }} }}
 +
| poor      = {{#vardefine:sharpAndQualityFactor | {{#expr: 0.9  * {{#show:{{#var:material}}|?Melee Sharp Damage Factor|link=none|default=1}} }} }} {{#vardefine:bluntAndQualityFactor | {{#expr: 0.9  * {{#show:{{#var:material}}|?Melee Blunt Damage Factor|link=none|default=1}} }} }}
 +
| good      = {{#vardefine:sharpAndQualityFactor | {{#expr: 1.1  * {{#show:{{#var:material}}|?Melee Sharp Damage Factor|link=none|default=1}} }} }} {{#vardefine:bluntAndQualityFactor | {{#expr: 1.1  * {{#show:{{#var:material}}|?Melee Blunt Damage Factor|link=none|default=1}} }} }}
 +
| excellent  = {{#vardefine:sharpAndQualityFactor | {{#expr: 1.2  * {{#show:{{#var:material}}|?Melee Sharp Damage Factor|link=none|default=1}} }} }} {{#vardefine:bluntAndQualityFactor | {{#expr: 1.2  * {{#show:{{#var:material}}|?Melee Blunt Damage Factor|link=none|default=1}} }} }}
 +
| masterwork = {{#vardefine:sharpAndQualityFactor | {{#expr: 1.45 * {{#show:{{#var:material}}|?Melee Sharp Damage Factor|link=none|default=1}} }} }} {{#vardefine:bluntAndQualityFactor | {{#expr: 1.45 * {{#show:{{#var:material}}|?Melee Blunt Damage Factor|link=none|default=1}} }} }}
 +
| legendary  = {{#vardefine:sharpAndQualityFactor | {{#expr: 1.65 * {{#show:{{#var:material}}|?Melee Sharp Damage Factor|link=none|default=1}} }} }} {{#vardefine:bluntAndQualityFactor | {{#expr: 1.65 * {{#show:{{#var:material}}|?Melee Blunt Damage Factor|link=none|default=1}} }} }}
 +
| #default  = {{#vardefine:sharpAndQualityFactor | {{#expr: 1    * {{#show:{{#var:material}}|?Melee Sharp Damage Factor|link=none|default=1}} }} }} {{#vardefine:bluntAndQualityFactor | {{#expr: 1    * {{#show:{{#var:material}}|?Melee Blunt Damage Factor|link=none|default=1}} }} }}
 +
}}<!--
 +
 
 +
WIP: Do we need to consider Melee Hit Chance? After all it's affected by manipulation
 +
 
 +
-->{{#if: {{#var:pawn}} |
 +
{{#vardefine:attack5Type  | {{#if: {{#var: 5}} | {{#ifeq: {{#var: 5}} | false || {{#show:{{#var: 5}}|?Attack 1 Type|link=none}} }} | {{#show:{{#var:pawn}}|?Attack 1 Type|link=none}} }} }}
 +
{{#vardefine:attack6Type  | {{#if: {{#var: 6}} | {{#ifeq: {{#var: 6}} | false || {{#show:{{#var: 6}}|?Attack 1 Type|link=none}} }} | {{#show:{{#var:pawn}}|?Attack 2 Type|link=none}} }} }}
 +
{{#vardefine:attack7Type  | {{#if: {{#var: 7}} | {{#ifeq: {{#var: 7}} | false || {{#show:{{#var: 7}}|?Attack 1 Type|link=none}} }} | {{#show:{{#var:pawn}}|?Attack 3 Type|link=none}} }} }}
 +
{{#vardefine:attack8Type  | {{#if: {{#var: 8}} | {{#ifeq: {{#var: 8}} | false || {{#show:{{#var: 8}}|?Attack 1 Type|link=none}} }} | {{#show:{{#var:pawn}}|?Attack 4 Type|link=none}} }} }}<!-- humans have four attacks. To allow for humans with two elbow blades and knee spikes each we need four extra attacks -->
 +
{{#vardefine:attack9Type  | {{#if: {{#var: 9}} | {{#ifeq: {{#var: 9}} | false || {{#show:{{#var: 9}}|?Attack 1 Type|link=none}} }} | {{#show:{{#var:pawn}}|?Attack 5 Type|link=none}} }} }}
 +
{{#vardefine:attack10Type | {{#if: {{#var:10}} | {{#ifeq: {{#var:10}} | false || {{#show:{{#var:10}}|?Attack 1 Type|link=none}} }} | {{#show:{{#var:pawn}}|?Attack 6 Type|link=none}} }} }}<!-- maximum number of attacks for all pawns. Further attacks can therefore only come from artificial body parts -->
 +
{{#vardefine:attack11Type | {{#show:{{#var:11}}|?Attack 1 Type|link=none}} }}
 +
{{#vardefine:attack12Type | {{#show:{{#var:12}}|?Attack 1 Type|link=none}} }}
 +
| {{#vardefine:attack5Type|}}{{#vardefine:attack6Type|}}{{#vardefine:attack7Type|}}{{#vardefine:attack8Type|}}{{#vardefine:attack9Type|}}{{#vardefine:attack10Type|}}{{#vardefine:attack11Type|}}{{#vardefine:attack12Type|}}
 +
}}<!--
  
{{#vardefine:name | Persona monosword}}
+
1.2 Clearing variables in case the page is called multiple times on the same page
{{#vardefine:qualityFactor | 1.45}}
+
-->{{#vardefine:attack1InitialSelectionWeight | }}{{#vardefine:attack1SelectionCategory |}}{{#vardefine:attack1AP | }}{{#vardefine:attack1Cooldown | }}{{#vardefine:attack1Damage | }}<!--
 +
-->{{#vardefine:attack2InitialSelectionWeight | }}{{#vardefine:attack2SelectionCategory |}}{{#vardefine:attack2AP | }}{{#vardefine:attack2Cooldown | }}{{#vardefine:attack2Damage | }}<!--
 +
-->{{#vardefine:attack3InitialSelectionWeight | }}{{#vardefine:attack3SelectionCategory |}}{{#vardefine:attack3AP | }}{{#vardefine:attack3Cooldown | }}{{#vardefine:attack3Damage | }}<!--
 +
-->{{#vardefine:attack4InitialSelectionWeight | }}{{#vardefine:attack4SelectionCategory |}}{{#vardefine:attack4AP | }}{{#vardefine:attack4Cooldown | }}{{#vardefine:attack4Damage | }}<!--
 +
-->{{#vardefine:attack5InitialSelectionWeight |0}}{{#vardefine:attack5SelectionCategory |}}{{#vardefine:attack5AP |0}}{{#vardefine:attack5Cooldown |0}}{{#vardefine:attack5Damage |0}}<!--
 +
-->{{#vardefine:attack6InitialSelectionWeight |0}}{{#vardefine:attack6SelectionCategory |}}{{#vardefine:attack6AP |0}}{{#vardefine:attack6Cooldown |0}}{{#vardefine:attack6Damage |0}}<!--
 +
-->{{#vardefine:attack7InitialSelectionWeight |0}}{{#vardefine:attack7SelectionCategory |}}{{#vardefine:attack7AP |0}}{{#vardefine:attack7Cooldown |0}}{{#vardefine:attack7Damage |0}}<!--
 +
-->{{#vardefine:attack8InitialSelectionWeight |0}}{{#vardefine:attack8SelectionCategory |}}{{#vardefine:attack8AP |0}}{{#vardefine:attack8Cooldown |0}}{{#vardefine:attack8Damage |0}}<!--
 +
-->{{#vardefine:attack9InitialSelectionWeight |0}}{{#vardefine:attack9SelectionCategory |}}{{#vardefine:attack9AP |0}}{{#vardefine:attack9Cooldown |0}}{{#vardefine:attack9Damage |0}}<!--
 +
-->{{#vardefine:attack10InitialSelectionWeight|0}}{{#vardefine:attack10SelectionCategory|}}{{#vardefine:attack10AP|0}}{{#vardefine:attack10Cooldown|0}}{{#vardefine:attack10Damage|0}}<!--
 +
-->{{#vardefine:attack11InitialSelectionWeight| }}{{#vardefine:attack11SelectionCategory|}}{{#vardefine:attack11AP| }}{{#vardefine:attack11Cooldown| }}{{#vardefine:attack11Damage| }}<!--
 +
-->{{#vardefine:attack12InitialSelectionWeight| }}{{#vardefine:attack12SelectionCategory|}}{{#vardefine:attack12AP| }}{{#vardefine:attack12Cooldown| }}{{#vardefine:attack12Damage| }}<!--
 +
-->{{#vardefine:attack1SelectionChance |}}{{#vardefineecho:attack1WeightedDamage |}}{{#vardefineecho:attack1WeightedCooldown |}}{{#vardefineecho:attack1WeightedAP |}}<!--
 +
-->{{#vardefine:attack2SelectionChance |}}{{#vardefineecho:attack2WeightedDamage |}}{{#vardefineecho:attack2WeightedCooldown |}}{{#vardefineecho:attack2WeightedAP |}}<!--
 +
-->{{#vardefine:attack3SelectionChance |}}{{#vardefineecho:attack3WeightedDamage |}}{{#vardefineecho:attack3WeightedCooldown |}}{{#vardefineecho:attack3WeightedAP |}}<!--
 +
-->{{#vardefine:attack4SelectionChance |}}{{#vardefineecho:attack4WeightedDamage |}}{{#vardefineecho:attack4WeightedCooldown |}}{{#vardefineecho:attack4WeightedAP |}}<!--
 +
-->{{#vardefine:attack5SelectionChance |}}{{#vardefineecho:attack5WeightedDamage |}}{{#vardefineecho:attack5WeightedCooldown |}}{{#vardefineecho:attack5WeightedAP |}}<!--
 +
-->{{#vardefine:attack6SelectionChance |}}{{#vardefineecho:attack6WeightedDamage |}}{{#vardefineecho:attack6WeightedCooldown |}}{{#vardefineecho:attack6WeightedAP |}}<!--
 +
-->{{#vardefine:attack7SelectionChance |}}{{#vardefineecho:attack7WeightedDamage |}}{{#vardefineecho:attack7WeightedCooldown |}}{{#vardefineecho:attack7WeightedAP |}}<!--
 +
-->{{#vardefine:attack8SelectionChance |}}{{#vardefineecho:attack8WeightedDamage |}}{{#vardefineecho:attack8WeightedCooldown |}}{{#vardefineecho:attack8WeightedAP |}}<!--
 +
-->{{#vardefine:attack9SelectionChance |}}{{#vardefineecho:attack9WeightedDamage |}}{{#vardefineecho:attack9WeightedCooldown |}}{{#vardefineecho:attack9WeightedAP |}}<!--
 +
-->{{#vardefine:attack10SelectionChance|}}{{#vardefineecho:attack10WeightedDamage|}}{{#vardefineecho:attack10WeightedCooldown|}}{{#vardefineecho:attack10WeightedAP|}}<!--
 +
-->{{#vardefine:attack11SelectionChance|}}{{#vardefineecho:attack11WeightedDamage|}}{{#vardefineecho:attack11WeightedCooldown|}}{{#vardefineecho:attack11WeightedAP|}}<!--
 +
-->{{#vardefine:attack12SelectionChance|}}{{#vardefineecho:attack12WeightedDamage|}}{{#vardefineecho:attack12WeightedCooldown|}}{{#vardefineecho:attack12WeightedAP|}}<!--
 +
-->{{#vardefine:numBestAttacks|0}}{{#vardefine:numMidAttacks|0}}<!--
  
</noinclude><!--
+
2. CALCULATIONS
Define the damage type of the 1st attack so it knows which mat stat to use for the damage multiplier. Needs updating if new damage types added.
+
2.1 Define the damage type of the attacks so it knows which material stat to use for the damage multiplier. Needs updating if new damage types added. Only include damage types that are "Category = Melee Weapons" and "Armor Category = Blunt". The statements default to Sharp damage if no fitting damage type is found.
-->{{#switch: {{Q|{{#var: name}}|Attack 1 Type}}
+
2.1.2 Weapon attacks
| Cut
+
2.1.1.1 First weapon attack
| Stab
+
-->{{#if: {{#var:attack1Type}} | {{#vardefine:attack1InitialSelectionWeight | {{#expr: {{#switch: {{#var:attack1Type}}
| RangedStab
+
| Blunt | Crush | Demolish | Poke =
| Bullet
+
    {{#vardefineecho:attack1Damage | {{#expr: {{#show:{{#var:weapon}}|?Attack 1 Damage|link=none}} * {{#var:bluntAndQualityFactor}} }} }}
| Arrow
+
    * (1 + ({{#vardefineecho:attack1AP | {{#expr: {{#show:{{#var:weapon}}|?Attack 1 AP|link=none}} * {{#var:bluntAndQualityFactor}} }} }}/100))
| ArrowHighVelocity
+
    * {{#show:{{#var:weapon}}|?Attack 1 Chance Factor|link=none|default=1}}
| Scratch
+
    / {{#vardefineecho:attack1Cooldown | {{#expr: {{#show:{{#var:weapon}}|?Attack 1 Cooldown|link=none}} * {{#var:cooldownFactor}} }} }}
| Toxic scratch
+
| #default =
| Bite
+
    {{#vardefineecho:attack1Damage | {{#expr: {{#show:{{#var:weapon}}|?Attack 1 Damage|link=none}} * {{#var:sharpAndQualityFactor}} }} }}
| Toxic bite
+
    * (1 + ({{#vardefineecho:attack1AP | {{#expr: {{#show:{{#var:weapon}}|?Attack 1 AP|link=none}} * {{#var:sharpAndQualityFactor}} }} }}/100))
| Bomb
+
    * {{#show:{{#var:weapon}}|?Attack 1 Chance Factor|link=none|default=1}}
| BombSuper
+
    / {{#vardefineecho:attack1Cooldown | {{#expr: {{#show:{{#var:weapon}}|?Attack 1 Cooldown|link=none}} * {{#var:cooldownFactor}} }} }}
| Thump =  
+
}} round 1}} }}<!--
{{#vardefine:attack1Damage| {{#expr: {{Q|{{#var: name}}|Attack 1 Damage}}*{{#var:qualityFactor}}*{{Q|{{#var:material}}|Melee Sharp Damage Factor|1}}    }}}}
+
2.1.1.2 Second weapon attack
{{#vardefine:attack1AP    | {{#expr: {{Q|{{#var: name}}|Attack 1 AP}}   *{{#var:qualityFactor}}*{{Q|{{#var:material}}|Melee Sharp Damage Factor|1}}    }}}}
+
-->{{#if: {{#var:attack2Type}} | {{#vardefine:attack2InitialSelectionWeight | {{#expr: {{#switch: {{#var:attack2Type}}
| Crush
+
| Blunt | Crush | Demolish | Poke =
| Blunt
+
    {{#vardefineecho:attack2Damage | {{#expr: {{#show:{{#var:weapon}}|?Attack 2 Damage|link=none}} * {{#var:bluntAndQualityFactor}} }} }}
| Poke
+
    * (1 + ({{#vardefineecho:attack2AP | {{#expr: {{#show:{{#var:weapon}}|?Attack 2 AP|link=none}} * {{#var:bluntAndQualityFactor}} }} }}/100))
| Demolish =  
+
    * {{#show:{{#var:weapon}}|?Attack 2 Chance Factor|link=none|default=1}}
{{#vardefine:attack1Damage| {{#expr: {{Q|{{#var: name}}|Attack 1 Damage}}*{{#var:qualityFactor}}*{{Q|{{#var:material}}|Melee Blunt Damage Factor|1}} }}}}
+
    / {{#vardefineecho:attack2Cooldown | {{#expr: {{#show:{{#var:weapon}}|?Attack 2 Cooldown|link=none}} * {{#var:cooldownFactor}} }} }}
{{#vardefine:attack1AP    | {{#expr: {{Q|{{#var: name}}|Attack 1 AP}}   *{{#var:qualityFactor}}*{{Q|{{#var:material}}|Melee Blunt Damage Factor|1}} }}}}
+
| #default =
| {{Error|Unrecognised Damage Type: {{Q|{{#var: name}}|Attack 1 Type}}}}
+
    {{#vardefineecho:attack2Damage | {{#expr: {{#show:{{#var:weapon}}|?Attack 2 Damage|link=none}} * {{#var:sharpAndQualityFactor}} }} }}
 +
    * (1 + ({{#vardefineecho:attack2AP | {{#expr: {{#show:{{#var:weapon}}|?Attack 2 AP|link=none}} * {{#var:sharpAndQualityFactor}} }} }}/100))
 +
    * {{#show:{{#var:weapon}}|?Attack 2 Chance Factor|link=none|default=1}}
 +
     / {{#vardefineecho:attack2Cooldown | {{#expr: {{#show:{{#var:weapon}}|?Attack 2 Cooldown|link=none}} * {{#var:cooldownFactor}} }} }}
 +
}} round 1}} }}<!--
 +
2.1.1.3 Third weapon attack
 +
-->{{#if: {{#var:attack3Type}} | {{#vardefine:attack3InitialSelectionWeight | {{#expr: {{#switch: {{#var:attack3Type}}
 +
| Blunt | Crush | Demolish | Poke =
 +
    {{#vardefineecho:attack3Damage | {{#expr: {{#show:{{#var:weapon}}|?Attack 3 Damage|link=none}} * {{#var:bluntAndQualityFactor}} }} }}
 +
    * (1 + ({{#vardefineecho:attack3AP | {{#expr: {{#show:{{#var:weapon}}|?Attack 3 AP|link=none}} * {{#var:bluntAndQualityFactor}} }} }}/100))
 +
    * {{#show:{{#var:weapon}}|?Attack 3 Chance Factor|link=none|default=1}}
 +
    / {{#vardefineecho:attack3Cooldown | {{#expr: {{#show:{{#var:weapon}}|?Attack 3 Cooldown|link=none}} * {{#var:cooldownFactor}} }} }}
 +
| #default =
 +
    {{#vardefineecho:attack3Damage | {{#expr: {{#show:{{#var:weapon}}|?Attack 3 Damage|link=none}} * {{#var:sharpAndQualityFactor}} }} }}
 +
    * (1 + ({{#vardefineecho:attack3AP | {{#expr: {{#show:{{#var:weapon}}|?Attack 3 AP|link=none}} * {{#var:sharpAndQualityFactor}} }} }}/100))
 +
    * {{#show:{{#var:weapon}}|?Attack 3 Chance Factor|link=none|default=1}}
 +
     / {{#vardefineecho:attack3Cooldown | {{#expr: {{#show:{{#var:weapon}}|?Attack 3 Cooldown|link=none}} * {{#var:cooldownFactor}} }} }}
 +
}} round 1}} }}<!--
 +
2.1.1.4 Fourth weapon attack
 +
-->{{#if: {{#var:attack4Type}} | {{#vardefine:attack4InitialSelectionWeight | {{#expr: {{#switch: {{#var:attack4Type}}
 +
| Blunt | Crush | Demolish | Poke =
 +
    {{#vardefineecho:attack4Damage | {{#expr: {{#show:{{#var:weapon}}|?Attack 4 Damage|link=none}} * {{#var:bluntAndQualityFactor}} }} }}
 +
    * (1 + ({{#vardefineecho:attack4AP | {{#expr: {{#show:{{#var:weapon}}|?Attack 4 AP|link=none}} * {{#var:bluntAndQualityFactor}} }} }}/100))
 +
    * {{#show:{{#var:weapon}}|?Attack 4 Chance Factor|link=none|default=1}}
 +
    / {{#vardefineecho:attack4Cooldown | {{#expr: {{#show:{{#var:weapon}}|?Attack 4 Cooldown|link=none}} * {{#var:cooldownFactor}} }} }}
 +
| #default =
 +
    {{#vardefineecho:attack4Damage | {{#expr: {{#show:{{#var:weapon}}|?Attack 4 Damage|link=none}} * {{#var:sharpAndQualityFactor}} }} }}
 +
    * (1 + ({{#vardefineecho:attack4AP | {{#expr: {{#show:{{#var:weapon}}|?Attack 4 AP|link=none}} * {{#var:sharpAndQualityFactor}} }} }}/100))
 +
    * {{#show:{{#var:weapon}}|?Attack 4 Chance Factor|link=none|default=1}}
 +
    / {{#vardefineecho:attack4Cooldown | {{#expr: {{#show:{{#var:weapon}}|?Attack 4 Cooldown|link=none}} * {{#var:cooldownFactor}} }} }}
 +
}} round 1}} }} }} }} }} }}<!--
 +
2.1.2 Pawn attacks
 +
2.1.2.1 First pawn attack
 +
-->{{#if: {{#var:attack5Type}} |
 +
{{#if: {{#var: 5}}
 +
| {{#vardefine:attack5InitialSelectionWeight | {{#expr: {{#vardefineecho:attack5Damage| {{#show:{{#var: 5}}|?Attack 1 Damage|link=none}} }} * (1 + ({{#vardefineecho:attack5AP| {{#show:{{#var: 5}}|?Attack 1 AP|link=none}} }}/100)) * {{#show:{{#var: 5}}|?Attack 1 Chance Factor|link=none|default=1}} / {{#vardefineecho:attack5Cooldown | {{#show:{{#var: 5}}|?Attack 1 Cooldown|link=none}} }} round 1}} }}
 +
| {{#vardefine:attack5InitialSelectionWeight | {{#expr: {{#vardefineecho:attack5Damage| {{#show:{{#var:pawn}}|?Attack 1 Damage|link=none}} }} * (1 + ({{#vardefineecho:attack5AP| {{#show:{{#var:pawn}}|?Attack 1 AP|link=none}} }}/100)) * {{#show:{{#var:pawn}}|?Attack 1 Chance Factor|link=none|default=1}} / {{#vardefineecho:attack5Cooldown | {{#show:{{#var:pawn}}|?Attack 1 Cooldown|link=none}} }} round 1}} }}
 +
}}
 +
}}<!--
 +
2.1.2.2 Second pawn attack
 +
-->{{#if: {{#var:attack6Type}} |
 +
{{#if: {{#var: 6}}
 +
| {{#vardefine:attack6InitialSelectionWeight | {{#expr: {{#vardefineecho:attack6Damage| {{#show:{{#var: 6}}|?Attack 1 Damage|link=none}} }} * (1 + ({{#vardefineecho:attack6AP| {{#show:{{#var: 6}}|?Attack 1 AP|link=none}} }}/100)) * {{#show:{{#var: 6}}|?Attack 1 Chance Factor|link=none|default=1}} / {{#vardefineecho:attack6Cooldown | {{#show:{{#var: 6}}|?Attack 1 Cooldown|link=none}} }} round 1}} }}
 +
| {{#vardefine:attack6InitialSelectionWeight | {{#expr: {{#vardefineecho:attack6Damage| {{#show:{{#var:pawn}}|?Attack 2 Damage|link=none}} }} * (1 + ({{#vardefineecho:attack6AP| {{#show:{{#var:pawn}}|?Attack 2 AP|link=none}} }}/100)) * {{#show:{{#var:pawn}}|?Attack 2 Chance Factor|link=none|default=1}} / {{#vardefineecho:attack6Cooldown | {{#show:{{#var:pawn}}|?Attack 2 Cooldown|link=none}} }} round 1}} }}
 +
}}
 +
}}<!--
 +
2.1.2.3 Third pawn attack
 +
-->{{#if: {{#var:attack7Type}} |
 +
{{#if: {{#var: 7}}
 +
| {{#vardefine:attack7InitialSelectionWeight | {{#expr: {{#vardefineecho:attack7Damage| {{#show:{{#var: 7}}|?Attack 1 Damage|link=none}} }} * (1 + ({{#vardefineecho:attack7AP| {{#show:{{#var: 7}}|?Attack 1 AP|link=none}} }}/100)) * {{#show:{{#var: 7}}|?Attack 1 Chance Factor|link=none|default=1}} / {{#vardefineecho:attack7Cooldown | {{#show:{{#var: 7}}|?Attack 1 Cooldown|link=none}} }} round 1}} }}
 +
| {{#vardefine:attack7InitialSelectionWeight | {{#expr: {{#vardefineecho:attack7Damage| {{#show:{{#var:pawn}}|?Attack 3 Damage|link=none}} }} * (1 + ({{#vardefineecho:attack7AP| {{#show:{{#var:pawn}}|?Attack 3 AP|link=none}} }}/100)) * {{#show:{{#var:pawn}}|?Attack 3 Chance Factor|link=none|default=1}} / {{#vardefineecho:attack7Cooldown | {{#show:{{#var:pawn}}|?Attack 3 Cooldown|link=none}} }} round 1}} }}
 +
}}
 
}}<!--
 
}}<!--
-->{{#vardefine: attack1InitialSelectionWeight | {{#expr: {{#var:attack1Damage}} * (1 + ({{#var:attack1AP}}/100)) * {{Q|{{#var: name}}|Attack 1 Chance Factor|1}} / ({{Q|{{#var: name}}|Attack 1 Cooldown}}*{{Q|{{#var: material}}|Melee Cooldown Factor|1}}) round 1}} }}<!--'
+
2.1.2.4 Fourth pawn attack
Define the damage type of the 2nd attack so it knows which mat stat to use for the damage multiplier. Needs updating if new damage types added.
+
-->{{#if: {{#var:attack8Type}} |
-->{{#if: {{Q|{{#var: name}}|Attack 2 Type}}|
+
{{#if: {{#var: 8}}
{{#switch: {{Q|{{#var: name}}|Attack 2 Type}}
+
| {{#vardefine:attack8InitialSelectionWeight | {{#expr: {{#vardefineecho:attack8Damage| {{#show:{{#var: 8}}|?Attack 1 Damage|link=none}} }} * (1 + ({{#vardefineecho:attack8AP| {{#show:{{#var: 8}}|?Attack 1 AP|link=none}} }}/100)) * {{#show:{{#var: 8}}|?Attack 1 Chance Factor|link=none|default=1}} / {{#vardefineecho:attack8Cooldown | {{#show:{{#var: 8}}|?Attack 1 Cooldown|link=none}} }} round 1}} }}
| Cut
+
| {{#vardefine:attack8InitialSelectionWeight | {{#expr: {{#vardefineecho:attack8Damage| {{#show:{{#var:pawn}}|?Attack 4 Damage|link=none}} }} * (1 + ({{#vardefineecho:attack8AP| {{#show:{{#var:pawn}}|?Attack 4 AP|link=none}} }}/100)) * {{#show:{{#var:pawn}}|?Attack 4 Chance Factor|link=none|default=1}} / {{#vardefineecho:attack8Cooldown | {{#show:{{#var:pawn}}|?Attack 4 Cooldown|link=none}} }} round 1}} }}
| Stab
+
}}
| RangedStab
 
| Bullet
 
| Arrow
 
| ArrowHighVelocity
 
| Scratch
 
| Toxic scratch
 
| Bite
 
| Toxic bite
 
| Bomb
 
| BombSuper
 
| Thump =
 
{{#vardefine:attack2Damage| {{#expr: {{Q|{{#var: name}}|Attack 2 Damage}}*{{#var:qualityFactor}}*{{Q|{{#var:material}}|Melee Sharp Damage Factor|1}}     }}}}
 
{{#vardefine:attack2AP    | {{#expr: {{Q|{{#var: name}}|Attack 2 AP}}   *{{#var:qualityFactor}}*{{Q|{{#var:material}}|Melee Sharp Damage Factor|1}}     }}}}
 
| Crush
 
| Blunt
 
| Poke
 
| Demolish =
 
{{#vardefine:attack2Damage| {{#expr: {{Q|{{#var: name}}|Attack 2 Damage}}*{{#var:qualityFactor}}*{{Q|{{#var:material}}|Melee Blunt Damage Factor|1}}    }}}}
 
{{#vardefine:attack2AP    | {{#expr: {{Q|{{#var: name}}|Attack 2 AP}}    *{{#var:qualityFactor}}*{{Q|{{#var:material}}|Melee Blunt Damage Factor|1}}     }}}}
 
| {{Error|Unrecognised Damage Type: {{Q|{{#var: name}}|Attack 2 Type}}}}
 
}}
 
{{#vardefine: attack2InitialSelectionWeight | {{#expr: {{#var:attack2Damage}} * (1 + ({{#var:attack2AP}}/100)) * {{Q|{{#var: name}}|Attack 2 Chance Factor|1}} / ({{Q|{{#var: name}}|Attack 2 Cooldown}}*{{Q|{{#var: material}}|Melee Cooldown Factor|1}}) round 1}} }}
 
 
}}<!--
 
}}<!--
Define the damage type of the 3rd attack so it knows which mat stat to use for the damage multiplier. Needs updating if new damage types added.
+
2.1.2.5 Fifth pawn attack
-->{{#if: {{Q|{{#var: name}}|Attack 3 Type}}|
+
-->{{#if: {{#var:attack9Type}} |
{{#switch: {{Q|{{#var: name}}|Attack 3 Type}}
+
{{#if: {{#var: 9}}
| Cut
+
| {{#vardefine:attack9InitialSelectionWeight | {{#expr: {{#vardefineecho:attack9Damage| {{#show:{{#var: 9}}|?Attack 1 Damage|link=none}} }} * (1 + ({{#vardefineecho:attack9AP| {{#show:{{#var: 9}}|?Attack 1 AP|link=none}} }}/100)) * {{#show:{{#var: 9}}|?Attack 1 Chance Factor|link=none|default=1}} / {{#vardefineecho:attack9Cooldown | {{#show:{{#var: 9}}|?Attack 1 Cooldown|link=none}} }} round 1}} }}
| Stab
+
| {{#vardefine:attack9InitialSelectionWeight | {{#expr: {{#vardefineecho:attack9Damage| {{#show:{{#var:pawn}}|?Attack 5 Damage|link=none}} }} * (1 + ({{#vardefineecho:attack9AP| {{#show:{{#var:pawn}}|?Attack 5 AP|link=none}} }}/100)) * {{#show:{{#var:pawn}}|?Attack 5 Chance Factor|link=none|default=1}} / {{#vardefineecho:attack9Cooldown | {{#show:{{#var:pawn}}|?Attack 5 Cooldown|link=none}} }} round 1}} }}
| RangedStab
+
}}
| Bullet
 
| Arrow
 
| ArrowHighVelocity
 
| Scratch
 
| Toxic scratch
 
| Bite
 
| Toxic bite
 
| Bomb
 
| BombSuper
 
| Thump =
 
{{#vardefine:attack3Damage| {{#expr: {{Q|{{#var: name}}|Attack 3 Damage}}*{{#var:qualityFactor}}*{{Q|{{#var:material}}|Melee Sharp Damage Factor|1}}     }}}}
 
{{#vardefine:attack3AP    | {{#expr: {{Q|{{#var: name}}|Attack 3 AP}}   *{{#var:qualityFactor}}*{{Q|{{#var:material}}|Melee Sharp Damage Factor|1}}     }}}}
 
| Crush
 
| Blunt
 
| Poke
 
| Demolish =
 
{{#vardefine:attack3Damage| {{#expr: {{Q|{{#var: name}}|Attack 3 Damage}}*{{#var:qualityFactor}}*{{Q|{{#var:material}}|Melee Blunt Damage Factor|1}}    }}}}
 
{{#vardefine:attack3AP    | {{#expr: {{Q|{{#var: name}}|Attack 3 AP}}    *{{#var:qualityFactor}}*{{Q|{{#var:material}}|Melee Blunt Damage Factor|1}}     }}}}
 
| {{Error|Unrecognised Damage Type: {{Q|{{#var: name}}|Attack 3 Type}}}}
 
}}
 
{{#vardefine: attack3InitialSelectionWeight | {{#expr: {{#var:attack3Damage}} * (1 + ({{#var:attack3AP}}/100)) * {{Q|{{#var: name}}|Attack 3 Chance Factor|1}} / ({{Q|{{#var: name}}|Attack 3 Cooldown}}*{{Q|{{#var: material}}|Melee Cooldown Factor|1}}) round 1}} }}
 
 
}}<!--
 
}}<!--
Define the damage type of the 4th attack so it knows which mat stat to use for the damage multiplier. Needs updating if new damage types added.
+
2.1.2.6 Sixth pawn attack
-->{{#if: {{Q|{{#var: name}}|Attack 4 Type}}|
+
-->{{#if: {{#var:attack10Type}} |
{{#switch: {{Q|{{#var: name}}|Attack 4 Type}}
+
{{#if: {{#var:10}}
| Cut
+
| {{#vardefine:attack10InitialSelectionWeight | {{#expr: {{#vardefineecho:attack10Damage| {{#show:{{#var:10}}|?Attack 1 Damage|link=none}} }} * (1 + ({{#vardefineecho:attack10AP| {{#show:{{#var:10}}|?Attack 1 AP|link=none}} }}/100)) * {{#show:{{#var:10}}|?Attack 1 Chance Factor|link=none|default=1}} / {{#vardefineecho:attack10Cooldown | {{#show:{{#var:10}}|?Attack 1 Cooldown|link=none}} }} round 1}} }}
| Stab
+
| {{#vardefine:attack10InitialSelectionWeight | {{#expr: {{#vardefineecho:attack10Damage| {{#show:{{#var:pawn}}|?Attack 6 Damage|link=none}} }} * (1 + ({{#vardefineecho:attack10AP| {{#show:{{#var:pawn}}|?Attack 6 AP|link=none}} }}/100)) * {{#show:{{#var:pawn}}|?Attack 6 Chance Factor|link=none|default=1}} / {{#vardefineecho:attack10Cooldown | {{#show:{{#var:pawn}}|?Attack 6 Cooldown|link=none}} }} round 1}} }}
| RangedStab
+
}}
| Bullet
 
| Arrow
 
| ArrowHighVelocity
 
| Scratch
 
| Toxic scratch
 
| Bite
 
| Toxic bite
 
| Bomb
 
| BombSuper
 
| Thump =
 
{{#vardefine:attack4Damage| {{#expr: {{Q|{{#var: name}}|Attack 4 Damage}}*{{#var:qualityFactor}}*{{Q|{{#var:material}}|Melee Sharp Damage Factor|1}}     }}}}
 
{{#vardefine:attack4AP    | {{#expr: {{Q|{{#var: name}}|Attack 4 AP}}   *{{#var:qualityFactor}}*{{Q|{{#var:material}}|Melee Sharp Damage Factor|1}}     }}}}
 
| Crush
 
| Blunt
 
| Poke
 
| Demolish =
 
{{#vardefine:attack4Damage| {{#expr: {{Q|{{#var: name}}|Attack 4 Damage}}*{{#var:qualityFactor}}*{{Q|{{#var:material}}|Melee Blunt Damage Factor|1}}    }}}}
 
{{#vardefine:attack4AP    | {{#expr: {{Q|{{#var: name}}|Attack 4 AP}}    *{{#var:qualityFactor}}*{{Q|{{#var:material}}|Melee Blunt Damage Factor|1}}     }}}}
 
| {{Error|Unrecognised Damage Type: {{Q|{{#var: name}}|Attack 4 Type}}}}
 
}}
 
{{#vardefine: attack4InitialSelectionWeight | {{#expr: {{#var:attack4Damage}} * (1 + ({{#var:attack4AP}}/100)) * {{Q|{{#var: name}}|Attack 4 Chance Factor|1}} / ({{Q|{{#var: name}}|Attack 4 Cooldown}}*{{Q|{{#var: material}}|Melee Cooldown Factor|1}}) round 1}} }}
 
 
}}<!--
 
}}<!--
Determine which attack has the highest weight to use as point of comparison for categorisation
+
2.1.2.7 Seventh pawn attack
-->{{#vardefine: maxSelectionWeight | {{#ifexpr: {{#var: attack1InitialSelectionWeight}} > {{#var: attack2InitialSelectionWeight|0}} | {{#var: attack1InitialSelectionWeight}} | {{#var: attack2InitialSelectionWeight}} }} }}<!--
+
-->{{#if: {{#var:attack11Type}} |
-->{{#ifexpr: {{#var: maxSelectionWeight}} < {{#var: attack3InitialSelectionWeight|0}} | {{#vardefine: maxSelectionWeight| {{#var: attack3InitialSelectionWeight}} }} }}<!--
+
{{#vardefine:attack11InitialSelectionWeight | {{#expr: {{#vardefineecho:attack11Damage| {{#show:{{#var:11}}|?Attack 1 Damage|link=none}} }} * (1 + ({{#vardefineecho:attack11AP| {{#show:{{#var:11}}|?Attack 1 AP|link=none}} }}/100)) * {{#show:{{#var:11}}|?Attack 1 Chance Factor|link=none|default=1}} / {{#vardefineecho:attack11Cooldown | {{#show:{{#var:11}}|?Attack 1 Cooldown|link=none}} }} round 1}} }}<!--
-->{{#ifexpr: {{#var: maxSelectionWeight}} < {{#var: attack4InitialSelectionWeight|0}} | {{#vardefine: maxSelectionWeight| {{#var: attack4InitialSelectionWeight}} }} }}<!--
+
2.1.2.8 Eighth pawn attack
Initialize vars for counting category sizes
+
-->{{#if: {{#var:attack12Type}} |
-->{{#vardefine: numBestAttacks | 0}}{{#vardefine: numMidAttacks | 0}}<!--
+
{{#vardefine:attack12InitialSelectionWeight | {{#expr: {{#vardefineecho:attack12Damage| {{#show:{{#var:12}}|?Attack 1 Damage|link=none}} }} * (1 + ({{#vardefineecho:attack12AP| {{#show:{{#var:12}}|?Attack 1 AP|link=none}} }}/100)) * {{#show:{{#var:12}}|?Attack 1 Chance Factor|link=none|default=1}} / {{#vardefineecho:attack12Cooldown | {{#show:{{#var:12}}|?Attack 1 Cooldown|link=none}} }} round 1}} }}
Categorize attack 1 relative to max
+
}} }}<!--
-->{{#ifexpr: {{#var: attack1InitialSelectionWeight}} > (0.95*{{#var: maxSelectionWeight}}) or {{#var: attack1InitialSelectionWeight}} = (0.95*{{#var: maxSelectionWeight}}) | {{#vardefine: numBestAttacks | {{#expr: {{#var: numBestAttacks}}+1}}}} {{#vardefine: attack1SelectionCategory | best }}|
 
{{#ifexpr: {{#var: attack1InitialSelectionWeight}} < (0.25*{{#var: maxSelectionWeight}}) | {{#vardefine: attack1SelectionCategory |worst}} | {{#vardefine: numMidAttacks | {{#expr: {{#var: numMidAttacks}}+1}}}} {{#vardefine: attack1SelectionCategory | mid }}}} }}<!--
 
Categorize attack 2 relative to max
 
-->{{#if: {{Q|{{#var: name}}|Attack 2 Type}}|
 
{{#ifexpr: {{#var: attack2InitialSelectionWeight}} > (0.95*{{#var: maxSelectionWeight}}) or {{#var: attack2InitialSelectionWeight}} = (0.95*{{#var: maxSelectionWeight}}) | {{#vardefine: numBestAttacks | {{#expr: {{#var: numBestAttacks}}+1}}}} {{#vardefine: attack2SelectionCategory | best }}|
 
{{#ifexpr: {{#var: attack2InitialSelectionWeight}} < (0.25*{{#var: maxSelectionWeight}}) | {{#vardefine: attack2SelectionCategory |worst}} | {{#vardefine: numMidAttacks | {{#expr: {{#var: numMidAttacks}}+1}}}} {{#vardefine: attack2SelectionCategory | mid }}}} }} }}<!--
 
Categorize attack 3 relative to max
 
-->{{#if: {{Q|{{#var: name}}|Attack 3 Type}}|
 
{{#ifexpr: {{#var: attack3InitialSelectionWeight}} > (0.95*{{#var: maxSelectionWeight}}) or {{#var: attack3InitialSelectionWeight}} = (0.95*{{#var: maxSelectionWeight}}) | {{#vardefine: numBestAttacks | {{#expr: {{#var: numBestAttacks}}+1}}}} {{#vardefine: attack3SelectionCategory | best }}|
 
{{#ifexpr: {{#var: attack3InitialSelectionWeight}} < (0.25*{{#var: maxSelectionWeight}}) | {{#vardefine: attack3SelectionCategory |worst}} | {{#vardefine: numMidAttacks | {{#expr: {{#var: numMidAttacks}}+1}}}} {{#vardefine: attack3SelectionCategory | mid }}}} }} }}<!--
 
Categorize attack 4 relative to max
 
-->{{#if: {{Q|{{#var: name}}|Attack 4 Type}}|
 
{{#ifexpr: {{#var: attack4InitialSelectionWeight}} > (0.95*{{#var: maxSelectionWeight}}) or {{#var: attack4InitialSelectionWeight}} = (0.95*{{#var: maxSelectionWeight}}) | {{#vardefine: numBestAttacks | {{#expr: {{#var: numBestAttacks}}+1}}}} {{#vardefine: attack4SelectionCategory | best }}|  
 
{{#ifexpr: {{#var: attack4InitialSelectionWeight}} < (0.25*{{#var: maxSelectionWeight}}) | {{#vardefine: attack4SelectionCategory |worst}} | {{#vardefine: numMidAttacks | {{#expr: {{#var: numMidAttacks}}+1}}}} {{#vardefine: attack4SelectionCategory | mid }}}} }} }}<!--
 
Sometimes there is no mid category, in which case it controls 100% of the selection chance, instead of only 75%
 
-->{{#ifeq: {{#var: numMidAttacks}} | 0 | {{#vardefine:bestCategoryPercentage|1.00}} | {{#vardefine:bestCategoryPercentage|0.75}}}}<!--
 
Define selection chances from category and number of attacks in category so we don't have to calc them twice and so they can be called.
 
-->{{#vardefine:attack1SelectionChance|{{#expr: {{#ifeq: {{#var:attack1SelectionCategory}} | best | ({{#var:bestCategoryPercentage}}/{{#var: numBestAttacks}}) | {{#ifeq: {{#var:attack1SelectionCategory}} | mid | (0.25/{{#var: numMidAttacks}}) | 0}} }} }} }}<!--
 
-->{{#vardefine:attack2SelectionChance|{{#expr: {{#ifeq: {{#var:attack2SelectionCategory}} | best | ({{#var:bestCategoryPercentage}}/{{#var: numBestAttacks}}) | {{#ifeq: {{#var:attack2SelectionCategory}} | mid | (0.25/{{#var: numMidAttacks}}) | 0}} }} }} }}<!--
 
-->{{#vardefine:attack3SelectionChance|{{#expr: {{#ifeq: {{#var:attack3SelectionCategory}} | best | ({{#var:bestCategoryPercentage}}/{{#var: numBestAttacks}}) | {{#ifeq: {{#var:attack3SelectionCategory}} | mid | (0.25/{{#var: numMidAttacks}}) | 0}} }} }} }}<!--
 
-->{{#vardefine:attack4SelectionChance|{{#expr: {{#ifeq: {{#var:attack4SelectionCategory}} | best | ({{#var:bestCategoryPercentage}}/{{#var: numBestAttacks}}) | {{#ifeq: {{#var:attack4SelectionCategory}} | mid | (0.25/{{#var: numMidAttacks}}) | 0}} }} }} }}<!--
 
Calculate actual DPS
 
-->{{#vardefine:trueDPS| {{#expr: ({{#var:attack1Damage}}/({{Q|{{#var: name}}|Attack 1 Cooldown}}*{{Q|{{#var: material}}|Melee Cooldown Factor|1}}) * {{#var:attack1SelectionChance}})<!--
 
  
-->{{#if: {{Q|{{#var: name}}|Attack 2 Type}}|+({{#var:attack2Damage}}/({{Q|{{#var: name}}|Attack 2 Cooldown}}*{{Q|{{#var: material}}|Melee Cooldown Factor|1}}) * {{#var:attack2SelectionChance}})
+
2.2 Determine which attack has the highest weight to use as point of comparison for categorisation
}}<!--
+
-->{{#vardefine:maxSelectionWeight | {{#ifexpr: {{#var:attack1InitialSelectionWeight|0}} > {{#var:attack2InitialSelectionWeight|0}} | {{#var:attack1InitialSelectionWeight|0}} | {{#var:attack2InitialSelectionWeight|0}} }} }}<!--
 +
-->{{#if: {{#var:attack3Type }} | {{#ifexpr: {{#var:maxSelectionWeight}} < {{#var:attack3InitialSelectionWeight }} | {{#vardefine:maxSelectionWeight | {{#var:attack3InitialSelectionWeight }} }} }}<!--
 +
-->{{#if: {{#var:attack4Type }} | {{#ifexpr: {{#var:maxSelectionWeight}} < {{#var:attack4InitialSelectionWeight }} | {{#vardefine:maxSelectionWeight | {{#var:attack4InitialSelectionWeight }} }} }} }} }}<!--
 +
-->{{#if: {{#var:attack5Type }} | {{#ifexpr: {{#var:maxSelectionWeight}} < {{#var:attack5InitialSelectionWeight }} | {{#vardefine:maxSelectionWeight | {{#var:attack5InitialSelectionWeight }} }} }} }}<!--
 +
-->{{#if: {{#var:attack6Type }} | {{#ifexpr: {{#var:maxSelectionWeight}} < {{#var:attack6InitialSelectionWeight }} | {{#vardefine:maxSelectionWeight | {{#var:attack6InitialSelectionWeight }} }} }} }}<!--
 +
-->{{#if: {{#var:attack7Type }} | {{#ifexpr: {{#var:maxSelectionWeight}} < {{#var:attack7InitialSelectionWeight }} | {{#vardefine:maxSelectionWeight | {{#var:attack7InitialSelectionWeight }} }} }} }}<!--
 +
-->{{#if: {{#var:attack8Type }} | {{#ifexpr: {{#var:maxSelectionWeight}} < {{#var:attack8InitialSelectionWeight }} | {{#vardefine:maxSelectionWeight | {{#var:attack8InitialSelectionWeight }} }} }} }}<!--
 +
-->{{#if: {{#var:attack9Type }} | {{#ifexpr: {{#var:maxSelectionWeight}} < {{#var:attack9InitialSelectionWeight }} | {{#vardefine:maxSelectionWeight | {{#var:attack9InitialSelectionWeight }} }} }} }}<!--
 +
-->{{#if: {{#var:attack10Type}} | {{#ifexpr: {{#var:maxSelectionWeight}} < {{#var:attack10InitialSelectionWeight}} | {{#vardefine:maxSelectionWeight | {{#var:attack10InitialSelectionWeight}} }} }} }}<!--
 +
-->{{#if: {{#var:attack11Type}} | {{#ifexpr: {{#var:maxSelectionWeight}} < {{#var:attack11InitialSelectionWeight}} | {{#vardefine:maxSelectionWeight | {{#var:attack11InitialSelectionWeight}} }} }}<!--
 +
-->{{#if: {{#var:attack12Type}} | {{#ifexpr: {{#var:maxSelectionWeight}} < {{#var:attack12InitialSelectionWeight}} | {{#vardefine:maxSelectionWeight | {{#var:attack12InitialSelectionWeight}} }} }} }} }}<!--
  
-->{{#if: {{Q|{{#var: name}}|Attack 3 Type}}|+({{#var:attack3Damage}}/({{Q|{{#var: name}}|Attack 3 Cooldown}}*{{Q|{{#var: material}}|Melee Cooldown Factor|1}}) *  {{#var:attack3SelectionChance}})
+
2.3 Categorize attacks relative to highest initial selection weight into best/mid/worst
}}<!--
+
2.3.1 Weapon attacks
 +
-->{{#if: {{#var:attack1Type }} |
 +
{{#vardefine:attack1SelectionCategory  | {{#ifexpr: {{#var:attack1InitialSelectionWeight }} >= 0.95*{{#var:maxSelectionWeight}} | best {{#vardefine:numBestAttacks | {{#expr: {{#var:numBestAttacks}}+1}} }} | {{#ifexpr: {{#var:attack1InitialSelectionWeight }} < 0.25*{{#var:maxSelectionWeight}} | worst | mid {{#vardefine:numMidAttacks | {{#expr: {{#var:numMidAttacks}}+1}} }} }} }} }}<!--
 +
-->{{#if: {{#var:attack2Type }} |
 +
{{#vardefine:attack2SelectionCategory  | {{#ifexpr: {{#var:attack2InitialSelectionWeight }} >= 0.95*{{#var:maxSelectionWeight}} | best {{#vardefine:numBestAttacks | {{#expr: {{#var:numBestAttacks}}+1}} }} | {{#ifexpr: {{#var:attack2InitialSelectionWeight }} < 0.25*{{#var:maxSelectionWeight}} | worst | mid {{#vardefine:numMidAttacks | {{#expr: {{#var:numMidAttacks}}+1}} }} }} }} }}<!--
 +
-->{{#if: {{#var:attack3Type }} |
 +
{{#vardefine:attack3SelectionCategory  | {{#ifexpr: {{#var:attack3InitialSelectionWeight }} >= 0.95*{{#var:maxSelectionWeight}} | best {{#vardefine:numBestAttacks | {{#expr: {{#var:numBestAttacks}}+1}} }} | {{#ifexpr: {{#var:attack3InitialSelectionWeight }} < 0.25*{{#var:maxSelectionWeight}} | worst | mid {{#vardefine:numMidAttacks | {{#expr: {{#var:numMidAttacks}}+1}} }} }} }} }}<!--
 +
-->{{#if: {{#var:attack4Type }} |
 +
{{#vardefine:attack4SelectionCategory  | {{#ifexpr: {{#var:attack4InitialSelectionWeight }} >= 0.95*{{#var:maxSelectionWeight}} | best {{#vardefine:numBestAttacks | {{#expr: {{#var:numBestAttacks}}+1}} }} | {{#ifexpr: {{#var:attack4InitialSelectionWeight }} < 0.25*{{#var:maxSelectionWeight}} | worst | mid {{#vardefine:numMidAttacks | {{#expr: {{#var:numMidAttacks}}+1}} }} }} }} }} }} }} }} }}<!--
 +
2.3.2 Pawn attacks
 +
-->{{#if: {{#var:attack5Type  | {{#var: 5}} }} |
 +
{{#vardefine:attack5SelectionCategory  | {{#ifexpr: {{#var:attack5InitialSelectionWeight }} >= 0.95*{{#var:maxSelectionWeight}} | best {{#vardefine:numBestAttacks | {{#expr: {{#var:numBestAttacks}}+1}} }} | {{#ifexpr: {{#var:attack5InitialSelectionWeight }} < 0.25*{{#var:maxSelectionWeight}} | worst | mid {{#vardefine:numMidAttacks | {{#expr: {{#var:numMidAttacks}}+1}} }} }} }} }}<!--
 +
-->{{#if: {{#var:attack6Type  | {{#var: 6}} }} |
 +
{{#vardefine:attack6SelectionCategory  | {{#ifexpr: {{#var:attack6InitialSelectionWeight }} >= 0.95*{{#var:maxSelectionWeight}} | best {{#vardefine:numBestAttacks | {{#expr: {{#var:numBestAttacks}}+1}} }} | {{#ifexpr: {{#var:attack6InitialSelectionWeight }} < 0.25*{{#var:maxSelectionWeight}} | worst | mid {{#vardefine:numMidAttacks | {{#expr: {{#var:numMidAttacks}}+1}} }} }} }} }}<!--
 +
-->{{#if: {{#var:attack7Type  | {{#var: 7}} }} |
 +
{{#vardefine:attack7SelectionCategory  | {{#ifexpr: {{#var:attack7InitialSelectionWeight }} >= 0.95*{{#var:maxSelectionWeight}} | best {{#vardefine:numBestAttacks | {{#expr: {{#var:numBestAttacks}}+1}} }} | {{#ifexpr: {{#var:attack7InitialSelectionWeight }} < 0.25*{{#var:maxSelectionWeight}} | worst | mid {{#vardefine:numMidAttacks | {{#expr: {{#var:numMidAttacks}}+1}} }} }} }} }}<!--
 +
-->{{#if: {{#var:attack8Type  | {{#var: 8}} }} |
 +
{{#vardefine:attack8SelectionCategory  | {{#ifexpr: {{#var:attack8InitialSelectionWeight }} >= 0.95*{{#var:maxSelectionWeight}} | best {{#vardefine:numBestAttacks | {{#expr: {{#var:numBestAttacks}}+1}} }} | {{#ifexpr: {{#var:attack8InitialSelectionWeight }} < 0.25*{{#var:maxSelectionWeight}} | worst | mid {{#vardefine:numMidAttacks | {{#expr: {{#var:numMidAttacks}}+1}} }} }} }} }}<!--
 +
-->{{#if: {{#var:attack9Type | {{#var: 9}} }} |
 +
{{#vardefine:attack9SelectionCategory  | {{#ifexpr: {{#var:attack9InitialSelectionWeight }} >= 0.95*{{#var:maxSelectionWeight}} | best {{#vardefine:numBestAttacks | {{#expr: {{#var:numBestAttacks}}+1}} }} | {{#ifexpr: {{#var:attack9InitialSelectionWeight }} < 0.25*{{#var:maxSelectionWeight}} | worst | mid {{#vardefine:numMidAttacks | {{#expr: {{#var:numMidAttacks}}+1}} }} }} }} }}<!--
 +
-->{{#if: {{#var:attack10Type | {{#var:10}} }} |
 +
{{#vardefine:attack10SelectionCategory | {{#ifexpr: {{#var:attack10InitialSelectionWeight}} >= 0.95*{{#var:maxSelectionWeight}} | best {{#vardefine:numBestAttacks | {{#expr: {{#var:numBestAttacks}}+1}} }} | {{#ifexpr: {{#var:attack10InitialSelectionWeight}} < 0.25*{{#var:maxSelectionWeight}} | worst | mid {{#vardefine:numMidAttacks | {{#expr: {{#var:numMidAttacks}}+1}} }} }} }} }}<!--
 +
-->{{#if: {{#var:attack11Type}}                |
 +
{{#vardefine:attack11SelectionCategory | {{#ifexpr: {{#var:attack11InitialSelectionWeight}} >= 0.95*{{#var:maxSelectionWeight}} | best {{#vardefine:numBestAttacks | {{#expr: {{#var:numBestAttacks}}+1}} }} | {{#ifexpr: {{#var:attack11InitialSelectionWeight}} < 0.25*{{#var:maxSelectionWeight}} | worst | mid {{#vardefine:numMidAttacks | {{#expr: {{#var:numMidAttacks}}+1}} }} }} }} }}<!--
 +
-->{{#if: {{#var:attack12Type}}                |
 +
{{#vardefine:attack12SelectionCategory | {{#ifexpr: {{#var:attack12InitialSelectionWeight}} >= 0.95*{{#var:maxSelectionWeight}} | best {{#vardefine:numBestAttacks | {{#expr: {{#var:numBestAttacks}}+1}} }} | {{#ifexpr: {{#var:attack12InitialSelectionWeight}} < 0.25*{{#var:maxSelectionWeight}} | worst | mid {{#vardefine:numMidAttacks | {{#expr: {{#var:numMidAttacks}}+1}} }} }} }} }} }} }} }} }} }} }} }} }}<!--
  
-->{{#if: {{Q|{{#var: name}}|Attack 4 Type}}|+({{#var:attack4Damage}}/({{Q|{{#var: name}}|Attack 4 Cooldown}}*{{Q|{{#var: material}}|Melee Cooldown Factor|1}}) * {{#var:attack4SelectionChance}})
+
2.4 Calculate selection chances
}}
+
Sometimes there is no mid category, in which case it controls 100% of the selection chance, instead of only 75%
round 2}}
+
-->{{#vardefine:bestCategoryPercentage| {{#ifeq: {{#var:numMidAttacks}} | 0 | 1 | 0.75 }} }}<!--
}}<!--
+
Define selection chances from category and number of attacks in category so we don't have to calc them twice and so they can be called.
Calculate actual avg AP
+
-->{{#if: {{#var:attack1Type                }} | {{#vardefine:attack1SelectionChance | {{#expr: {{#switch: {{#var:attack1SelectionCategory }} | mid = 0.25 / {{#var:numMidAttacks}} | best = {{#var:bestCategoryPercentage}} / {{#var:numBestAttacks}} | 0 }} }} }}<!--
-->{{#vardefine:trueAP| {{#expr: (({{#var:attack1AP}} * {{#var:attack1SelectionChance}})<!--
+
-->{{#if: {{#var:attack2Type                }} | {{#vardefine:attack2SelectionChance | {{#expr: {{#switch: {{#var:attack2SelectionCategory }} | mid = 0.25 / {{#var:numMidAttacks}} | best = {{#var:bestCategoryPercentage}} / {{#var:numBestAttacks}} | 0 }} }} }}<!--
 +
-->{{#if: {{#var:attack3Type                }} | {{#vardefine:attack3SelectionChance | {{#expr: {{#switch: {{#var:attack3SelectionCategory }} | mid = 0.25 / {{#var:numMidAttacks}} | best = {{#var:bestCategoryPercentage}} / {{#var:numBestAttacks}} | 0 }} }} }}<!--
 +
-->{{#if: {{#var:attack4Type                }} | {{#vardefine:attack4SelectionChance | {{#expr: {{#switch: {{#var:attack4SelectionCategory }} | mid = 0.25 / {{#var:numMidAttacks}} | best = {{#var:bestCategoryPercentage}} / {{#var:numBestAttacks}} | 0 }} }} }} }} }} }} }}<!--
 +
-->{{#if: {{#var:attack5Type  | {{#var: 5}} }} | {{#vardefine:attack5SelectionChance | {{#expr: {{#switch: {{#var:attack5SelectionCategory }} | mid = 0.25 / {{#var:numMidAttacks}} | best = {{#var:bestCategoryPercentage}} / {{#var:numBestAttacks}} | 0 }} }} }}<!--
 +
-->{{#if: {{#var:attack6Type  | {{#var: 6}} }} | {{#vardefine:attack6SelectionChance | {{#expr: {{#switch: {{#var:attack6SelectionCategory }} | mid = 0.25 / {{#var:numMidAttacks}} | best = {{#var:bestCategoryPercentage}} / {{#var:numBestAttacks}} | 0 }} }} }}<!--
 +
-->{{#if: {{#var:attack7Type | {{#var: 7}} }} | {{#vardefine:attack7SelectionChance | {{#expr: {{#switch: {{#var:attack7SelectionCategory }} | mid = 0.25 / {{#var:numMidAttacks}} | best = {{#var:bestCategoryPercentage}} / {{#var:numBestAttacks}} | 0 }} }} }}<!--
 +
-->{{#if: {{#var:attack8Type  | {{#var: 8}} }} | {{#vardefine:attack8SelectionChance | {{#expr: {{#switch: {{#var:attack8SelectionCategory }} | mid = 0.25 / {{#var:numMidAttacks}} | best = {{#var:bestCategoryPercentage}} / {{#var:numBestAttacks}} | 0 }} }} }}<!--
 +
-->{{#if: {{#var:attack9Type  | {{#var: 9}} }} | {{#vardefine:attack9SelectionChance | {{#expr: {{#switch: {{#var:attack9SelectionCategory }} | mid = 0.25 / {{#var:numMidAttacks}} | best = {{#var:bestCategoryPercentage}} / {{#var:numBestAttacks}} | 0 }} }} }}<!--
 +
-->{{#if: {{#var:attack10Type | {{#var:10}} }} | {{#vardefine:attack10SelectionChance| {{#expr: {{#switch: {{#var:attack10SelectionCategory}} | mid = 0.25 / {{#var:numMidAttacks}} | best = {{#var:bestCategoryPercentage}} / {{#var:numBestAttacks}} | 0 }} }} }}<!--
 +
-->{{#if: {{#var:attack11Type              }} | {{#vardefine:attack11SelectionChance| {{#expr: {{#switch: {{#var:attack11SelectionCategory}} | mid = 0.25 / {{#var:numMidAttacks}} | best = {{#var:bestCategoryPercentage}} / {{#var:numBestAttacks}} | 0 }} }} }}<!--
 +
-->{{#if: {{#var:attack12Type              }} | {{#vardefine:attack12SelectionChance| {{#expr: {{#switch: {{#var:attack12SelectionCategory}} | mid = 0.25 / {{#var:numMidAttacks}} | best = {{#var:bestCategoryPercentage}} / {{#var:numBestAttacks}} | 0 }} }} }} }} }} }} }} }} }} }} }}<!--
  
-->{{#if: {{Q|{{#var: name}}|Attack 2 Type}}|+({{#var:attack2AP}} * {{#var:attack2SelectionChance}})
+
2.5 Calculate actual DPS
}}<!--
+
(bestDamage*bestSelectionWeight + midDamage*midSelectionWeight) / (bestCooldownTime*bestSelectionWeight + midCoolDownTime*midSelectionWeight) = DPS
 +
-->{{#vardefine:weightedDamageTotal | {{#expr: 0
 +
    {{#if: {{#var:attack1Type                }} | +{{#vardefineecho:attack1WeightedDamage  | {{#expr: {{#var:attack1Damage }} * {{#var:attack1SelectionChance }} }} }}
 +
    {{#if: {{#var:attack2Type                }} | +{{#vardefineecho:attack2WeightedDamage  | {{#expr: {{#var:attack2Damage }} * {{#var:attack2SelectionChance }} }} }}
 +
    {{#if: {{#var:attack3Type                }} | +{{#vardefineecho:attack3WeightedDamage  | {{#expr: {{#var:attack3Damage }} * {{#var:attack3SelectionChance }} }} }}
 +
    {{#if: {{#var:attack4Type                }} | +{{#vardefineecho:attack4WeightedDamage  | {{#expr: {{#var:attack4Damage }} * {{#var:attack4SelectionChance }} }} }} }} }} }} }}
 +
    {{#if: {{#var:attack5Type  | {{#var: 5}} }} | +{{#vardefineecho:attack5WeightedDamage  | {{#expr: {{#var:attack5Damage }} * {{#var:attack5SelectionChance }} }} }}
 +
    {{#if: {{#var:attack6Type  | {{#var: 6}} }} | +{{#vardefineecho:attack6WeightedDamage  | {{#expr: {{#var:attack6Damage }} * {{#var:attack6SelectionChance }} }} }}
 +
    {{#if: {{#var:attack7Type  | {{#var: 7}} }} | +{{#vardefineecho:attack7WeightedDamage  | {{#expr: {{#var:attack7Damage }} * {{#var:attack7SelectionChance }} }} }}
 +
    {{#if: {{#var:attack8Type  | {{#var: 8}} }} | +{{#vardefineecho:attack8WeightedDamage  | {{#expr: {{#var:attack8Damage }} * {{#var:attack8SelectionChance }} }} }}
 +
    {{#if: {{#var:attack9Type  | {{#var: 9}} }} | +{{#vardefineecho:attack9WeightedDamage  | {{#expr: {{#var:attack9Damage }} * {{#var:attack9SelectionChance }} }} }}
 +
    {{#if: {{#var:attack10Type | {{#var:10}} }} | +{{#vardefineecho:attack10WeightedDamage | {{#expr: {{#var:attack10Damage}} * {{#var:attack10SelectionChance}} }} }}
 +
    {{#if: {{#var:attack11Type              }} | +{{#vardefineecho:attack11WeightedDamage | {{#expr: {{#var:attack11Damage}} * {{#var:attack11SelectionChance}} }} }}
 +
    {{#if: {{#var:attack12Type              }} | +{{#vardefineecho:attack12WeightedDamage | {{#expr: {{#var:attack12Damage}} * {{#var:attack12SelectionChance}} }} }} }} }} }} }} }} }} }} }}
 +
}} }}<!--
 +
-->{{#vardefine:weightedTimeTotal | {{#expr: 0
 +
    {{#if: {{#var:attack1Type                }} | +{{#vardefineecho:attack1WeightedCooldown  | {{#expr: {{#var:attack1Cooldown }} * {{#var:attack1SelectionChance }} }} }}
 +
    {{#if: {{#var:attack2Type                }} | +{{#vardefineecho:attack2WeightedCooldown  | {{#expr: {{#var:attack2Cooldown }} * {{#var:attack2SelectionChance }} }} }}
 +
    {{#if: {{#var:attack3Type                }} | +{{#vardefineecho:attack3WeightedCooldown  | {{#expr: {{#var:attack3Cooldown }} * {{#var:attack3SelectionChance }} }} }}
 +
    {{#if: {{#var:attack4Type                }} | +{{#vardefineecho:attack4WeightedCooldown  | {{#expr: {{#var:attack4Cooldown }} * {{#var:attack4SelectionChance }} }} }} }} }} }} }}
 +
    {{#if: {{#var:attack5Type  | {{#var: 5}} }} | +{{#vardefineecho:attack5WeightedCooldown  | {{#expr: {{#var:attack5Cooldown }} * {{#var:attack5SelectionChance }} }} }}
 +
    {{#if: {{#var:attack6Type  | {{#var: 6}} }} | +{{#vardefineecho:attack6WeightedCooldown  | {{#expr: {{#var:attack6Cooldown }} * {{#var:attack6SelectionChance }} }} }}
 +
    {{#if: {{#var:attack7Type  | {{#var: 7}} }} | +{{#vardefineecho:attack7WeightedCooldown  | {{#expr: {{#var:attack7Cooldown }} * {{#var:attack7SelectionChance }} }} }}
 +
    {{#if: {{#var:attack8Type  | {{#var: 8}} }} | +{{#vardefineecho:attack8WeightedCooldown  | {{#expr: {{#var:attack8Cooldown }} * {{#var:attack8SelectionChance }} }} }}
 +
    {{#if: {{#var:attack9Type  | {{#var: 9}} }} | +{{#vardefineecho:attack9WeightedCooldown  | {{#expr: {{#var:attack9Cooldown }} * {{#var:attack9SelectionChance }} }} }}
 +
    {{#if: {{#var:attack10Type | {{#var:10}} }} | +{{#vardefineecho:attack10WeightedCooldown | {{#expr: {{#var:attack10Cooldown}} * {{#var:attack10SelectionChance}} }} }}
 +
    {{#if: {{#var:attack11Type              }} | +{{#vardefineecho:attack11WeightedCooldown | {{#expr: {{#var:attack11Cooldown}} * {{#var:attack11SelectionChance}} }} }}
 +
    {{#if: {{#var:attack12Type              }} | +{{#vardefineecho:attack12WeightedCooldown | {{#expr: {{#var:attack12Cooldown}} * {{#var:attack12SelectionChance}} }} }} }} }} }} }} }} }} }} }}
 +
}} }}<!--
 +
-->{{#vardefine:trueDPS | {{#expr:{{#var:weightedDamageTotal}}/{{#var:weightedTimeTotal}} round 2}} }}<!--
  
-->{{#if: {{Q|{{#var: name}}|Attack 3 Type}}|+({{#var:attack3AP}} * {{#var:attack3SelectionChance}})
+
2.6 Calculate actual average AP
}}<!--
+
-->{{#vardefine:trueAP | {{#expr: 0
 +
    {{#if: {{#var:attack1Type                }} | +{{#vardefineecho:attack1WeightedAP  | {{#expr: {{#var:attack1AP }} * {{#var:attack1SelectionChance }} }} }}
 +
    {{#if: {{#var:attack2Type                }} | +{{#vardefineecho:attack2WeightedAP  | {{#expr: {{#var:attack2AP }} * {{#var:attack2SelectionChance }} }} }}
 +
    {{#if: {{#var:attack3Type                }} | +{{#vardefineecho:attack3WeightedAP  | {{#expr: {{#var:attack3AP }} * {{#var:attack3SelectionChance }} }} }}
 +
    {{#if: {{#var:attack4Type                }} | +{{#vardefineecho:attack4WeightedAP  | {{#expr: {{#var:attack4AP }} * {{#var:attack4SelectionChance }} }} }} }} }} }} }}
 +
    {{#if: {{#var:attack5Type  | {{#var: 5}} }} | +{{#vardefineecho:attack5WeightedAP  | {{#expr: {{#var:attack5AP }} * {{#var:attack5SelectionChance }} }} }}
 +
    {{#if: {{#var:attack6Type  | {{#var: 6}} }} | +{{#vardefineecho:attack6WeightedAP  | {{#expr: {{#var:attack6AP }} * {{#var:attack6SelectionChance }} }} }}
 +
    {{#if: {{#var:attack7Type  | {{#var: 7}} }} | +{{#vardefineecho:attack7WeightedAP  | {{#expr: {{#var:attack7AP }} * {{#var:attack7SelectionChance }} }} }}
 +
    {{#if: {{#var:attack8Type  | {{#var: 8}} }} | +{{#vardefineecho:attack8WeightedAP  | {{#expr: {{#var:attack8AP }} * {{#var:attack8SelectionChance }} }} }}
 +
    {{#if: {{#var:attack9Type  | {{#var: 9}} }} | +{{#vardefineecho:attack9WeightedAP  | {{#expr: {{#var:attack9AP }} * {{#var:attack9SelectionChance }} }} }}
 +
    {{#if: {{#var:attack10Type | {{#var:10}} }} | +{{#vardefineecho:attack10WeightedAP | {{#expr: {{#var:attack10AP}} * {{#var:attack10SelectionChance}} }} }}
 +
    {{#if: {{#var:attack11Type              }} | +{{#vardefineecho:attack11WeightedAP | {{#expr: {{#var:attack11AP}} * {{#var:attack11SelectionChance}} }} }}
 +
    {{#if: {{#var:attack12Type              }} | +{{#vardefineecho:attack12WeightedAP | {{#expr: {{#var:attack12AP}} * {{#var:attack12SelectionChance}} }} }} }} }} }} }} }} }} }} }}
 +
round 2}} }}<!--
  
-->{{#if: {{Q|{{#var: name}}|Attack 4 Type}}|+({{#var:attack4AP}} * {{#var:attack4SelectionChance}})
+
3. RETURNED VALUE
}})
+
-->{{#var:trueDPS}}</includeonly><noinclude>{{Recode|reason=1) Given the Proliferation of melee damage factors. It would be good to have a way to set a multiplier 2) Consider converting to a lua module IFF it reduces load}}
round 2}}
+
{{Documentation}}
}}{{#var:trueDPS}}<noinclude>
+
<!--{{True Melee DPS Calculator|Longsword|Gold|Good|Human}} Example for most common use case. Enable this line and disable Documentation for performance testing. -->
{{documentation}}
 
 
</noinclude>
 
</noinclude>

Latest revision as of 03:40, 11 November 2024

Documentation icon Template documentation[view] [edit] [history] [purge]

Summary[edit]

Returns the true DPS of a melee weapon or animal i.e. the DPS taking into account the melee verb system introduced in Version/1.1.2610. This value often disagrees with the listed melee DPS in-game but better represents the reality in most cases.

Parameters[edit]

The template takes up to tvelve parameters. All of them are optional.

  1. A weapon or a pawn. If absent, {{PAGENAME}} will be used.
  2. If 1) is a stuffable weapon: The material the weapon is made out of. If absent, the template will assume multipliers of 1 for all stats.
  3. If 1) is a weapon with quality: The weapons quality. If absent, the template will assume multipliers of 1 for all stats.
  4. If 1) is a weapon: the pawn that wields it. If absent, the template will asume that no pawn wields the weapon.
  5. If 4) is present: The artificial body part that replaces the body part of the pawns first attack, or that provides an additional attack. Provide false if the body part is missing without replacement.
  6. If 4) is present and pawn has at least 1 attacks: The artificial body part that replaces the body part of the pawns second attack, or that provides an additional attack. Provide false if the body part is missing without replacement.
  7. If 4) is present and pawn has at least 2 attacks: The artificial body part that replaces the body part of the pawns third attack, or that provides an additional attack. Provide false if the body part is missing without replacement.
  8. If 4) is present and pawn has at least 3 attacks: The artificial body part that replaces the body part of the pawns fourth attack, or that provides an additional attack. Provide false if the body part is missing without replacement.
  9. If 4) is present and pawn has at least 4 attacks: The artificial body part that replaces the body part of the pawns fifth attack, or that provides an additional attack. Provide false if the body part is missing without replacement.
  10. If 4) is present and pawn has at least 5 attacks: The artificial body part that replaces the body part of the pawns sixth attack, or that provides an additional attack. Provide false if the body part is missing without replacement.
  11. If 4) is present and pawn has at least 6 attacks: The artificial body part that provides an additional attack.
  12. If 4) and 11) is present: The artificial body part that provides an additional attack.

In short:

{{True Melee DPS Calculator|<weapon/pawn>|<material>|<quality>|<pawn>|<artificial body part/false>|<artificial body part/false>|<artificial body part/false>|<artificial body part/false>|<artificial body part/false>|<artificial body part/false>|<artificial body part>|<artificial body part>}}

Examples[edit]

Non-stuffable weapon without quality[edit]

A persona zeushammer:

{{True Melee DPS Calculator|Persona zeushammer}}

Has a true DPS of: 13.17

Stuffable weapon with quality[edit]

A longsword, made out of plasteel with a legendary quality:

{{True Melee DPS Calculator|Longsword|plasteel|Legendary}}

Has a true DPS of: 17.68

Pawn with no weapon[edit]

A grizzly bear:

{{True Melee DPS Calculator|Grizzly bear}}

Has a true DPS of: 8.67

Pawn with a weapon[edit]

A human with a left archotech arm, no teeth and an elbow blade wielding an ikwa, made out of plasteel of masterwork quality:

{{True Melee DPS Calculator|Ikwa|Plasteel|Masterwork|Human|Archotech arm||false||Elbow blade}}

Has a true DPS of: 12.98

Calling additional variables[edit]

The template defines a lot of useful variables that can be called. Below you can see a full table of them. This also means we can retrace the calculations step by step.

This example is for a human with an archotech left arm, an elbow blade at the right arm, two knee spikes and no teeth wielding a masterwork plasteel longsword.

{{True Melee DPS Calculator|Longsword|Plasteel|Masterwork|Human|Archotech arm||false||Elbow blade|Knee spike|Knee spike}}
{| class="wikitable"
! Attack Source !! Part name (artificial body part) !! Attack Type !! Damage !! AP !! Cooldown !! Weight !! Category !! Selection chance !! weighted Damage !! weighted Cooldown !! weighted AP
|-
! rowspan="4" | {{#var:weapon|''<weapon>''}}{{#if: {{#var:material}}{{#var:quality}} | <br/>({{#var:material}} {{#var:quality}}) }}
| {{Q|{{#var:weapon}}|Attack 1 Part}} || {{#var:attack1Type}} || {{#var:attack1Damage}} || {{#var:attack1AP}} || {{#var:attack1Cooldown}} || {{#var: attack1InitialSelectionWeight}} || {{#var:attack1SelectionCategory}} || {{#var:attack1SelectionChance}}
|{{#var:attack1WeightedDamage}} || {{#var:attack1WeightedCooldown}} || {{#var:attack1WeightedAP}}
|-
| {{Q|{{#var:weapon}}|Attack 2 Part}} || {{#var:attack2Type}} || {{#var:attack2Damage}} || {{#var:attack2AP}} || {{#var:attack2Cooldown}} || {{#var: attack2InitialSelectionWeight}} || {{#var:attack2SelectionCategory}} || {{#var:attack2SelectionChance}}
| {{#var:attack2WeightedDamage}} || {{#var:attack2WeightedCooldown}} || {{#var:attack2WeightedAP}}
|-
| {{Q|{{#var:weapon}}|Attack 3 Part}} || {{#var:attack3Type}} || {{#var:attack3Damage}} || {{#var:attack3AP}} || {{#var:attack3Cooldown}} || {{#var: attack3InitialSelectionWeight}} || {{#var:attack3SelectionCategory}} || {{#var:attack3SelectionChance}}
| {{#var:attack3WeightedDamage}} || {{#var:attack3WeightedCooldown}} || {{#var:attack3WeightedAP}}
|-
| {{Q|{{#var:weapon}}|Attack 4 Part}} || {{#var:attack4Type}} || {{#var:attack4Damage}} || {{#var:attack4AP}} || {{#var:attack4Cooldown}} || {{#var: attack4InitialSelectionWeight}} || {{#var:attack4SelectionCategory}} || {{#var:attack4SelectionChance}}
| {{#var:attack4WeightedDamage}} || {{#var:attack4WeightedCooldown}} || {{#var:attack4WeightedAP}}
|-
! rowspan="8" | {{#var:pawn|''<pawn>''}}
| {{#if:{{#var:5}}|{{Q|{{#var:5}}|Attack 1 Part}} ({{#var:5}})|{{Q|{{#var:pawn}}|Attack 1 Part}} }}
| {{#var:attack5Type}} || {{#var:attack5Damage}} || {{#var:attack5AP}} || {{#var:attack5Cooldown}} || {{#var: attack5InitialSelectionWeight}} || {{#var:attack5SelectionCategory}} || {{#var:attack5SelectionChance}}
| {{#var:attack5WeightedDamage}} || {{#var:attack5WeightedCooldown}} || {{#var:attack5WeightedAP}}
|-
| {{#if:{{#var:6}}|{{Q|{{#var:6}}|Attack 1 Part}} ({{#var:6}})|{{Q|{{#var:pawn}}|Attack 2 Part}} }}
| {{#var:attack6Type}} || {{#var:attack6Damage}} || {{#var:attack6AP}} || {{#var:attack6Cooldown}} || {{#var: attack6InitialSelectionWeight}} || {{#var:attack6SelectionCategory}} || {{#var:attack6SelectionChance}}
| {{#var:attack6WeightedDamage}} || {{#var:attack6WeightedCooldown}} || {{#var:attack6WeightedAP}}
|-
| {{#if:{{#var:7}}|{{Q|{{#var:7}}|Attack 1 Part}} ({{#var:7}})|{{Q|{{#var:pawn}}|Attack 3 Part}} }}
| {{#var:attack7Type}} || {{#var:attack7Damage}} || {{#var:attack7AP}} || {{#var:attack7Cooldown}} || {{#var: attack7InitialSelectionWeight}} || {{#var:attack7SelectionCategory}} || {{#var:attack7SelectionChance}}
| {{#var:attack7WeightedDamage}} || {{#var:attack7WeightedCooldown}} || {{#var:attack7WeightedAP}}
|-
| {{#if:{{#var:8}}|{{Q|{{#var:8}}|Attack 1 Part}} ({{#var:8}})|{{Q|{{#var:pawn}}|Attack 4 Part}} }}
| {{#var:attack8Type}} || {{#var:attack8Damage}} || {{#var:attack8AP}} || {{#var:attack8Cooldown}} || {{#var: attack8InitialSelectionWeight}} || {{#var:attack8SelectionCategory}} || {{#var:attack8SelectionChance}}
| {{#var:attack8WeightedDamage}} || {{#var:attack8WeightedCooldown}} || {{#var:attack8WeightedAP}}
|-
| {{#if:{{#var:9}}|{{Q|{{#var:9}}|Attack 1 Part}} ({{#var:9}})|{{Q|{{#var:pawn}}|Attack 5 Part}} }}
| {{#var:attack9Type}} || {{#var:attack9Damage}} || {{#var:attack9AP}} || {{#var:attack9Cooldown}} || {{#var: attack9InitialSelectionWeight}} || {{#var:attack9SelectionCategory}} || {{#var:attack9SelectionChance}}
| {{#var:attack9WeightedDamage}} || {{#var:attack9WeightedCooldown}} || {{#var:attack9WeightedAP}}
|-
| {{#if:{{#var:10}}|{{Q|{{#var:10}}|Attack 1 Part}} ({{#var:10}})|{{Q|{{#var:pawn}}|Attack 6 Part}} }}
| {{#var:attack10Type}} || {{#var:attack10Damage}} || {{#var:attack10AP}} || {{#var:attack10Cooldown}} || {{#var: attack10InitialSelectionWeight}} || {{#var:attack10SelectionCategory}} || {{#var:attack10SelectionChance}}
| {{#var:attack10WeightedDamage}} || {{#var:attack10WeightedCooldown}} || {{#var:attack10WeightedAP}}
|-
| {{#if:{{#var:11}}|{{Q|{{#var:11}}|Attack 1 Part}} ({{#var:11}}) }}
| {{#var:attack11Type}} || {{#var:attack11Damage}} || {{#var:attack11AP}} || {{#var:attack11Cooldown}} || {{#var: attack11InitialSelectionWeight}} || {{#var:attack11SelectionCategory}} || {{#var:attack11SelectionChance}}
| {{#var:attack11WeightedDamage}} || {{#var:attack11WeightedCooldown}} || {{#var:attack11WeightedAP}}
|-
| {{#if:{{#var:12}}|{{Q|{{#var:12}}|Attack 1 Part}} ({{#var:12}}) }}
| {{#var:attack12Type}} || {{#var:attack12Damage}} || {{#var:attack12AP}} || {{#var:attack12Cooldown}} || {{#var: attack12InitialSelectionWeight}} || {{#var:attack12SelectionCategory}} || {{#var:attack12SelectionChance}}
| {{#var:attack12WeightedDamage}} || {{#var:attack12WeightedCooldown}} || {{#var:attack12WeightedAP}}
|-
! colspan="9" rowspan="2" | SUM:
! {{#var:weightedDamageTotal}}
! {{#var:weightedTimeTotal}}
! rowspan="2" | {{#var:trueAP}} ''(True AP)''
|-
! colspan="2" | {{#var:trueDPS}} ''(True DPS)''
|}

15.19

Attack Source Part name (artificial body part) Attack Type Damage AP Cooldown Weight Category Selection chance weighted Damage weighted Cooldown weighted AP
Longsword
(Plasteel Masterwork)
Handle Poke 11.745 16.965 1.6 8.6 mid 0.05 0.58725 0.08 0.84825
Point Stab 36.685 54.23 2.08 27.2 best 0.375 13.756875 0.78 20.33625
Blade Cut 36.685 54.23 2.08 27.2 best 0.375 13.756875 0.78 20.33625
Human Fist (Archotech arm) Blunt 14 21 2 8.5 mid 0.05 0.7 0.1 1.05
RightHand Blunt 8.2 12 2 4.6 worst 0 0 0 0
(false) 0 0 0 0 worst 0 0 0 0
Teeth Bite 8.2 12 2 0.3 worst 0 0 0 0
Blade (Elbow blade) Cut 18 27 2 11.4 mid 0.05 0.9 0.1 1.35
Spike (Knee spike) Stab 22 38 2.6 11.7 mid 0.05 1.1 0.13 1.9
Spike (Knee spike) Stab 22 38 2.6 11.7 mid 0.05 1.1 0.13 1.9
SUM: 31.901 2.1 47.72 (True AP)
15.19 (True DPS)

Warning to editors[edit]

The encouragement above to reuse variables defined by this template means that you need to be extremely careful when changing names of variables or their definitions, since it might affect other templates as well.

Namely Template:Weapon Stats Table/Melee reuses the following variables defined in this template:

* {{#var:trueAP}}
* {{#var:attack1AP}}, {{#var:attack2AP}}, {{#var:attack3AP}}, {{#var:attack4AP}}
* {{#var:attack1Cooldown}}, {{#var:attack2Cooldown}}, {{#var:attack3Cooldown}}, {{#var:attack4Cooldown}}
* {{#var:attack1Damage}}, {{#var:attack2Damage}}, {{#var:attack3Damage}}, {{#var:attack4Damage}}
* {{#var:attack1SelectionChance}}, {{#var:attack2SelectionChance}}, {{#var:attack3SelectionChance}}, {{#var:attack4SelectionChance}}