pages/assets/public_lit_docs_upgrades.md.8b96ffe6.js

12 lines
6.6 KiB
JavaScript
Raw Normal View History

import{_ as e,c as s,o as a,a as n}from"./app.e9531dc8.js";const g=JSON.parse('{"title":"Upgrades","description":"","frontmatter":{},"headers":[],"relativePath":"public/lit/docs/upgrades.md","lastUpdated":null}'),t={name:"public/lit/docs/upgrades.md"},o=n(`<h1 id="upgrades" tabindex="-1">Upgrades <a class="header-anchor" href="#upgrades" aria-hidden="true">#</a></h1><p>Useful functions for dealing with Upgrades and implementing their effects:</p><ul><li>hasUpgrade(layer, id): determine if the player has the upgrade</li><li>upgradeEffect(layer, id): Returns the current effects of the upgrade, if any</li><li>buyUpgrade(layer, id): Buys an upgrade directly (if affordable)</li></ul><p>Hint: Basic point gain is calculated in <a href="/js/mod.js">mod.js</a>&#39;s &quot;getPointGen&quot; function.</p><p>Upgrades are stored in the following format:</p><div class="language-js"><button class="copy"></button><span class="lang">js</span><pre><code><span class="line"><span style="color:#FFCB6B;">upgrades</span><span style="color:#89DDFF;">:</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">{</span></span>
<span class="line"><span style="color:#F07178;"> </span><span style="color:#FFCB6B;">rows</span><span style="color:#89DDFF;">:</span><span style="color:#F07178;"> # </span><span style="color:#89DDFF;">of</span><span style="color:#F07178;"> </span><span style="color:#A6ACCD;">rows</span><span style="color:#89DDFF;">,</span></span>
<span class="line"><span style="color:#F07178;"> </span><span style="color:#FFCB6B;">cols</span><span style="color:#89DDFF;">:</span><span style="color:#F07178;"> # </span><span style="color:#89DDFF;">of</span><span style="color:#F07178;"> </span><span style="color:#A6ACCD;">columns</span><span style="color:#89DDFF;">,</span></span>
<span class="line"><span style="color:#F07178;"> </span><span style="color:#F78C6C;">11</span><span style="color:#F07178;">: </span><span style="color:#89DDFF;">{</span></span>
<span class="line"><span style="color:#F07178;"> description</span><span style="color:#89DDFF;">:</span><span style="color:#F07178;"> </span><span style="color:#89DDFF;">&quot;</span><span style="color:#C3E88D;">Blah</span><span style="color:#89DDFF;">&quot;</span><span style="color:#89DDFF;">,</span></span>
<span class="line"><span style="color:#F07178;"> cost</span><span style="color:#89DDFF;">:</span><span style="color:#F07178;"> </span><span style="color:#89DDFF;">new</span><span style="color:#F07178;"> </span><span style="color:#82AAFF;">Decimal</span><span style="color:#F07178;">(</span><span style="color:#F78C6C;">100</span><span style="color:#F07178;">)</span><span style="color:#89DDFF;">,</span></span>
<span class="line"><span style="color:#F07178;"> </span><span style="color:#A6ACCD;">etc</span></span>
<span class="line"><span style="color:#F07178;"> </span><span style="color:#89DDFF;">},</span></span>
<span class="line"><span style="color:#F07178;"> </span><span style="color:#A6ACCD;">etc</span></span>
<span class="line"><span style="color:#89DDFF;">}</span></span>
<span class="line"></span></code></pre></div><p>Each upgrade should have an id where the first digit is the row and the second digit is the column.</p><p>Individual upgrades can have these features:</p><ul><li><p>title: <strong>optional</strong>. Displayed at the top in a larger font. It can also be a function that returns updating text. Can use basic HTML.</p></li><li><p>description: A description of the upgrade&#39;s effect. <em>You will also have to implement the effect where it is applied.</em> It can also be a function that returns updating text. Can use basic HTML.</p></li><li><p>effect(): <strong>optional</strong>. A function that calculates and returns the current values of any bonuses from the upgrade. Can return a value or an object containing multiple values.</p></li><li><p>effectDisplay(): <strong>optional</strong>. A function that returns a display of the current effects of the upgrade with formatting. Default displays nothing. Can use basic HTML.</p></li><li><p>fullDisplay(): <strong>OVERRIDE</strong>. Overrides the other displays and descriptions, and lets you set the full text for the upgrade. Can use basic HTML.</p></li><li><p>cost: A Decimal for the cost of the upgrade. By default, upgrades cost the main prestige currency for the layer.</p></li><li><p>unlocked(): <strong>optional</strong>. A function returning a bool to determine if the upgrade is visible or not. Default is unlocked.</p></li><li><p>onPurchase(): <strong>optional</strong>. This function will be called when the upgrade is purchased. Good for upgrades like &quot;makes this layer act like it was unlocked first&quot;.</p></li><li><p>style: <strong>optional</strong>. Applies CSS to this upgrade, in the form of an object where the keys are CSS attributes, and the values are the values for those attributes (both as strings).</p></li><li><p>layer: <strong>assigned automagically</strong>. It&#39;s the same value as the name of this layer, so you can do <code>player[this.layer].points</code> or similar.</p></li><li><p>id: <strong>assigned automagically</strong>. It&#39;s the &quot;key&quot; which the upgrade was stored under, for convenient access. The upgrade in the example&#39;s id is 11.</p></li></ul><p>By default, upgrades use the main prestige currency for the layer. You can include these to change them (but it needs to be a Decimal):</p><ul><li><p>currencyDisplayName: <strong>optional</strong>. The name to display for the currency for the upgrade.</p></li><li><p>currencyInternalName: <strong>optional</strong>. The internal name for that currency.</p></li><li><p>currencyLayer: <strong>optional</strong>. The internal name of the layer that currency is stored in. If it&#39;s not in a layer (like Points), omit. If it&#39;s not stored directly in a layer, instead use the next feature.</p></li><li><p>currencyLocation: <strong>optional</strong>. If your currency is stored in something inside a layer (e.g. a buyable&#39;s amount), you can access it this way. This is a function returning the object in &quot;player&quot; that contains the value (like <code>player[this.layer].buyables</code>)</p></li></ul><p>If you want to do something more complicated like upgrades that cost two currencies, you can override the purchase system with these (and you need to use fullDisplay as well)</p><ul><li><p>canAfford(): <strong>OVERRIDE</strong>, a function determining if you are able to buy the upgrade</p></li><li><p>pay(): <strong>OVERRIDE</strong>, a function that reduces your currencies when you buy the upgrade</p></li></ul>`,13),l=[o];function r(p,i,c,u,d,y){return a(),s("div",null,l)}const f=e(t,[["render",r]]);export{g as __pageData,f as default};