Fix cards not being removed from hand

This commit is contained in:
Dragon Fire
2021-03-14 16:29:29 -04:00
parent 4843895ce4
commit 4c27156567
+3 -3
View File
@@ -42,7 +42,7 @@ module.exports = class Player {
const chosen = []; const chosen = [];
for (let i = 0; i < black.pick; i++) { for (let i = 0; i < black.pick; i++) {
const valid = hand.filter(card => !chosen.includes(card)); const valid = hand.filter(card => !chosen.includes(card));
chosen.push(escapeMarkdown(valid[Math.floor(Math.random() * valid.length)])); chosen.push(valid[Math.floor(Math.random() * valid.length)]);
} }
for (const card of chosen) this.hand.delete(card); for (const card of chosen) this.hand.delete(card);
chosenCards.push({ id: this.id, cards: chosen }); chosenCards.push({ id: this.id, cards: chosen });
@@ -80,7 +80,7 @@ module.exports = class Player {
return; return;
} else if (existing) { } else if (existing) {
await msg.react(SUCCESS_EMOJI_ID || '✅'); await msg.react(SUCCESS_EMOJI_ID || '✅');
chosen.push(escapeMarkdown(existing)); chosen.push(existing);
} }
if (chosen.length >= black.pick * (gambled ? 2 : 1)) collector.stop(); if (chosen.length >= black.pick * (gambled ? 2 : 1)) collector.stop();
}); });
@@ -89,7 +89,7 @@ module.exports = class Player {
const count = black.pick - chosen.length; const count = black.pick - chosen.length;
for (let i = 0; i < count; i++) { for (let i = 0; i < count; i++) {
const valid = hand.filter(card => !chosen.includes(card)); const valid = hand.filter(card => !chosen.includes(card));
chosen.push(escapeMarkdown(valid[Math.floor(Math.random() * valid.length)])); chosen.push(valid[Math.floor(Math.random() * valid.length)]);
} }
this.strikes++; this.strikes++;
} }