mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
New Challenger Image
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 105 KiB After Width: | Height: | Size: 294 KiB |
@@ -37,7 +37,7 @@ module.exports = class CardCommand extends Command {
|
||||
size: 256
|
||||
});
|
||||
try {
|
||||
const cardID = Math.floor(Math.random() * (9999 - 1000 + 1)) + 1000;
|
||||
const cardID = Math.floor(Math.random() * ((9999 - 1000) + 1)) + 1000;
|
||||
let rarity;
|
||||
if (cardID < 5000) rarity = 'C';
|
||||
else if (cardID < 8000) rarity = 'U';
|
||||
|
||||
@@ -33,15 +33,13 @@ module.exports = class ChallengerCommand extends Command {
|
||||
size: 256
|
||||
});
|
||||
try {
|
||||
const canvas = createCanvas(500, 500);
|
||||
const canvas = createCanvas(800, 450);
|
||||
const ctx = canvas.getContext('2d');
|
||||
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'challenger.png'));
|
||||
const { body } = await snekfetch.get(avatarURL);
|
||||
const avatar = await loadImage(body);
|
||||
ctx.fillStyle = '#ff0028';
|
||||
ctx.fillRect(0, 0, 500, 500);
|
||||
ctx.drawImage(avatar, 226, 155, 200, 200);
|
||||
ctx.drawImage(base, 0, 0);
|
||||
ctx.drawImage(avatar, 484, 98, 256, 256);
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'challenger.png' }] });
|
||||
} catch (err) {
|
||||
return msg.say(`Oh no, the image generation failed: \`${err.message}\`. Try again later!`);
|
||||
|
||||
@@ -94,7 +94,7 @@ module.exports = class BattleCommand extends Command {
|
||||
} else if (choice === 'special') {
|
||||
const hit = Math.floor(Math.random() * 4) + 1;
|
||||
if (hit === 1) {
|
||||
const damage = Math.floor((Math.random() * ((guard ? 300 : 150) - (100 + 1))) + 100);
|
||||
const damage = Math.floor(Math.random() * (((guard ? 300 : 150) - 100) + 1)) + 100;
|
||||
await msg.say(`${user} deals **${damage}** damage!`);
|
||||
dealDamage(damage);
|
||||
reset();
|
||||
|
||||
@@ -39,7 +39,7 @@ module.exports = class GunfightCommand extends Command {
|
||||
return msg.say('Looks like they declined...');
|
||||
}
|
||||
await msg.say('Get Ready...');
|
||||
const length = Math.floor((Math.random() * ((30000 - 1000) + 1)) + 1000);
|
||||
const length = Math.floor(Math.random() * ((30000 - 1000) + 1)) + 1000;
|
||||
this.client.setTimeout(async () => {
|
||||
const word = words[Math.floor(Math.random() * words.length)];
|
||||
await msg.say(`TYPE \`${word.toUpperCase()}\` NOW!`);
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiaobot",
|
||||
"version": "29.1.1",
|
||||
"version": "29.1.2",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "Shard.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user