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

From RimWorld Wiki
Jump to navigation Jump to search
(Fixed differences between preview and live example. Added a warning about changing variables)
Line 1: Line 1:
 +
== Summary ==
 
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.  
 
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.  
  
==Usage==
+
== Usage ==
 
The first parameter, if present, will specify which weapon or animal to generate the template for. If absent, <code><nowiki>{{PAGENAME}}</nowiki></code> will be used.
 
The first parameter, if present, will specify which weapon or animal to generate the template for. If absent, <code><nowiki>{{PAGENAME}}</nowiki></code> will be used.
 
The second parameter, if present, will specify which material to generate the template for. If absent, the template will assume multipliers of 1 for all stats, returning the base values for animals or non-[[stuff]]able weapons such as the [[monosword]], or the equivalent of [[steel]] for stuffed weapons.
 
The second parameter, if present, will specify which material to generate the template for. If absent, the template will assume multipliers of 1 for all stats, returning the base values for animals or non-[[stuff]]able weapons such as the [[monosword]], or the equivalent of [[steel]] for stuffed weapons.
Line 20: Line 21:
 
</pre>
 
</pre>
  
==Examples==
+
== Examples ==
===Pawn attacks===
+
=== Pawn attacks ===
 
<pre>
 
<pre>
 
{{True Melee DPS Calculator| Grizzly bear}}
 
{{True Melee DPS Calculator| Grizzly bear}}
Line 27: Line 28:
 
produces:
 
produces:
 
{{True Melee DPS Calculator| Grizzly bear}}
 
{{True Melee DPS Calculator| Grizzly bear}}
===Stuffed weapons===
+
 
 +
=== Stuffed weapons ===
 
<pre>
 
<pre>
 
{{True Melee DPS Calculator|Longsword|plasteel|Legendary}}
 
{{True Melee DPS Calculator|Longsword|plasteel|Legendary}}
Line 33: Line 35:
 
produces:
 
produces:
 
{{True Melee DPS Calculator|Longsword|plasteel|Legendary}}
 
{{True Melee DPS Calculator|Longsword|plasteel|Legendary}}
===Calling additional variables===
+
 
 +
=== Calling additional variables ===
 
<pre>
 
<pre>
 
{{True Melee DPS Calculator|Persona monosword||Masterwork}}
 
{{True Melee DPS Calculator|Persona monosword||Masterwork}}
 
