带有百分比discord.js的随机系统
我正在为我的机器人创建一个战利品箱系统,人们可以使用命令打开战利品箱,然后从中扔下一些物品 但是我想放置一些具有特定下降百分比的项目,目前我正在使用Math.floor(Math.random())随机生成下降项目,但我想做一些事情,使我更难将项目作为下降百分比设置随机下降 这是我为这个系统编写的代码带有百分比discord.js的随机系统,discord,discord.js,bots,Discord,Discord.js,Bots,我正在为我的机器人创建一个战利品箱系统,人们可以使用命令打开战利品箱,然后从中扔下一些物品 但是我想放置一些具有特定下降百分比的项目,目前我正在使用Math.floor(Math.random())随机生成下降项目,但我想做一些事情,使我更难将项目作为下降百分比设置随机下降 这是我为这个系统编写的代码 if (random === 3) { let ganhoU = new MessageEmbed() .setColor('GREEN') .setTi
if (random === 3) {
let ganhoU = new MessageEmbed()
.setColor('GREEN')
.setTitle(`LOOT BOX - ${message.author.username}`)
.setDescription(`You win **${prize} Tokens**`)
const loot = new MessageEmbed()
.setTitle(`Open LOOT BOX - ${message.author.username}`)
.setFooter('Opens in 10 seconds, good luck!')
.setImage('https://cdn.shopify.com/s/files/1/1048/1380/products/8a5f006ffd4ce801c8e888ec3bc68361_600x.png?v=1571439674')
message.channel.send(loot).then((msg) =>
setTimeout(() => {
msg.edit(ganhoU);
msg.edit("\u200B");
}, 10000));
db.add(`tokens_${message.author.id}_${message.guild.id}`, premio5)
db.subtract(`lootbox_${message.author.id}_${message.guild.id}`, 1)
}
在这种情况下,在这个战利品箱中,我想放置3件物品用于掉落,而我能做的困难是放置最薄弱的物品以便更频繁地掉落
去杜帕尔
- 鱼
- 狮子
- 斑马
- 代币