Difference between revisions of "Template:Apparel AP Calculation"

From RimWorld Wiki
Jump to navigation Jump to search
Line 1: Line 1:
{{#vardefine: effectiveArmor |{{#expr: {{{1|armor}}} - {{{2|ap}}}}}}}<!--
+
-->{{#vardefine: effectiveArmor1 |{{#expr: {{{armor1|0}}} - {{{ap|9}}}}}}}
 +
-->{{#vardefine: effectiveArmor2 |{{#expr: {{{armor2|0}}} - {{{ap|0}}}}}}} <!--
 +
-->{{#vardefine: effectiveArmor3 |{{#expr: {{{armor3|0}}} - {{{ap|0}}}}}}} <!--
 +
-->{{#vardefine: effectiveArmor4 |{{#expr: {{{armor4|0}}} - {{{ap|0}}}}}}} <!--
 +
-->{{#ifexpr: {{#var: effectiveArmor1}} < 0| {{#vardefine: effectiveArmor1 | 0 }} }} <!--
 +
-->{{#ifexpr: {{#var: effectiveArmor2}} < 0| {{#vardefine: effectiveArmor2 | 0 }} }} <!--
 +
-->{{#ifexpr: {{#var: effectiveArmor3}} < 0| {{#vardefine: effectiveArmor3 | 0 }} }} <!--
 +
-->{{#ifexpr: {{#var: effectiveArmor4}} < 0| {{#vardefine: effectiveArmor4 | 0 }} }} <!-
  
--><!--
+
-->{{#expr:100*(({{#ifexpr: (100-{{#var: effectiveArmor}}) > 0 | {{#expr:100-{{#var: effectiveArmor}}}} | 0}}/100.0) + ({{#ifexpr: ({{#var: effectiveArmor}}/2.0) < (100.0-{{#var: effectiveArmor}}/2.0) | {{#expr:{{#var: effectiveArmor}}/2.0}} | {{#expr:100.0-{{#var: effectiveArmor}}/2.0}} }}/100)* 0.5)
  
-->{{#ifexpr: {{#var: effectiveArmor}} < 0| {{#vardefine: effectiveArmor | 0 }} }}<!--
+
{{#if: {{{armor2|}}} | * (({{#ifexpr: (100-{{#var: effectiveArmor}}) > 0 | {{#expr:100-{{#var: effectiveArmor}}}} | 0}}/100.0) + ({{#ifexpr: ({{#var: effectiveArmor}}/2.0) < (100.0-{{#var: effectiveArmor}}/2.0) | {{#expr:{{#var: effectiveArmor}}/2.0}} | {{#expr:100.0-{{#var: effectiveArmor}}/2.0}} }}/100)* 0.5) }}
  
 +
{{#if: {{{armor3|}}} | * (({{#ifexpr: (100-{{#var: effectiveArmor}}) > 0 | {{#expr:100-{{#var: effectiveArmor}}}} | 0}}/100.0) + ({{#ifexpr: ({{#var: effectiveArmor}}/2.0) < (100.0-{{#var: effectiveArmor}}/2.0) | {{#expr:{{#var: effectiveArmor}}/2.0}} | {{#expr:100.0-{{#var: effectiveArmor}}/2.0}} }}/100)* 0.5) }}
  
-->{{#expr:100*(({{#ifexpr: (100-{{#var: effectiveArmor}}) > 0 | {{#expr:100-{{#var: effectiveArmor}}}} | 0}}/100.0) + ({{#ifexpr: ({{#var: effectiveArmor}}/2.0) < (100.0-{{#var: effectiveArmor}}/2.0) | {{#expr:{{#var: effectiveArmor}}/2.0}} | {{#expr:100.0-{{#var: effectiveArmor}}/2.0}} }}/100)* 0.5)}}
+
{{#if: {{{armor4|}}} | * (({{#ifexpr: (100-{{#var: effectiveArmor}}) > 0 | {{#expr:100-{{#var: effectiveArmor}}}} | 0}}/100.0) + ({{#ifexpr: ({{#var: effectiveArmor}}/2.0) < (100.0-{{#var: effectiveArmor}}/2.0) | {{#expr:{{#var: effectiveArmor}}/2.0}} | {{#expr:100.0-{{#var: effectiveArmor}}/2.0}} }}/100)* 0.5) }}
 +
}}

Revision as of 08:45, 22 March 2021

--> --> <!-

-->Expression error: Unexpected < operator.