Difference between revisions of "Template:Cts-solve"

From Tales of Maj'Eyal
Jump to: navigation, search
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
{{#expr: ({{#expr:( ( {{{high|0}}} - {{{low|0}}} )/( ( {{{x_high|5}}} + {{{shift|0}}} )^ {{{power|0.5}}} - ( {{{x_low|1}}} + {{{shift|0}}} )^ {{{power|0.5}}} )) }} ) * {{#expr:({{{t|0}}}+{{{shift|0}}})^{{{power|0.5}}} }} + ({{#expr:{{{low|0}}} - ({{#expr:( ( {{{high|0}}} - {{{low|0}}} )/( ( {{{x_high|5}}} + {{{shift|0}}} )^ {{{power|0.5}}} - ( {{{x_low|1}}} + {{{shift|0}}} )^ {{{power|0.5}}} )) }} ) *({{{x_low|1}}}+{{{shift|0}}})^{{{power|0.50}}} }}) + {{{add|0}}} round2}}
+
<includeonly>{{#expr: ({{#expr:( ( {{{high|0}}} - {{{low|0}}} )/( ( {{{x_high|5}}} + {{{shift|0}}} )^ {{{power|0.5}}} - ( {{{x_low|1}}} + {{{shift|0}}} )^ {{{power|0.5}}} )) }} ) * {{#expr:({{{t|0}}}+{{{shift|0}}})^{{{power|0.5}}} }} + ({{#expr:{{{low|0}}} - ({{#expr:( ( {{{high|0}}} - {{{low|0}}} )/( ( {{{x_high|5}}} + {{{shift|0}}} )^ {{{power|0.5}}} - ( {{{x_low|1}}} + {{{shift|0}}} )^ {{{power|0.5}}} )) }} ) *({{{x_low|1}}}+{{{shift|0}}})^{{{power|0.5}}} }}) + {{{add|0}}} {{#ifeq:{{{digit|0}}}|1|round0|round2}} }}</includeonly>
 
<noinclude>
 
<noinclude>
Use for solving for [[Template:cts]] for given values.
+
This template is used to generate values for scaling which uses the [[Scaling#.28cTS.29_combatTalentScale| combatTalentScale]] function. See also: [[Template:cts]].
 +
 
 +
===Format===
  
 
<pre>
 
<pre>
Line 13: Line 15:
 
|shift= (default 0, optional)
 
|shift= (default 0, optional)
 
|add= (default 0, optional)
 
|add= (default 0, optional)
 +
|digit= (default 0, optional)
 
}}
 
}}
 
</pre>
 
</pre>
  
 +
===Use===
 +
 +
When given a function of type:
 +
 +
<pre>
 +
combatTalentScale(t, 4, 15, 0.75, 1, 2, true)
 +
</pre>
 +
 +
These values map to:
 +
 +
<pre>
 +
combatTalentScale(t, low, high, power, shift, add)
 +
</pre>
 +
 +
And 'raw' or 'log' is not currently implemented. ''t'' is always the talent level value you want to generate the final result for!
 +
 +
Therefore, we can use the following:
 +
 +
combatTalentScale(t, 4, 15, 0.75, 1, 2) for t=3 is {{cts-solve|t=3|low=4|high=15|power=0.75|shift=1|add=2}}
 +
 +
===Other parameters===
 +
 +
''x_low'' is the talent level for which we expect the result to be ''low'', and defaults to 1
 +
 +
''x_high'' is the talent level for which we expect to result to be ''high'', and defaults to 5
 +
 +
''digit'' defines the rounding of the final result. If digit=1, it will be rounded to the nearest whole number. Otherwise (if omitted), it will be rounded to two decimal places.
 +
 +
You should not usually need to override these.
 +
 +
 +
===Math===
 
Input: power(=0), add(=0), shift(=0), x_low (=1), x_high(=5), low, high, (raw or log), t  
 
Input: power(=0), add(=0), shift(=0), x_low (=1), x_high(=5), low, high, (raw or log), t  
  

Latest revision as of 15:35, 1 March 2016


This template is used to generate values for scaling which uses the combatTalentScale function. See also: Template:cts.

Format

{{cts-solve
|high=  
|low=
|t= 
|x_high= (default 5, optional)
|x_low= (default 1, optional)
|power= (default 0.5, optional)
|shift= (default 0, optional)
|add= (default 0, optional)
|digit= (default 0, optional)
}}

Use

When given a function of type:

combatTalentScale(t, 4, 15, 0.75, 1, 2, true)

These values map to:

combatTalentScale(t, low, high, power, shift, add)

And 'raw' or 'log' is not currently implemented. t is always the talent level value you want to generate the final result for!

Therefore, we can use the following:

combatTalentScale(t, 4, 15, 0.75, 1, 2) for t=3 is 11.86


Other parameters

x_low is the talent level for which we expect the result to be low, and defaults to 1

x_high is the talent level for which we expect to result to be high, and defaults to 5

digit defines the rounding of the final result. If digit=1, it will be rounded to the nearest whole number. Otherwise (if omitted), it will be rounded to two decimal places.

You should not usually need to override these.


Math

Input: power(=0), add(=0), shift(=0), x_low (=1), x_high(=5), low, high, (raw or log), t

Psuedo code for m:

  • m = (high - low) / ( (x_high+shift)^power - (x_low+shift)^power )
  • Expr for m: {{#expr:( ( {{{high|0}}} - {{{low|0}}} )/( ( {{{x_high|5}}} + {{{shift|0}}} )^ {{{power|0.5}}} - ( {{{x_low|1}}} + {{{shift|0}}} )^ {{{power|0.5}}} )) }}

Psuedo code for b:

  • b = low - m*(x_low+shift)^power
  • Expr for b (unexpanded): {{#expr:{{{low|0}}} - (m)*({{{xlow|1}}}+{{{shift|0}}})^{{{power|0.75}}} }}
  • Expr for b (expanded): {{#expr:{{{low|0}}} - ({{#expr:( ( {{{high|0}}} - {{{low|0}}} )/( ( {{{x_high|5}}} + {{{shift|0}}} )^ {{{power|0.5}}} - ( {{{x_low|1}}} + {{{shift|0}}} )^ {{{power|0.5}}} )) }} )*({{{x_low|1}}}+{{{shift|0}}})^{{{power|0.75}}} }}

Psuedo code for the whole thing:

  • Output = m * (t+shift)^power + b + add
  • Expr for output (unexpanded): (m)* {{#expr:({{{t|0}}}+{{{shift|0}}})^{{{power|0.5}}} }} + (b) + add
  • Expr for output (expanded): {{#expr: ({{#expr:( ( {{{high|0}}} - {{{low|0}}} )/( ( {{{x_high|5}}} + {{{shift|0}}} )^ {{{power|0.5}}} - ( {{{x_low|1}}} + {{{shift|0}}} )^ {{{power|0.5}}} )) }} ) * {{#expr:({{{t|0}}}+{{{shift|0}}})^{{{power|0.5}}} }} + ({{#expr:{{{low|0}}} - ({{#expr:( ( {{{high|0}}} - {{{low|0}}} )/( ( {{{x_high|5}}} + {{{shift|0}}} )^ {{{power|0.5}}} - ( {{{x_low|1}}} + {{{shift|0}}} )^ {{{power|0.5}}} )) }} ) *({{{x_low|1}}}+{{{shift|0}}})^{{{power|0.50}}} }}) + {{{add|0.5}}} }}