{| class="wikitable"
 
{| class="wikitable"
|-
 
 
! Part name !! Weight !! Category
 
! Part name !! Weight !! Category
 
|-
 
|-
Line 54: Line 56:
 
{{True Melee DPS Calculator|Persona monosword||Masterwork}}
 
{{True Melee DPS Calculator|Persona monosword||Masterwork}}
 
{| class="wikitable"
 
{| class="wikitable"
|-
 
 
! Part name !! Weight !! Chance !! Category
 
! Part name !! Weight !! Chance !! Category
 
|-
 
|-
| {{Q|{{#var:name}}|Attack 1 Part}} || {{#var: attack1InitialSelectionWeight}} || {{#expr: {{#ifeq: {{#var:attack1SelectionCategory}} | best | ({{#var:bestCategoryPercentage}}/{{#var: numBestAttacks}}) | {{#ifeq: {{#var:attack1SelectionCategory}} | mid | (0.25/{{#var: numMidAttacks}}) | 0}} }} }} || {{#var:attack1SelectionCategory}}
+
| {{Q|{{#var:name}}|Attack 1 Part}} || {{#var: attack1InitialSelectionWeight}} || {{#var:attack1SelectionChance}} || {{#var:attack1SelectionCategory}}
 
|-
 
|-
| {{Q|{{#var:name}}|Attack 2 Part}} || {{#var: attack2InitialSelectionWeight}} || {{#expr: {{#ifeq: {{#var:attack2SelectionCategory}} | best | ({{#var:bestCategoryPercentage}}/{{#var: numBestAttacks}}) | {{#ifeq: {{#var:attack2SelectionCategory}} | mid | (0.25/{{#var: numMidAttacks}}) | 0}} }} }} || {{#var:attack2SelectionCategory}}
+
| {{Q|{{#var:name}}|Attack 2 Part}} || {{#var: attack2InitialSelectionWeight}} || {{#var:attack2SelectionChance}} || {{#var:attack2SelectionCategory}}
 
|-
 
|-
| {{Q|{{#var:name}}|Attack 3 Part}} || {{#var: attack3InitialSelectionWeight}} || {{#expr: {{#ifeq: {{#var:attack3SelectionCategory}} | best | ({{#var:bestCategoryPercentage}}/{{#var: numBestAttacks}}) | {{#ifeq: {{#var:attack3SelectionCategory}} | mid | (0.25/{{#var: numMidAttacks}}) | 0}} }} }} || {{#var:attack3SelectionCategory}}
+
| {{Q|{{#var:name}}|Attack 3 Part}} || {{#var: attack3InitialSelectionWeight}} || {{#var:attack3SelectionChance}} || {{#var:attack3SelectionCategory}}
 
|-
 
|-
| {{Q|{{#var:name}}|Attack 4 Part}} || {{#var: attack4InitialSelectionWeight}} || {{#expr: {{#ifeq: {{#var:attack4SelectionCategory}} | best | ({{#var:bestCategoryPercentage}}/{{#var: numBestAttacks}}) | {{#ifeq: {{#var:attack4SelectionCategory}} | mid | (0.25/{{#var: numMidAttacks}}) | 0}} }} }} || {{#var:attack4SelectionCategory}}
+
| {{Q|{{#var:name}}|Attack 4 Part}} || {{#var: attack4InitialSelectionWeight}} || {{#var:attack4SelectionChance}} || {{#var:attack4SelectionCategory}}
 
|}
 
|}
 
True DPS = {{#var:trueDPS}}
 
True DPS = {{#var:trueDPS}}
 
True AP = {{#var:trueAP}}
 
True AP = {{#var:trueAP}}
  
 +
=== Persona zeushammer ===
 +
<pre>{{True Melee DPS Calculator|Persona zeushammer}}</pre>
 
{{True Melee DPS Calculator|Persona zeushammer}}
 
{{True Melee DPS Calculator|Persona zeushammer}}
 +
 +
== Warning to editors ==
 +
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 Quality Table/Melee]] reuses the following variables defined in this template:
 +
<pre>
 +
* {{#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}}
 +
</pre>

Revision as of 06:22, 18 April 2023

Summary

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.

Usage

The first parameter, if present, will specify which weapon or animal to generate the template for. If absent, {{PAGENAME}} will be used. The second parameter, if present, will specify which material to generate the template for. If absent, the template will assume multipliers of 1 for all stats, returning the base values for animals or non-stuffable weapons such as the monosword, or the equivalent of steel for stuffed weapons. The third parameter, if present, will specify the quality of the weapon to generate the template for. If absent, the template will assume multipliers of 1 for all stats, returning the base values for animals or quality-less weapons, or the equivalent of Normal quality for other weapons.

Additionally, the values may be useful to call if more than just the DPS is useful. Namely:

{{#var: attack1InitialSelectionWeight}} = Selection weight of Attack 1
{{#var: attack2InitialSelectionWeight}} = Selection weight of Attack 2 
{{#var: attack3InitialSelectionWeight}} = Selection weight of Attack 3 
{{#var: attack4InitialSelectionWeight}} = Selection weight of Attack 4  
{{#var:attack1SelectionCategory}} = Selection category for Attack 1, out of Worst (0% chance), Mid (25% chance split between all in category), and Best (75% chance split between all in category)
{{#var:attack2SelectionCategory}} = Selection category for Attack 2, out of Worst (0% chance), Mid (25% chance split between all in category), and Best (75% chance split between all in category)
{{#var:attack3SelectionCategory}} = Selection category for Attack 3, out of Worst (0% chance), Mid (25% chance split between all in category), and Best (75% chance split between all in category)
{{#var:attack4SelectionCategory}} = Selection category for Attack 4, out of Worst (0% chance), Mid (25% chance split between all in category), and Best (75% chance split between all in category)
{{#var:trueDPS}} = The DPS output by the template - only useful for further math.
{{#var:trueAP}} = The average AP of the weapon, using the outcome of the melee verb system.

Examples

Pawn attacks

{{True Melee DPS Calculator| Grizzly bear}}

produces: 8.67

Stuffed weapons

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

produces: 17.68

Calling additional variables

{{True Melee DPS Calculator|Persona monosword||Masterwork}}
{| class="wikitable"
! Part name !! Weight !! Category
|-
| {{Q|{{#var:name}}|Attack 1 Part}} || {{#var: attack1InitialSelectionWeight}} || {{#var:attack1SelectionCategory}}
|-
| {{Q|{{#var:name}}|Attack 2 Part}} || {{#var: attack2InitialSelectionWeight}} || {{#var:attack2SelectionCategory}}
|-
| {{Q|{{#var:name}}|Attack 3 Part}} || {{#var: attack3InitialSelectionWeight}} || {{#var:attack3SelectionCategory}}
|-
| {{Q|{{#var:name}}|Attack 4 Part}} || {{#var: attack4InitialSelectionWeight}} || {{#var:attack4SelectionCategory}}
|}
True DPS = {{#var:trueDPS}}
True AP = {{#var:trueAP}}

produces: 24.47

Part name Weight Chance Category
Handle 13.7 0 worst
Point 56.4 0.5 best
Edge 56.4 0.5 best

True DPS = 24.47 True AP = 130.5

Persona zeushammer

{{True Melee DPS Calculator|Persona zeushammer}}

13.17

Warning to editors

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 Quality 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}}