Зачем откруглять, скорость и профиты

This commit is contained in:
JonnyBro 2022-01-19 20:57:44 +05:00
parent 4ea15367c7
commit f6da7fd2ee
6 changed files with 9 additions and 9 deletions

View file

@ -50,7 +50,7 @@ class Rob extends Command {
memberData.cooldowns.rob = toWait;
memberData.markModified("cooldowns");
await memberData.save();
const randomNum = Math.floor(this.client.functions.randomNum(1, 3));
const randomNum = this.client.functions.randomNum(1, 3);
message.sendT("economy/rob:ROB_WON_" + randomNum, {
money: `${amountToRob} ${message.getNoun(amountToRob, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`,
username: member.user.username
@ -61,7 +61,7 @@ class Rob extends Command {
data.memberData.save();
} else {
const won = Math.floor(0.9 * amountToRob);
const randomNum = Math.floor(this.client.functions.randomNum(1, 3));
const randomNum = this.client.functions.randomNum(1, 3);
message.sendT("economy/rob:ROB_LOSE_" + randomNum, {
fine: `${potentiallyLose} ${message.getNoun(potentiallyLose, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`,
offset: `${won} ${message.getNoun(won, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`,

View file

@ -36,8 +36,8 @@ class Horserace extends Command {
const f = [];
for (let i = 0; i < 5; i++) {
const speed = Math.ceil(Math.random() * 10);
const profit = Math.floor((((8.9 / 9) * (10 - speed)) + 1.1) * 10) / 10;
const speed = this.client.functions.randomNum(1, 5);
const profit = Math.floor((((8.9 / 9) * (6 - speed)) + 1.1) * 10) / 10;
thisGame.horseSpeeds.push(speed);
f.push({
name: message.translate("fun/horserace:HORSE_NAME", {
@ -90,7 +90,7 @@ class Horserace extends Command {
// eslint-disable-next-line no-constant-condition
while (true) {
for (let i = 0; i < 5; i++) {
if (thisGame.horseSpeeds[i] >= Math.random() * 15) {
if (thisGame.horseSpeeds[i] >= Math.floor(Math.random() * 15)) {
horsePositions[i] += 1;
if (horsePositions[i] === 3) {
const winnings = [];

View file

@ -23,7 +23,7 @@ class Number extends Command {
if (currentGames[message.guild.id]) return message.error("fun/number:GAME_RUNNING");
const participants = [],
number = Math.floor(this.client.functions.randomNum(1000, 10000));
number = this.client.functions.randomNum(1000, 10000);
await message.sendT("fun/number:GAME_START");

View file

@ -225,7 +225,7 @@ async function updateXp(client, msg, data) {
const toWait = Date.now() + 60000;
xpCooldown[msg.author.id] = toWait;
// Gets a random number between 10 and 5
// Gets a random number between 5 and 10
const won = client.functions.randomNum(5, 10);
const newXp = parseInt(points + won, 10);

View file

@ -6,7 +6,7 @@
"HORSE_NUM": "На скачках всего 5 лошадей!",
"EMBED_T": "Конные скачки",
"HORSE_NAME": "Лошадь {{number}}",
"HORSE_VALUE": "Скорость - {{speed}}\nПрибыль - *ставка* x {{profit}}",
"HORSE_VALUE": "Скорость - {{speed}}\nПрибыль - *ставка* x **{{profit}}**",
"BET": "**{{user}}** поставил {{amount}} на лошадь **{{horse}}**!",
"NO_WINNERS": "Победила лошадь **{{horse}}**. Никто не выиграл кредиты!",
"WINNERS": "Победила лошадь **{{horse}}**. {{winners}}!",

View file

@ -6,7 +6,7 @@
"HORSE_NUM": "На скачках всего 5 лошадей!",
"EMBED_T": "Конные скачки",
"HORSE_NAME": "Лошадь {{number}}",
"HORSE_VALUE": "Скорость - {{speed}}\nПрибыль - *ставка* x {{profit}}",
"HORSE_VALUE": "Скорость - {{speed}}\nПрибыль - *ставка* x **{{profit}}**",
"BET": "**{{user}}** поставил {{amount}} на лошадь **{{horse}}**!",
"NO_WINNERS": "Победила лошадь **{{horse}}**. Никто не выиграл кредиты!",
"WINNERS": "Победила лошадь **{{horse}}**. {{winners}}!",