Difference between revisions of "Template:Apparel AP Calculation"
m (Temporary solution for armor ratings 0~2 instead of 0~200: multiply by 100) |
Arcangelus (talk | contribs) m (Added documentation.) |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 7: | Line 7: | ||
-->{{#ifexpr: {{#var: effectiveArmor3}} < 0| {{#vardefine: effectiveArmor3 | 0 }} }} <!-- | -->{{#ifexpr: {{#var: effectiveArmor3}} < 0| {{#vardefine: effectiveArmor3 | 0 }} }} <!-- | ||
-->{{#ifexpr: {{#var: effectiveArmor4}} < 0| {{#vardefine: effectiveArmor4 | 0 }} }} <!-- | -->{{#ifexpr: {{#var: effectiveArmor4}} < 0| {{#vardefine: effectiveArmor4 | 0 }} }} <!-- | ||
− | |||
− | |||
− | |||
− | |||
− | |||
-->{{#expr:100*(({{#ifexpr: (100-{{#var: effectiveArmor1}}) > 0 | {{#expr:100-{{#var: effectiveArmor1}}}} | 0}}/100.0) + ({{#ifexpr: ({{#var: effectiveArmor1}}/2.0) < (100.0-{{#var: effectiveArmor1}}/2.0) | {{#expr:{{#var: effectiveArmor1}}/2.0}} | {{#expr:100.0-{{#var: effectiveArmor1}}/2.0}} }}/100)* 0.5) | -->{{#expr:100*(({{#ifexpr: (100-{{#var: effectiveArmor1}}) > 0 | {{#expr:100-{{#var: effectiveArmor1}}}} | 0}}/100.0) + ({{#ifexpr: ({{#var: effectiveArmor1}}/2.0) < (100.0-{{#var: effectiveArmor1}}/2.0) | {{#expr:{{#var: effectiveArmor1}}/2.0}} | {{#expr:100.0-{{#var: effectiveArmor1}}/2.0}} }}/100)* 0.5) | ||
Line 20: | Line 15: | ||
{{#if: {{{armor4|}}} | * (({{#ifexpr: (100-{{#var: effectiveArmor4}}) > 0 | {{#expr:100-{{#var: effectiveArmor4}}}} | 0}}/100.0) + ({{#ifexpr: ({{#var: effectiveArmor4}}/2.0) < (100.0-{{#var: effectiveArmor4}}/2.0) | {{#expr:{{#var: effectiveArmor4}}/2.0}} | {{#expr:100.0-{{#var: effectiveArmor4}}/2.0}} }}/100)* 0.5) }} | {{#if: {{{armor4|}}} | * (({{#ifexpr: (100-{{#var: effectiveArmor4}}) > 0 | {{#expr:100-{{#var: effectiveArmor4}}}} | 0}}/100.0) + ({{#ifexpr: ({{#var: effectiveArmor4}}/2.0) < (100.0-{{#var: effectiveArmor4}}/2.0) | {{#expr:{{#var: effectiveArmor4}}/2.0}} | {{#expr:100.0-{{#var: effectiveArmor4}}/2.0}} }}/100)* 0.5) }} | ||
− | }}<noinclude>{{Documentation | + | }}<noinclude>{{Documentation}}</noinclude> |
Latest revision as of 16:23, 4 March 2025
100
This template calculates the damage multiplier (as a percentage) for a given set of armors against an attacks's armor penetration. This is mainly used by Template:Apparel Protection Chart.
Formula[edit]
{{Apparel AP Calculation|armor1=|armor2=|armor3=|armor4=|ap=}}
- armor1 = The armor value of the first set of appeal.
- armor2 = The armor value of the second set of appeal. Ignored if not present.
- armor3 = The armor value of the third set of appeal. Ignored if not present.
- armor4 = The armor value of the fourth set of appeal. Ignored if not present.
- ap = The armor penetration of the attack being tested. Defaults to 0.
Explanation[edit]
This template has 2 stages. First, it calculates the effective armor for the given ap. If no armor value defined, it uses 0 for this calculation. Then, it obtains the maximum value between the calculated number and 0:
effectiveArmor = max(armor - ap, 0)
For armor1 and each of the other armor values present, it multiples the default value 100 by:
(max(100-effectiveArmor, 0) + min(effectiveArmor/2, 100-effectiveArmor/2) * 0.5)/100
If all armors were defined, the calculation would be:
100 * (max(100-effectiveArmor1, 0) + min(effectiveArmor1/2, 100-effectiveArmor1/2) * 0.5)/100 * (max(100-effectiveArmor2, 0) + min(effectiveArmor2/2, 100-effectiveArmor2/2) * 0.5)/100 * (max(100-effectiveArmor3, 0) + min(effectiveArmor3/2, 100-effectiveArmor3/2) * 0.5)/100 * (max(100-effectiveArmor4, 0) + min(effectiveArmor4/2, 100-effectiveArmor4/2) * 0.5)/100
Examples[edit]
{{Apparel AP Calculation|armor1={{Q|Marine armor|Armor - Sharp}}|ap={{Q|Chain shotgun|Armor Penetration}} }}
31
{{Apparel AP Calculation|armor1={{Q|Marine armor|Armor - Sharp}}|ap={{Q|Charge rifle|Armor Penetration}} }}
46.75
{{Apparel AP Calculation|armor1={{Q|Flack Vest|Armor - Sharp}}|armor2=42|ap={{Q|Charge rifle|Armor Penetration}} }}
94.75
The above documentation is transcluded from Template:Apparel AP Calculation/doc. (edit | history) Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages. Please add categories to the /doc subpage. Subpages of this template. |