1
0
Fork 0
mirror of https://github.com/Acamaeda/The-Modding-Tree.git synced 2024-11-25 18:00:10 +00:00

Added pluralize

This commit is contained in:
Harley White 2021-09-11 20:55:46 -04:00
parent 19e9115a14
commit 15931a0ffa
8 changed files with 16 additions and 2 deletions

View file

@ -2,6 +2,8 @@
- Changed the name to "Incrementum" and replaced all instances of "mod" with "game". game.js has been renamed incrementum.js, and mod.js is now game.js.
- Added linear and quadratic prestige types, improved the prestige type system.
- Added "pluralize" function, and made main point displays correctly use singular and plural (if singular is supplied).
- Upgrade effectDisplay and grid tooltip no longer display if they return "".

View file

@ -32,6 +32,8 @@ You can make almost any value dynamic by using a function in its place, includin
- resource: Name of the main currency you gain by resetting on this layer.
- singular: **optional**, singular version of the currency name.
- effect(): **optional**. A function that calculates and returns the current values of any bonuses inherent to the main currency. Can return a value or an object containing multiple values. *You will also have to implement the effect where it is applied.*
- effectDescription: **optional**. A function that returns a description of this effect. If the text stays constant, it can just be a string.

View file

@ -10,6 +10,8 @@ Here's a breakdown of what's in it:
- id: The id for your game, a unique string that is used to determine savefile location. Be sure to set it when you start making a game, and don't change it later because it will erase all saves.
- author: The name of the author, displayed in the info tab.
- pointsName: This changes what is displayed instead of "points" for the main currency. (It does not affect it in the code.)
= singularName: The singular version of pointsName.
- gameFiles: An array of file addresses which will be loaded for this game. Using smaller files makes it easier to find what you're looking for.
- discordName, discordLink: If you have a Discord server or other discussion place, you can add a link to it.

View file

@ -2,6 +2,7 @@ let gameInfo = {
name: "Incrementum",
id: "modbase",
pointsName: "points",
singularName: "point",
gameFiles: ["Demo/layers/c.js", "Demo/layers/f.js", "Demo/layers/a.js", "Demo/demoTree.js"],

View file

@ -20,6 +20,7 @@ addLayer("c", {
color: "#4BDC13",
requires: new Decimal(10), // Can be a function that takes requirement increases into account
resource: "lollipops", // Name of prestige currency
singular: "lollipop",
baseResource: "points", // Name of resource prestige is based on
baseAmount() {return player.points}, // Get the current amount of baseResource
type: "normal", // normal: cost to gain currency depends on amount gained. static: cost depends on how much you already have

View file

@ -236,7 +236,7 @@ function loadVue() {
Vue.component('main-display', {
props: ['layer', 'data'],
template: `
<div><span v-if="player[layer].points.lt('1e1000')">You have </span><h2 v-bind:style="{'color': tmp[layer].color, 'text-shadow': '0px 0px 10px ' + tmp[layer].color}">{{data ? format(player[layer].points, data) : formatWhole(player[layer].points)}}</h2> {{tmp[layer].resource}}<span v-if="layers[layer].effectDescription">, <span v-html="run(layers[layer].effectDescription, layers[layer])"></span></span><br><br></div>
<div><span v-if="player[layer].points.lt('1e1000')">You have </span><h2 v-bind:style="{'color': tmp[layer].color, 'text-shadow': '0px 0px 10px ' + tmp[layer].color}">{{data ? format(player[layer].points, data) : formatWhole(player[layer].points)}}</h2> {{pluralize(player[layer].points, tmp[layer].singular || tmp[layer].resource, tmp[layer].resource)}}<span v-if="layers[layer].effectDescription">, <span v-html="run(layers[layer].effectDescription, layers[layer])"></span></span><br><br></div>
`
})

View file

@ -114,7 +114,7 @@ var systemComponents = {
<br>
<span v-if="player.points.lt('1e1000')" class="overlayThing">You have </span>
<h2 class="overlayThing" id="points">{{format(player.points)}}</h2>
<span v-if="player.points.lt('1e1e6')" class="overlayThing"> {{gameInfo.pointsName}}</span>
<span v-if="player.points.lt('1e1e6')" class="overlayThing"> {{pluralize(player.points, gameInfo.singularName || gameInfo.pointsName, gameInfo.pointsName)}}</span>
<br>
<span v-if="canGenPoints()" class="overlayThing">({{tmp.other.oompsMag != 0 ? format(tmp.other.oomps) + " OOM" + (tmp.other.oompsMag < 0 ? "^OOM" : tmp.other.oompsMag > 1 ? "^" + tmp.other.oompsMag : "") + "s" : formatSmall(getPointGen())}}/sec)</span>
<div v-for="thing in tmp.displayThings" class="overlayThing"><span v-if="thing" v-html="thing"></span></div>

View file

@ -1,3 +1,9 @@
// Makes things grammatically correct
function pluralize (value, singular, plural) {
value = new Decimal(value)
if (value.eq(decimalOne)) return singular
return plural
}
function exponentialFormat(num, precision, mantissa = true) {
let e = num.log10().floor()