profectus-docs/assets/api_modules_features_conversion.md.e2d6443b.js

1 line
26 KiB
JavaScript

import{_ as e,c as t,o as a,a as o}from"./app.ab34650d.js";const g=JSON.parse('{"title":"Module: features/conversion","description":"","frontmatter":{"editLink":false},"headers":[{"level":2,"title":"Interfaces","slug":"interfaces"},{"level":2,"title":"Type Aliases","slug":"type-aliases"},{"level":3,"title":"Conversion","slug":"conversion"},{"level":3,"title":"GenericConversion","slug":"genericconversion"},{"level":2,"title":"Functions","slug":"functions"},{"level":3,"title":"addHardcap","slug":"addhardcap"},{"level":3,"title":"addSoftcap","slug":"addsoftcap"},{"level":3,"title":"createConversion","slug":"createconversion"},{"level":3,"title":"createCumulativeConversion","slug":"createcumulativeconversion"},{"level":3,"title":"createIndependentConversion","slug":"createindependentconversion"},{"level":3,"title":"createLinearScaling","slug":"createlinearscaling"},{"level":3,"title":"createPolynomialScaling","slug":"createpolynomialscaling"},{"level":3,"title":"setupPassiveGeneration","slug":"setuppassivegeneration"},{"level":3,"title":"softcap","slug":"softcap"}],"relativePath":"api/modules/features/conversion.md","lastUpdated":null}'),r={name:"api/modules/features/conversion.md"},d=o('<h1 id="module-features-conversion" tabindex="-1">Module: features/conversion <a class="header-anchor" href="#module-features-conversion" aria-hidden="true">#</a></h1><h2 id="interfaces" tabindex="-1">Interfaces <a class="header-anchor" href="#interfaces" aria-hidden="true">#</a></h2><ul><li><a href="../../interfaces/features/conversion.BaseConversion">BaseConversion</a></li><li><a href="../../interfaces/features/conversion.ConversionOptions">ConversionOptions</a></li><li><a href="../../interfaces/features/conversion.ScalingFunction">ScalingFunction</a></li></ul><h2 id="type-aliases" tabindex="-1">Type Aliases <a class="header-anchor" href="#type-aliases" aria-hidden="true">#</a></h2><h3 id="conversion" tabindex="-1">Conversion <a class="header-anchor" href="#conversion" aria-hidden="true">#</a></h3><p>\u01AC <strong>Conversion</strong>&lt;<code>T</code>&gt;: <a href="./feature.html#replace"><code>Replace</code></a>&lt;<code>T</code> &amp; <a href="../../interfaces/features/conversion.BaseConversion"><code>BaseConversion</code></a>, { <code>actualGain</code>: <a href="./../util/computed.html#getcomputabletypewithdefault"><code>GetComputableTypeWithDefault</code></a>&lt;<code>T</code>[<code>&quot;actualGain&quot;</code>], <code>Ref</code>&lt;<a href="./../util/bignum.html#decimalsource"><code>DecimalSource</code></a>&gt;&gt; ; <code>buyMax</code>: <a href="./../util/computed.html#getcomputabletypewithdefault"><code>GetComputableTypeWithDefault</code></a>&lt;<code>T</code>[<code>&quot;buyMax&quot;</code>], <code>true</code>&gt; ; <code>currentAt</code>: <a href="./../util/computed.html#getcomputabletypewithdefault"><code>GetComputableTypeWithDefault</code></a>&lt;<code>T</code>[<code>&quot;currentAt&quot;</code>], <code>Ref</code>&lt;<a href="./../util/bignum.html#decimalsource"><code>DecimalSource</code></a>&gt;&gt; ; <code>currentGain</code>: <a href="./../util/computed.html#getcomputabletypewithdefault"><code>GetComputableTypeWithDefault</code></a>&lt;<code>T</code>[<code>&quot;currentGain&quot;</code>], <code>Ref</code>&lt;<a href="./../util/bignum.html#decimalsource"><code>DecimalSource</code></a>&gt;&gt; ; <code>nextAt</code>: <a href="./../util/computed.html#getcomputabletypewithdefault"><code>GetComputableTypeWithDefault</code></a>&lt;<code>T</code>[<code>&quot;nextAt&quot;</code>], <code>Ref</code>&lt;<a href="./../util/bignum.html#decimalsource"><code>DecimalSource</code></a>&gt;&gt; ; <code>roundUpCost</code>: <a href="./../util/computed.html#getcomputabletypewithdefault"><code>GetComputableTypeWithDefault</code></a>&lt;<code>T</code>[<code>&quot;roundUpCost&quot;</code>], <code>true</code>&gt; ; <code>spend</code>: <code>undefined</code> extends <code>T</code>[<code>&quot;spend&quot;</code>] ? (<code>amountGained</code>: <a href="./../util/bignum.html#decimalsource"><code>DecimalSource</code></a>) =&gt; <code>void</code> : <code>T</code>[<code>&quot;spend&quot;</code>] }&gt;</p><p>An object that converts one <a href="../../interfaces/features/resources/resource.Resource">Resource</a> into another at a given rate.</p><h4 id="type-parameters" tabindex="-1">Type parameters <a class="header-anchor" href="#type-parameters" aria-hidden="true">#</a></h4><table><thead><tr><th style="text-align:left;">Name</th><th style="text-align:left;">Type</th></tr></thead><tbody><tr><td style="text-align:left;"><code>T</code></td><td style="text-align:left;">extends <a href="../../interfaces/features/conversion.ConversionOptions"><code>ConversionOptions</code></a></td></tr></tbody></table><h4 id="defined-in" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in" aria-hidden="true">#</a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/013092f/src/features/conversion.ts#L103" target="_blank" rel="noopener noreferrer">profectus/src/features/conversion.ts:103</a></p><hr><h3 id="genericconversion" tabindex="-1">GenericConversion <a class="header-anchor" href="#genericconversion" aria-hidden="true">#</a></h3><p>\u01AC <strong>GenericConversion</strong>: <a href="./feature.html#replace"><code>Replace</code></a>&lt;<a href="./conversion.html#conversion"><code>Conversion</code></a>&lt;<a href="../../interfaces/features/conversion.ConversionOptions"><code>ConversionOptions</code></a>&gt;, { <code>actualGain</code>: <a href="./../util/computed.html#processedcomputable"><code>ProcessedComputable</code></a>&lt;<a href="./../util/bignum.html#decimalsource"><code>DecimalSource</code></a>&gt; ; <code>buyMax</code>: <a href="./../util/computed.html#processedcomputable"><code>ProcessedComputable</code></a>&lt;<code>boolean</code>&gt; ; <code>currentAt</code>: <a href="./../util/computed.html#processedcomputable"><code>ProcessedComputable</code></a>&lt;<a href="./../util/bignum.html#decimalsource"><code>DecimalSource</code></a>&gt; ; <code>currentGain</code>: <a href="./../util/computed.html#processedcomputable"><code>ProcessedComputable</code></a>&lt;<a href="./../util/bignum.html#decimalsource"><code>DecimalSource</code></a>&gt; ; <code>nextAt</code>: <a href="./../util/computed.html#processedcomputable"><code>ProcessedComputable</code></a>&lt;<a href="./../util/bignum.html#decimalsource"><code>DecimalSource</code></a>&gt; ; <code>roundUpCost</code>: <a href="./../util/computed.html#processedcomputable"><code>ProcessedComputable</code></a>&lt;<code>boolean</code>&gt; ; <code>spend</code>: (<code>amountGained</code>: <a href="./../util/bignum.html#decimalsource"><code>DecimalSource</code></a>) =&gt; <code>void</code> }&gt;</p><p>A type that matches any valid <a href="./conversion.html#conversion">Conversion</a> object.</p><h4 id="defined-in-1" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in-1" aria-hidden="true">#</a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/013092f/src/features/conversion.ts#L117" target="_blank" rel="noopener noreferrer">profectus/src/features/conversion.ts:117</a></p><h2 id="functions" tabindex="-1">Functions <a class="header-anchor" href="#functions" aria-hidden="true">#</a></h2><h3 id="addhardcap" tabindex="-1">addHardcap <a class="header-anchor" href="#addhardcap" aria-hidden="true">#</a></h3><p>\u25B8 <strong>addHardcap</strong>(<code>scaling</code>, <code>cap</code>): <a href="../../interfaces/features/conversion.ScalingFunction"><code>ScalingFunction</code></a></p><p>Creates a scaling function off an existing function, with a hardcap applied to it. The harcap will ensure that the currentGain will stop at a given cap.</p><h4 id="parameters" tabindex="-1">Parameters <a class="header-anchor" href="#parameters" aria-hidden="true">#</a></h4><table><thead><tr><th style="text-align:left;">Name</th><th style="text-align:left;">Type</th><th style="text-align:left;">Description</th></tr></thead><tbody><tr><td style="text-align:left;"><code>scaling</code></td><td style="text-align:left;"><a href="../../interfaces/features/conversion.ScalingFunction"><code>ScalingFunction</code></a></td><td style="text-align:left;">The raw scaling function.</td></tr><tr><td style="text-align:left;"><code>cap</code></td><td style="text-align:left;"><a href="./../util/computed.html#processedcomputable"><code>ProcessedComputable</code></a>&lt;<a href="./../lib/break_eternity.html#decimalsource"><code>DecimalSource</code></a>&gt;</td><td style="text-align:left;">The maximum value the scaling function can output.</td></tr></tbody></table><h4 id="returns" tabindex="-1">Returns <a class="header-anchor" href="#returns" aria-hidden="true">#</a></h4><p><a href="../../interfaces/features/conversion.ScalingFunction"><code>ScalingFunction</code></a></p><hr><h3 id="addsoftcap" tabindex="-1">addSoftcap <a class="header-anchor" href="#addsoftcap" aria-hidden="true">#</a></h3><p>\u25B8 <strong>addSoftcap</strong>(<code>scaling</code>, <code>cap</code>, <code>power?</code>): <a href="../../interfaces/features/conversion.ScalingFunction"><code>ScalingFunction</code></a></p><p>Creates a scaling function based off an existing scaling function, with a softcap applied to it. The softcap will take any value above a certain value and raise it to a power. If the power is &lt;1, this will effectively make the value scale slower after the cap.</p><p><strong><code>See</code></strong></p><p><a href="./conversion.html#softcap">softcap</a>.</p><h4 id="parameters-1" tabindex="-1">Parameters <a class="header-anchor" href="#parameters-1" aria-hidden="true">#</a></h4><table><thead><tr><th style="text-align:left;">Name</th><th style="text-align:left;">Type</th><th style="text-align:left;">Default value</th><th style="text-align:left;">Description</th></tr></thead><tbody><tr><td style="text-align:left;"><code>scaling</code></td><td style="text-align:left;"><a href="../../interfaces/features/conversion.ScalingFunction"><code>ScalingFunction</code></a></td><td style="text-align:left;"><code>undefined</code></td><td style="text-align:left;">The raw scaling function.</td></tr><tr><td style="text-align:left;"><code>cap</code></td><td style="text-align:left;"><a href="./../util/computed.html#processedcomputable"><code>ProcessedComputable</code></a>&lt;<a href="./../lib/break_eternity.html#decimalsource"><code>DecimalSource</code></a>&gt;</td><td style="text-align:left;"><code>undefined</code></td><td style="text-align:left;">The value after which the softcap should be applied.</td></tr><tr><td style="text-align:left;"><code>power</code></td><td style="text-align:left;"><a href="./../util/computed.html#processedcomputable"><code>ProcessedComputable</code></a>&lt;<a href="./../lib/break_eternity.html#decimalsource"><code>DecimalSource</code></a>&gt;</td><td style="text-align:left;"><code>0.5</code></td><td style="text-align:left;">The power to raise value about the cap to.</td></tr></tbody></table><h4 id="returns-1" tabindex="-1">Returns <a class="header-anchor" href="#returns-1" aria-hidden="true">#</a></h4><p><a href="../../interfaces/features/conversion.ScalingFunction"><code>ScalingFunction</code></a></p><hr><h3 id="createconversion" tabindex="-1">createConversion <a class="header-anchor" href="#createconversion" aria-hidden="true">#</a></h3><p>\u25B8 <strong>createConversion</strong>&lt;<code>T</code>&gt;(<code>optionsFunc</code>): <a href="./conversion.html#conversion"><code>Conversion</code></a>&lt;<code>T</code>&gt;</p><p>Lazily creates a conversion with the given options. You typically shouldn&#39;t use this function directly. Instead use one of the other conversion constructors, which will then call this.</p><p><strong><code>See</code></strong></p><ul><li><a href="./conversion.html#createcumulativeconversion">createCumulativeConversion</a>.</li><li><a href="./conversion.html#createindependentconversion">createIndependentConversion</a>.</li></ul><h4 id="type-parameters-1" tabindex="-1">Type parameters <a class="header-anchor" href="#type-parameters-1" aria-hidden="true">#</a></h4><table><thead><tr><th style="text-align:left;">Name</th><th style="text-align:left;">Type</th></tr></thead><tbody><tr><td style="text-align:left;"><code>T</code></td><td style="text-align:left;">extends <a href="../../interfaces/features/conversion.ConversionOptions"><code>ConversionOptions</code></a></td></tr></tbody></table><h4 id="parameters-2" tabindex="-1">Parameters <a class="header-anchor" href="#parameters-2" aria-hidden="true">#</a></h4><table><thead><tr><th style="text-align:left;">Name</th><th style="text-align:left;">Type</th><th style="text-align:left;">Description</th></tr></thead><tbody><tr><td style="text-align:left;"><code>optionsFunc</code></td><td style="text-align:left;"><a href="./feature.html#optionsfunc"><code>OptionsFunc</code></a>&lt;<code>T</code>, <a href="../../interfaces/features/conversion.BaseConversion"><code>BaseConversion</code></a>, <a href="./conversion.html#genericconversion"><code>GenericConversion</code></a>&gt;</td><td style="text-align:left;">Conversion options.</td></tr></tbody></table><h4 id="returns-2" tabindex="-1">Returns <a class="header-anchor" href="#returns-2" aria-hidden="true">#</a></h4><p><a href="./conversion.html#conversion"><code>Conversion</code></a>&lt;<code>T</code>&gt;</p><hr><h3 id="createcumulativeconversion" tabindex="-1">createCumulativeConversion <a class="header-anchor" href="#createcumulativeconversion" aria-hidden="true">#</a></h3><p>\u25B8 <strong>createCumulativeConversion</strong>&lt;<code>S</code>&gt;(<code>optionsFunc</code>): <a href="./conversion.html#conversion"><code>Conversion</code></a>&lt;<code>S</code>&gt;</p><p>Creates a conversion that simply adds to the gainResource amount upon converting. This is similar to the behavior of &quot;normal&quot; layers in The Modding Tree. This is equivalent to just calling createConversion directly.</p><h4 id="type-parameters-2" tabindex="-1">Type parameters <a class="header-anchor" href="#type-parameters-2" aria-hidden="true">#</a></h4><table><thead><tr><th style="text-align:left;">Name</th><th style="text-align:left;">Type</th></tr></thead><tbody><tr><td style="text-align:left;"><code>S</code></td><td style="text-align:left;">extends <a href="../../interfaces/features/conversion.ConversionOptions"><code>ConversionOptions</code></a></td></tr></tbody></table><h4 id="parameters-3" tabindex="-1">Parameters <a class="header-anchor" href="#parameters-3" aria-hidden="true">#</a></h4><table><thead><tr><th style="text-align:left;">Name</th><th style="text-align:left;">Type</th><th style="text-align:left;">Description</th></tr></thead><tbody><tr><td style="text-align:left;"><code>optionsFunc</code></td><td style="text-align:left;"><a href="./feature.html#optionsfunc"><code>OptionsFunc</code></a>&lt;<code>S</code>, <a href="../../interfaces/features/conversion.BaseConversion"><code>BaseConversion</code></a>, <a href="./conversion.html#genericconversion"><code>GenericConversion</code></a>&gt;</td><td style="text-align:left;">Conversion options.</td></tr></tbody></table><h4 id="returns-3" tabindex="-1">Returns <a class="header-anchor" href="#returns-3" aria-hidden="true">#</a></h4><p><a href="./conversion.html#conversion"><code>Conversion</code></a>&lt;<code>S</code>&gt;</p><hr><h3 id="createindependentconversion" tabindex="-1">createIndependentConversion <a class="header-anchor" href="#createindependentconversion" aria-hidden="true">#</a></h3><p>\u25B8 <strong>createIndependentConversion</strong>&lt;<code>S</code>&gt;(<code>optionsFunc</code>): <a href="./conversion.html#conversion"><code>Conversion</code></a>&lt;<code>S</code>&gt;</p><p>Creates a conversion that will replace the gainResource amount with the new amount upon converting. This is similar to the behavior of &quot;static&quot; layers in The Modding Tree.</p><h4 id="type-parameters-3" tabindex="-1">Type parameters <a class="header-anchor" href="#type-parameters-3" aria-hidden="true">#</a></h4><table><thead><tr><th style="text-align:left;">Name</th><th style="text-align:left;">Type</th></tr></thead><tbody><tr><td style="text-align:left;"><code>S</code></td><td style="text-align:left;">extends <a href="../../interfaces/features/conversion.ConversionOptions"><code>ConversionOptions</code></a></td></tr></tbody></table><h4 id="parameters-4" tabindex="-1">Parameters <a class="header-anchor" href="#parameters-4" aria-hidden="true">#</a></h4><table><thead><tr><th style="text-align:left;">Name</th><th style="text-align:left;">Type</th><th style="text-align:left;">Description</th></tr></thead><tbody><tr><td style="text-align:left;"><code>optionsFunc</code></td><td style="text-align:left;"><a href="./feature.html#optionsfunc"><code>OptionsFunc</code></a>&lt;<code>S</code>, <a href="../../interfaces/features/conversion.BaseConversion"><code>BaseConversion</code></a>, <a href="./conversion.html#genericconversion"><code>GenericConversion</code></a>&gt;</td><td style="text-align:left;">Converison options.</td></tr></tbody></table><h4 id="returns-4" tabindex="-1">Returns <a class="header-anchor" href="#returns-4" aria-hidden="true">#</a></h4><p><a href="./conversion.html#conversion"><code>Conversion</code></a>&lt;<code>S</code>&gt;</p><hr><h3 id="createlinearscaling" tabindex="-1">createLinearScaling <a class="header-anchor" href="#createlinearscaling" aria-hidden="true">#</a></h3><p>\u25B8 <strong>createLinearScaling</strong>(<code>base</code>, <code>coefficient</code>): <a href="../../interfaces/features/conversion.ScalingFunction"><code>ScalingFunction</code></a></p><p>Creates a scaling function based off the formula <code>(baseResource - base) * coefficient</code>. If the baseResource value is less than base then the currentGain will be 0.</p><p><strong><code>Example</code></strong></p><p>A scaling function created via <code>createLinearScaling(10, 0.5)</code> would produce the following values:</p><table><thead><tr><th>Base Resource</th><th>Current Gain</th></tr></thead><tbody><tr><td>10</td><td>1</td></tr><tr><td>12</td><td>2</td></tr><tr><td>20</td><td>6</td></tr></tbody></table><h4 id="parameters-5" tabindex="-1">Parameters <a class="header-anchor" href="#parameters-5" aria-hidden="true">#</a></h4><table><thead><tr><th style="text-align:left;">Name</th><th style="text-align:left;">Type</th><th style="text-align:left;">Description</th></tr></thead><tbody><tr><td style="text-align:left;"><code>base</code></td><td style="text-align:left;"><a href="./../util/computed.html#computable"><code>Computable</code></a>&lt;<a href="./../lib/break_eternity.html#decimalsource"><code>DecimalSource</code></a>&gt;</td><td style="text-align:left;">The base variable in the scaling formula.</td></tr><tr><td style="text-align:left;"><code>coefficient</code></td><td style="text-align:left;"><a href="./../util/computed.html#computable"><code>Computable</code></a>&lt;<a href="./../lib/break_eternity.html#decimalsource"><code>DecimalSource</code></a>&gt;</td><td style="text-align:left;">The coefficient variable in the scaling formula.</td></tr></tbody></table><h4 id="returns-5" tabindex="-1">Returns <a class="header-anchor" href="#returns-5" aria-hidden="true">#</a></h4><p><a href="../../interfaces/features/conversion.ScalingFunction"><code>ScalingFunction</code></a></p><hr><h3 id="createpolynomialscaling" tabindex="-1">createPolynomialScaling <a class="header-anchor" href="#createpolynomialscaling" aria-hidden="true">#</a></h3><p>\u25B8 <strong>createPolynomialScaling</strong>(<code>base</code>, <code>exponent</code>): <a href="../../interfaces/features/conversion.ScalingFunction"><code>ScalingFunction</code></a></p><p>Creates a scaling function based off the formula <code>(baseResource / base) ^ exponent</code>. If the baseResource value is less than base then the currentGain will be 0.</p><p><strong><code>Example</code></strong></p><p>A scaling function created via <code>createPolynomialScaling(10, 0.5)</code> would produce the following values:</p><table><thead><tr><th>Base Resource</th><th>Current Gain</th></tr></thead><tbody><tr><td>10</td><td>1</td></tr><tr><td>40</td><td>2</td></tr><tr><td>250</td><td>5</td></tr></tbody></table><h4 id="parameters-6" tabindex="-1">Parameters <a class="header-anchor" href="#parameters-6" aria-hidden="true">#</a></h4><table><thead><tr><th style="text-align:left;">Name</th><th style="text-align:left;">Type</th><th style="text-align:left;">Description</th></tr></thead><tbody><tr><td style="text-align:left;"><code>base</code></td><td style="text-align:left;"><a href="./../util/computed.html#computable"><code>Computable</code></a>&lt;<a href="./../lib/break_eternity.html#decimalsource"><code>DecimalSource</code></a>&gt;</td><td style="text-align:left;">The base variable in the scaling formula.</td></tr><tr><td style="text-align:left;"><code>exponent</code></td><td style="text-align:left;"><a href="./../util/computed.html#computable"><code>Computable</code></a>&lt;<a href="./../lib/break_eternity.html#decimalsource"><code>DecimalSource</code></a>&gt;</td><td style="text-align:left;">The exponent variable in the scaling formula.</td></tr></tbody></table><h4 id="returns-6" tabindex="-1">Returns <a class="header-anchor" href="#returns-6" aria-hidden="true">#</a></h4><p><a href="../../interfaces/features/conversion.ScalingFunction"><code>ScalingFunction</code></a></p><hr><h3 id="setuppassivegeneration" tabindex="-1">setupPassiveGeneration <a class="header-anchor" href="#setuppassivegeneration" aria-hidden="true">#</a></h3><p>\u25B8 <strong>setupPassiveGeneration</strong>(<code>layer</code>, <code>conversion</code>, <code>rate?</code>, <code>cap?</code>): <code>void</code></p><p>This will automatically increase the value of conversion.gainResource without lowering the value of the input resource. It will by default perform 100% of a conversion&#39;s currentGain per second. If you use a ref for the rate you can set it&#39;s value to 0 when passive generation should be disabled.</p><h4 id="parameters-7" tabindex="-1">Parameters <a class="header-anchor" href="#parameters-7" aria-hidden="true">#</a></h4><table><thead><tr><th style="text-align:left;">Name</th><th style="text-align:left;">Type</th><th style="text-align:left;">Default value</th><th style="text-align:left;">Description</th></tr></thead><tbody><tr><td style="text-align:left;"><code>layer</code></td><td style="text-align:left;"><a href="../../interfaces/game/layers.BaseLayer"><code>BaseLayer</code></a></td><td style="text-align:left;"><code>undefined</code></td><td style="text-align:left;">The layer this passive generation will be associated with. Typically <code>this</code> when calling this function from inside a layer&#39;s options function.</td></tr><tr><td style="text-align:left;"><code>conversion</code></td><td style="text-align:left;"><a href="./conversion.html#genericconversion"><code>GenericConversion</code></a></td><td style="text-align:left;"><code>undefined</code></td><td style="text-align:left;">The conversion that will determine how much generation there is.</td></tr><tr><td style="text-align:left;"><code>rate</code></td><td style="text-align:left;"><a href="./../util/computed.html#computable"><code>Computable</code></a>&lt;<a href="./../lib/break_eternity.html#decimalsource"><code>DecimalSource</code></a>&gt;</td><td style="text-align:left;"><code>1</code></td><td style="text-align:left;">A multiplier to multiply against the conversion&#39;s currentGain.</td></tr><tr><td style="text-align:left;"><code>cap</code></td><td style="text-align:left;"><a href="./../util/computed.html#computable"><code>Computable</code></a>&lt;<code>null</code> | <a href="./../lib/break_eternity.html#decimalsource"><code>DecimalSource</code></a>&gt;</td><td style="text-align:left;"><code>null</code></td><td style="text-align:left;">A value that should not be passed via passive generation. If null, no cap is applied.</td></tr></tbody></table><h4 id="returns-7" tabindex="-1">Returns <a class="header-anchor" href="#returns-7" aria-hidden="true">#</a></h4><p><code>void</code></p><hr><h3 id="softcap" tabindex="-1">softcap <a class="header-anchor" href="#softcap" aria-hidden="true">#</a></h3><p>\u25B8 <strong>softcap</strong>(<code>value</code>, <code>cap</code>, <code>power?</code>): <a href="./../util/bignum.html#decimalsource"><code>DecimalSource</code></a></p><p>Given a value, this function finds the amount above a certain value and raises it to a power. If the power is &lt;1, this will effectively make the value scale slower after the cap.</p><p><strong><code>Example</code></strong></p><p>A softcap added via <code>addSoftcap(scaling, 100, 0.5)</code> would produce the following values:</p><table><thead><tr><th>Raw Value</th><th>Softcapped Value</th></tr></thead><tbody><tr><td>1</td><td>1</td></tr><tr><td>100</td><td>100</td></tr><tr><td>125</td><td>105</td></tr><tr><td>200</td><td>110</td></tr></tbody></table><h4 id="parameters-8" tabindex="-1">Parameters <a class="header-anchor" href="#parameters-8" aria-hidden="true">#</a></h4><table><thead><tr><th style="text-align:left;">Name</th><th style="text-align:left;">Type</th><th style="text-align:left;">Default value</th><th style="text-align:left;">Description</th></tr></thead><tbody><tr><td style="text-align:left;"><code>value</code></td><td style="text-align:left;"><a href="./../lib/break_eternity.html#decimalsource"><code>DecimalSource</code></a></td><td style="text-align:left;"><code>undefined</code></td><td style="text-align:left;">The raw value.</td></tr><tr><td style="text-align:left;"><code>cap</code></td><td style="text-align:left;"><a href="./../lib/break_eternity.html#decimalsource"><code>DecimalSource</code></a></td><td style="text-align:left;"><code>undefined</code></td><td style="text-align:left;">The value after which the softcap should be applied.</td></tr><tr><td style="text-align:left;"><code>power</code></td><td style="text-align:left;"><a href="./../lib/break_eternity.html#decimalsource"><code>DecimalSource</code></a></td><td style="text-align:left;"><code>0.5</code></td><td style="text-align:left;">The power to raise value above the cap to.</td></tr></tbody></table><h4 id="returns-8" tabindex="-1">Returns <a class="header-anchor" href="#returns-8" aria-hidden="true">#</a></h4><p><a href="./../util/bignum.html#decimalsource"><code>DecimalSource</code></a></p>',108),c=[d];function n(l,i,s,h,u,f){return a(),t("div",null,c)}var m=e(r,[["render",n]]);export{g as __pageData,m as default};