Difference between revisions of "Template:Weapon DPS Chart"

From RimWorld Wiki
Jump to navigation Jump to search
(I totally remember linear interpolation.)
Line 1: Line 1:
<includeonly>{{#vardefine: name | {{{1|{{PAGENAME}} }}} }} {{#vardefine: range | {{Q|{{#var: name}}|Range}}}} {{#if: {{{2|}}} |  
+
<includeonly>{{#vardefine: name | {{{1|{{PAGENAME}} }}} }} {{#vardefine: range | {{#expr: {{Q|{{#var: name}}|Range}} round 0}}}} {{#if: {{{2|}}} |  
 
{{#ifeq: {{{2|}}} | Awful |
 
{{#ifeq: {{{2|}}} | Awful |
 
{{#vardefine: TouchAccuracy  | {{#ifexpr: {{ #expr: 0.8*{{Q|{{#var: name}}| Accuracy (Touch) Base}}  round 2}} > 100 | 1 | {{ #expr: 0.8*{{Q|{{#var: name}}| Accuracy (Touch) Base}}/100}}}}}}
 
{{#vardefine: TouchAccuracy  | {{#ifexpr: {{ #expr: 0.8*{{Q|{{#var: name}}| Accuracy (Touch) Base}}  round 2}} > 100 | 1 | {{ #expr: 0.8*{{Q|{{#var: name}}| Accuracy (Touch) Base}}/100}}}}}}
Line 88: Line 88:
 
|
 
|
 
{{#vardefine: XAxisString | {{#var: XAxisString}}, {{#var:range}}}}
 
{{#vardefine: XAxisString | {{#var: XAxisString}}, {{#var:range}}}}
{{#vardefine: YAxisString | {{#var: YAxisString}}, {{#expr: ((({{#var:range}} - 25) / (40-25)) * {{#var: MediumAccuracy}} + (1-({{#var:range}} - 25) / (40-25)) * {{#var: LongAccuracy}}) * {{#var: DPS}} }}}}
+
{{#vardefine: YAxisString | {{#var: YAxisString}}, {{#expr: ((40-{{#var:range}})*{{#var: MediumAccuracy}} + ({{#var:range}}-25)*{{#var: LongAccuracy}})*{{#var:DPS}}/(40-25) }} }}
 
}}
 
}}
 
|
 
|
 
{{#vardefine: XAxisString | {{#var: XAxisString}}, {{#var:range}}}}
 
{{#vardefine: XAxisString | {{#var: XAxisString}}, {{#var:range}}}}
{{#vardefine: YAxisString | {{#var: YAxisString}}, {{#expr: ((({{#var:range}} - 12) / (25-12)) * {{#var: ShortAccuracy}} + (1-({{#var:range}} - 12) / (25-12)) * {{#var: MediumAccuracy}}) * {{#var: DPS}} }}}}
+
{{#vardefine: YAxisString | {{#var: YAxisString}}, {{#expr: ((25-{{#var:range}})*{{#var: ShortAccuracy}} + ({{#var:range}}-12)*{{#var: MediumAccuracy}})*{{#var:DPS}}/(25-12) }} }}
 
}}
 
}}
 
|
 
|
 
{{#vardefine: XAxisString | {{#var: XAxisString}}, {{#var:range}}}}
 
{{#vardefine: XAxisString | {{#var: XAxisString}}, {{#var:range}}}}
{{#vardefine: YAxisString | {{#var: YAxisString}}, {{#expr: ((({{#var:range}} - 3) / (12-3)) * {{#var: TouchAccuracy}} + (1-({{#var:range}} - 3) / (12-3)) * {{#var: ShortAccuracy}}) * {{#var: DPS}} }}}}
+
{{#vardefine: YAxisString | {{#var: YAxisString}}, {{#expr: ((12-{{#var:range}})*{{#var: TouchAccuracy}} + ({{#var:range}}-3)*{{#var: ShortAccuracy}})*{{#var:DPS}}/(12-3) }} }}
 
}}
 
}}
 
|}}
 
|}}
 +
 +
{{#expr: ((40-{{#var:range}})*{{#var: MediumAccuracy}} + ({{#var:range}}-25)*{{#var: LongAccuracy}})/(40-25) }} 
  
 
{{GraphChart|width=400
 
{{GraphChart|width=400
|height=200
+
|height=400
 
|type=area
 
|type=area
 
|xAxisTitle=Range (Cells)
 
|xAxisTitle=Range (Cells)
|xAxisMin = 0
+
|xAxisMin = 10
 
|xAxisMax = 38
 
|xAxisMax = 38
|yAxisMin = 1
+
|yAxisMin = 10
 
|yAxisMax = 30
 
|yAxisMax = 30
 
|yAxisTitle=DPS
 
|yAxisTitle=DPS

Revision as of 03:15, 27 January 2021


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

Creates a graph showing the optimum DPS that a ranged weapon is capable of at each range, assuming perfect Pawn accuracy. The dimensions and display are standardized to offer ease of comparison.

Usage

Without parameters, the template will display the chart for the current PAGENAME, assuming normal quality. For example, if the following was used on the assault rifle page:

{{Weapon DPS Chart}}

it would produce:




0.61


The first parameter, if present, allows the weapon to be chosen if it is not used on the page of the weapon in question. The template will display the chart for the chosen weapon, assuming normal quality. For example, if the following was used on any page:

{{Weapon DPS Chart|Sniper rifle}}

it would produce:




0.88666666666667


The second parameter, if present, allows the quality of the weapon to be chosen. It can be used with or without first parameter. The template will display the chart for the chosen weapon and quality. For example, if the following was used on the minigun page

{{Weapon DPS Chart||Legendary}}

it would produce:




0.333