Make tributes use the weapon they have 1/2 the time

This commit is contained in:
Dragon Fire
2024-05-06 14:24:11 -04:00
parent 5ff0c81c42
commit 19fe03dbfc
+4
View File
@@ -122,6 +122,10 @@ module.exports = class HungerGamesCommand extends Command {
const type = types[Math.floor(Math.random() * types.length)];
const valid = eventsArr.filter(event => {
if (event.type !== type) return false;
if (event.type === 'kill' && tribute.weapon && !event.requires) {
const useWeapon = Math.floor(Math.random() * 2);
if (useWeapon) return false;
}
if (event.requires && event.requires !== 'food' && event.requires !== tribute.weapon) return false;
if (event.requires && event.requires === 'food' && tribute.food <= 0) return false;
if (event.requires && event.requires === '!food' && tribute.food !== 0) return false;