I suggest this change to upshall
exports.upshall = function(data, user) {
var pool = etgutil.deck2pool(user.pool);
for(var code in pool){
var card = Cards.Codes[code];
if (!card || pool[code] < 12 || card.rarity == 5 || card.rarity < 1 || (card.upped && card.shiny)) continue;
var upcode = etgutil.asUpped(code, true);
if (upcode != code){
if (!(upcode in pool)) pool[upcode] = 0;
while (pool[upcode] < 6 && pool[code] >= 12){
pool[upcode]++;
pool[code] -= 6;
}
}
upcode = etgutil.asShiny(code, true);
if (upcode != code){
if (!(upcode in pool)) pool[upcode] = 0;
while (pool[code] >= 12){
pool[upcode]++;
pool[code] -= 6;
}
}
code = upcode
upcode = etgutil.asUpped(code, true);
if (upcode != code){
if (!(upcode in pool)) pool[upcode] = 0;
while (pool[code] >= 12){
pool[upcode]++;
pool[code] -= 6;
}
}
}
var newpool = "";
for(var code in pool){
if (pool[code]) newpool = etgutil.addcard(newpool, code, pool[code]);
}
user.pool = newpool;
}
since keeping the conversion only if the target has less than 6 cards ends up accumulating the cards as unshiny and unnupped (rendering the button useless). This change should accumulate any excess as shiny upped. I had to open the loop though to make this.
DISCLAIMER:
I don't really know js and this was done entirelly assuming things are similar to python and C (whatever looked closer in each line), so double check my logic. For example, I don't know if those etgutil[] are needed or if that's a way to use a namespace or something like that, or if the line 'code = upcode' works as I think it does.
serpedit Improved etgutil member referencing