Skip to content

Version 8.3.0

Compare
Choose a tag to compare
@xShadowBlade xShadowBlade released this 14 May 13:18
· 81 commits to main since this release

Release Notes

Overview

This minor version introduces changes such as:

  • Fix upgrade typing in <CurrencyStatic>
  • Fix upgrade maxLevel
  • Add currencyContext to <Upgrade>.effect
  • Update dependency version

Here is an example of the new upgrade typing system.

// CurrencyStatic usage (typescript)
import { E, CurrencyStatic } from "emath.js";
import type { UpgradeStatic, UpgradeInit } from "emath.js";

const upgsList = [
    {
        id: "upgId1",
        cost: (level: E): E => level.mul(10),
        effect: (level: E, upgradeContext: UpgradeStatic, currencyContext: CurrencyStatic): void => {
            currencyContext.boost.setBoost(
                // add boost here ...
            );
        }
    },
    {
        id: "upgId2",
        cost: (level: E): E => level.mul(20),
    },
] as const satisfies UpgradeInit[];

const myCurrency = new CurrencyStatic(undefined, upgsList);

const upgrade1 = myCurrency.getUpgrade("upgId1a"); // Typed upgrade get

// Game usage (typescript)
import { myGame } from "./game";

const myGameCurrency = myGame.addCurrency("myCurrency", upgsList);

const upgrade = myGameCurrency.static.getUpgrade("upgId1a"); // Typed upgrade get

Full Changelog: v8.2.1...v8.3.0

Known Bugs

  • TBD

Feedback

We value your feedback! If you encounter any issues or have suggestions for improvement, please open a new issue.

Thank you for using this project!