simple-gacha

1.1.2 • Public • Published

simple-gacha

A very simple gacha function that picks an element based off a loot table.

Example

const gacha = require("simple-gacha");
 
const lootTable = [
    {
        "name" : "Golden Knife",
        "weight" : 10
    },
    {
        "name" : "Diamond Pickaxe",
        "weight" : 5
    },
    {
        "name" : "Invisibility Cap",
        "weight" : 2
    }
]
 
const { pick } = gacha.simple(lootTable);
console.log(pick);

Since Golden Knife has the biggest weight, there's a higher chance that it will return Golden Knife.

{
    "name" : "Golden Knife",
    "weight" : 10
}

Contributing

Pull requests are very welcomed. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i simple-gacha

Weekly Downloads

2

Version

1.1.2

License

MIT

Unpacked Size

5.37 kB

Total Files

9

Last publish

Collaborators

  • reaganiwadha