diff --git a/www/furball.js b/www/furball.js index 09137ea..88bf01f 100644 --- a/www/furball.js +++ b/www/furball.js @@ -171,26 +171,36 @@ defer.joe = () => { furball.toggle("joe", true, false); - furball.set("joe", "time", minutes(5), false); + furball.set("joe", "time", minutes(10), false); furball.set("joe", "amt", 5); const races = game.diplomacy.races; let idx = 0; setInterval(() => { - const race = races[idx]; - - if(should_run("joe") && race.unlocked) { - game.diplomacy.tradeMultiple(race, furball.conf.joe.amt); - log_msg(`did a trade with ${race.name} ${furball.conf.joe.amt} times`); - game.village.huntAll(); - log_msg("hunted all the things on the way back"); + if(should_run("joe")) { + const race = races[idx]; if(idx === races.length - 1) { idx = 0; } else { idx += 1; } + + if(race.unlocked) { + let amt = game.diplomacy.getMaxTradeAmt(race); + + if(amt > 0) { + if(amt > furball.conf.joe.amt) { + amt = furball.conf.joe.amt; + } + + game.diplomacy.tradeMultiple(race, amt); + log_msg(`did a trade with ${race.name} ${amt} times`); + game.village.huntAll(); + log_msg("hunted all the things on the way back"); + } + } } }, furball.conf.joe.time); }